/*
 * Modern Header Styles - GoodShort Style
 * Version: 1.0.0
 */

/* Header Variables */
:root {
    --header-height: 70px;
    --header-bg: #ffffff;
    --header-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --brand-color: #e11d48;
    --nav-link-color: #374151;
    --nav-link-hover: #e11d48;
    --search-bg: #f9fafb;
    --search-border: #e5e7eb;
    --dropdown-bg: #ffffff;
    --dropdown-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    --mobile-overlay-bg: rgba(0, 0, 0, 0.5);
}

/* Dark mode variables */
[data-theme="dark"] {
    --header-bg: #1f2937;
    --nav-link-color: #f3f4f6;
    --search-bg: #374151;
    --search-border: #4b5563;
    --dropdown-bg: #374151;
}

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

/* Modern Header */
.modern-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--header-bg);
    box-shadow: var(--header-shadow);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* Logo Section */
.logo-section {
    flex-shrink: 0;
}

.logo-link {
    text-decoration: none;
    display: block;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.play-icon {
    width: 32px;
    height: 32px;
    color: var(--brand-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--nav-link-color);
    margin: 0;
}

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

.nav-list {
    display: flex;
    align-items: center;
    gap: 40px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--nav-link-color);
    text-decoration: none;
    transition: color 0.2s ease;
    border-bottom: 2px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: var(--nav-link-hover);
    border-bottom-color: var(--nav-link-hover);
}

/* Dropdown Menu */
.has-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dropdown-bg);
    border-radius: 12px;
    box-shadow: var(--dropdown-shadow);
    padding: 20px;
    min-width: 300px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 10px;
    border: 1px solid var(--search-border);
}

.has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}

.dropdown-content {
    width: 100%;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--nav-link-color);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.category-link:hover {
    background-color: var(--search-bg);
    color: var(--nav-link-hover);
}

.category-link i {
    font-size: 14px;
    color: var(--brand-color);
}

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

/* Search Container */
.search-container {
    position: relative;
}

.search-form {
    margin: 0;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 300px;
    height: 40px;
    padding: 0 40px 0 16px;
    border: 1px solid var(--search-border);
    border-radius: 20px;
    background: var(--search-bg);
    font-size: 14px;
    color: var(--nav-link-color);
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.search-btn:hover {
    background-color: var(--search-bg);
    color: var(--brand-color);
}

/* Following Button */
.following-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--search-border);
    border-radius: 20px;
    color: var(--nav-link-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.following-btn:hover {
    border-color: var(--brand-color);
    color: var(--brand-color);
}

/* Language Switcher */
.language-switcher {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 20px;
    color: var(--nav-link-color);
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.lang-btn:hover {
    background-color: var(--search-bg);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--dropdown-bg);
    border-radius: 8px;
    box-shadow: var(--dropdown-shadow);
    padding: 8px;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 10px;
    border: 1px solid var(--search-border);
}

.language-switcher:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}

.lang-option {
    display: block;
    padding: 8px 12px;
    color: var(--nav-link-color);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.lang-option:hover {
    background-color: var(--search-bg);
    color: var(--brand-color);
}

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

.login-btn {
    padding: 8px 20px;
    background: var(--brand-color);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.login-btn:hover {
    background: #be123c;
    transform: translateY(-1px);
}

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

.user-btn {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.user-btn:hover {
    background-color: var(--search-bg);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--search-border);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--dropdown-bg);
    border-radius: 12px;
    box-shadow: var(--dropdown-shadow);
    padding: 16px;
    min-width: 250px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 10px;
    border: 1px solid var(--search-border);
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    flex: 1;
}

.user-name {
    display: block;
    font-weight: 600;
    color: var(--nav-link-color);
    margin-bottom: 2px;
}

.user-email {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.dropdown-divider {
    height: 1px;
    background: var(--search-border);
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    color: var(--nav-link-color);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--search-bg);
    color: var(--brand-color);
}

.dropdown-item i {
    width: 16px;
    font-size: 14px;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    gap: 4px;
}

.hamburger {
    width: 20px;
    height: 2px;
    background: var(--nav-link-color);
    transition: all 0.3s ease;
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mobile-overlay-bg);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.mobile-nav {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: #ffffff !important; /* 确保白色背景 */
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1); /* 增加阴影 */
    border-left: 1px solid #e0e0e0; /* 添加左边框 */
    padding: 20px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

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

.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--search-border);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-logo .play-icon {
    width: 24px;
    height: 24px;
}

.mobile-logo .logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #333333 !important; /* 确保深色文字 */
}

.mobile-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #333333 !important; /* 确保深色文字 */
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.mobile-close:hover {
    background-color: var(--search-bg);
}

.mobile-navigation {
    margin-bottom: 30px;
}

.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-list li {
    margin-bottom: 8px;
}

.mobile-nav-link {
    display: block;
    padding: 12px 16px;
    color: #333333 !important; /* 确保深色文字 */
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background-color: #f8f9fa !important; /* 浅灰色悬停背景 */
    color: #007bff !important; /* 蓝色悬停文字 */
}

.mobile-user-section {
    padding-top: 20px;
    border-top: 1px solid var(--search-border);
}

.mobile-login-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: var(--brand-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.mobile-login-btn:hover {
    background: #be123c;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .search-input {
        width: 250px;
    }
    
    .nav-list {
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
    }
    
    .search-container {
        display: none;
    }
    
    .following-btn {
        display: none;
    }
    
    .language-switcher {
        display: none;
    }
    
    .mobile-toggle {
        display: flex;
    }
    
    .header-actions {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 16px;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .mobile-nav {
        width: 280px;
    }
}

/* Smooth scrolling offset for fixed header */
html {
    scroll-padding-top: var(--header-height);
}

body {
    padding-top: var(--header-height);
}

/* Animation for mobile hamburger */
.mobile-toggle.active .hamburger:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

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

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

/* Focus styles for accessibility */
.nav-link:focus,
.search-input:focus,
.lang-btn:focus,
.user-btn:focus,
.login-btn:focus {
    outline: 2px solid var(--brand-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --header-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --dropdown-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    }
}

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