/* =========================================
   1. VARIABLES Y RESET
   ========================================= */
:root {
    --primary-dark: #0b132b;
    --secondary-dark: #1c2541;
    --accent: #64ffda;
    --text-dark: #3a506b;
    --background: #f4f4f4;
    --white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(45deg, #667eea, #764ba2);
    --gradient-danger: linear-gradient(45deg, #ff6b6b, #ee5a24);
    --shadow-light: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-medium: 0 8px 25px rgba(0,0,0,0.15);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.2);
    --border-radius: 15px;
    --border-radius-sm: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    line-height: 1.6;
    touch-action: manipulation;
}

/* =========================================
   2. HEADER Y NAVEGACIÓN (Consolidado)
   ========================================= */
.main-header {
    background-color: var(--primary-dark);
    color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow-light);
    z-index: 1000;
    position: relative;
    transition: all 0.3s ease;
}

.logo-container { display: flex; align-items: center; }
.logo { width: 40px; margin-right: 0.8rem; }
.logo-link { text-decoration: none; display: flex; align-items: center; }
.logo-text { font-size: 1.5rem; color: white; margin: 0; font-weight: 700; }

.main-nav a.nav-link {
    margin: 0 1rem;
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    display: inline-block;
    position: relative;
    transition: all 0.3s ease;
}

.main-nav a.nav-link:hover {
    color: var(--accent);
    background: rgba(255,255,255,0.1);
}

.main-nav a.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.main-nav a.nav-link:hover::after { width: 80%; }

/* Dropdown Usuario */
.user-info { position: relative; }
.user-dropdown-trigger {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    font-weight: 600;
}

.user-dropdown-trigger::after {
    content: '';
    display: inline-block;
    width: 0.4em;
    height: 0.4em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.3s;
}

.user-dropdown-trigger.show::after { transform: rotate(-135deg); }

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-medium);
    z-index: 1000;
    min-width: 200px;
    overflow: hidden;
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--primary-dark);
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:hover { background: #f8f9fa; }

/* =========================================
   3. COMPONENTES (Cards, Buttons, etc.)
   ========================================= */
.product-card {
    transition: all 0.3s ease;
    border: none;
    box-shadow: var(--shadow-light);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: white;
}

.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

.product-image { height: 180px; object-fit: cover; width: 100%; }

.btn-modern {
    background: var(--gradient-accent);
    border: none;
    color: var(--white);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-modern:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4); }

/* =========================================
   4. PRODUCT DETAIL - ZOOM & MEDIA
   ========================================= */
.product-media {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.zoom-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; 
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
    cursor: crosshair !important; /* Forzamos el cursor aquí */
}

.product-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none; /* La imagen no debe recibir clics, solo el contenedor */
}

.product-main-video {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 8px;
    display: none;
    background: #000;
}

/* CARRUSEL MINIATURAS */
.product-thumbnails {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 15px 5px;
    margin-top: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

/* Ocultar scrollbar */
.product-thumbnails::-webkit-scrollbar { display: none; }

.product-thumb {
    flex: 0 0 80px; /* Tamaño fijo para que Chrome no las rompa */
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    scroll-snap-align: start;
    transition: all 0.2s;
}

.product-thumb.active {
    border-color: var(--accent);
    transform: scale(0.95);
}

/* LENTE Y ZOOM */
.magnifier-lens {
    position: absolute;
    width: 150px;
    height: 150px;
    background-color: rgba(91, 192, 190, 0.2);
    border: 1px solid var(--accent);
    pointer-events: none;
    display: none;
    z-index: 10;
}

.magnified-image {
    position: absolute;
    left: calc(100% + 20px);
    top: 0;
    width: 500px;
    height: 500px;
    background-color: white;
    border: 1px solid #eee;
    background-repeat: no-repeat;
    display: none;
    z-index: 1000;
    box-shadow: var(--shadow-medium);
    border-radius: 8px;
}

/* Contenedor para las flechas */
.thumbnails-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    overflow: visible; /* Cambiado de hidden a visible si fuera el caso */
}

/* Estilo de las flechas */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(11, 19, 43, 0.8);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; /* Ahora siempre es flex */
    align-items: center;
    justify-content: center;
    visibility: hidden; /* Pero invisible por defecto */
    opacity: 0;
    z-index: 20; /* Asegurar que estén sobre las imágenes */
    transition: opacity 0.3s ease, visibility 0.3s;
}

.carousel-arrow:hover {
    background: var(--accent);
}

.prev-arrow { left: 5px; /* Las metemos un poco para que no se corten */}
.next-arrow { right: 5px; }

/* Mostrar flechas solo en pantallas grandes y cuando haya hover */
@media (min-width: 1025px) {
    .thumbnails-wrapper:hover .carousel-arrow {
        opacity: 1;
        /* El JS controlará la visibility */
    }
}

/* Ajuste al carrusel para que no choque con las flechas en escritorio */
@media (min-width: 1025px) {
    .product-thumbnails {
        padding: 15px 20px;
    }
}

/* =========================================
   5. RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    .magnified-image, .magnifier-lens { display: none !important; }
    .zoom-container { cursor: default; }
}

@media (max-width: 768px) {
    .product-media { max-width: 100%; }
    .product-thumb { flex: 0 0 70px; height: 70px; }
}
/* Estilos adicionales para compartir */
.btn-native {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-native:hover {
    background: linear-gradient(135deg, #5568d3 0%, #63408a 100%);
}