:root {
    --azul: #004aad;
    --amarillo: #ffde59;
    --blanco: #ffffff;
    --gris-fondo: #f8f9fa;
    --texto: #2d3436;
    --verde-wa: #25D366;
}

* { box-sizing: border-box; }
body { font-family: 'Segoe UI', Roboto, sans-serif; margin: 0; color: var(--texto); background: var(--blanco); }
.container { width: 90%; max-width: 1200px; margin: auto; }

/* Ajuste para anclajes con header sticky */
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

/* Header */
header { padding: 15px 0; border-bottom: 2px solid var(--gris-fondo); position: sticky; top: 0; background: white; z-index: 10; }
.navbar { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; font-size: 1.5rem; font-weight: bold; color: var(--azul); }
nav a { text-decoration: none; color: var(--azul); margin-left: 20px; font-weight: 600; }
.btn-cta { 
    background: var(--verde-wa); /* Cambiado de azul a verde */
    color: white; 
    padding: 8px 15px; 
    border-radius: 5px; 
    transition: 0.3s;
    text-decoration: none;
}

.btn-cta:hover {
    background: #128C7E; /* Un verde un poco más oscuro al pasar el mouse */
    color: white;
}

.btn-email {
    background: #dc3545; /* Rojo */
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    transition: 0.3s;
    text-decoration: none;
}

.btn-email:hover {
    background: #c82333; /* Rojo más oscuro al pasar el mouse */
    color: white;
}

/* ... resto del código ... */

/* Ajuste en el Responsivo para que use la variable */
@media (max-width: 768px) {
    /* ... otros estilos ... */
    
    .btn-cta {
        text-align: center;
        background: var(--verde-wa); 
        margin-top: 10px;
    }
    
    .btn-email {
        text-align: center;
        background: #dc3545;
        margin-top: 10px;
    }
}

/* --- Estilos para el Menú Desplegable --- */
.menu-toggle {
    display: none; /* Oculto en PC */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 20;
}

.menu-toggle .bar {
    width: 100%;
    height: 3px;
    background-color: var(--azul);
    border-radius: 10px;
    transition: 0.3s;
}

/* Responsivo (Móvil) */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex; /* Mostrar botón en móvil */
    }

    nav {
        display: none; /* Ocultar menú normal */
        flex-direction: column;
        position: absolute;
        top: 70px; 
        right: 5%;
        background: white;
        width: 200px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        border-radius: 8px;
        padding: 20px;
        border: 1px solid #eee;
    }

    nav.active {
        display: flex; 
        animation: fadeIn 0.3s ease-in-out;
    }

    nav a {
        margin: 10px 0;
        margin-left: 0;
        font-size: 1.1rem;
    }

    .btn-cta {
        text-align: center;
        background: #25D366; 
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero { background: var(--azul); color: white; padding: 80px 0; text-align: center; }
.hero h1 { font-size: 2.5rem; margin-bottom: 10px; }
.btn-yellow { background: var(--amarillo); color: #000; padding: 12px 25px; text-decoration: none; border-radius: 5px; font-weight: bold; display: inline-block; margin-top: 20px; }

/* Grid */
.title { text-align: center; margin: 50px 0; font-size: 2rem; }
.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 30px; 
    margin-bottom: 50px; 
}

/* --- Card Actualizada para Alineación --- */
.card { 
    border: 1px solid #eee; 
    border-radius: 10px; 
    overflow: hidden; 
    transition: 0.3s; 
    display: flex;           /* Nuevo: Activa flexbox */
    flex-direction: column;  /* Nuevo: Ordena contenido en vertical */
    height: 100%;            /* Nuevo: Asegura que todas midan lo mismo en la fila */
}

.card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.card img { width: 100%; height: 200px; object-fit: cover; }

.card-body { 
    padding: 20px; 
    display: flex;           /* Nuevo: Activa flexbox interno */
    flex-direction: column;  /* Nuevo: Ordena contenido en vertical */
    flex-grow: 1;            /* Nuevo: Expande este contenedor para ocupar el espacio */
}

.card-body p {
    text-align: left;
}

.badge { 
    align-self: flex-start;  /* Mantiene el badge pequeño a la izquierda */
    background: #eef2ff; 
    color: var(--azul); 
    font-size: 0.7rem; 
    padding: 3px 8px; 
    border-radius: 10px; 
    text-transform: uppercase; 
    margin-bottom: 10px;
}

.price-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin: 15px 0; 
    margin-top: auto;        /* CLAVE: Empuja el precio y el botón al fondo de la card */
}

.price { font-size: 1.3rem; font-weight: bold; color: var(--azul); }
.stock { color: #28a745; font-weight: 600; }
.btn-buy { display: block; background: var(--gris-fondo); color: var(--azul); text-align: center; text-decoration: none; padding: 10px; border-radius: 5px; border: 1px solid var(--azul); font-weight: bold; }
.btn-buy:hover { background: var(--azul); color: white; }

/* Footer */
footer { 
    background: linear-gradient(135deg, #f1f2f6 0%, #e6ecf5 100%);
    padding: 60px 0 20px 0; 
    margin-top: 60px; 
    color: #1f2d3d;
}

.footer-grid { 
    display: grid; 
    grid-template-columns: 1.5fr 1fr 1fr; 
    gap: 30px; 
    align-items: start; 
}

footer h4 { 
    margin-top: 0; 
    margin-bottom: 12px; 
    color: var(--azul); 
    letter-spacing: 0.3px;
}

.footer-brand p { 
    margin: 6px 0; 
    color: #42526e; 
}

.footer-list { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
}

.footer-list a { 
    color: #2d3436; 
    text-decoration: none; 
    transition: color 0.2s ease; 
}

.footer-list a:hover { color: var(--azul); }

.footer-contact a { color: #2d3436; text-decoration: none; }
.footer-contact a:hover { color: var(--azul); }

.footer-cta {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.footer-cta .btn-cta, .footer-cta .btn-email { 
    padding: 10px 14px; 
    font-size: 0.95rem; 
}

.bottom-bar { 
    text-align: center; 
    border-top: 1px solid #d4d9e1; 
    margin-top: 35px; 
    padding-top: 18px; 
    font-size: 0.85rem; 
    color: #5f6b7a;
}

@media (max-width: 900px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .footer-grid { grid-template-columns: 1fr; }
    .footer-cta { flex-direction: column; }
    .footer-cta .btn-cta, .footer-cta .btn-email { width: 100%; text-align: center; }
}

/* Página de Términos */
.content-legal { padding: 60px 0; line-height: 1.8; color: var(--texto); background: var(--gris-fondo); }
.content-legal h1 { margin-bottom: 30px; text-align: center; color: var(--azul); }
.content-legal section { background: var(--blanco); border: 1px solid #eee; border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 10px 25px rgba(0,0,0,0.04); }
.content-legal h2 { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; color: var(--azul); border-left: 6px solid var(--amarillo); padding-left: 12px; margin: 0 0 10px 0; }
.back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; color: var(--azul); text-decoration: none; font-weight: 700; transition: color 0.2s ease; }
.back-link:hover { color: #003b80; }
.content-legal ul { padding-left: 20px; margin: 10px 0; }
.content-legal li { margin-bottom: 6px; }
.legal-updated { margin-top: 40px; font-size: 0.9rem; font-style: italic; color: #666; text-align: right; }

@media (max-width: 768px) {
    .content-legal { padding: 40px 0; }
    .content-legal h1 { font-size: 1.8rem; }
    .content-legal section { padding: 16px; }
}

/* Popup de Descuento */
.popup-discount {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 320px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    border: 2px solid var(--amarillo);
}

.popup-discount.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.popup-close:hover {
    color: #333;
}

.popup-discount h3 {
    margin: 0 0 10px 0;
    color: var(--azul);
    font-size: 1.3rem;
}

.popup-discount p {
    margin: 0 0 15px 0;
    color: var(--texto);
    font-size: 0.95rem;
    line-height: 1.5;
}

#discountForm {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#emailInput {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

#emailInput:focus {
    outline: none;
    border-color: var(--azul);
}

.btn-submit {
    background: var(--amarillo);
    color: #000;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: #f0d14a;
}

.popup-success {
    color: #28a745;
    font-weight: bold;
    text-align: center;
}

@media (max-width: 768px) {
    .popup-discount {
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
        bottom: 10px;
    }
}