/* 1. LIMPIEZA (RESET) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    }

/* 2. ESTRUCTURA (FLEXBOX) */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

body {
    background-color: #fafafa;
}

/* 3. MAQUILLAJE DE ELEMENTOS */
.logo {
    color: #0056D2;
    font-size: 44px;
    font-weight: 900;
    letter-spacing: 1px;
}

nav a {
    display: inline-block;
    text-decoration: none;
    color: #333333;
    font-size: 18px;
    font-weight: 600;
    margin-right: 50px;
    transition: transform 0.3s ease;
}

nav a:hover {
    color: #0056D2;
    transform: scale(1.1);
    text-decoration: underline;
}

.search-box {
    width: 350px;
    height: 33px;
    background-color: #fafafa;
    border: 2px solid #0056D2;
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    transform: translateY(0px);
    /* Para cuadrar la barra de busqueda en altura */
}

/* Ajustes para el texto y la lupa dentro*/
.search-box input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 16px;
    color: #333;
}

.search-box button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #0056D2;
}

/* ICONOS DE USUARIO Y CARRITO (Versión Grande) */
.icons {
    display: flex;
    align-items: center;
}

.icons a {
    color: #333333;
    font-size: 25px;
    margin-left: 25px;
    transition: color 0.3s;
}

.icons a:hover {
    color: #0056D2;
    transform: scale(1.1);
}

/* --- HERO / BANNER --- */
.hero {
    height: 610px;
    /* Altura del banner */
    background-image: url('../img/hero.jpg');
    background-size: cover;
    background-position: center;

    /* Para centrar el cuadro de texto verticalmente */
    display: flex;
    align-items: center;
}

/* El cuadro blanco con el texto */
.hero-text {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 40px;
    margin-left: 20%;
    /* Lo separamos un poco de la izquierda */
    transform: translateY(-99px);
    border-radius: 20px;
    max-width: 600px;
    box-shadow: 0 30px 40px rgba(0, 0, 0, 0.9);
}

.hero-text h2 {
    color: #0056D2;
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 10px;
}

.hero-text p {
    font-size: 18px;
    color: #333333;
}

/* --- SECCIÓN OFERTAS --- */
.seccion-ofertas {
    padding: 50px 0;
    text-align: center;
}

.titulo-rojo {
    background-color: #CE1010;
    color: white;
    display: block;
    max-width: 1090px;
    margin: 10px auto 40px;
    width: 95%;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 25px;
    font-weight: 900;
    margin-bottom: 40px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.9);
}

/* El contenedor que pone las tarjetas una al lado de la otra */
.ofertas-grid {
    display: flex;
    justify-content: center;
    gap: 50px;
}

/* --- DISEÑO DE LA TARJETA ROJA --- */
.card-roja {
    background-color: #CE1010;
    color: white;
    width: 45%;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.9);
}

.card-roja:hover {
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.card-img {
    width: 45%;
}

.card-img img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.3));
}

/* Texto a la derecha */
.card-info {
    width: 55%;
    text-align: right;
}

.card-info h4 {
    color: black;
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 5px;
}

.precio-old {
    display: block;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.6);
    text-decoration: line-through; /* Tachado */
    
}

.precio-new {
    display: block;
    font-size: 50px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.btn-comprar {
    color: black;
    font-weight: 800;
    text-decoration: underline;
    font-size: 14px;
}

/* --- SECCIÓN CATEGORÍAS --- */
.categoria-section {
    padding: 40px 50px;
    margin-bottom: 20px;
}

.categoria-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
}

.categoria-header h3 {
    font-size: 24px;
    font-weight: 600;
    color: #333333;
}

.ver-mas {
    font-size: 14px;
    color: #555;
    text-decoration: underline;
    font-weight: 600;
}

/* REJILLA DE 4 PRODUCTOS */
.productos-grid {
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

/* TARJETA SIMPLE (Gris/Blanca) */
.producto-card {
    background-color: #fafafa;
    border-radius: 10px;
    padding: 15px;
    width: 23%;
    /* Para que quepan 4 en fila (23% x 4 = 92%) */
    text-align: left;
    border: 1px solid #ddd;
    transition: transform 0.1s;
}

.producto-card:hover {
    transform: translateY(-2px);
    border-color: #0056D2;
}

.img-box {
    background: #fafafa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
}

.img-box img {
    height: 100px;
    /* Altura fija para que todas sean iguales */
    object-fit: contain;
}

.producto-card h5 {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
    font-weight: 400;
}

.producto-card .precio-final {
    font-size: 18px;
    font-weight: 600;
    color: #CE1010;
}

/* --- FOOTER --- */
footer {
    background-color: #fafafa;
    padding: 60px 0;
    margin-top: 50px;
    border-top: 1px solid #CCC;
}

.footer-grid {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.footer-col h4 {
    font-weight: 700;
    margin-bottom: 15px;
    color: #000;
}

.footer-col .logo-diagon-footer {
    color: #0056D2;
    font-size: 54px;
    font-weight: 900;

}

.footer-col a {
    display: block;
    text-decoration: none;
    color: #333;
    margin-bottom: 3px;
    transition: color 0.2s;
}

.footer-col a:hover {
    text-decoration: underline;
}

.footer-col p {
    color: #555;
    margin-bottom: 20px;
}

/* Iconos de pago*/
.pagos-icons {
    margin-top: 20px;
    font-size: 24px;
    color: #333;
}

.pagos-icons i {
    margin-right: 5px;
}

/* --- PÁGINA DE PRODUCTO --- */

.producto-detalle {
    padding: 60px 20px;
    display: flex;
    /* Pone foto y texto lado a lado */
    align-items: center;
    gap: 60px;
}

/* 1. LA FOTO */
.col-foto {
    flex: 1;
    display: flex;
    justify-content: center;
    background-color: #fafafa;
    border: 1px solid #333333;
    border-radius: 20px;
    padding: 40px;
}

.col-foto img {
    max-width: 100%;
    height: auto;
    max-height: 450px;
}

/* 2. LA INFO */
.col-info {
    flex: 1;
}

.col-info h1 {
    font-size: 32px;
    color: #333;
    margin-bottom: 10px;
}

.ref {
    color: #888;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Precios */
.ficha-old {
    font-size: 20px;
    text-decoration: line-through;
    color: #999;
    margin-right: 15px;
}

.ficha-new {
    font-size: 40px;
    color: #CE1010;
    font-weight: 900;
}

.desc {
    margin: 20px 0 30px;
    line-height: 1.6;
    color: #333333;
}

/* Zona de botones */
.compra-actions {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.input-cantidad {
    width: 60px;
    padding: 10px;
    font-size: 18px;
    border: 2px solid #ccc;
    border-radius: 10px;
    text-align: center;
}

.btn-anadir {
    background-color: #0056D2;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s;
    flex: 1;
}

.btn-anadir:hover {
    background-color: #004494;
}

.garantias p {
    color: #0056D2;
    margin-bottom: 1px;
    font-weight: 300;
}

/* --- MIGAS DE PAN --- */
.breadcrumbs-bar {
    width: 100%;
    background-color: #fafafa;
    border-top: 1px solid #dadada;
    padding: 25px 0;
}

.migas {
    font-size: 14px;
    color: #888;
    margin: 0;
}

.migas strong {
    color: #333;
}

/* AJUSTES PARA TARJETA OFERTA */
.tarjeta-enlace {
    text-decoration: none; /* Arregla el subrayado a los textos de dentro */
    display: flex;
}
/* EMPUJAR LAS MIGAS DE PAN PARA QUE SE VEA BIEN*/
    .breadcrumbs-bar {
        margin-top: 10px; 
        width: 100%;
        box-sizing: border-box;
    }

    /* --- BURBUJA DEL CARRITO --- */
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: red;
    color: white;
    font-size: 10px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden; /* Oculto si es 0 */
}

/* Cuando tenga articulos, le pondremos esta clase para que se vea */
.cart-badge.visible {
    visibility: visible;
}

/* Contenedor del carrito para que la burbuja se posicione bien */
.cart-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

/* --- VERSIÓN MÓVIL  --- */
@media (max-width: 768px) {

    /* 1. EL CONTENEDOR PRINCIPAL */
    header .container {
        flex-direction: row; 
        flex-wrap: wrap;
        justify-content: space-between; /* Separa menú a la izq e iconos a la der */
        align-items: center;
        padding-bottom: 10px;
    }

    /* PARA QUE NO SE MONTE EN LA FOTO */
    header {
        background-color: #fafafa; 
        position: relative; 
    }

    /* FILA 1: EL LOGO */
    .logo {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
        order: 1;
    }

    /* FILA 2: EL MENÚ */
    nav {
        order: 2; 
        width: 100%;
    }

    nav ul {
        display: flex; 
        justify-content: center;
        gap: 20px;
        font-size: 14px;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    /* FILA 3: LOS ICONOS */
    .icons {
        order: 3;
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 20px;
        margin-top: 10px;
    }

    /* FILA 3: EL BUSCADOR (Al final del todo) */
    .search-box {
        width: 100%;
        order: 4;
        margin-top: 15px;
    }
    
    .search-box input {
        width: 100%; /* Que la caja de texto llene el hueco */
    }
    
    /* ARREGLO EXTRA PARA EL HERO */
    .hero {
        margin-top: 130px; 
        min-height: 10px;
        padding: 20px;
        height: auto;
        display: flex;
        align-items: center;
    }

    .hero-text {
        margin: 20px; 
        width: auto;
        transform: none;
        text-align: center;
    }

    .hero-text h2 {
        font-size: 32px;
    }


    /* 3. OFERTAS */
    .ofertas-grid {
        flex-direction: column; /* Una debajo de otra */
        align-items: center;
    }

    .card-roja {
        width: 100%; 
        max-width: none;
    }

    .titulo-rojo {
        width: 100%; 
        font-size: 18px; 
    }

    /* 4. Rejilla de productos */
    .productos-grid {
        flex-wrap: wrap; /* Permite que bajen de línea si no caben */
    }

    .producto-card {
        width: 46%; /* Ponemos 2 por fila (46% + espacio = 100%) */
        margin-bottom: 20px;
    }

    /* 5. FOOTER */
    .footer-grid {
        flex-direction: column; 
        text-align: center;
        gap: 30px;
    }

    /* 6. FICHA DE PRODUCTO */
    .producto-detalle {
        flex-direction: column;
        gap: 20px;
        padding-top: 20px;
    }

    .col-foto, .col-info {
        width: 100%;
    }

    /* Botón de añadir */
    .compra-actions {
        flex-direction: column;
    }

    .btn-anadir {
        width: 100%;
        padding: 20px;
    }
    
    .input-cantidad {
        width: 100%;
        margin-bottom: 10px;
    }
    .breadcrumbs-bar {
        margin-top: 130px;
        width: 100%;
        box-sizing: border-box;
    }
}
