/* ==========================================================
   SUPERMERCADO BABILONIA
   Hoja de estilos V2
========================================================== */

:root{
    --rojo:#E30613;
    --rojo-dark:#C4000F;
    --negro:#111827;
    --gris:#6B7280;
    --gris-claro:#F3F4F6;
    --blanco:#FFFFFF;
    --fondo:#F5F5F5;

    --radio:18px;
    --sombra:0 10px 25px rgba(0,0,0,.08);
    --transition:.25s ease;
}

/* ================= RESET ================= */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

html{
    scroll-behavior:smooth;
}

body{
    font-family:Inter,Arial,Helvetica,sans-serif;
    background:var(--fondo);
    color:#222;
}

/* ================= CONTENEDOR ================= */

.container{
    width:100%;
    max-width:480px;
    margin:auto;
    padding-bottom:95px;
}

/* ================= HEADER ================= */

.header{
    position:sticky;
    top:0;
    z-index:999;
    background:var(--blanco);
    box-shadow:0 2px 12px rgba(0,0,0,.06);
}

.header-container{
    max-width:480px;
    margin:auto;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:12px 16px;
}

.logo{
    height:58px;
    object-fit:contain;
}

.icon-btn{
    background:none;
    border:none;
    font-size:26px;
    cursor:pointer;
    position:relative;
}

.icon-btn:active{
    transform:scale(.95);
}

.cart-header span{
    position:absolute;
    top:-6px;
    right:-8px;
    width:20px;
    height:20px;
    border-radius:50%;
    background:var(--rojo);
    color:white;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:11px;
    font-weight:bold;
}

/* ================= CARRUSEL ================= */

.carousel{
    padding:16px;
}

.carousel-track{
    display:flex;
    overflow:hidden;
    border-radius:22px;
    transition:.45s ease;
    box-shadow:var(--sombra);
}

.slide{
    min-width:100%;
    position:relative;
}

.slide img{
    width:100%;
    height:190px;
    object-fit:cover;
    display:block;
}

.slide-overlay{
    position:absolute;
    inset:0;
    background:linear-gradient(
        90deg,
        rgba(0,0,0,.75),
        rgba(0,0,0,.15)
    );
    color:white;
    padding:22px;
    display:flex;
    flex-direction:column;
    justify-content:center;
}

.slide-overlay h2{
    font-size:28px;
    line-height:1;
    font-weight:800;
}

.slide-overlay p{
    margin:12px 0 18px;
    color:#FFD54A;
    font-weight:700;
    letter-spacing:.5px;
}

.slide-overlay button{
    width:150px;
    padding:12px;
    border:none;
    border-radius:12px;
    background:var(--rojo);
    color:white;
    font-weight:bold;
    cursor:pointer;
}

.slide-overlay button:hover{
    background:var(--rojo-dark);
}

.dots{
    display:flex;
    justify-content:center;
    gap:8px;
    margin-top:12px;
}

.dots span{
    width:10px;
    height:10px;
    border-radius:50%;
    background:#D1D5DB;
    transition:var(--transition);
}

.dots .active{
    background:var(--rojo);
    width:22px;
    border-radius:20px;
}

/* ================= BUSCADOR ================= */

.search-box{
    margin:0 16px 20px;
    background:white;
    border-radius:16px;
    display:flex;
    align-items:center;
    padding:0 16px;
    box-shadow:var(--sombra);
}

.search-box input{
    flex:1;
    border:none;
    outline:none;
    padding:16px 0;
    font-size:15px;
    background:transparent;
}

.search-icon{
    font-size:20px;
    color:var(--gris);
}

/* ================= TITULOS ================= */

.section-title{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 16px;
    margin-bottom:14px;
}

.section-title h3{
    font-size:22px;
}

.section-title a{
    text-decoration:none;
    color:var(--rojo);
    font-weight:600;
    font-size:14px;
}

/* ================= CATEGORIAS ================= */

.categories{
    display:flex;
    gap:14px;
    overflow-x:auto;
    padding:0 16px 20px;
    scrollbar-width:none;
}

.categories::-webkit-scrollbar{
    display:none;
}

.category{
    min-width:78px;
    background:white;
    border-radius:18px;
    padding:14px 10px;
    text-align:center;
    box-shadow:var(--sombra);
    cursor:pointer;
    transition:var(--transition);
}

.category:hover{
    transform:translateY(-3px);
}

.category div{
    font-size:28px;
}

.category span{
    display:block;
    margin-top:8px;
    font-size:11px;
    font-weight:600;
}

/* ================= PRODUCTOS ================= */

.product-list{
    display:flex;
    flex-direction:column;
    gap:14px;
    padding:0 16px;
}

.product{
    background:white;
    border-radius:20px;
    padding:12px;
    display:flex;
    gap:12px;
    box-shadow:var(--sombra);
    transition:var(--transition);
}

.product:hover{
    transform:translateY(-2px);
}

.product img{
    width:82px;
    height:82px;
    object-fit:contain;
    border-radius:12px;
    background:#FAFAFA;
}

.product-info{
    flex:1;
}

.product-info h4{
    font-size:17px;
    margin-bottom:4px;
}

.product-info p{
    color:var(--gris);
    font-size:13px;
}

.price{
    margin-top:8px;
    color:var(--rojo);
    font-size:20px;
    font-weight:800;
}

/* ================= CONTADOR ================= */

.qty{
    display:flex;
    align-items:center;
    gap:8px;
    margin-top:10px;
}

.qty button{
    width:32px;
    height:32px;
    border:none;
    border-radius:10px;
    cursor:pointer;
    font-size:18px;
    font-weight:bold;
}

.minus{
    background:#ECECEC;
}

.plus{
    background:var(--rojo);
    color:white;
}

.qty strong{
    width:24px;
    text-align:center;
}

/* ================= BOTON FLOTANTE ================= */

.floating-cart{
    position:fixed;
    bottom:18px;
    left:50%;
    transform:translateX(-50%);
    width:min(92%,460px);
    background:linear-gradient(90deg,#111,#202938);
    color:white;
    border:none;
    border-radius:18px;
    padding:16px 20px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    box-shadow:0 12px 30px rgba(0,0,0,.35);
    cursor:pointer;
}

.floating-cart small{
    display:block;
    margin-top:4px;
    color:#D1D5DB;
    font-size:12px;
}

/* ================= MODAL ================= */

.modal{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.45);
    display:flex;
    align-items:flex-end;
    z-index:9999;
}

.hidden{
    display:none;
}

.modal-content{
    width:100%;
    background:white;
    border-radius:24px 24px 0 0;
    padding:20px;
    max-height:88vh;
    overflow:auto;
}

.modal-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:20px;
}

.modal-header h2{
    font-size:22px;
}

.back-btn,
.close-btn{
    background:none;
    border:none;
    font-size:24px;
    cursor:pointer;
}

.cart-item{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:14px 0;
    border-bottom:1px solid #ECECEC;
}

.cart-item p{
    color:var(--gris);
    font-size:13px;
    margin-top:4px;
}

.cart-total{
    display:flex;
    justify-content:space-between;
    align-items:center;
    font-size:22px;
    margin:24px 0;
}

.primary-btn{
    width:100%;
    border:none;
    border-radius:14px;
    padding:16px;
    background:var(--rojo);
    color:white;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
}

.primary-btn:hover{
    background:var(--rojo-dark);
}

/* ================= DESKTOP ================= */

@media (min-width:768px){

    .container{
        max-width:1000px;
    }

    .header-container{
        max-width:1000px;
    }

    .logo{
        height:70px;
    }

    .slide img{
        height:300px;
    }

    .product-list{
        display:grid;
        grid-template-columns:1fr 1fr;
        gap:18px;
    }

    .modal{
        align-items:center;
        justify-content:center;
    }

    .modal-content{
        max-width:540px;
        border-radius:24px;
    }

    .floating-cart{
        width:460px;
    }

}