@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* Variables de colores */
:root {
    --color-crema: #F5F5DC;
    --color-crema-claro: #FFFEF7;
    --color-azul-celeste: #5B9BD5;
    --color-azul-oscuro: #4A90A4;
    --color-texto-oscuro: #2C3E50;
    --color-texto-medio: #5A6C7D;
    --sombra-suave: 0 4px 20px rgba(0, 0, 0, 0.08);
    --sombra-media: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Escala global al 80% - Ajuste de font-size base */
html {
    font-size: 80%; /* Reduce el tamaño base de 16px a 12.8px (80% de 16px) */
}

/* --- Estilos Generales --- */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

/* --- Barra de Navegación Principal --- */
.barra-navegacion {
    background-color: var(--color-crema-claro);
    box-shadow: var(--sombra-suave);
    position: sticky;
    top: 0;
    z-index: 50;
}

.contenedor-nav {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.contenido-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 6rem;
}

/* --- Logo --- */
.nav-logo img {
    height: 65px;
    width: auto;
    transition: transform 0.3s ease;
}

.nav-logo img:hover {
    transform: scale(1.05);
}

/* --- Menú Principal (Escritorio) --- */
.menu-principal {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.enlace-menu, .boton-desplegable {
    color: var(--color-texto-oscuro);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

.enlace-menu:hover, .boton-desplegable:hover {
    color: var(--color-azul-celeste);
}

/* Contenedor para el botón desplegable */
.menu-desplegable-contenedor {
    position: relative;
}

.menu-desplegable-contenedor:hover .mega-menu,
.menu-desplegable-contenedor .mega-menu.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    opacity: 1;
    transform: translateY(0);
}

.boton-desplegable {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-family: 'Inter', sans-serif;
    padding: 0.5rem 0;
}

.icono-flecha {
    width: 1rem;
    height: 1rem;
    margin-left: 0.25rem;
    transition: transform 0.3s ease;
}

.boton-desplegable:hover .icono-flecha {
    transform: translateY(2px);
}

/* --- Opciones Desplegables --- */
.opciones-desplegables {
    position: absolute;
    margin-top: 0.5rem;
    width: 12rem;
    background-color: var(--color-crema-claro);
    border-radius: 15px;
    box-shadow: var(--sombra-media);
    z-index: 20;
    display: none;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(91, 155, 213, 0.1);
    overflow: hidden;
}

/* Mega Menú de Categorías */
.mega-menu {
    position: absolute;
    margin-top: 0.5rem;
    left: 0;
    width: min(600px, 95vw);
    background-color: var(--color-crema-claro);
    border-radius: 20px;
    box-shadow: var(--sombra-media);
    z-index: 20;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(91, 155, 213, 0.1);
    overflow: hidden;
    padding: 2rem;
}

.mega-menu-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mega-menu-column:first-child {
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    padding-right: 2rem;
    margin-right: 2rem;
}

.mega-menu-title-link {
    text-decoration: none;
    display: block;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.mega-menu-title-link:hover {
    transform: translateX(5px);
}

.mega-menu-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-azul-celeste);
    margin: 0;
    transition: color 0.3s ease;
}

.mega-menu-title-link:hover .mega-menu-title {
    color: var(--color-azul-oscuro);
}

.mega-menu-link {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    color: var(--color-texto-oscuro);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mega-menu-link:hover {
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.1) 0%, rgba(74, 144, 164, 0.1) 100%);
    color: var(--color-azul-celeste);
    padding-left: 1rem;
}

.opcion-desplegable {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--color-texto-oscuro);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.opcion-desplegable:last-child {
    border-bottom: none;
}

.opcion-desplegable:hover {
    background: linear-gradient(135deg, var(--color-azul-celeste) 0%, var(--color-azul-oscuro) 100%);
    color: white;
    padding-left: 1.25rem;
}

/* --- Barra de Búsqueda --- */
.contenedor-busqueda {
    position: relative;
}

.campo-busqueda {
    border: 2px solid #E0E0E0;
    border-radius: 15px;
    transition: all 0.3s ease;
    color: var(--color-texto-oscuro);
    width: 10rem;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    background: white;
}

.campo-busqueda:focus {
    outline: none;
    border-color: var(--color-azul-celeste);
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
    width: 12rem;
}

.campo-busqueda::placeholder {
    color: #B0B0B0;
}

/* --- Acciones de Usuario (Derecha) --- */
.nav-acciones {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.usuario-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.boton-logout {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.boton-sesion {
    background: linear-gradient(135deg, var(--color-azul-celeste) 0%, var(--color-azul-oscuro) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 15px rgba(91, 155, 213, 0.3);
    display: inline-block;
}

.boton-sesion:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 155, 213, 0.4);
}

.boton-usuario-logueado {
    display: flex;
    color: var(--color-texto-oscuro);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 15px;
    text-decoration: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-direction: row;
}

.boton-usuario-logueado:hover {
    color: var(--color-azul-celeste);
    background-color: rgba(91, 155, 213, 0.1);
}

.nombre-usuario {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-texto-oscuro);
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.boton-usuario-logueado:hover .nombre-usuario {
    color: var(--color-azul-celeste);
}

.icono-usuario {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

.boton-usuario-logueado-movil {
    display: none;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--color-azul-celeste) 0%, var(--color-azul-oscuro) 100%);
    color: white;
    border-radius: 15px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(91, 155, 213, 0.3);
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 0.5rem;
}

.nombre-usuario-movil {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.boton-usuario-logueado-movil:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 155, 213, 0.4);
}

/* Botón Cerrar Sesión - Desktop */
.boton-cerrar-sesion {
    display: flex;
    color: var(--color-texto-medio);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 15px;
    text-decoration: none;
    align-items: center;
    justify-content: center;
}

.boton-cerrar-sesion:hover {
    color: var(--color-texto-oscuro);
    background-color: rgba(0, 0, 0, 0.05);
}

.icono-cerrar-sesion {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

/* Botón Cerrar Sesión - Móvil */
.boton-cerrar-sesion-movil {
    display: flex;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    color: var(--color-texto-medio);
    border: 2px solid #E0E0E0;
    border-radius: 15px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 0.5rem;
    width: 100%;
    cursor: pointer;
}

.boton-cerrar-sesion-movil:hover {
    background: var(--color-crema-claro);
    border-color: var(--color-texto-medio);
    color: var(--color-texto-oscuro);
}

.boton-carrito {
    position: relative;
    color: var(--color-texto-oscuro);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 15px;
}

.boton-carrito:hover {
    color: var(--color-azul-celeste);
    background-color: rgba(91, 155, 213, 0.1);
}

.icono-carrito {
    width: 2rem;
    height: 2rem;
}

.notificacion-carrito {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    height: 1.25rem;
    min-width: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* --- Menú Móvil --- */
.contenedor-menu-movil {
    display: flex;
    align-items: center;
}

.boton-menu-movil {
    color: var(--color-texto-oscuro);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 15px;
    transition: all 0.3s ease;
}

.boton-menu-movil:hover {
    background-color: rgba(91, 155, 213, 0.1);
    color: var(--color-azul-celeste);
}

.icono-hamburguesa {
    width: 1.5rem;
    height: 1.5rem;
}

    .menu-movil {
        display: block;
        background-color: var(--color-crema-claro);
        border-top: 2px solid rgba(91, 155, 213, 0.1);
        padding: 1rem 0.5rem;
        box-shadow: var(--sombra-suave);
    }

.enlace-menu-movil {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--color-texto-oscuro);
    text-decoration: none;
    border-radius: 15px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.enlace-menu-movil:hover {
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.1) 0%, rgba(74, 144, 164, 0.1) 100%);
    color: var(--color-azul-celeste);
    padding-left: 1.25rem;
}

.contenedor-busqueda-movil {
    padding: 0.5rem 0.75rem;
}

.contenedor-busqueda-movil .campo-busqueda {
    width: 100%;
}

.boton-sesion-movil {
    display: none;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--color-azul-celeste) 0%, var(--color-azul-oscuro) 100%);
    color: white;
    border-radius: 15px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(91, 155, 213, 0.3);
}

.boton-sesion-movil:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 155, 213, 0.4);
}

/* --- Media Queries para Diseño Adaptable (Responsive) --- */

/* Pantallas pequeñas (sm) - 640px en adelante */
@media (min-width: 640px) {
    .contenedor-nav {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .boton-sesion {
        display: block;
    }
    
    .campo-busqueda {
        width: 12rem;
    }
}

/* Pantallas medianas (md) - 768px en adelante */
@media (min-width: 768px) {
    .menu-principal {
        display: flex;
        align-items: center;
    }
    
    .contenedor-menu-movil {
        display: none;
    }
    
    .menu-movil {
        display: none !important;
    }
}

/* Móviles - Mejoras del menú hamburguesa */
@media (max-width: 767px) {
    .menu-principal {
        display: none;
    }
    
    .contenedor-menu-movil {
        display: flex;
    }
    
    .menu-movil {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 320px;
        height: 100vh;
        background: var(--color-crema-claro);
        z-index: 100;
        padding: 2rem 1.5rem;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        display: block;
    }
    
    .menu-movil.activo {
        transform: translateX(0);
    }
    
    .enlace-menu-movil {
        padding: 1rem 1.25rem;
        font-size: 1.1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        margin-bottom: 0;
    }
    
    .contenedor-busqueda-movil {
        padding: 1rem 1.25rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .boton-sesion-movil,
    .boton-usuario-logueado-movil {
        margin-top: 1rem;
        padding: 1rem;
        font-size: 1rem;
    }
    
    .nombre-usuario {
        max-width: 120px;
        font-size: 0.85rem;
    }
    
    .icono-usuario {
        width: 1.75rem;
        height: 1.75rem;
    }
    
    .boton-usuario-logueado {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    .boton-cerrar-sesion {
        padding: 0.4rem;
    }
    
    .icono-cerrar-sesion {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .boton-cerrar-sesion-movil {
        margin-top: 0.75rem;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    /* Overlay oscuro cuando el menú está abierto */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .menu-overlay.activo {
        opacity: 1;
        visibility: visible;
    }
}

/* Pantallas grandes (lg) - 1024px en adelante */
@media (min-width: 1024px) {
    .contenedor-nav {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .menu-principal {
        gap: 3.5rem;
    }
}

/* Pantallas muy pequeñas (menos de 640px) */
@media (max-width: 639px) {
    .contenido-nav {
        height: 5rem;
    }
    
    .nav-logo img {
        height: 50px;
    }
    
    .campo-busqueda {
        width: 8rem;
        font-size: 0.9rem;
        padding: 0.4rem 0.75rem;
    }
}

/* --- Dropdown Admin en header --- */
.boton-admin-menu {
    background: linear-gradient(135deg, rgba(91,155,213,0.15), rgba(74,144,164,0.15));
    color: var(--color-azul-oscuro) !important;
    border: 2px solid rgba(91,155,213,0.3);
    border-radius: 10px;
    padding: 0.4rem 0.85rem !important;
    font-weight: 600;
}
.boton-admin-menu:hover {
    background: linear-gradient(135deg, var(--color-azul-celeste), var(--color-azul-oscuro)) !important;
    color: white !important;
}

.admin-dropdown {
    width: 200px !important;
    padding: 1rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* ── Select global — identidad visual del mega-menú de Categorías ────────────
   REGLA ÚNICA en todo el sitio. header.css se carga en TODAS las páginas.
   Se usa la propiedad shorthand `background` (color + imagen + no-repeat +
   posición + tamaño en una sola declaración) para evitar que el navegador
   herede un background-repeat:repeat por defecto al mezclar sub-propiedades.
   ─────────────────────────────────────────────────────────────────────────── */
select {
    /* Eliminar COMPLETAMENTE la apariencia nativa del navegador */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* Background en shorthand: color imagen repeat posición / tamaño
       Esto garantiza que no-repeat aplique sobre el mismo fondo crema */
    background: #FFFEF7
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%235A6C7D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        no-repeat
        right 0.85rem center / 12px 8px;

    /* Borde — igual que .mega-menu */
    border: 1px solid rgba(91, 155, 213, 0.15);
    border-radius: 15px;

    /* Sombra — igual que .mega-menu */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10);

    /* Tipografía */
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #2C3E50;

    /* Espaciado */
    padding: 0.72rem 2.5rem 0.72rem 1rem;
    width: 100%;
    box-sizing: border-box;

    /* Interacción */
    outline: none;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

select:hover {
    border-color: rgba(91, 155, 213, 0.45);
    background-color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

select:focus {
    border-color: #5B9BD5;
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.18), 0 8px 30px rgba(0, 0, 0, 0.10);
    background-color: #fff;
    outline: none;
}

/* Asegurarse de que select:hover y select:focus no re-introduzcan la flecha */
select:hover,
select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%235B9BD5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 12px 8px;
}
