/* --- CONFIGURACIÓN GLOBAL --- */
html { scroll-behavior: smooth; }

:root {
    --color-azul: #0cabaa;
    --texto-claro: #ffffff;
    --tarjeta-trasera: #ffffff;
    --texto-oscuro: #333333;
}

* { box-sizing: border-box; }

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--color-azul); 
    color: var(--texto-claro);
    margin: 0; padding: 0; 
    line-height: 1.6;
}

/* --- HEADER --- */
header {
    background-image: url('../img/fondologo.jpg'); 
    background-repeat: repeat; 
    background-size: 350px;
    background-color: #ffffff; 
    padding: 10px 30px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    position: sticky; 
    top: 0; 
    z-index: 1000;
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    min-height: 100px;
}

.bloque-centro {
    position: absolute; 
    left: 50%; 
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.logo-img { max-width: 250px; height: auto; display: block; }

.nav-principal { display: flex; gap: 25px; position: relative; z-index: 11; }
.nav-principal a {
    text-decoration: none; 
    color: #000000;
    font-size: 0.85rem; 
    font-weight: 700; 
    text-transform: uppercase;
    transition: 0.3s; 
    letter-spacing: 1px;
}
.nav-principal a:hover { color: var(--color-azul); }

.idiomas { position: relative; z-index: 11; font-size: 0.9rem; }
.idiomas a { text-decoration: none; color: #444; padding: 5px; }
.idiomas a.activo { 
    color: var(--color-azul); 
    font-weight: 700; 
    border-bottom: 2px solid var(--color-azul); 
}

/* --- HERO --- */
.hero { 
    padding: 80px 20px; 
    background-color: var(--color-azul); 
    margin-bottom: 50px; 
    overflow: hidden; 
    width: 100%;
}
.hero-flex { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    text-align: center;
    gap: 40px; 
    max-width: 1100px; 
    margin: 0 auto; 
}
.hero h1 { 
    font-family: 'Montserrat', sans-serif; 
    font-size: 3rem; 
    text-transform: uppercase; 
    color: white !important; 
    line-height: 1.1; 
    margin: 0;
}
.hero p { font-size: 1.2rem; color: white !important; margin: 20px 0 0; }
.hero-image-container { flex: 1; display: flex; justify-content: flex-end; }
.floating-potato { 
    max-width: 100%; 
    height: auto; 
    max-height: 420px; 
    filter: drop-shadow(0 20px 30px rgba(0,0,0,0.2)); 
}

/* --- GRID Y CONTENEDOR --- */
.contenedor { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.seccion-titulo { 
    font-size: 2.2rem; 
    text-align: center; 
    margin: 80px 0 50px; 
    text-transform: uppercase; 
    border-bottom: 2px solid rgba(255,255,255,0.2); 
    padding-bottom: 15px; 
}
.grid-productos { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 50px; 
}

/* --- TARJETAS --- */
.producto-escena { 
    perspective: 1000px; 
    width: 100%; 
    height: 580px; /* +20px extra para compensar el margen más generoso del reverso */
    max-width: 320px; 
    margin: 0 auto;
}

.producto-card { 
    width: 100%; 
    height: 100%; 
    position: relative; 
    transition: transform 0.8s; 
    transform-style: preserve-3d; 
}

.producto-card.is-flipped { transform: rotateY(180deg); }

.cara { 
    position: absolute; 
    width: 100%; 
    height: 100%; 
    backface-visibility: hidden; 
    border-radius: 30px; 
    padding: 30px; 
    display: flex; 
    flex-direction: column; 
    align-items: center;
    justify-content: flex-start; /* Alineamos todo arriba para controlar distancias */
}

/* CARA FRENTE */
.cara-frente { 
    background-color: var(--color-azul) !important; 
}

.img-container { 
    width: 100%; 
    height: 280px; /* Recuperamos el tamaño de tu foto */
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 15px; 
}
.img-container img { 
    max-height: 100%; 
    max-width: 100%; 
    object-fit: contain; 
    border-radius: 30px; /* Recuperamos el redondeo de la imagen */
}

.contenido-frente {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.cara-frente h3 { 
    font-size: 1.1rem; 
    color: white; 
    margin: 10px 0 5px 0; /* Espaciado ajustado */
}

.precio-verde { 
    font-size: 1.6rem; 
    font-weight: 700; 
    color: white; 
    margin-bottom: 10px; /* AQUÍ CONTROLAS LA DISTANCIA CON INFO */
}

/* CARA DETRÁS (Tarjeta Blanca con Sombra) */
.cara-detras { 
    background-color: var(--tarjeta-trasera) !important; 
    color: var(--texto-oscuro); 
    transform: rotateY(180deg); 
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    justify-content: flex-start; /* Arriba, y que el botón quede pegado al final del scroll */
    padding: 42px 38px 28px; /* Margen más generoso alrededor de toda la tarjeta */
}

.contenido-detras {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0; /* imprescindible para que el overflow funcione dentro de flexbox */
    overflow-y: auto; /* red de seguridad: si no cabe, hace scroll en vez de desbordar */
    margin-bottom: 10px;
    padding-right: 4px; /* separa el texto de la barra de scroll */
}

/* Scrollbar discreta dentro de la tarjeta */
.contenido-detras::-webkit-scrollbar { width: 4px; }
.contenido-detras::-webkit-scrollbar-thumb { background: rgba(12,171,170,0.4); border-radius: 4px; }

.cara-detras h3 { 
    color: var(--color-azul); 
    font-size: 1rem; 
    margin: 0 0 8px 0; 
    text-align: center;
}

.nutricional-intro { 
    font-size: 0.75rem; 
    color: #666; 
    margin-bottom: 12px; 
    text-align: justify;
    line-height: 1.4;
}

/* TABLA NUTRICIONAL */
.tabla-nutricional { 
    width: 100%; 
    border-collapse: collapse; 
    color: var(--texto-oscuro);
}
.tabla-nutricional td { 
    padding: 5px 0; 
    border-bottom: 1px solid #eee; 
    font-size: 0.78rem;
}
.tabla-nutricional td:last-child { 
    text-align: right; 
    font-weight: 700; 
    white-space: nowrap;
}

/* BOTONES (INFO / TORNAR) */
.btn-girar { 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 0.8rem; 
    border-radius: 25px; 
    padding: 8px 35px; 
    background: transparent; 
    text-transform: uppercase; 
    transition: 0.3s;
    flex-shrink: 0; /* el botón nunca se aplasta, aunque el contenido de arriba crezca */
}

.cara-frente .btn-girar { 
    border: 1.5px solid white; 
    color: white; 
}
.cara-frente .btn-girar:hover { 
    background: white; 
    color: var(--color-azul); 
}

/* Variante "sense sal": letras en negro en vez de blanco */
.cara-frente-sinsal h3,
.cara-frente-sinsal .precio-verde {
    color: #000000;
}
.cara-frente-sinsal .btn-girar {
    border-color: #000000;
    color: #000000;
}
.cara-frente-sinsal .btn-girar:hover {
    background: #000000;
    color: white;
}

.cara-detras .btn-girar { 
    border: 1.5px solid var(--color-azul); 
    color: var(--color-azul); 
    margin-top: 6px; 
}
.cara-detras .btn-girar:hover { 
    background: var(--color-azul); 
    color: white; 
}

/* --- FOOTER --- */
footer { padding: 80px 20px; margin-top: 100px; }
.footer-logo-img { 
    max-width: 250px; 
    filter: brightness(0) invert(1); 
    margin-bottom: 40px; 
    display: block; 
    margin-left: auto; 
    margin-right: auto;
}
.footer-columns { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 40px; 
    text-align: center;
}
.legal-links { list-style: none; padding: 0; }
.legal-links a { color: white; text-decoration: none; font-size: 0.85rem; }

/* --- BANNER DE COOKIES --- */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background-color: #ffffff;
    color: var(--texto-oscuro);
    box-shadow: 0 -6px 24px rgba(0,0,0,0.2);
    padding: 22px 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    transform: translateY(120%);
    transition: transform 0.4s ease;
}
.cookie-banner-visible {
    transform: translateY(0);
}
.cookie-banner-texto {
    flex: 1 1 400px;
    max-width: 700px;
}
.cookie-banner-texto p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}
.cookie-banner-texto a {
    color: var(--color-azul);
    font-weight: 700;
    text-decoration: underline;
}
.cookie-banner-botones {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
.cookie-btn {
    cursor: pointer;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    border-radius: 25px;
    padding: 10px 28px;
    transition: 0.3s;
    border: 1.5px solid var(--color-azul);
}
.cookie-btn-rechazar {
    background: transparent;
    color: var(--color-azul);
}
.cookie-btn-rechazar:hover {
    background: #f0f0f0;
}
.cookie-btn-aceptar {
    background: var(--color-azul);
    color: white;
}
.cookie-btn-aceptar:hover {
    background: #098d8c;
}

@media (max-width: 600px) {
    .cookie-banner { padding: 18px 20px; justify-content: flex-start; }
    .cookie-banner-botones { width: 100%; }
    .cookie-btn { flex: 1; padding: 10px 0; }
}

/* --- PÁGINAS LEGALES --- */
.legal-container {
    max-width: 850px;
    margin: 60px auto 120px;
    background-color: #ffffff;
    color: var(--texto-oscuro);
    border-radius: 30px;
    padding: 55px 60px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    line-height: 1.7;
}
.legal-container h1 {
    color: var(--color-azul);
    font-size: 2rem;
    margin: 0 0 8px;
    text-transform: uppercase;
}
.legal-fecha {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 40px;
}
.legal-container h2 {
    color: var(--color-azul);
    font-size: 1.2rem;
    margin: 40px 0 12px;
}
.legal-container p, .legal-container li {
    font-size: 0.95rem;
    color: var(--texto-oscuro);
    text-align: justify;
}
.legal-container ul { padding-left: 20px; }
.legal-container a { color: var(--color-azul); }
.legal-nota {
    margin-top: 45px;
    padding: 18px 20px;
    background: #f4f4f4;
    border-left: 4px solid var(--color-azul);
    font-size: 0.85rem;
    color: #555;
    border-radius: 6px;
}

@media (max-width: 600px) {
    .legal-container { padding: 35px 25px; margin: 30px auto 80px; }
}
@media (max-width: 600px) {
    .grid-productos { grid-template-columns: 1fr; gap: 30px; }
    .hero-flex { flex-direction: column; text-align: center; }
    .hero h1 { font-size: 2.2rem; }
    header { 
        flex-direction: column; 
        padding: 25px 15px; 
        gap: 20px; 
    }
    .bloque-centro { 
        position: static; 
        transform: none; 
        order: -1; 
    }
}