/* ========================================
   🏆 PROFESSIONAL DYNAMIC ISLAND HEADER
   Clean, user-friendly, iPhone-inspired design
   ======================================== */

/* Core Variables */
:root {
    --header-height-normal: 80px;
    --header-height-compact: 60px;
    --header-bg-normal: rgba(28, 28, 30, 0.95);
    --header-bg-compact: rgba(28, 28, 30, 0.95);
    --header-text-normal: rgba(255, 255, 255, 0.9);
    --header-text-compact: rgba(255, 255, 255, 0.9);
    --header-shadow-normal: 0 4px 20px rgba(0, 0, 0, 0.3);
    --header-shadow-compact: 0 4px 20px rgba(0, 0, 0, 0.3);
    --header-border-radius: 25px;
    --header-padding-normal: 0 2rem;
    --header-padding-compact: 0 1.5rem;
    --header-transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    --header-backdrop-blur: 20px;
    --brand-transition: all 0.4s ease;
    --link-transition: all 0.3s ease;
    
    /* Header area spacing to prevent overlap */
    --header-area-height: 110px; /* 80px height + 30px margin */
}

/* ========================================
   MAIN HEADER STRUCTURE
   ======================================== */

/* Body padding to prevent header overlap */
body {
    padding-top: var(--header-area-height);
}

.professional-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transition: var(--header-transition);
}

/* Header Container */
.header-container {
    max-width: 1400px;
    margin: 15px auto;
    padding: var(--header-padding-normal);
    height: var(--header-height-normal);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--header-bg-normal);
    backdrop-filter: blur(var(--header-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--header-backdrop-blur));
    box-shadow: var(--header-shadow-normal);
    border-radius: var(--header-border-radius);
    transition: var(--header-transition);
    position: relative;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: calc(100% - 30px);
}

/* Dynamic Island Transformation */
.professional-header.scrolled .header-container {
    height: var(--header-height-compact);
    background: var(--header-bg-compact);
    box-shadow: var(--header-shadow-compact);
    border-radius: var(--header-border-radius);
    margin: 15px auto;
    width: calc(100% - 30px);
    max-width: 600px;
    padding: var(--header-padding-compact);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Consistent Glow Effect */
.header-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(196, 169, 98, 0.3),
        rgba(139, 111, 142, 0.3),
        rgba(196, 169, 98, 0.3));
    border-radius: var(--header-border-radius);
    z-index: -1;
    opacity: 0.4;
    animation: headerGlow 3s ease-in-out infinite;
    pointer-events: none;
}

/* Enhanced glow on scroll */
.professional-header.scrolled .header-container::before {
    opacity: 0.7;
}

@keyframes headerGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ========================================
   BRAND SECTION
   ======================================== */

.header-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--header-text-normal);
    transition: var(--brand-transition);
    padding: 0.5rem;
    border-radius: 12px;
}

.brand-link:hover {
    transform: scale(1.05);
}

.header-logo {
    height: 40px;
    width: auto;
    transition: var(--brand-transition);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.professional-header.scrolled .header-logo {
    height: 32px;
    filter: drop-shadow(0 2px 8px rgba(196, 169, 98, 0.4));
}

/* Brand text removed - logo only approach */

.professional-header.scrolled .brand-link {
    color: var(--header-text-compact);
}

/* ========================================
   NAVIGATION SECTION
   ======================================== */

.header-nav {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    transition: var(--header-transition);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    transition: var(--header-transition);
}

.professional-header.scrolled .nav-links {
    gap: 1rem;
}

.nav-link {
    position: relative;
    text-decoration: none;
    color: var(--header-text-normal);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: 20px;
    transition: var(--link-transition);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

.nav-link.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 12px rgba(196, 169, 98, 0.3);
}

.professional-header.scrolled .nav-link {
    color: var(--header-text-compact);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}

.professional-header.scrolled .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.professional-header.scrolled .nav-link.active {
    background: var(--gradient-1);
    color: white;
}

/* Hide non-essential links on scroll */
.professional-header.scrolled .nav-link:not(.active):not(:hover) .link-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.professional-header.scrolled .nav-link:hover .link-text {
    opacity: 1;
    width: auto;
}

/* ========================================
   ACTION SECTION
   ======================================== */

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* User Menu Styles */
.user-menu {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 0.4rem 1rem 0.4rem 0.4rem;
    color: var(--header-text-normal);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.user-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.user-avatar,
.user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.user-avatar {
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-avatar-placeholder {
    background: var(--gradient-1);
    color: white;
    border: 2px solid rgba(196, 169, 98, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-name {
    color: var(--header-text-normal);
    font-weight: 500;
    transition: all 0.3s ease;
}

.professional-header.scrolled .user-toggle {
    padding: 0.3rem 0.8rem 0.3rem 0.3rem;
    font-size: 0.85rem;
}

.professional-header.scrolled .user-avatar,
.professional-header.scrolled .user-avatar-placeholder {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
}

.professional-header.scrolled .user-name {
    display: none;
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: rgba(28, 28, 30, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 0.5rem 0;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1001;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.user-dropdown[style*="block"] {
    opacity: 1;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.dropdown-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 1.25rem;
}

.contact-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-1);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--link-transition);
    box-shadow: 0 4px 12px rgba(196, 169, 98, 0.3);
    position: relative;
    overflow: hidden;
}

.contact-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 100%);
    transition: left 0.6s ease;
}

.contact-btn:hover::before {
    left: 100%;
}

.contact-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(196, 169, 98, 0.4);
}

.professional-header.scrolled .contact-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.professional-header.scrolled .contact-btn .btn-text {
    display: none;
}

.join-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(139, 111, 142, 0.1);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    border: 2px solid rgba(139, 111, 142, 0.2);
    transition: var(--link-transition);
    position: relative;
    overflow: hidden;
}

.join-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 100%);
    transition: left 0.6s ease;
}

.join-btn:hover::before {
    left: 100%;
}

.join-btn:hover {
    background: var(--gradient-2);
    color: white;
    border-color: transparent;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(139, 111, 142, 0.4);
}

.professional-header.scrolled .join-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.professional-header.scrolled .join-btn .btn-text {
    display: none;
}

/* ========================================
   MOBILE TOGGLE
   ======================================== */

.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    gap: 4px;
    z-index: 200;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.hamburger-line {
    width: calc(100% - 16px);
    height: 2px;
    background: var(--header-text-normal);
    transition: all 0.3s ease;
    border-radius: 2px;
    display: block;
    margin: 0 auto;
}

.professional-header.scrolled .hamburger-line {
    background: var(--header-text-compact);
}

.mobile-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ========================================
   NEW MOBILE NAVIGATION MENU
   ======================================== */

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Navigation Container */
.mobile-nav {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.mobile-nav-overlay.active .mobile-nav {
    transform: translateY(0);
}

/* Mobile Navigation Header */
.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-logo img {
    height: 32px;
    width: auto;
}

.mobile-nav-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Mobile Navigation Content */
.mobile-nav-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Mobile Navigation Links */
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.mobile-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-1);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    z-index: -1;
}

.mobile-nav-link:hover::before,
.mobile-nav-link.active::before {
    transform: scaleX(1);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(8px);
}

.mobile-nav-link span {
    position: relative;
    z-index: 1;
}

/* Mobile Navigation Actions */
.mobile-nav-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mobile-nav-btn.primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 16px rgba(139, 111, 142, 0.3);
}

.mobile-nav-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 111, 142, 0.4);
}

.mobile-nav-btn.secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

.mobile-nav-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Mobile Navigation Animations */
.mobile-nav-overlay.active .mobile-nav-link {
    animation: slideInLeft 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    opacity: 0;
}

.mobile-nav-overlay.active .mobile-nav-link:nth-child(1) { animation-delay: 0.1s; }
.mobile-nav-overlay.active .mobile-nav-link:nth-child(2) { animation-delay: 0.15s; }
.mobile-nav-overlay.active .mobile-nav-link:nth-child(3) { animation-delay: 0.2s; }
.mobile-nav-overlay.active .mobile-nav-link:nth-child(4) { animation-delay: 0.25s; }
.mobile-nav-overlay.active .mobile-nav-link:nth-child(5) { animation-delay: 0.3s; }
.mobile-nav-overlay.active .mobile-nav-link:nth-child(6) { animation-delay: 0.35s; }
.mobile-nav-overlay.active .mobile-nav-link:nth-child(7) { animation-delay: 0.4s; }
.mobile-nav-overlay.active .mobile-nav-link:nth-child(8) { animation-delay: 0.45s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   RESPONSIVE BREAKPOINTS - PROFESSIONAL MOBILE
   ======================================== */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 1.5rem;
        max-width: 95%;
    }
    
    .nav-links {
        gap: 1.5rem;
    }
    
    .professional-header.scrolled .header-container {
        max-width: 70%;
        min-width: 500px;
    }
}

/* Tablet breakpoint */
@media (max-width: 768px) {
    :root {
        --header-height-normal: 65px;
        --header-height-compact: 50px;
        --header-area-height: 90px; /* 65px height + 25px margin */
    }
    
    .mobile-toggle {
        display: flex;
        order: 3;
    }
    
    .header-nav {
        display: none;
    }
    
    .header-container {
        padding: 0 1.2rem;
        max-width: 95%;
    }
    
    .header-actions {
        order: 2;
        margin-right: 0.5rem;
        gap: 0.5rem;
    }
    
    .user-toggle {
        padding: 0.3rem 0.8rem 0.3rem 0.3rem;
        border-radius: 20px;
    }
    
    .user-avatar,
    .user-avatar-placeholder {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .user-name {
        display: none;
    }
    
    .contact-btn .btn-text {
        display: none;
    }
    
    .join-btn .btn-text {
        display: none;
    }
    
    .contact-btn {
        padding: 0.6rem 1rem;
        min-width: 44px; /* Touch target minimum */
        min-height: 44px;
        justify-content: center;
    }
    
    .join-btn {
        padding: 0.6rem 1rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    
    .join-btn .btn-icon {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .professional-header.scrolled .header-container {
        max-width: 85%;
        min-width: 350px;
        padding: 0 1.2rem;
    }
    
    /* Mobile dropdown styles */
    .user-dropdown {
        max-width: calc(100vw - 40px);
        right: 0;
        left: auto;
        min-width: 120px;
    }
}

/* Large mobile phones */
@media (max-width: 640px) {
    .header-container {
        padding: 0 1.2rem;
        margin: 10px auto;
    }
    
    .header-logo {
        height: 35px;
    }
    
    .professional-header.scrolled .header-logo {
        height: 28px;
    }
    
    .professional-header.scrolled .header-container {
        max-width: 90%;
        min-width: 280px;
        padding: 0 1rem;
    }
    
    .header-actions {
        gap: 0.8rem;
    }
    
    /* Smaller mobile dropdown adjustments */
    .user-dropdown {
        max-width: calc(100vw - 30px);
        min-width: 100px;
        font-size: 0.85rem;
    }
    
    .dropdown-link {
        padding: 0.6rem 0.8rem;
    }
}

/* Standard mobile phones */
@media (max-width: 480px) {
    :root {
        --header-height-normal: 65px;
        --header-height-compact: 50px;
        --header-padding-normal: 0 1rem;
        --header-padding-compact: 0 0.8rem;
        --header-area-height: 85px; /* 65px height + 20px margin */
    }
    
    .header-container {
        padding: 0 1rem;
        margin: 8px auto;
        max-width: 95%;
        min-height: 50px;
    }
    
    .header-logo {
        height: 32px;
    }
    
    .professional-header.scrolled .header-logo {
        height: 26px;
    }
    
    .professional-header.scrolled .header-container {
        max-width: 95%;
        min-width: 250px;
        margin: 6px auto;
        padding: 0 0.8rem;
    }
    
    .header-actions {
        gap: 0.6rem;
    }
    
    .contact-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    
    .join-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    
    .mobile-toggle {
        width: 28px;
        height: 28px;
        padding: 0.2rem;
    }
    
    .hamburger-line {
        height: 2.5px;
    }
    
    /* Mobile dropdown compact styles */
    .user-dropdown {
        max-width: calc(100vw - 20px);
        min-width: 90px;
        font-size: 0.8rem;
        padding: 0.3rem 0;
    }
    
    .dropdown-link {
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
    }
}

/* Small mobile phones */
@media (max-width: 360px) {
    .header-container {
        padding: 0 0.8rem;
        margin: 6px auto;
    }
    
    .header-logo {
        height: 28px;
    }
    
    .professional-header.scrolled .header-logo {
        height: 24px;
    }
    
    .professional-header.scrolled .header-container {
        max-width: 98%;
        min-width: 220px;
        padding: 0 0.6rem;
    }
    
    .header-actions {
        gap: 0.4rem;
    }
    
    .contact-btn {
        padding: 0.4rem 0.6rem;
        min-width: 40px;
        min-height: 40px;
        justify-content: center;
    }
    
    .join-btn {
        padding: 0.4rem 0.6rem;
        min-width: 40px;
        min-height: 40px;
        justify-content: center;
    }
    
    .contact-btn .btn-icon svg,
    .join-btn .btn-icon svg {
        width: 16px;
        height: 16px;
    }
    
    /* Extra small mobile dropdown */
    .user-dropdown {
        max-width: calc(100vw - 16px);
        min-width: 80px;
        font-size: 0.75rem;
        padding: 0.25rem 0;
    }
    
    .dropdown-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

.professional-header,
.header-container {
    will-change: transform;
    backface-visibility: hidden;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
}

/* ========================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================== */

.nav-link:focus,
.contact-btn:focus,
.join-btn:focus,
.mobile-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.professional-header.scrolled .nav-link:focus {
    outline-color: rgba(255, 255, 255, 0.8);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .header-container {
        border: 2px solid;
    }
    
    .nav-link {
        border: 1px solid transparent;
    }
    
    .nav-link:hover,
    .nav-link:focus {
        border-color: currentColor;
    }
}