/*
    WAITERPRO ELITE - CSS COMPLETO (VERSÃO ALTA DENSIDADE)
    Foco: Visualização otimizada, Estilo Premium Red, Responsividade Tablet.
*/

:root {
    /* Cores */
    --primary: #d90429;
    --primary-dark: #a4161a;
    --primary-light: #ef233c;
    --primary-glass: rgba(217, 4, 41, 0.08);
    --dark: #1a1c22;
    --bg-app: #f4f7f9;
    --surface: #ffffff;

    /* Tipografia e Espaçamento Otimizado */
    --text-main: #1d3557;
    --text-muted: #8d99ae;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. RESET E BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-app);
    font-family:
        "Inter",
        -apple-system,
        sans-serif;
    color: var(--text-main);
    line-height: 1.3;
    overflow-x: hidden;
}

/* 2. HEADER E ZONA STICKY (Compacta) */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--surface);
    transition: var(--transition);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Redução de altura ao rolar */
.sticky-header.scrolled {
    box-shadow: 0 8px 25px rgba(217, 4, 41, 0.12);
}
.sticky-header.scrolled .top-bar {
    padding: 6px 15px;
    background: var(--primary);
}
.sticky-header.scrolled .logo,
.sticky-header.scrolled .logo i,
.sticky-header.scrolled .table-badge,
.sticky-header.scrolled .btn-request-bill {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.4);
}

.top-bar {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 700;
}
.logo i {
    color: var(--primary);
    font-size: 1.4rem;
}

.active-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botão de Pedir Conta (Compacto) */
.btn-request-bill {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
}
.btn-request-bill i {
    font-size: 0.9rem;
}

.table-badge {
    font-weight: 800;
    font-size: 1rem;
    color: var(--primary);
}

/* 3. SELETORES HORIZONTAIS (Densidade Aumentada) */
.scroll-wrapper {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 15px;
    scrollbar-width: none;
}
.scroll-wrapper::-webkit-scrollbar {
    display: none;
}

/* Mesas Menores */
.table-card {
    min-width: 50px;
    height: 50px;
    background: #e9ecef;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid transparent;
    transition: var(--transition);
}
.table-card.active {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow);
}
.table-card span {
    font-size: 0.5rem;
    text-transform: uppercase;
    opacity: 0.7;
}
.table-card strong {
    font-size: 0.9rem;
}

/* Categorias (Pills menores) */
.cat-pill {
    padding: 7px 16px;
    background: var(--surface);
    border-radius: 20px;
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.cat-pill.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(217, 4, 41, 0.2);
}

/* 4. BUSCA E PRODUTOS (Grid Otimizada) */
.content-area {
    padding: 12px 15px;
}

.search-box {
    background: var(--surface);
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 15px;
}
.search-box input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.product-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.product-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-glass);
    color: var(--primary);
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.product-card h4 {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    height: 32px;
    overflow: hidden;
}

.product-card .price {
    color: var(--primary);
    font-weight: 800;
    font-size: 0.95rem;
}

.add-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    display: grid;
    place-items: center;
}

/* 5. NOTAS NO PEDIDO */
.item-row-container {
    border-bottom: 1px solid #eee;
    padding: 8px 0;
}
.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.item-info p {
    font-size: 0.9rem;
    font-weight: 700;
}
.item-info span {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
}

.item-actions {
    display: flex;
    gap: 8px;
}
.btn-note {
    background: #f1f1f1;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-muted);
}
.btn-note.has-note {
    background: var(--primary-glass);
    color: var(--primary);
}

.note-field {
    max-height: 0;
    overflow: hidden;
    transition: 0.3s;
    opacity: 0;
}
.note-field.visible {
    max-height: 40px;
    margin-top: 8px;
    opacity: 1;
}
.note-field input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px dashed var(--primary);
    font-size: 0.75rem;
}

/* 6. CARRINHO FLUTUANTE (Slim) */
.floating-cart {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 420px;
    background: var(--dark);
    color: white;
    padding: 12px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1100;
}

.cart-icon {
    position: relative;
    font-size: 1.5rem;
}
.badge {
    position: absolute;
    -top: 5px;
    -right: -5px;
    background: var(--primary);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid var(--dark);
}

.cart-info {
    flex: 1;
}
.cart-info .label {
    font-size: 0.65rem;
    opacity: 0.6;
}
.cart-info .total {
    font-size: 1.1rem;
    font-weight: 800;
    display: block;
}

/* 7. MODAL DE REVISÃO */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    z-index: 2000;
}

.order-modal {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 20px 20px 30px;
}

.btn-send {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
}

/* ===========================================
   8. AJUSTES PARA TABLETS (Otimização Máxima)
   =========================================== */
@media (min-width: 768px) {
    /* No Tablet, usamos 4 colunas para ver muitos produtos */
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }

    .content-area,
    .top-bar,
    .scroll-wrapper {
        padding-left: 30px;
        padding-right: 30px;
    }

    /* Mesas um pouco maiores no Tablet para facilitar toque */
    .table-card {
        min-width: 55px;
        height: 55px;
    }

    /* Modal estilo Dialog no centro */
    .order-modal {
        width: 480px;
        bottom: 50%;
        left: 50%;
        transform: translate(-50%, 50%);
        border-radius: 20px;
    }

    /* FAB na lateral direita para ergonomia */
    .floating-cart {
        left: auto;
        right: 30px;
        transform: none;
        width: 350px;
    }
}

@media (min-width: 1024px) {
    /* No iPad Pro / Desktop, usamos até 5 colunas */
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}
