/* ===================================
   Advanced Header Styles - Premium Design
   Neon Blue Theme with Glassmorphism
   RTL SUPPORT BUILT-IN - FIXED
   =================================== */

:root {
    --primary-cyan: #06b6d4;
    --primary-blue: #3b82f6;
    --accent-cyan: #22d3ee;
    --accent-blue: #60a5fa;
    --dark-bg: #0f172a;
    --dark-secondary: #1e293b;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
}

header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(
        135deg,
        rgba(15, 23, 42, 0.92) 0%,
        rgba(30, 41, 59, 0.92) 50%,
        rgba(15, 23, 42, 0.92) 100%
    );
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-bottom: 1px solid rgba(34, 211, 238, 0.25);
    box-shadow: 
        0 8px 50px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(34, 211, 238, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(34, 211, 238, 0.8) 50%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

header:hover::before {
    opacity: 1;
}

.header-container {
    max-width: 90rem;
    margin: 0 auto;
    padding: 0.75rem 1.5rem; /* ✅ Reduced from 2rem to prevent overflow */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem; /* ✅ Reduced from 2rem */
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* ===================================
   Logo Section - FIXED
   =================================== */

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* ✅ Reduced from 1rem */
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

div.logo-icon,
.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.logo-icon * {
    background: transparent !important;
}

.logo-icon svg {
    width: 50px;
    height: 50px;
    color: white;
    position: relative;
    z-index: 1;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff 0%, #22d3ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.02em;
    position: relative;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 0 30px rgba(34, 211, 238, 0.3);
    white-space: nowrap;
}

.logo-text::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 2px;
}

.logo-text:hover::after {
    width: 100%;
}

/* ===================================
   Desktop Navigation
   =================================== */

.main-nav {
    display: none;
    align-items: center;
    flex: 1;
    justify-content: center;
}

@media (min-width: 1024px) {
    .main-nav {
        display: flex;
    }
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* ✅ Reduced from 0.75rem */
    list-style: none;
    margin: 0;
    padding: 0.75rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 1.25rem;
    border: 1px solid rgba(34, 211, 238, 0.15);
    backdrop-filter: blur(15px);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 4px 30px rgba(0, 0, 0, 0.2);
}

.nav-menu li {
    margin: 0;
    position: relative;
}

.nav-menu a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem; /* ✅ Reduced from 0.95rem */
    font-weight: 700;
    padding: 0.7rem 1.1rem; /* ✅ Reduced from 0.8rem 1.4rem */
    border-radius: 0.85rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.nav-menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(59, 130, 246, 0.15));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0.85rem;
}

.nav-menu a:hover::before {
    opacity: 1;
}

.nav-menu a:hover {
    color: var(--accent-cyan);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.25);
}

/* ===================================
   Header Right Section - FIXED
   =================================== */

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem; /* ✅ Reduced from 1.5rem */
    flex-shrink: 0; /* ✅ CRITICAL: Prevents shrinking */
}

/* Language Switcher */
.lang-switcher {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 1rem;
    padding: 0.4rem; /* ✅ Reduced from 0.5rem */
    display: flex;
    gap: 0.4rem; /* ✅ Reduced from 0.5rem */
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 1px rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.lang-btn {
    padding: 0.5rem 0.85rem; /* ✅ Reduced from 0.55rem 1rem */
    border-radius: 0.65rem;
    font-size: 0.8rem; /* ✅ Reduced from 0.85rem */
    font-weight: 800;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.08em;
}

.lang-btn:hover {
    color: var(--accent-cyan);
    transform: translateY(-3px);
    border-color: rgba(6, 182, 212, 0.4);
}

.lang-btn.active {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: white;
    box-shadow: 
        0 0 30px rgba(6, 182, 212, 0.6),
        0 6px 20px rgba(0, 0, 0, 0.35),
        inset 0 1px 1px rgba(255, 255, 255, 0.25);
    border-color: transparent;
    transform: scale(1.08);
}

/* Auth Links - FIXED */
.auth-links {
    display: none;
    align-items: center;
    gap: 0.75rem; /* ✅ Reduced from 1.25rem */
    flex-shrink: 0; /* ✅ CRITICAL */
}

@media (min-width: 1024px) {
    .auth-links {
        display: flex;
    }
}

.link-default,
.link-signup,
.link-logout {
    text-decoration: none;
    font-size: 0.88rem; /* ✅ Reduced from 0.95rem */
    font-weight: 700;
    padding: 0.65rem 1.1rem; /* ✅ Reduced from 0.7rem 1.4rem */
    border-radius: 0.85rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap; /* ✅ CRITICAL: Prevents text wrapping */
    flex-shrink: 0;
}

.link-default {
    color: var(--text-secondary);
    border: 1.5px solid rgba(34, 211, 238, 0.25);
    background: rgba(30, 41, 59, 0.5);
}

.link-default:hover {
    color: var(--accent-cyan);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(6, 182, 212, 0.35);
}

.link-signup,
.link-logout {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    color: white;
    font-weight: 800;
    border: 1.5px solid rgba(6, 182, 212, 0.6);
    box-shadow: 
        0 0 35px rgba(6, 182, 212, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3);
}

.link-signup:hover,
.link-logout:hover {
    box-shadow: 0 0 45px rgba(6, 182, 212, 0.7);
    transform: translateY(-4px);
}

/* Mobile Menu Button - FIXED CENTERING */
.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(15px);
    border: 1.5px solid rgba(34, 211, 238, 0.25);
    border-radius: 0.85rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 0 !important; /* ✅ Remove any default padding */
    position: relative; /* ✅ For absolute centering */
}

.mobile-menu-btn:hover {
    color: var(--accent-cyan);
    border-color: rgba(34, 211, 238, 0.6);
    transform: translateY(-3px);
}

.mobile-menu-btn svg {
    width: 1.6rem;
    height: 1.6rem;
    stroke: currentColor;
    stroke-width: 2;
    position: absolute; /* ✅ Absolute centering */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* ✅ Perfect center */
}

@media (min-width: 1024px) {
    .mobile-menu-btn {
        display: none;
    }
}

/* ===================================
   Mobile Menu
   =================================== */

.mobile-menu {
    display: none;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
    backdrop-filter: blur(30px);
    border-top: 1px solid rgba(34, 211, 238, 0.25);
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-menu.show {
    display: block;
    animation: slideDownFade 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 1024px) {
    .mobile-menu {
        display: none !important;
    }
}

.mobile-menu-content {
    padding: 2rem 1.75rem;
}

.mobile-nav {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(34, 211, 238, 0.2);
}

.mobile-nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-menu a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 1.1rem 1.4rem;
    border-radius: 0.85rem;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-nav-menu a:active,
.mobile-nav-menu a:hover {
    color: var(--accent-cyan);
    border-color: rgba(34, 211, 238, 0.4);
}

/* Mobile Language Switcher */
.mobile-lang-switcher {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(34, 211, 238, 0.2);
    display: flex;
    gap: 1rem;
}

.mobile-lang-switcher .lang-btn {
    flex: 1;
    padding: 0.95rem;
    text-align: center;
    font-size: 0.95rem;
    border: 1.5px solid rgba(34, 211, 238, 0.3);
    border-radius: 0.85rem;
    background: rgba(30, 41, 59, 0.5);
}

.mobile-lang-switcher .lang-btn.active {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border-color: transparent;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.6);
}

/* Mobile Auth Links */
.mobile-auth-links {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.mobile-auth-links a {
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 800;
    padding: 1.1rem 1.75rem;
    border-radius: 0.85rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-login {
    border: 1.5px solid rgba(34, 211, 238, 0.5);
    color: var(--accent-cyan);
    background: rgba(30, 41, 59, 0.5);
}

.btn-signup,
.btn-logout {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: white;
    border: 1.5px solid rgba(6, 182, 212, 0.6);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.5);
}

/* ===================================
   Responsive Design - FIXED
   =================================== */

@media (max-width: 1280px) {
    .header-container {
        padding: 0.75rem 1.25rem;
    }
    
    .nav-menu a {
        font-size: 0.85rem;
        padding: 0.65rem 0.9rem;
    }
    
    .link-default,
    .link-signup,
    .link-logout {
        font-size: 0.85rem;
        padding: 0.6rem 0.95rem;
    }
}

@media (max-width: 1024px) {
    .header-container {
        padding: 0.65rem 1rem;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0.6rem 1rem;
        gap: 0.75rem;
    }

    .logo {
        gap: 0.6rem;
    }

    div.logo-icon,
    .logo-icon {
        width: 42px;
        height: 42px;
    }

    .logo-icon svg {
        width: 42px;
        height: 42px;
    }

    .logo-text {
        font-size: 1.25rem;
    }
    
    .lang-switcher {
        padding: 0.35rem;
        gap: 0.35rem;
    }
    
    .lang-btn {
        padding: 0.45rem 0.7rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 640px) {
    .header-container {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .logo {
        gap: 0.5rem;
    }

    div.logo-icon,
    .logo-icon {
        width: 36px;
        height: 36px;
    }

    .logo-icon svg {
        width: 36px;
        height: 36px;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .lang-switcher {
        display: none;
    }

    .mobile-menu-content {
        padding: 1.5rem 1rem;
    }
}
