/* Header mejorado */
header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    color: var(--dark-color);
    box-shadow: var(--shadow-lg);
    position: fixed;
    width: 100%;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    min-height: 80px;
    top: 0;
}

header.scrolled {
    background: rgba(174, 223, 247, 0.95);
    backdrop-filter: blur(20px);
}

/* Navegación principal */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

/* Animaciones para la expansión de user-info */
@keyframes expandIn {
    from { opacity: 0; transform: translateX(20px) scale(0.9); max-width: 0; }
    to { opacity: 1; transform: translateX(0) scale(1); max-width: 400px; }
}

@keyframes contractOut {
    from { opacity: 1; transform: translateX(0) scale(1); max-width: 400px; }
    to { opacity: 0; transform: translateX(20px) scale(0.9); max-width: 0; }
}

#user-info.show {
    animation: expandIn 0.3s ease-out forwards;
}

/* Responsive */
@media (max-width: 768px) {
    /* Ocultar elementos de escritorio en móvil */
    .main-nav { display: none; }
    .auth-section { display: none; }
    /* Mostrar botón de menú móvil */
    .mobile-menu-btn { display: block; }
    
    /* mobile menu should overlay content and be visible full-width */
    .mobile-menu {
        position: absolute; /* positioned relative to header */
        left: 0;
        right: 0;
        top: 100%;
        z-index: 1100; /* above header (1000) and most other content */
        border-bottom-left-radius: 16px;
        border-bottom-right-radius: 16px;
    }
    
    /* show/hide helpers */
    .mobile-menu.hidden { display: none !important; }
    .mobile-menu.show { display: block !important; }
}

/* Safe space for floating contact card (desktop only) */
:root { --contact-float-safe: 16px; }
@media (min-width: 1024px) {
    header { padding-bottom: var(--contact-float-safe); }
}

/* Print styles */
@media print {
    header,
    .mobile-menu {
        display: none;
    }
}

/* Focus styles para accesibilidad */
.nav-link:focus,
.mobile-nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
