/* Premium Header Styles */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --dark-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-muted: #95a5a6;
    --accent-blue: #3498db;
    --accent-green: #2ecc71;
    --accent-red: #e74c3c;
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f8fafc 0%, #e8f4f8 100%);
}

/* Premium Header */
.premium-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: var(--transition);
    overflow: visible !important; /* Prevent internal scroll */
}

.premium-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-light);
}

.premium-nav {
    padding: 0;
    overflow: visible !important;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 2rem;
    overflow: visible !important;
}

/* Brand Section */
.brand-section {
    flex-shrink: 0;
}

.brand-link {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.brand-link:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-1px);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-circle {
    position: relative;
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
}

.logo-circle i {
    position: relative;
    z-index: 2;
}

.logo-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: -2px;
}

/* Main Navigation */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    color: var(--accent-blue);
    background: rgba(52, 152, 219, 0.1);
    text-decoration: none;
    transform: translateY(-1px);
}

.nav-link.active {
    color: white;
    background: var(--primary-gradient);
    box-shadow: var(--shadow-medium);
}

.nav-link i {
    font-size: 1rem;
    opacity: 0.8;
}

.nav-link:hover i,
.nav-link.active i {
    opacity: 1;
}

.nav-indicator {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 100%;
    height: 2px;
    background: var(--primary-gradient);
    transition: var(--transition);
}

.nav-link:hover .nav-indicator {
    transform: translateX(-50%) scaleX(1);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

/* Enhanced Search */
.search-section {
    position: relative;
}

.search-trigger {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 50%;
    color: var(--accent-blue);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-trigger:hover {
    background: var(--accent-blue);
    color: white;
    transform: scale(1.05);
}

/* Header Search Dropdown */
.header-search-container {
    position: relative;
}

.header-search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1001;
    max-height: 80vh;
    overflow: hidden;
}

.header-search-container.active .header-search-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(8px);
}

.header-search-dropdown .search-input-wrapper {
    position: relative;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.header-search-dropdown .search-icon {
    position: absolute;
    left: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-blue);
    z-index: 2;
}

.header-search-input {
    width: 100%;
    padding: 12px 50px 12px 45px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
    background: #f8f9fa;
}

.header-search-input:focus {
    border-color: var(--accent-blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-close {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-close:hover {
    background: var(--accent-red);
    color: white;
}

.header-search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.header-search-results:empty {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .header-search-dropdown {
        width: 320px;
        right: -60px;
    }
}

@media (max-width: 480px) {
    .header-search-dropdown {
        width: 280px;
        right: -120px;
    }
}

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    display: none;
    z-index: 9999;
    padding: 2rem;
}

.search-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.search-container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
    animation: searchSlideIn 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

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

.search-input-wrapper {
    position: relative;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
}

.search-icon {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-blue);
    font-size: 1.1rem;
    z-index: 2;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
    font-weight: 500;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.search-close {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.search-close:hover {
    background: var(--accent-red);
    color: white;
}

.search-results {
    background: white;
    max-height: 300px;
    overflow-y: auto;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.search-results:empty {
    display: none;
}

.search-result-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-result-item:hover {
    background: rgba(52, 152, 219, 0.05);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-icon {
    width: 32px;
    height: 32px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    font-size: 0.9rem;
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.search-result-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.search-suggestions {
    padding: 1.5rem;
    background: white;
}

.suggestion-category h6 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    padding: 0.4rem 0.8rem;
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-blue);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tag:hover {
    background: var(--accent-blue);
    color: white;
}

/* User Section */
.user-section {
    position: relative;
}

/* Auth Section for guests */
.auth-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.auth-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

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

.auth-btn.login-btn {
    background: transparent;
    color: var(--accent-blue);
    border: 2px solid var(--accent-blue);
}

.auth-btn.login-btn:hover {
    background: var(--accent-blue);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.auth-btn.register-btn {
    background: var(--primary-gradient);
    color: white;
    border: 2px solid transparent;
}

.auth-btn.register-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
    filter: brightness(1.1);
}

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

.user-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.user-trigger:hover {
    background: rgba(52, 152, 219, 0.1);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

.user-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--accent-green);
    border: 2px solid white;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-arrow {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: var(--transition);
}

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

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    overflow: hidden;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #f8fafc 0%, #e8f4f8 100%);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details h6 {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.user-details p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.user-dropdown .dropdown-menu {
    padding: 0.5rem 0;
    display: block !important;
    position: static !important;
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.user-dropdown .dropdown-item {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #2c3e50 !important;
    text-decoration: none !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    clear: both !important;
    white-space: nowrap !important;
}

.user-dropdown .dropdown-item:hover {
    background: rgba(52, 152, 219, 0.08) !important;
    color: #3498db !important;
    text-decoration: none !important;
}

.user-dropdown .dropdown-item i {
    width: 16px;
    font-size: 0.9rem;
    opacity: 0.7;
    text-align: center;
    flex-shrink: 0;
}

.user-dropdown .dropdown-item:hover i {
    opacity: 1;
    color: #3498db !important;
}

.user-dropdown .dropdown-divider {
    height: 1px !important;
    background: #f0f0f0 !important;
    margin: 0.5rem 0 !important;
    border: none !important;
    opacity: 1 !important;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    background: rgba(52, 152, 219, 0.1);
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

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

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

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

/* Mobile Styles */
@media (max-width: 991.98px) {
    .main-nav,
    .search-section,
    .auth-section,
    .user-menu {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .brand-subtitle {
        display: none;
    }
    
    .logo-circle {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .brand-title {
        font-size: 1.3rem;
    }
    
    .nav-wrapper {
        padding: 0.75rem 0;
    }
}

@media (max-width: 575.98px) {
    .brand-text {
        display: none;
    }
    
    .nav-wrapper {
        gap: 1rem;
    }
}