/**
 * Header CSS - Synckpro
 * Estilos del navbar, logo, navegación, megamenu, user menu
 * Se carga en TODAS las páginas
 */

/* ==================== NAVBAR MODERNO CON GLASSMORPHISM ==================== */
.navbar {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: none;
    border-bottom: 1px solid rgba(1, 87, 254, 0.1);
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    padding: 0;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Navbar con scroll - más sólido */
.navbar.scrolled {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 
        0 8px 40px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    overflow: visible;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    position: relative;
}

/* ==================== LOGO MODERNO ==================== */
.logo-container {
    position: relative;
    z-index: 10;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-link:hover {
    transform: translateY(-2px);
}

.logo-image {
    height: 35px;
    width: auto;
}

.logo-dark {
    display: none;
}

.logo-light {
    display: block;
}

/* ==================== NAVEGACIÓN MODERNA ==================== */
.nav-menu {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
}

.nav-items {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid rgba(1, 87, 254, 0.12);
    border-radius: 50px;
    padding: 0.5rem;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: static;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    padding: 0.8rem 1.2rem;
    border-radius: 25px;
    position: relative;
    transition: background-color 0.1s ease, color 0.1s ease;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(1, 87, 254, 0.08);
}

.nav-link.active {
    background: rgba(1, 87, 254, 0.12);
    color: var(--primary);
}

.nav-indicator {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 2px;
    transition: width 0.15s ease;
}

.nav-link:hover .nav-indicator,
.nav-link.active .nav-indicator {
    width: 20px;
}

.nav-text {
    position: relative;
    z-index: 1;
}

/* ==================== BOTÓN CTA MODERNO ==================== */
.nav-cta {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    color: white !important;
    box-shadow: 0 8px 25px rgba(1, 87, 254, 0.3);
    border: none;
    margin-left: 0.5rem;
    position: relative;
    overflow: hidden;
}

.nav-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(1, 87, 254, 0.4);
}

.cta-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: var(--transition);
}

.nav-cta:hover .cta-glow {
    opacity: 1;
}

/* ==================== CONTROLES MODERNOS ==================== */
.nav-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(1, 87, 254, 0.12);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px rgba(1, 87, 254, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.toggle-ripple {
    display: none;
}

/* ==================== USER MENU ==================== */
.user-menu-container {
    position: relative;
}

.user-toggle {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(1, 87, 254, 0.12);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    height: 50px;
    padding: 0 1.25rem;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.user-toggle:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px rgba(1, 87, 254, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.user-toggle i {
    font-size: 1.1rem;
}

.user-toggle .user-arrow {
    font-size: 0.65rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 0.25rem;
}

.user-toggle.active .user-arrow {
    transform: rotate(180deg);
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ocultar nombre y flecha en móvil */
@media (max-width: 768px) {
    .user-toggle .user-name,
    .user-toggle .user-arrow {
        display: none;
    }
    
    /* Botones uniformes en móvil */
    .theme-toggle,
    .user-toggle,
    .menu-toggle {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 22px;
    }
    
    .nav-controls {
        gap: 0.4rem;
    }
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    min-width: 280px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(1, 87, 254, 0.15);
    border-radius: 16px;
    box-shadow: 
        0 10px 50px rgba(0, 0, 0, 0.15),
        0 4px 20px rgba(1, 87, 254, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 1000;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top right;
    transition: 
        opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        visibility 0.25s;
    pointer-events: none;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.user-dropdown-header {
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), #0066cc);
    color: white;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-display-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.85rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.user-dropdown-menu {
    padding: 0.5rem;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    font-family: inherit;
    position: relative;
}

.user-menu-item i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.user-menu-item > span:first-of-type {
    flex: 1;
}

.user-menu-item .badge {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
    position: initial;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.user-menu-item:hover {
    background: var(--hover-bg);
    color: var(--primary);
}

.user-menu-item:hover i {
    color: var(--primary);
}

.logout-item {
    color: #ef4444;
}

.logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.logout-item i {
    color: #ef4444;
}

/* ==================== HAMBURGER MODERNO ==================== */
.menu-toggle {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(1, 87, 254, 0.12);
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 25px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.hamburger-lines {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.line {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle:hover {
    background: var(--primary);
}

.menu-toggle:hover .line {
    background: #fff;
}

.menu-toggle.active .line1 {
    transform: rotate(
45deg) translate(3px, 2px);
}

.menu-toggle.active .line2 {
    opacity: 0;
}

.menu-toggle.active .line3 {
    transform: rotate(-45deg) translate(5px, -4px);
}

.nav-dropdown {
    position: static;
}

.dropdown-trigger {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    font-family: inherit;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 25px;
    position: relative;
}

.dropdown-trigger:hover {
    background: rgba(1, 87, 254, 0.08);
}

.dropdown-trigger.active {
    background: rgba(1, 87, 254, 0.12);
    color: var(--primary);
}

.dropdown-icon {
    font-size: 0.65rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-trigger:hover .dropdown-icon,
.dropdown-trigger.active .dropdown-icon {
    transform: rotate(180deg);
}

/* ==================== MEGAMENU CON GLASSMORPHISM ==================== */
.mega-menu {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    transform: translateY(-8px);
    transform-origin: top center;
    width: 100%;
    max-width: 100%;
    height: auto;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-bottom: 1px solid rgba(1, 87, 254, 0.12);
    border-radius: 0;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease-out, transform 0.15s ease-out, visibility 0.15s;
    z-index: 9999;
    padding: 2rem 0;
    margin: 0;
    box-sizing: border-box;
    pointer-events: none;
    overflow-x: hidden;
}

.mega-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.mega-menu-content {
    display: grid;
    grid-template-columns: 1fr 1fr 300px;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 3rem;
    width: auto;
    box-sizing: border-box;
}

.mega-menu .mega-category,
.mega-menu .mega-promo {
    opacity: 1;
    transform: none;
}

.mega-category h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mega-category ul {
    list-style: none;
}

.mega-category li {
    margin-bottom: 0.8rem;
}

.mega-category a {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.8rem;
    border-radius: 8px;
    transition: 
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mega-category a:hover {
    background: rgba(1, 87, 254, 0.1);
    color: var(--primary);
    transform: translateX(6px);
}

.mega-category a i {
    color: var(--primary);
    margin-bottom: 0.3rem;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mega-category a:hover i {
    transform: scale(1.15);
}

.mega-category .description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.mega-promo {
    background: linear-gradient(135deg, #e8f0fe 0%, #d3e3fd 50%, #e8f0fe 100%);
    color: var(--text-primary);
    padding: 1.5rem;
    padding-top: 2rem;
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 2px solid rgba(1, 87, 254, 0.3);
    box-shadow: 0 8px 32px rgba(1, 87, 254, 0.2);
    overflow: visible;
}

.mega-promo::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(1, 87, 254, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.mega-promo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, var(--primary) 50%, transparent 100%);
}

.promo-badge {
    position: absolute;
    top: -12px;
    right: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(1, 87, 254, 0.5);
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mega-promo h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.mega-promo p {
    font-size: 0.9rem;
    opacity: 1;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.promo-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    margin-top: 0.5rem;
    transition: var(--transition);
    display: inline-block;
    position: relative;
    z-index: 1;
}

.promo-link:hover {
    transform: translateX(5px);
    text-decoration: underline;
}

/* ==================== BOTTOM SHEET - Mobile User Menu ==================== */
/* El plugin bootstrap-sheet.css maneja los estilos base */
/* Aquí solo personalizaciones específicas para el menú de usuario */

/* Ocultar en desktop */
@media (min-width: 768px) {
    #userBottomSheet {
        display: none !important;
    }
}

/* Ocultar dropdown en móvil */
@media (max-width: 767px) {
    .user-menu-container .user-dropdown {
        display: none !important;
    }
    
    .user-toggle .user-name,
    .user-toggle .user-arrow {
        display: none;
    }
}

/* Personalización del header del sheet */
#userBottomSheet .sheet-header {
    border-bottom: none;
    padding-bottom: 0.5rem;
}

#userBottomSheet .sheet-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#userBottomSheet .sheet-avatar {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, rgba(1, 87, 254, 0.1), rgba(0, 212, 255, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

#userBottomSheet .sheet-user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#userBottomSheet .sheet-user-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#userBottomSheet .sheet-user-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Menu items */
#userBottomSheet .sheet-menu-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 0.5rem;
}

#userBottomSheet .sheet-menu-item:hover,
#userBottomSheet .sheet-menu-item:active {
    background: rgba(0, 0, 0, 0.04);
}

#userBottomSheet .sheet-menu-item svg {
    color: var(--primary);
    flex-shrink: 0;
}

#userBottomSheet .sheet-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

/* Dark Mode */
[data-theme="dark"] #userBottomSheet {
    --bs-sheet-bg: #1a1a2e;
    --bs-sheet-border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #userBottomSheet .sheet-avatar {
    background: linear-gradient(135deg, rgba(1, 87, 254, 0.2), rgba(0, 212, 255, 0.2));
}

[data-theme="dark"] #userBottomSheet .sheet-user-name {
    color: #fff;
}

[data-theme="dark"] #userBottomSheet .sheet-user-email {
    color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] #userBottomSheet .sheet-menu-item {
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] #userBottomSheet .sheet-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] #userBottomSheet .sheet-menu-item svg {
    color: var(--accent);
}

/* Footer y botón cerrar sesión */
#userBottomSheet .sheet-footer {
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#userBottomSheet .sheet-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #dc3545;
    background: transparent;
    border: 1.5px solid #dc3545;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#userBottomSheet .sheet-logout-btn:hover,
#userBottomSheet .sheet-logout-btn:active {
    background: #dc3545;
    color: #fff;
}

#userBottomSheet .sheet-logout-btn svg {
    flex-shrink: 0;
}

[data-theme="dark"] #userBottomSheet .sheet-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #userBottomSheet .sheet-logout-btn {
    color: #ff6b6b;
    border-color: #ff6b6b;
}

[data-theme="dark"] #userBottomSheet .sheet-logout-btn:hover {
    background: #ff6b6b;
    color: #fff;
}

/* Forzar bloqueo de scroll cuando sheet está abierto */
html.sheet-open,
body.sheet-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    touch-action: none !important;
    -webkit-overflow-scrolling: none !important;
}

