/* ======================
   Header Base
====================== */

header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(10, 15, 30, 0.92);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
}

/* ======================
   Logo
====================== */

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    user-select: none;
}

.logo-img {
    height: 46px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.22);
    transition: transform 0.45s ease, box-shadow 0.45s ease;
}

.logo-text {
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    background: linear-gradient(270deg, var(--primary), var(--accent), var(--primary));
    background-size: 400% 400%;
    -webkit-background-clip: text;
    color: transparent;
    animation: logoGradient 6s ease infinite;
    transition: transform 0.35s ease, text-shadow 0.35s ease;
}

@keyframes logoGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.logo:hover .logo-text {
    transform: translateX(4px);
    text-shadow: 0 0 14px rgba(108,124,255,.45);
}

.logo:hover .logo-img {
    transform: translateY(-3px) scale(1.07);
    box-shadow: 0 18px 45px rgba(108,124,255,.45);
}

/* ======================
   Desktop Navigation
====================== */

.desktop-nav ul {
    display: flex;
    gap: 32px;
    list-style: none;
}

.desktop-nav a {
    position: relative;
    font-weight: 500;
    padding: 6px 0;
    color: var(--text);
    transition: color 0.3s ease;
}

.desktop-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.3s ease;
}

.desktop-nav a:hover,
.desktop-nav a.active {
    color: var(--primary);
}

.desktop-nav a:hover::after,
.desktop-nav a.active::after {
    width: 100%;
}

/* ======================
   Desktop Dropdown
====================== */

.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 130%;
    left: 0;
    display: flex;
    flex-direction: column;
    min-width: 210px;
    padding: 8px 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: 0.25s ease;
    z-index: 1000;
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    padding: 12px 18px;
    font-size: .95rem;
    color: var(--text);
    white-space: nowrap;
}

.dropdown-menu a:hover {
    background: rgba(108,124,255,.12);
    color: var(--primary);
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown i {
    font-size: .7rem;
    transition: transform .3s ease;
}

.nav-dropdown:hover i {
    transform: rotate(180deg);
}

/* ======================
   Actions
====================== */

.actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ======================
   Mode Toggle
====================== */

.mode-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mode-toggle:hover {
    background: rgba(108,124,255,.2);
    transform: rotate(15deg);
    box-shadow: 0 0 20px rgba(108,124,255,.3);
}

.mode-toggle i {
    font-size: 1.2rem;
}

/* ======================
   Mobile Menu Button
====================== */

.mobile-menu {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.mobile-menu:hover {
    background: rgba(255,255,255,.1);
    transform: scale(1.05);
}

.mobile-menu span {
    position: absolute;
    left: 50%;
    width: 18px;
    height: 2px;
    background: #fff;
    transform: translateX(-50%);
    transition: .3s ease;
    border-radius: 2px;
}

.mobile-menu span:nth-child(1) { top: 14px; }
.mobile-menu span:nth-child(2) { top: 21px; }
.mobile-menu span:nth-child(3) { top: 28px; }

.mobile-menu.active span:nth-child(1) {
    transform: translateX(-50%) rotate(45deg);
    top: 21px;
}

.mobile-menu.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu.active span:nth-child(3) {
    transform: translateX(-50%) rotate(-45deg);
    top: 21px;
}

/* ======================
   Mobile Overlay
====================== */

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: .3s ease;
    z-index: 998;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ======================
   Mobile Menu (Enhanced Floating Card)
====================== */

.mobile-nav {
    position: fixed;
    top: 0;
    right: -400px;
    width: 320px;
    height: 100vh;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border);
    box-shadow: -20px 0 60px rgba(0,0,0,.45);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 15, 30, 0.9);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-logo img {
    height: 36px;
    border-radius: 10px;
}

.mobile-logo span {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(270deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    color: transparent;
}

.mobile-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-close:hover {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
    transform: rotate(90deg);
}

.mobile-nav-content {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.mobile-nav-content ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-content li {
    margin: 0;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: rgba(108,124,255,.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.mobile-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.8;
}

/* ======================
   Mobile Dropdown
====================== */

.mobile-dropdown-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.mobile-dropdown-toggle:hover {
    background: rgba(108,124,255,.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.mobile-dropdown-toggle i:first-child {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.8;
}

.mobile-dropdown-toggle i:last-child {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.mobile-dropdown.active .mobile-dropdown-toggle i:last-child {
    transform: rotate(180deg);
}

.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    background: rgba(0,0,0,.05);
    transition: max-height 0.35s ease;
}

.mobile-submenu a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px 14px 44px;
    font-size: 0.95rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
}

.mobile-submenu a:hover {
    background: rgba(108,124,255,.08);
    color: var(--primary);
    padding-left: 48px;
}

.mobile-submenu a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.7;
}

.mobile-dropdown.active .mobile-submenu {
    max-height: 400px;
}

/* ======================
   Mobile Nav Footer
====================== */

.mobile-nav-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.mobile-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255,255,255,.05);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.mobile-theme-toggle span {
    font-size: 0.95rem;
    color: var(--text);
}

.mode-toggle-mobile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mode-toggle-mobile:hover {
    background: rgba(108,124,255,.2);
    transform: rotate(15deg);
}

/* ======================
   Responsive Design
====================== */

@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }
    
    .mobile-menu {
        display: block;
    }
    
    .header-wrap {
        padding: 14px 0;
    }
    
    .logo-img {
        height: 40px;
    }
    
    .logo-text {
        font-size: 1.3rem;
    }
    
    .mobile-nav {
        width: 280px;
    }
}

@media (max-width: 480px) {
    .mobile-nav {
        width: 260px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
}

/* Light mode adjustments */
body.light .mobile-nav {
    background: rgba(255, 255, 255, 0.98);
    border-left: 1px solid rgba(0,0,0,.1);
}

body.light .mobile-submenu {
    background: rgba(0,0,0,.03);
}