/**
 * Emex Cars Core Styles
 * Design Philosophy: Modern Luxury, Mobile First, High Contrast
 */

:root {
    /* --- Paleta Oficial Emex_Corp --- */
    --emex-night-bordeaux: #4C060E;
    --emex-punch-red:      #EE2139;
    --emex-coffee-beam:    #291F1E;
    --emex-gray-olive:     #978F84;
    --emex-seashell:       #FFF3ED;

    /* --- Variaciones Funcionales --- */
    --emex-white:          #FFFFFF;
    --emex-black:          #000000;
    --emex-success:        #27ae60;
    --emex-error:          #c0392b;
    --emex-overlay:        rgba(41, 31, 30, 0.8); /* Coffee Beam con transparencia */

    /* --- Tipografía & Espaciado --- */
    --emex-font-main:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --emex-radius-sm:      8px;
    --emex-radius-md:      16px;
    --emex-radius-lg:      24px;
    
    /* --- Sombras (Efecto Elevación) --- */
    --emex-shadow-sm:      0 2px 8px rgba(41, 31, 30, 0.08);
    --emex-shadow-md:      0 8px 24px rgba(41, 31, 30, 0.12);
    --emex-shadow-hover:   0 16px 32px rgba(76, 6, 14, 0.15); /* Sombra con tinte rojo sutil */
    
    /* --- Animaciones --- */
    --emex-transition:     all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* === Base & Reset === */
.emex-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    font-family: var(--emex-font-main);
    color: var(--emex-coffee-beam);
}

/* Fondo principal (Se recomienda aplicar al body del tema, pero lo forzamos aquí para contenedores) */
.emex-bg-seashell {
    background-color: var(--emex-seashell);
}

/* === Botones (Interacción Principal) === */
.emex-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--emex-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--emex-transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* CTA Principal (Acción) */
.emex-btn-primary {
    background-color: var(--emex-punch-red);
    color: var(--emex-white);
    box-shadow: 0 4px 12px rgba(238, 33, 57, 0.3);
}

.emex-btn-primary:hover {
    background-color: #d61c32; /* Un poco más oscuro */
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(238, 33, 57, 0.4);
}

/* CTA Secundario (Elegancia) */
.emex-btn-secondary {
    background-color: var(--emex-night-bordeaux);
    color: var(--emex-white);
}

.emex-btn-secondary:hover {
    background-color: #3a040a;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(76, 6, 14, 0.3);
}

/* Botón Outline (Filtros, acciones terciarias) */
.emex-btn-outline {
    background-color: transparent;
    border: 2px solid var(--emex-gray-olive);
    color: var(--emex-coffee-beam);
}

.emex-btn-outline:hover {
    border-color: var(--emex-night-bordeaux);
    color: var(--emex-night-bordeaux);
    background-color: rgba(151, 143, 132, 0.1);
}

/* === Tarjetas (Cards) === */
.emex-card {
    background-color: var(--emex-white);
    border-radius: var(--emex-radius-md);
    overflow: hidden;
    box-shadow: var(--emex-shadow-sm);
    transition: var(--emex-transition);
    position: relative;
    border: 1px solid rgba(0,0,0,0.02);
}

.emex-card:hover {
    box-shadow: var(--emex-shadow-hover);
    transform: translateY(-4px);
}

/* Etiquetas flotantes (ej. Precio, Estado) */
.emex-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--emex-night-bordeaux);
    color: var(--emex-white);
    padding: 6px 12px;
    border-radius: var(--emex-radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10;
    backdrop-filter: blur(4px); /* Efecto cristal moderno */
}

/* === Formularios Modernos === */
.emex-form-group {
    margin-bottom: 20px;
}

.emex-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--emex-night-bordeaux);
    font-size: 0.9rem;
}

.emex-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #E0E0E0; /* Gris muy suave neutral */
    border-radius: var(--emex-radius-sm);
    background-color: var(--emex-white);
    font-size: 1rem;
    color: var(--emex-coffee-beam);
    transition: var(--emex-transition);
}

.emex-input:focus {
    outline: none;
    border-color: var(--emex-night-bordeaux);
    box-shadow: 0 0 0 4px rgba(76, 6, 14, 0.1); /* Focus ring elegante */
}

/* === Utilidades de Grid Responsivo === */
.emex-grid {
    display: grid;
    grid-template-columns: 1fr; /* Móvil: 1 columna */
    gap: 24px;
}

@media (min-width: 768px) {
    .emex-grid {
        grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columnas */
    }
}

@media (min-width: 1024px) {
    .emex-grid {
        grid-template-columns: repeat(3, 1fr); /* Desktop: 3 columnas */
    }
}

/* Animación de carga (Skeleton) */
@keyframes emex-pulse {
    0% { background-color: #eee; }
    50% { background-color: #ddd; }
    100% { background-color: #eee; }
}
.emex-skeleton {
    animation: emex-pulse 1.5s infinite ease-in-out;
    border-radius: var(--emex-radius-sm);
}
/* === HEADER MODERNO (CORREGIDO) === */
.emex-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    /* Transición suave para el fondo y el padding */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 15px 0;
    color: var(--emex-white);
}

/* Estado Scrolled (cuando bajas la página) */
.emex-header.scrolled {
    background-color: rgba(76, 6, 14, 0.95); /* Un poco más opaco para legibilidad */
    backdrop-filter: blur(10px);
    padding: 10px 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.emex-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- LOGOTIPOS (SISTEMA DINÁMICO) --- */

/* 1. Contenedor Base (ESTADO INICIAL - TRANSPARENTE DESKTOP) */
.emex-logo-container {
    position: relative;
    display: block;
    
    /* TUS MEDIDAS: 150px ancho x 75px alto */
    width: 150px; 
    height: 75px; 
    
    /* Transición fluida del tamaño */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Contenedor Scrolled (ESTADO BAJANDO - DESKTOP) */
/* Cuando el header tiene la clase .scrolled, el contenedor crece */
.emex-header.scrolled .emex-logo-container {
    /* TUS MEDIDAS: 300px ancho x 90px alto */
    width: 300px;
    height: 90px;
}

/* Imágenes dentro del contenedor */
.emex-logo-img {
    position: absolute;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    
    /* Aseguramos que la imagen no se deforme y respete el contenedor */
    object-fit: contain; 
    object-position: left center; /* Crece hacia la derecha */
    
    transition: opacity 0.4s ease-in-out;
}

/* Clases de visibilidad (React las activa/desactiva) */
.emex-logo-img.visible { opacity: 1; }
.emex-logo-img.hidden { opacity: 0; }


/* --- MEDIA QUERY MÓVIL (MEDIDAS ESPECÍFICAS) --- */
@media (max-width: 768px) {
    
    /* 1. Móvil Inicial (Sin Scroll) */
    .emex-logo-container {
        /* TUS MEDIDAS: 80px ancho x 20px alto */
        width: 80px;
        height: 20px;
    }

    /* 2. Móvil Scrolled (Bajando) */
    .emex-header.scrolled .emex-logo-container {
        /* TUS MEDIDAS: 160px ancho x 30px alto */
        width: 160px;
        height: 30px;
    }
}


/* --- NAV DESKTOP --- */
.emex-nav-desktop {
    display: flex;
    gap: 30px;
    align-items: center;
}

.emex-nav-link {
    color: var(--emex-white);
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    position: relative;
    padding: 5px 0;
}

/* Efecto de subrayado animado */
.emex-nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--emex-punch-red);
    transition: width 0.3s ease;
}

.emex-nav-link:hover::after {
    width: 100%;
}

@media (max-width: 768px) {
    .emex-nav-desktop { display: none; }
}

/* --- MENU MOVIL (HAMBURGER) --- */
.emex-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--emex-white);
    font-size: 1.8rem;
    cursor: pointer;
}
@media (max-width: 768px) {
    .emex-hamburger { display: block; }
}

/* Overlay Menú Móvil */
.emex-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; /* Oculto a la derecha */
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background-color: var(--emex-coffee-beam);
    z-index: 1001;
    transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    padding: 80px 40px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
}

.emex-mobile-menu.open {
    right: 0; /* Visible */
}

.emex-mobile-link {
    display: block;
    color: var(--emex-white);
    font-size: 1.2rem;
    margin-bottom: 20px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

/* Botón cerrar menú móvil */
.emex-close-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--emex-white);
    font-size: 2rem;
    cursor: pointer;
}
/* === HERO GARAJE INTERACTIVO (VERSIÓN FINAL COMPLETA) === */

.emex-garage-hero {
    position: relative;
    width: 100vw;
    background-color: #050505;
    overflow: hidden;
    
    /* ESCRITORIO: Altura grande para impacto visual */
    height: 85vh; 
    min-height: 500px;
    
    /* Compensación para subir la imagen por debajo del Header */
    margin-top: -80px !important; 
    
    /* Romper contenedor para ancho completo */
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Capas de Imagen (Fondo y Luces) */
.emex-garage-bg, 
.emex-garage-light {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    
    background-size: cover; 
    background-position: center bottom; 
    background-repeat: no-repeat;
    
    transition: opacity 0.2s ease-in-out; /* Rápido para efecto encendido */
    pointer-events: none; /* Decorativo, no bloquea el ratón */
}

/* --- ZONAS DE INTERACCIÓN (HITBOXES) - CORREGIDO --- */
.emex-garage-hitboxes {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    z-index: 25;
    /* Quitamos display: flex para evitar conflictos con absolute */
}

.emex-hitbox {
    /* CAMBIO CLAVE: Absolute para obedecer exactamente al 'left' del JS */
    position: absolute; 
    top: 0;           /* Pegado arriba */
    height: 100%;     /* Altura completa */
    cursor: pointer;
    
}

/* --- CONTENEDOR DE TEXTO --- */
.emex-hero-content {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 30; /* Por encima de todo */
    pointer-events: none; /* FANTASMA: El ratón lo atraviesa para tocar los coches */
    
    display: flex;
    flex-direction: column;
    align-items: center;
    
    /* POSICIÓN ESCRITORIO: Subido para no tapar coches */
    justify-content: flex-end; 
    margin-top: -80px; 
}

/* Título */
.emex-hero-title {
    font-size: 4rem;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    letter-spacing: 5px;
    text-align: center;
    margin: 0;
    text-shadow: 0 10px 30px rgba(0,0,0,0.8);
    
    /* Animación de entrada */
    opacity: 0;
    animation: emexSimpleFade 1.5s ease-out forwards 0.5s;
}

/* Subtítulo */
.emex-hero-subtitle {
    color: var(--emex-punch-red);
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 15px;
    text-align: center;
    
    /* Animación de entrada */
    opacity: 0;
    animation: emexSimpleFade 1.5s ease-out forwards 1s;
}

/* Animación de aparición suave */
@keyframes emexSimpleFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- INDICADOR DE SCROLL (FLECHA) --- */
.emex-scroll-indicator {
    position: absolute;
    bottom: 30px; 
    left: 0; 
    width: 100%;
    
    display: flex; 
    flex-direction: column; 
    align-items: center;
    
    color: rgba(255,255,255,0.7);
    z-index: 30;
    pointer-events: none;
    
    animation: emexBounce 2s infinite;
}

.emex-scroll-indicator span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.emex-arrow-down {
    width: 20px; 
    height: 20px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(45deg);
}

/* Animación de rebote */
@keyframes emexBounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-10px);}
    60% {transform: translateY(-5px);}
}

/* --- MEDIA QUERY: MÓVIL (AJUSTES CRÍTICOS) --- */
@media (max-width: 768px) {
    .emex-garage-hero {
        /* SOLUCIÓN FRANJAS NEGRAS: Altura proporcional al ancho (60vw es aprox 16:9 + margen) */
        height: 60vw; 
        min-height: auto; 
        
        margin-top: -80px !important; /* Ajuste específico para header móvil */
    }

    .emex-garage-bg, 
    .emex-garage-light {
        /* En móvil forzamos cover sobre la caja proporcional */
        background-size: cover; 
        background-position: center center;
    }

    .emex-hero-content {
        /* POSICIÓN MÓVIL: Texto bajado debajo del header */
        justify-content: flex-start;
        padding-bottom: 0;
        padding-top: 225px; 
    }

    .emex-hero-title { 
        font-size: 1.5rem; 
        letter-spacing: 1px; 
        line-height: 1.1;
    }
    
    .emex-hero-subtitle { 
        font-size: 0.75rem; 
        margin-top: 5px; 
    }
    
    /* Ocultamos la flecha en móvil para limpiar la vista */
    .emex-scroll-indicator { 
        display: none; 
    }
}
/* === SOLUCIÓN DESBORDAMIENTO Y MÁRGENES (Global Fixes) === */

/* 1. Evitar scroll horizontal por el buscador */
body {
    overflow-x: hidden; /* Seguridad extra */
}

.emex-input {
    /* El input no puede ser más ancho que su padre */
    max-width: 100%; 
    box-sizing: border-box; /* Vital para que el padding no sume al ancho */
}

/* Contenedor del Catálogo y Contenido General */
.emex-public-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    
    /* ESTO ES LO QUE FALTABA: Padding en escritorio también */
    padding: 0 40px !important; 
    
    box-sizing: border-box;
    width: 100%;
}

/* 2. Márgenes en Móvil para las tarjetas */
@media (max-width: 768px) {
    .emex-public-wrapper {
        /* Padding lateral generoso en móvil */
        padding: 20px 20px !important; 
        width: 100%;
        box-sizing: border-box;
    }
    
    .emex-grid {
        /* Asegurar que el grid respete el padding del padre */
        width: 100%;
        margin: 0;
        gap: 20px; /* Espacio entre tarjetas verticales */
    }
    
    .emex-card {
        /* Asegurar que la tarjeta no se salga */
        width: 100%;
        box-sizing: border-box;
    }
}

/* === LOGIN MODERNO EMEX === */
.emex-login-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh; /* Ocupa casi toda la pantalla */
    padding: 20px;
    background-color: var(--emex-seashell);
    overflow: hidden;
}

/* Tarjeta de Login */
.emex-login-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(76, 6, 14, 0.15); /* Sombra Night Bordeaux suave */
    width: 100%;
    max-width: 400px;
    z-index: 10;
    position: relative;
    border: 1px solid rgba(0,0,0,0.02);
}

.emex-login-header {
    text-align: center;
    margin-bottom: 30px;
}

.emex-login-logo {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: cover;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.emex-login-header h3 {
    color: var(--emex-night-bordeaux);
    margin: 0;
    font-size: 1.5rem;
}
.emex-login-header p {
    color: var(--emex-gray-olive);
    font-size: 0.9rem;
    margin: 5px 0 0 0;
}

/* Estilos de los inputs de WP */
#emex-login-form p { margin-bottom: 20px; }
#emex-login-form label { 
    display: block; 
    font-weight: 600; 
    margin-bottom: 8px; 
    color: var(--emex-coffee-beam); 
    font-size: 0.9rem;
}

#emex-login-form input[type="text"], 
#emex-login-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    box-sizing: border-box; /* Importante */
}

#emex-login-form input[type="text"]:focus, 
#emex-login-form input[type="password"]:focus {
    border-color: var(--emex-night-bordeaux);
    outline: none;
}

#emex-login-form input[type="submit"] {
    background-color: var(--emex-punch-red);
    color: white;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    margin-top: 10px;
}

#emex-login-form input[type="submit"]:hover {
    background-color: #d61c32;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(238, 33, 57, 0.3);
}

.emex-login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
}
.emex-login-footer a { color: var(--emex-gray-olive); text-decoration: none; }
.emex-login-footer a:hover { text-decoration: underline; 
}

/* === PANEL DE ADMINISTRACIÓN (APP) === */

.emex-admin-layout {
    background-color: #f5f5f7; /* Gris muy suave tipo Apple/SaaS */
    min-height: 100vh;
}

/* Header Admin */
.emex-admin-header {
    background-color: var(--emex-night-bordeaux);
    color: white;
    padding: 0 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.emex-admin-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo Admin */
.emex-admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.emex-admin-logo-sq {
    width: 36px; height: 36px;
    background: var(--emex-punch-red);
    color: white;
    font-weight: bold;
    display: flex; align-items: center; justify-Content: center;
    border-radius: 8px;
}
.emex-admin-title {
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 1.1rem;
}

/* Navegación */
.emex-admin-nav {
    display: flex;
    gap: 5px;
    background: rgba(255,255,255,0.1);
    padding: 5px;
    border-radius: 8px;
}

.emex-admin-link {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.emex-admin-link:hover { color: white; }
.emex-admin-link.active {
    background-color: white;
    color: var(--emex-night-bordeaux);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Acciones Usuario */
.emex-admin-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.emex-user-badge {
    font-size: 0.85rem;
    opacity: 0.8;
}
.emex-btn-logout {
    color: #ffcccc;
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 4px;
}
.emex-btn-logout:hover {
    background: rgba(255,0,0,0.2);
    border-color: #ffcccc;
}

.emex-admin-hamburger { display: none; background:none; border:none; color:white; font-size:1.5rem; }

/* Contenido Principal */
.emex-admin-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.emex-stat-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 150px;
    box-shadow: var(--emex-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Responsive Admin */
@media (max-width: 768px) {
    .emex-admin-nav, .emex-admin-actions { display: none; }
    .emex-admin-hamburger { display: block; }
    
    .emex-admin-mobile-menu {
        background: var(--emex-coffee-beam);
        padding: 20px;
        position: absolute;
        top: 70px; left: 0; width: 100%;
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }
    .emex-mobile-link {
        display: block;
        width: 100%;
        text-align: left;
        background: none;
        border: none;
        color: white;
        padding: 15px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        font-size: 1rem;
    }
    .emex-mobile-link.active { color: var(--emex-punch-red); font-weight: bold; }
    .emex-mobile-link.logout { color: #ff9999; }
}
/* === TARJETAS INTERACTIVAS (SLIDER REPARADO) === */

.emex-card-media-wrapper {
    position: relative;
    height: 240px; /* Altura fija para la zona de fotos */
    background-color: #f0f0f0;
    overflow: hidden;
}

/* El Slider Nativo */
.emex-card-slider {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto; /* Permite scroll horizontal */
    scroll-snap-type: x mandatory; /* Magia: Obliga a parar en cada foto */
    scroll-behavior: smooth;
    touch-action: pan-x pan-y;
    
    /* Ocultar barra de scroll pero mantener funcionalidad */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE */
}
.emex-card-slider::-webkit-scrollbar { 
    display: none; /* Chrome/Safari */
}

/* --- CORRECCIÓN CRÍTICA: APLICAR A IMAGEN Y A ITEM DE VIDEO --- */
.emex-slider-img,
.emex-slider-item {
    flex: 0 0 100%; /* OBLIGATORIO: No encoger, base 100% */
    width: 100%;
    min-width: 100%; /* Seguridad extra */
    height: 100%;
    object-fit: cover;
    scroll-snap-align: center;
    position: relative;
    touch-action: pan-x pan-y;
}

/* === REPRODUCTOR DE VIDEO PERSONALIZADO (Youtube Style) === */

.emex-custom-player {
    position: relative;
    width: 100%;
    height: 100%;
    background: black;
    overflow: hidden;
}

/* Placeholder (Miniatura antes de reproducir) */
.emex-video-placeholder {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}

.emex-video-overlay,
.emex-play-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center; /* Sintaxis corregida */
    backdrop-filter: blur(2px);
    transition: background-color 0.3s;
}

/* Capa transparente para detectar clics (Pause/Play) */
.emex-player-click-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: calc(100% - 10px);
    z-index: 10;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Icono Play */
.emex-play-icon {
    font-size: 2rem;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    width: 60px; height: 60px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    padding-left: 5px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

/* Hover en desktop para el play */
@media (min-width: 769px) {
    .emex-video-placeholder:hover .emex-play-icon,
    .emex-player-click-layer:hover .emex-play-icon {
        transform: scale(1.1);
        background: rgba(238, 33, 57, 0.8);
        border-color: transparent;
    }
}

/* Contenedor de controles (Barra inferior) */
.emex-player-controls {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    height: 10px;
    z-index: 20;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    display: flex; align-items: flex-end;
}

/* Barra de Progreso Roja */
.emex-video-seeker {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.3);
    outline: none;
    transition: height 0.2s;
    cursor: pointer;
    background-image: linear-gradient(var(--emex-punch-red), var(--emex-punch-red));
    background-repeat: no-repeat;
}

.emex-video-seeker::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 0; width: 0;
    background: var(--emex-punch-red);
    border-radius: 50%;
    transition: all 0.2s;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Interacción Barra */
.emex-player-controls:hover .emex-video-seeker,
.emex-video-seeker:active {
    height: 5px;
}
.emex-player-controls:hover .emex-video-seeker::-webkit-slider-thumb,
.emex-video-seeker:active::-webkit-slider-thumb {
    width: 12px; height: 12px; background: white;
}
.emex-video-seeker::-moz-range-thumb {
    width: 0; height: 0; border: none; transition: all 0.2s;
}
.emex-player-controls:hover .emex-video-seeker::-moz-range-thumb,
.emex-video-seeker:active::-moz-range-thumb {
    width: 12px; height: 12px; background: white; border-radius: 50%;
}

/* Iframe pointer events fix */
.video-slide iframe, #yt-player iframe {
    pointer-events: none;
}


/* === ESTILOS DE LA TARJETA (BODY) === */
.emex-card-body {
    padding: 20px;
}
.emex-card-body h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--emex-coffee-beam);
}
.emex-card-specs {
    display: flex; gap: 10px;
    font-size: 0.85rem; color: #616161;
    margin-bottom: 10px;
}
.emex-card-desc {
    font-size: 0.9rem; color: #444;
    line-height: 1.4;
    margin-bottom: 15px;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* Estándar */
    -webkit-box-orient: vertical;
}
.emex-card-actions {
    display: flex; gap: 10px;
}
.emex-btn-icon {
    background: #25D366; color: white;
    width: 42px; height: 42px;
    border-radius: 8px;
    display: flex; align-items: center; 
    justify-content: center; /* Corregido */
    text-decoration: none;
    font-size: 1.2rem;
}

/* === NAVEGACIÓN DE TARJETAS (FLECHAS Y PUNTOS) === */
.emex-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none; border-radius: 50%;
    color: var(--emex-night-bordeaux);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    opacity: 0; 
}
.emex-arrow-prev { left: 10px; padding-right: 3px; }
.emex-arrow-next { right: 10px; padding-left: 3px; }

/* Mostrar flechas solo al hacer HOVER en la tarjeta (Solo Desktop) */
.emex-card-media-wrapper:hover .emex-slider-arrow {
    opacity: 1;
}
.emex-slider-arrow:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

/* Puntos de Paginación (Dots) */
.emex-slider-dots {
    position: absolute;
    bottom: 15px;
    left: 0; width: 100%;
    display: flex; justify-content: center; gap: 6px;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.3s;
}

.emex-dot {
    width: 6px; height: 6px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.emex-dot.active {
    background-color: white;
    transform: scale(1.3);
    opacity: 1;
}

/* --- AJUSTES MÓVIL --- */
@media (max-width: 768px) {
    .emex-slider-arrow { display: none !important; }
    .emex-slider-dots { bottom: 10px; }
}
/* === REPRODUCTOR DE VIDEO PERSONALIZADO === */

.emex-custom-player {
    position: relative;
    width: 100%;
    height: 100%;
    background: black;
    overflow: hidden;
}

/* Capa transparente para detectar clics (Pause/Play) */
.emex-player-click-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: calc(100% - 10px); /* Deja espacio abajo para la barra */
    z-index: 10;
    cursor: pointer;
    display: flex; align-items: center; justify-Content: center;
}

/* Icono Play gigante al pausar */
.emex-play-overlay {
    background: rgba(0,0,0,0.4);
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-Content: center;
    backdrop-filter: blur(2px);
}

/* Contenedor de controles (Barra inferior) */
.emex-player-controls {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    height: 10px; /* Zona táctil inferior */
    z-index: 20;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    display: flex; align-items: flex-end;
}

/* EL INPUT RANGE MÁGICO (Barra de Progreso) */
.emex-video-seeker {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px; /* Altura normal (discreta) */
    background: rgba(255,255,255,0.3); /* Fondo grisaceo */
    outline: none;
    transition: height 0.2s;
    cursor: pointer;
    
    /* Truco para la parte roja (progreso) */
    background-image: linear-gradient(var(--emex-punch-red), var(--emex-punch-red));
    background-repeat: no-repeat;
    /* background-size se controla via JS (progress%) */
}

/* Thumb (La bolita) - Webkit (Chrome/Safari/Móviles) */
.emex-video-seeker::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 0; width: 0; /* Invisible por defecto */
    background: var(--emex-punch-red);
    border-radius: 50%;
    transition: all 0.2s;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* INTERACCIÓN: Cuando pasas el ratón o tocas la barra */
.emex-player-controls:hover .emex-video-seeker,
.emex-video-seeker:active {
    height: 5px; /* Se hace más alta */
}

.emex-player-controls:hover .emex-video-seeker::-webkit-slider-thumb,
.emex-video-seeker:active::-webkit-slider-thumb {
    width: 12px; height: 12px; /* Aparece la bolita */
    background: white; /* Bolita blanca (como YouTube) */
}

/* Firefox Thumb */
.emex-video-seeker::-moz-range-thumb {
    width: 0; height: 0; border: none;
    transition: all 0.2s;
}
.emex-player-controls:hover .emex-video-seeker::-moz-range-thumb,
.emex-video-seeker:active::-moz-range-thumb {
    width: 12px; height: 12px; background: white; border-radius: 50%;
}
/* === CORRECCIONES DE CAPAS E INTERACCIÓN === */

/* 1. Flechas y Puntos SIEMPRE encima del video */
.emex-slider-arrow,
.emex-slider-dots {
    z-index: 100 !important; /* Valor alto para asegurar que están sobre el player */
}

/* 2. Nuevo Indicador de "Tiene Video" (MOVIDO ABAJO A LA IZQUIERDA) */
.emex-has-video-icon {
    position: absolute;
    
    /* CAMBIO DE COORDENADAS */
    bottom: 15px; /* Misma altura que los puntos (dots) */
    left: 15px;   /* Esquina izquierda */
    top: auto;    /* Anulamos top por si acaso */
    right: auto;  /* Anulamos right por si acaso */

    width: 28px;
    height: 28px;
    background-color: rgba(238, 33, 57, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 50;
    pointer-events: none;
    font-size: 0.8rem;
    
    /* Animación sutil de pulso para llamar la atención suavemente */
    animation: emexPulseRed 3s infinite;
}

/* Icono de cámara de video simple usando CSS/Texto o SVG */
.emex-has-video-icon::before {
    content: "▶"; /* Triángulo simple */
    font-size: 10px;
    margin-left: 1px;
}

@keyframes emexPulseRed {
    0% { box-shadow: 0 0 0 0 rgba(238, 33, 57, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(238, 33, 57, 0); }
    100% { box-shadow: 0 0 0 0 rgba(238, 33, 57, 0); }
}


/* === PÁGINA DE DETALLE (LAYOUT 50/50) === */

.emex-single-wrapper {
    max-width: 1300px; /* Un poco más ancho para el split screen */
    margin: 0 auto;
    padding: 120px 40px 100px 40px;
    font-family: var(--emex-font-main);
}

/* Estructura Split */
.emex-split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 50% - 50% */
    gap: 60px;
}

/* Columna Galería */
.emex-main-viewer-desktop {
    position: relative;
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    cursor: zoom-in;
    background: #f5f5f5;
}

.emex-main-img-desktop {
    width: 100%; height: 100%; object-fit: cover;
}

/* Flechas Galería Principal */
.emex-gallery-arrow {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.8);
    border: none; border-radius: 50%;
    font-size: 1.5rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--emex-coffee-beam);
    transition: all 0.2s;
    opacity: 0; /* Ocultas hasta hover */
}
.emex-main-viewer-desktop:hover .emex-gallery-arrow { opacity: 1; }
.emex-gallery-arrow:hover { background: white; transform: translateY(-50%) scale(1.1); }
.emex-gallery-arrow.prev { left: 15px; }
.emex-gallery-arrow.next { right: 15px; }

/* Columna Info */
.emex-col-info {
    padding-top: 10px;
}
.emex-info-header h1 {
    font-size: 2.5rem; margin: 0 0 10px 0; line-height: 1.1; color: var(--emex-night-bordeaux);
}
.emex-price-display {
    font-size: 2.2rem; font-weight: 800; color: var(--emex-punch-red); margin-bottom: 30px;
}

/* Grid Specs Simple */
.emex-specs-simple-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}
.emex-spec-simple {
    display: flex; gap: 12px; align-items: center;
}
.emex-spec-simple .icon { font-size: 1.5rem; }
.emex-spec-simple .label { display: block; font-size: 0.8rem; color: #888; text-transform: uppercase; }
.emex-spec-simple .val { font-weight: 600; font-size: 1.1rem; }

/* Descripción */
.emex-description-text {
    margin-top: 40px; border-top: 1px solid #eee; padding-top: 20px;
}
.emex-description-text h3 { color: var(--emex-night-bordeaux); margin-bottom: 15px; }
.emex-description-text div { line-height: 1.7; color: #444; }


/* === MODAL DE ZOOM (ESCRITORIO & MÓVIL) === */
.emex-zoom-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 3000;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.3s;
}

/* Áreas de navegación laterales (5% cada una) */
.emex-zoom-nav {
    position: absolute; top: 0; height: 100%; width: 10%; /* Un poco más ancho para facilitar el clic */
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 3rem; cursor: pointer;
    user-select: none;
    z-index: 3002;
}
.emex-zoom-nav.left { left: 0; }
.emex-zoom-nav.right { right: 0; }
.emex-zoom-nav:hover { background: rgba(255,255,255,0.05); }

.emex-zoom-content {
    width: 80%; height: 90%;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    overflow: hidden; /* Importante para el efecto lupa */
}

.emex-zoom-img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease; /* Suave para el zoom móvil */
}

/* Efecto Zoom Móvil */
.emex-zoom-img.mobile-zoomed {
    transform: scale(2.5);
    cursor: grab;
}

.emex-zoom-close {
    position: absolute; top: 20px; right: 20px;
    background: none; border: none; color: white; font-size: 2.5rem;
    cursor: pointer; z-index: 3005;
}
.emex-zoom-counter {
    position: absolute; bottom: 20px; color: white; font-size: 1rem;
    background: rgba(0,0,0,0.5); padding: 5px 15px; border-radius: 20px;
}

/* === RESPONSIVE (MÓVIL) === */
@media (max-width: 900px) {
    .emex-split-layout { display: block; }
    .emex-single-wrapper { padding: 90px 0 100px 0; }
    .emex-col-gallery { margin-bottom: 20px; }
    
    .emex-main-viewer-desktop { height: 300px; border-radius: 0; }
    .emex-col-info { padding: 0 20px; }
    
    .emex-thumbnails-strip { display: none; } /* Ocultar miniaturas en móvil */
    .emex-gallery-arrow { display: none; } /* Ocultar flechas galería normal (usar swipe) */
    
    /* En móvil usamos scroll snap en la galería principal */
    .emex-main-viewer-desktop {
        display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    }
    .emex-main-img-desktop {
        flex: 0 0 100%; scroll-snap-align: center;
    }
}

/* === PÁGINA DE DETALLE (CORRECCIONES FINALES) === */

/* 1. CONTENEDOR PRINCIPAL CON DEGRADADO PARA EL HEADER */
.emex-single-hero-bg {
    /* Degradado Branding: Rojo Oscuro -> Gris Negro */
    background: linear-gradient(135deg, var(--emex-night-bordeaux) 0%, #1a1a1a 100%);
    
    /* Dimensiones para cubrir header y título */
    width: 100vw;
    margin-left: calc(50% - 50vw); /* Full width breakout */
    margin-right: calc(50% - 50vw);
    margin-top: -120px !important; /* Subimos para tapar el hueco del header */
    padding-top: 140px; /* Compensamos el contenido */
    padding-bottom: 60px;
    margin-bottom: 40px;
    
    color: white; /* Texto blanco sobre el fondo oscuro */
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.emex-single-hero-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px; /* Alineado con el resto */
}

.emex-single-header h1 {
    color: white !important; /* Forzamos blanco en el título */
    font-size: 2.8rem;
    margin-bottom: 10px;
}

.emex-single-meta {
    color: rgba(255,255,255,0.7) !important; /* Meta info en gris claro */
}
/* 3. SIDEBAR STICKY (Acompañante) */
.emex-col-info {
    position: sticky;
    top: 100px; /* Se queda a 100px del techo al bajar */
    height: fit-content; /* Importante */
}

/* Separación de Botones */
.emex-action-box {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Espacio vertical elegante entre botones */
    margin-top: 25px;
}

/* 4. CORRECCIONES MÓVIL */
@media (max-width: 900px) {
    .emex-split-layout { 
        display: block; /* Una columna */
        padding: 0 20px 100px 20px;
    }
    
    .emex-single-hero-bg {
        padding-top: 120px;
        margin-bottom: 20px;
    }
    
    .emex-single-hero-content { padding: 0 20px; }
    .emex-single-header h1 { font-size: 1.8rem; }
    
    /* En móvil, la info (precio y botones) va normal, no sticky sidebar */
    .emex-col-info { position: static; }
}

/* 5. ELIMINAR DUPLICADOS Y LIMPIEZA */

/* Ocultar la barra flotante móvil en escritorio SIEMPRE */
@media (min-width: 901px) {
    .emex-mobile-cta-bar { display: none !important; }
}

/* Ocultar elementos sobrantes que dijiste */
.emex-price-display {
    font-size: 2.2rem; font-weight: 800; color: var(--emex-punch-red); 
    margin-bottom: 20px;
}

/* === ZOOM MÓVIL (PAN & SCROLL) === */
.emex-mobile-zoom-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 5000;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}

.emex-mobile-pan-container {
    width: 100%; height: 100%;
    overflow: auto; /* ESTO PERMITE ARRASTRAR (PAN) */
    display: flex; 
    align-items: center; 
    justify-content: center; /* Centrado inicial */
    -webkit-overflow-scrolling: touch;
}

.emex-mobile-zoomed-img {
    /* La imagen es más grande que la pantalla para poder arrastrarla */
    min-width: 150vw; 
    max-width: none;
    height: auto;
    object-fit: contain;
    transition: width 0.3s;
}

.emex-close-btn-fixed {
    position: absolute; top: 20px; right: 20px;
    color: white; background: rgba(0,0,0,0.5); border: none;
    width: 40px; height: 40px; border-radius: 50%;
    font-size: 1.5rem; z-index: 5001;
}

.emex-zoom-hint {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    color: white; font-size: 0.8rem; opacity: 0.7; pointer-events: none;
}