/* =========================================================
   RESET
========================================================= */
*{ box-sizing:border-box; }

body{
    margin:0;
    font-family: Arial, Helvetica, sans-serif;
    background:#111;
    color:#fff;
}


/* =========================================================
   TOPO
========================================================= */
.topo{
    position: relative;
    background:#c62828;
    color:#fff;
    text-align:center;
    padding:14px 10px;
    font-size:20px;
    font-weight:600;
}

.btn-voltar{
    position:absolute;
    left:10px;
    top:50%;
    transform:translateY(-50%);
    background:transparent;
    border:none;
    color:#fff;
    font-size:22px;
    cursor:pointer;
    opacity:.8;
    transition:.2s;
}
.btn-voltar:hover{
    opacity:1;
    transform:translateY(-50%) scale(1.1);
}


/* =========================================================
   LAYOUT PRINCIPAL
========================================================= */
.container{
    display:flex;
    height:calc(100vh - 74px);
}

.layout{
    display:flex;
    flex:1;
    overflow:hidden;
}


/* =========================================================
   MENU GRUPOS
========================================================= */
.sidebar-grupos{
    width:220px;
    min-width:180px;
    max-width:260px;
    background:#1b1b1b;
    border-right:3px solid #c62828;
    padding:12px;
    overflow-y:auto;
}

.grupo-btn{
    width:100%;
    padding:12px;
    margin-bottom:10px;
    background:#c62828;
    border:none;
    color:#fff;
    border-radius:10px;
    text-align:left;
    cursor:pointer;
}


/* =========================================================
   SUBGRUPOS + PRODUTOS
========================================================= */
.sidebar-sub{
    flex:1;
    padding:18px;
    overflow-y:auto;
}

.sub-btn{
    width:100%;
    padding:10px;
    margin:6px 0;
    background:#c62828;
    border:none;
    color:#fff;
    border-radius:8px;
    text-align:left;
    cursor:pointer;
}

.sub-grid{ display:none; }
.subgrupo-box{ display:none; }

/* =========================================================
   MODAL GLOBAL
========================================================= */
.modal-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.6);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:9999;
    opacity:0;
    pointer-events:none;
    transition:.25s;
}

.modal-overlay.ativo{
    opacity:1;
    pointer-events:auto;
}

.modal-box{
    background:#fff;
    padding:30px 35px;
    border-radius:14px;
    width:90%;
    max-width:360px;
    text-align:center;
    box-shadow:0 15px 40px rgba(0,0,0,.3);
    animation:zoom .25s ease;
}

@keyframes zoom{
    from{transform:scale(.8); opacity:0;}
    to{transform:scale(1); opacity:1;}
}

.modal-icon{
    width:70px;
    height:70px;
    margin:0 auto 15px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:34px;
    color:#fff;
    background:#22c55e;
}

.modal-icon.erro{
    background:#ef4444;
}

.modal-title{
    font-size:20px;
    font-weight:bold;
    margin-bottom:8px;
}

.modal-text{
    font-size:15px;
    color:#555;
    margin-bottom:20px;
    line-height:1.4;
}

.modal-btn{
    background:#111827;
    color:#fff;
    border:none;
    padding:10px 22px;
    border-radius:8px;
    cursor:pointer;
    font-size:14px;
}


/* ================= MODAL MESAS ================= */
.modal-mesas{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-box{
    background:#1e1e1e;
    padding:25px;
    border-radius:16px;
    width:95%;
    max-width:600px;
    text-align:center;

    display:flex;
    flex-direction:column;
    gap:12px;
}
.modal-box h2{
   margin:10px 0 20px;
}


/* ================= GRID MESAS ================= */
.grid-mesas{
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(90px,1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.mesa-btn{
    background: #2a2a2a;
    border: none;
    padding: 18px;
    font-size: 20px;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    transition: .2s;
}

.mesa-btn:hover{
    background: #c62828;
    transform: scale(1.05);
}

/* =========================================================
   MODAL MESAS SCROLL (IPHONE / MOBILE)
========================================================= */

.modal-box{
    background:#1e1e1e;
    padding:25px;
    border-radius:16px;
    width:95%;
    max-width:600px;

    display:flex;
    flex-direction:column;

    max-height:90vh;      /* nunca passa da tela */
}

/* GRID COM SCROLL */
#gridMesas{
    flex:1;               /* ocupa espaço disponível */
    overflow-y:auto;
    min-height:120px;
}

/* GRID */
.grid-mesas{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(90px,1fr));
    gap:12px;
}


/* scroll suave */
#gridMesas::-webkit-scrollbar{
    width:6px;
}

#gridMesas::-webkit-scrollbar-thumb{
    background:#555;
    border-radius:6px;
}


/* =========================================================
   MOBILE (iphone)
========================================================= */
@media (max-width:720px){

#gridMesas{
    max-height:50vh;
}

.grid-mesas{
    grid-template-columns:repeat(auto-fill,minmax(80px,1fr));
}

.mesa-btn{
    padding:14px;
    font-size:18px;
}

}


/* =========================================================
   MOBILE HORIZONTAL (LANDSCAPE)
========================================================= */

@media (max-width:900px) and (orientation:landscape){

.modal-box{
    max-height:95vh;
}

.grid-mesas{
    grid-template-columns:repeat(auto-fill,minmax(70px,1fr));
}

.mesa-btn{
    padding:10px;
    font-size:16px;
}

}

/* ================= BOTÕES ================= */
.btn-sem-mesa{
    width: 100%;
    padding: 14px;
    margin-bottom: 10px;
    font-size: 18px;
    background: #4caf50;
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
}

.btn-cancelar{
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: #555;
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
}



/* =========================================================
   GRID PRODUTOS RESPONSIVO
========================================================= */
.grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
    gap:18px;
}



.modal-add-overlay{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    background:rgba(0,0,0,0.3);
    opacity:0;
    pointer-events:none;
    transition:.3s;
    z-index:9999;
}

.modal-add-overlay.show{
    opacity:1;
    pointer-events:auto;
}

.modal-add-box{
    background:#fff;
    padding:25px 35px;
    border-radius:15px;
    text-align:center;
    animation:scaleIn .2s ease;
}

.modal-add-icon{
    font-size:40px;
    color:#28a745;
    margin-bottom:10px;
}

.modal-add-text{
    font-size:18px;
    font-weight:600;
}

@keyframes scaleIn{
    from{ transform:scale(.7); opacity:0; }
    to{ transform:scale(1); opacity:1; }
}

/* ULTRAWIDE */
@media (min-width:1600px){
    .grid{
        grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
    }
}


/* =========================================================
   CARD
========================================================= */
.card{
    background:#1e1e1e;
    border-radius:15px;
    padding:18px;
    text-align:center;
    transition:.2s;
}
.card:hover{ transform:scale(1.02); }

.card img{
    width:100%;
    height:180px;
    object-fit:cover;
    border-radius:12px;
    margin-bottom:10px;
}

.card h2{ margin:6px 0; font-size:20px; }

.price{
    font-size:20px;
    color:#4caf50;
    margin-bottom:10px;
}

.options,
.options-obs{
    margin-top:10px;
    font-size:14px;
    text-align:left;
}

.options label,
.options-obs label{
    display:flex;
    align-items:center;
    gap:6px;
    justify-content:flex-start;
}

.add-btn{
    margin-top:12px;
    width:100%;
    padding:12px;
    font-size:17px;
    background:#c62828;
    border:none;
    border-radius:10px;
    color:#fff;
    cursor:pointer;
}


/* =========================================================
   CARRINHO
========================================================= */
#carrinho{
    width:360px;
    min-width:300px;
    max-width:420px;
    background:#1b1b1b;
    padding:20px;
    border-left:4px solid #c62828;
    overflow-y:auto;
}

.item{
    border-bottom:1px solid #333;
    padding-bottom:12px;
    margin-bottom:12px;
}




.qty{
    display:flex;
    align-items:center;
    gap:6px;
    margin-left:auto;
    justify-content:flex-end;
}
.qty button{
    width:30px;
    height:30px;
    border:none;
    border-radius:6px;
    background:#c62828;
    color:#fff;
    font-size:18px;
    cursor:pointer;
}

.total{
    font-size:24px;
    font-weight:bold;
    margin-top:15px;
}

.finalizar{
    width:100%;
    padding:15px;
    font-size:20px;
    background:#c62828;
    border:none;
    border-radius:12px;
    color:#fff;
    cursor:pointer;
    margin-top:15px;
}

/* =========================================================
   SCROLL INVISÍVEL GLOBAL
========================================================= */

/* Chrome / Edge / Safari */
.sidebar-grupos::-webkit-scrollbar,
.sidebar-sub::-webkit-scrollbar,
#carrinho::-webkit-scrollbar{
    width:0px;
    height:0px;
}

/* Firefox */
.sidebar-grupos,
.sidebar-sub,
#carrinho{
    scrollbar-width:none;
}

/* IE antigo */
.sidebar-grupos,
.sidebar-sub,
#carrinho{
    -ms-overflow-style:none;
}


/* =========================================================
   TABLET
========================================================= */
@media (max-width:1200px){

    .sidebar-grupos{ width:180px; }

    #carrinho{ width:300px; }

    .grid{
        grid-template-columns:repeat(auto-fill,minmax(200px,1fr));
    }
}


/* =========================================================
   TABLET / MOBILE
========================================================= */
@media (max-width:900px){

    .container{
        flex-direction:column;
        height:auto;
    }

    .layout{
        flex-direction:column;
    }

    .sidebar-grupos{
        width:100%;
        border-right:none;
        border-bottom:3px solid #c62828;
        /* display:flex; */
        flex-wrap:wrap;
        gap:8px;
    }

    .grupo-btn{
        flex:1 1 120px;
        text-align:center;
    }

    .grid{
        grid-template-columns:repeat(auto-fill,minmax(180px,1fr));
    }

    #carrinho{
        width:100%;
        border-left:none;
        border-top:4px solid #c62828;
        margin-top:10px;
    }
}

/* =========================================================
   TABLET VERTICAL (LAYOUT iFOOD STYLE)
   Grupo + Sub lado a lado
   Carrinho abaixo
========================================================= */
/* =========================================================
   TABLET VERTICAL (601px até 1024px)
========================================================= */
@media (min-width:401px) and (max-width:1024px){

    .container{
        flex-direction:column;
        height:auto;
    }

    /* linha grupo + subgrupo */
    .layout{
        display:flex;
        flex-direction:row;
        width:100%;
        flex:none;              /* 🔥 remove crescimento automático */
    }

    /* GRUPOS */
    .sidebar-grupos{
        width:120px;            /* largura fixa */
        min-width:220px;
        max-width:220px;
        border-right:3px solid #c62828;
        border-bottom:none;
    }

    .grupo-btn{
        width:100%;
        display:block;          /* 🔥 impede expandir */
    }

    /* SUBGRUPOS */
    .sidebar-sub{
        flex:1;                 /* ocupa o restante */
        width:auto;
    }

    /* CARRINHO */
    #carrinho{
        width:100% !important;  /* 🔥 força 100% */
        max-width:none;
        min-width:0;
        border-left:none;
        border-top:4px solid #c62828;
        margin-top:10px;
    }

}
/* =========================================================
   MOBILE
========================================================= */
@media (max-width:600px){

    .grid{
        grid-template-columns:repeat(auto-fill,minmax(160px,1fr));
    }

    .card img{ height:140px; }
    .card h2{ font-size:16px; }
    .price{ font-size:18px; }

}


#toastAdd{
    position:fixed;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%) scale(.8);
    background:#28a745;
    color:#fff;
    padding:20px 35px;
    border-radius:15px;
    font-size:18px;
    font-weight:bold;
    z-index:99999;
    opacity:0;
    transition:.2s;
    pointer-events:none;
    box-shadow:0 10px 30px rgba(0,0,0,0.3);
}

#toastAdd.show{
    opacity:1;
    transform:translate(-50%,-50%) scale(1);
}