/**
 * Enhanced Header Styles - Fixed and Improved
 * Professional navigation with proper spacing and organization
 */

/* Header Container */
header {
    background: linear-gradient(135deg, #1cabe2 0%, #147ba5 100%) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    padding: 0 !important;
    display: block !important;
    width: 100% !important;
    border-radius: 0 !important;
}

.header-container {
    max-width: 1400px !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 24px !important;
    gap: 20px !important;
}

/* Logo Section */
.logo {
    flex-shrink: 0;
    z-index: 10;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo a:hover {
    transform: scale(1.02);
}

.logo img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: none; /* Hidden by default, show on larger screens */
}

@media (min-width: 1200px) {
    .logo-text {
        display: block;
    }
}

/* Navigation */
.navbar {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
}

.nav-links {
    list-style: none !important;
    display: flex !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center !important;
    flex-direction: row !important;
}

.nav-links li {
    position: relative;
}

.nav-links li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: block;
    white-space: nowrap;
}

.nav-links li a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-links li a.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 600;
}

/* Right Section */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Get Involved Button */
.btn-get-involved {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-get-involved:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
}

.btn-get-involved svg {
    width: 16px;
    height: 16px;
}

/* Share Story Button - Green gradient matching Get Involved */
.btn-share-story {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-share-story:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
}

.btn-share-story svg {
    width: 16px;
    height: 16px;
}

/* Incubation Program Button - Brand Blue gradient */
.btn-incubation {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.btn-incubation:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.5);
}

.btn-incubation svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Mobile responsiveness for incubation button */
@media (max-width: 768px) {
    .btn-incubation span {
        display: none; /* Show only icon on mobile */
    }

    .btn-incubation {
        padding: 10px;
    }
}

/* Login Button */
.btn-login {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Admin Button */
.btn-admin {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 193, 7, 0.9);
    color: #1a202c;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-admin:hover {
    background: #ffc107;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

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

.user-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.user-button:hover {
    background: rgba(255, 255, 255, 0.25);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    color: #1cabe2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 500;
    font-size: 0.85rem;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    padding: 8px;
    display: none;
    animation: slideDown 0.2s ease-out;
}

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

.user-dropdown.active {
    display: block;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #2d3748;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.user-dropdown a:hover {
    background: #f7fafc;
    color: #1cabe2;
}

.user-dropdown a svg {
    color: #718096;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    gap: 4px;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 10px;
    border-radius: 8px;
    flex-shrink: 0;
    height: fit-content;
}

.lang-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.lang-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.lang-btn.active {
    background: white;
    color: #1cabe2;
    font-weight: 600;
}

.language-switcher .separator {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 11;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

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

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

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

/* Responsive Design */
@media (max-width: 1024px) {
    .header-container {
        gap: 12px;
    }

    .nav-links {
        gap: 4px;
    }

    .nav-links li a {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .btn-get-involved span,
    .btn-share-story span,
    .btn-login span,
    .btn-admin span {
        display: none; /* Hide text, show only icons */
    }

    .user-name {
        display: none;
    }
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .navbar {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(28, 171, 226, 0.75);
        backdrop-filter: blur(8px);
        padding: 16px 24px;
        display: none !important;
        width: 100vw;
        height: calc(100vh - 70px);
        overflow-y: auto;
        z-index: 9999;
    }

    .navbar.active {
        display: flex !important;
        flex-direction: column;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }

    .nav-links {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px;
        width: 100%;
        align-items: stretch;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .nav-links li {
        width: 100%;
        display: block;
    }

    .nav-links li a {
        display: block;
        width: 100%;
        text-align: left;
        padding: 16px 20px;
        font-size: 1.1rem;
        font-weight: 500;
        border-radius: 8px;
        transition: background-color 0.2s ease;
        color: white;
        text-decoration: none;
    }

    .nav-links li a:hover,
    .nav-links li a.active {
        background-color: rgba(255, 255, 255, 0.2);
    }

    .header-right {
        gap: 6px;
        flex-wrap: nowrap;
        flex-shrink: 0;
        min-width: fit-content;
    }

    .btn-get-involved,
    .btn-share-story {
        padding: 8px 10px;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .language-switcher {
        flex-shrink: 0;
        min-width: 70px;
    }

    /* Prevent horizontal overflow on mobile */
    header {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .header-container {
        max-width: 100vw;
        overflow-x: hidden;
        justify-content: space-between;
    }

    .logo {
        flex-shrink: 1;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 10px 16px;
    }

    .logo img {
        height: 45px;
    }

    .language-switcher {
        padding: 5px 8px;
    }

    .lang-btn {
        font-size: 0.8rem;
        padding: 3px 6px;
    }

    .btn-get-involved,
    .btn-share-story,
    .btn-login,
    .btn-admin {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .logo img {
        height: 40px;
    }

    .header-right {
        gap: 3px;
        flex-shrink: 0;
    }

    .language-switcher {
        padding: 3px 5px;
        gap: 1px;
        min-width: 60px;
        flex-shrink: 0;
    }

    .lang-btn {
        font-size: 0.7rem;
        padding: 2px 3px;
        min-width: 22px;
    }

    .language-switcher .separator {
        display: none;
    }

    /* Reduce padding for smaller screens */
    .header-container {
        padding: 8px 12px;
        gap: 8px;
    }

    .btn-get-involved,
    .btn-share-story {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    /* Make touch targets larger for better mobile UX */
    .mobile-menu-toggle {
        padding: 12px;
        margin: -4px;
    }

    .mobile-menu-toggle span {
        width: 26px;
        height: 3px;
    }

    /* Ensure menu doesn't cause layout shift */
    .navbar {
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Prevent horizontal overflow globally */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Header Shadow on Scroll */
header.scrolled {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Optimize for mobile devices - reduce bandwidth */
@media (max-width: 768px) {
    /* Disable animations on mobile for better performance */
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Keep essential transitions */
    .mobile-menu-toggle span,
    .navbar {
        transition-duration: 0.3s !important;
    }
}

/* Fix for hamburger menu behavior */
.mobile-menu-toggle {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.navbar {
    will-change: transform;
    transform: translateZ(0);
}
