/* public/assets/css/header.css */

/* -- Base y Variables -- */
:root {
    --header-bg: var(--bg-secondary);
    --header-border: 1px solid var(--border-color);
    --header-shadow: var(--shadow);
    --nav-link-color: var(--text-secondary);
    --nav-link-hover-color: var(--primary-color);
    --nav-brand-color: var(--text-primary);
    --dropdown-bg: var(--bg-secondary);
    --dropdown-border: 1px solid var(--border-color);
    --dropdown-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --hamburger-color: var(--text-primary);
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

/* -- Estilos Generales del Header -- */
.header {
    background: rgba(var(--bg-secondary-rgb), 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: var(--spacing-md) var(--spacing-xl);
    border-bottom: var(--header-border);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: var(--top-bar-height, 40px);
    width: 100%;
    z-index: 999;
    box-sizing: border-box;
    height: 80px;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    width: 100%;
}

.nav-brand h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--nav-brand-color);
    margin: 0;
}

.nav-brand h1 a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.nav-brand h1 a:hover {
    color: var(--primary-color);
    text-shadow: 0 0 8px var(--primary-color);
}

/* -- Menú de Navegación Principal (Desktop) -- */
.nav-menu, .dropdown-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: var(--nav-link-color);
    text-decoration: none;
    font-weight: 500;
    padding: var(--spacing-sm) 0;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after, .nav-menu a.active::after {
    width: 100%;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--nav-link-hover-color);
}

/* -- Dropdowns (Desktop) -- */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dropdown-bg);
    border: var(--dropdown-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    flex-direction: column;
    padding: var(--spacing-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) translateX(-50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown:hover .dropdown-menu {
    display: flex;
    opacity: 1;
    visibility: visible;
    transform: translateY(0) translateX(-50%);
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu a {
    padding: var(--spacing-sm) var(--spacing-md);
    width: 100%;
    display: block;
    box-sizing: border-box;
    white-space: nowrap;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover {
    background-color: var(--bg-card-hover);
    transform: translateX(4px);
}

.dropdown-menu a::after {
    display: none;
}

.dropdown-arrow {
    margin-left: var(--spacing-sm);
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* -- Menú Hamburguesa (Móvil) -- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 28px;
    cursor: pointer;
    padding: 4px;
    z-index: 10002;
    background: transparent;
    border: none;
    position: relative;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.hamburger:hover {
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--hamburger-color);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.hamburger.active span {
    background: #ffffff;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* -- Media Queries para Responsividad -- */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        display: none;
    }

    .nav-menu.active {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: linear-gradient(135deg, rgba(15, 15, 25, 0.98), rgba(25, 25, 40, 0.98));
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 10001;
        gap: 0;
        animation: slideInFromTop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 140px;
        overflow-y: auto;
    }

    @keyframes slideInFromTop {
        from { 
            opacity: 0;
            transform: translateY(-100%);
        }
        to { 
            opacity: 1;
            transform: translateY(0);
        }
    }

    .nav-menu li {
        width: 85%;
        max-width: 280px;
        text-align: center;
        opacity: 0;
        animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        margin-bottom: var(--spacing-sm);
    }
    
    .nav-menu.active li:nth-child(1) { animation-delay: 0.1s; }
    .nav-menu.active li:nth-child(2) { animation-delay: 0.2s; }
    .nav-menu.active li:nth-child(3) { animation-delay: 0.3s; }
    .nav-menu.active li:nth-child(4) { animation-delay: 0.4s; }

    @keyframes slideInUp {
        from {
            transform: translateY(30px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .nav-menu a {
        font-size: 1.1rem;
        font-weight: 500;
        color: #ffffff;
        padding: 14px 20px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        transition: all 0.3s ease;
        width: 100%;
        display: block;
        text-align: center;
        position: relative;
        overflow: hidden;
    }

    .nav-menu a::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
        transition: left 0.5s ease;
    }
    
    .nav-menu a:hover {
        background: rgba(var(--primary-color-rgb), 0.15);
        border-color: rgba(var(--primary-color-rgb), 0.3);
        transform: translateY(-1px);
        box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.2);
    }

    .nav-menu a:hover::before {
        left: 100%;
    }
    
    .nav-menu a::after {
        display: none;
    }

    /* Dropdowns en móvil */
    .dropdown .dropdown-toggle {
        cursor: pointer;
        position: relative;
    }
    
    .dropdown-menu {
        display: block;
        position: static;
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
        padding: var(--spacing-sm);
        margin-top: var(--spacing-sm);
        width: 100%;
        text-align: center;
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateY(-10px);
    }
    
    .dropdown.active .dropdown-menu {
        max-height: 250px;
        opacity: 1;
        transform: translateY(0);
    }

    .dropdown-menu li {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }

    .dropdown-menu li:last-child {
        margin-bottom: 0;
    }

    .dropdown-menu a {
        font-size: 0.95rem;
        font-weight: 400;
        color: rgba(255, 255, 255, 0.85);
        padding: 10px 16px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 6px;
        margin-bottom: 0;
        transition: all 0.2s ease;
    }

    .dropdown-menu a:hover {
        background: rgba(var(--primary-color-rgb), 0.12);
        color: var(--primary-color);
        border-color: rgba(var(--primary-color-rgb), 0.25);
        transform: translateX(0) scale(1.02);
    }

    .dropdown-arrow {
        transition: transform 0.3s ease;
    }

    .dropdown.active .dropdown-arrow {
        transform: rotate(180deg);
    }
}

/* Mejoras adicionales para tablets */
@media (max-width: 1024px) and (min-width: 769px) {
    .nav-menu {
        gap: var(--spacing-md);
    }
    
    .nav-menu a {
        font-size: 0.95rem;
    }
}
