/* Unified Header Style (all public pages) */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    padding: 0 clamp(14px, 3vw, 3%);
    background: transparent;
    border-bottom: 1px solid transparent;
    box-shadow: none;
    backdrop-filter: none;
    animation: headerIntro 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    transition: padding 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.header::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(1000px 120px at -10% -20%, rgba(0, 168, 225, 0.22), transparent 55%),
        radial-gradient(900px 140px at 110% -40%, rgba(255, 255, 255, 0.1), transparent 56%);
    opacity: 0;
    pointer-events: none;
    animation: headerBeam 6.5s ease-in-out infinite;
    transition: opacity 0.28s ease;
}

.header.scrolled {
    padding-top: 0;
    padding-bottom: 0;
}

.header.scrolled::before {
    opacity: 0.76;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1920px;
    margin: 0 auto;
    height: 70px;
    position: relative;
    z-index: 1;
    gap: 14px;
    border-radius: 0;
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
    padding: 0 8px;
    backdrop-filter: none;
    transition:
        height 0.28s ease,
        width 0.28s ease,
        max-width 0.28s ease,
        border-radius 0.28s ease,
        border-color 0.28s ease,
        box-shadow 0.28s ease,
        padding 0.28s ease,
        background 0.28s ease;
}

.header.scrolled .header-content {
    height: 64px;
    width: calc(100% - clamp(24px, 4vw, 110px));
    max-width: 1820px;
    margin: 0 auto;
    padding: 0 16px;
    border-radius: 0 0 12px 12px;
    border-color: rgba(0, 168, 225, 0.24);
    background:
        radial-gradient(100% 220% at 50% -130%, rgba(0, 168, 225, 0.26), rgba(0, 168, 225, 0) 48%),
        linear-gradient(180deg, rgba(10, 16, 28, 0.96) 0%, rgba(8, 13, 24, 0.93) 100%);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px) saturate(140%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--prime-text, #fff);
    font-size: 20px;
    font-weight: 700;
    position: relative;
    transition: transform 0.22s ease;
}

.logo img {
    display: block;
    width: 110px;
    filter: drop-shadow(0 6px 16px rgba(0, 168, 225, 0.18));
    transition: transform 0.22s ease, filter 0.22s ease;
}

.logo:hover img {
    transform: translateY(-1px) scale(1.02);
    filter: drop-shadow(0 8px 22px rgba(0, 168, 225, 0.3));
}

.nav-menu {
    display: flex;
    gap: 24px;
    list-style: none;
    margin-left: 24px;
}

.nav-menu a {
    position: relative;
    color: var(--prime-text, #fff);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: color 0.22s ease, text-shadow 0.22s ease;
    padding: 8px 0;
    display: block;
}

.nav-menu a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -10px;
    width: 100%;
    height: 2px;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(0, 168, 225, 0.25), rgba(0, 168, 225, 0.9), rgba(167, 240, 255, 0.8));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.24s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #d7f6ff;
    text-shadow: 0 0 18px rgba(0, 168, 225, 0.35);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    transform: scaleX(1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 36px;
    padding-left: 8px;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 530px;
    margin: 0 12px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.search-input-wrapper:hover {
    border-color: rgba(0, 168, 225, 0.36);
}

.search-input-wrapper:focus-within {
    border-color: rgba(0, 168, 225, 0.74);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 4px rgba(0, 168, 225, 0.12), 0 10px 26px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.search-input {
    width: 100%;
    padding: 11px 42px 11px 16px;
    background: transparent;
    border: none;
    border-radius: 14px;
    color: var(--prime-text, #fff);
    font-size: 15px;
    outline: none;
    transition: color 0.22s ease;
}

.search-input::placeholder {
    color: #95a0ac;
}

.search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--prime-text-secondary, #aaa);
    font-size: 14px;
    pointer-events: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.search-input:focus ~ .search-icon {
    color: var(--prime-blue, #00a8e1);
    transform: translateY(-50%) scale(1.08);
}

.search-input-wrapper:hover .search-icon {
    color: #a7f0ff;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 1210;
    display: block;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.985);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.user-dropdown-menu { z-index: 1215; }
.notification-dropdown { z-index: 1216; }
.mobile-menu-btn { z-index: 1220; }
.mobile-nav-overlay { z-index: 1300; }
.mobile-nav-menu { z-index: 1301; }
.mobile-search-overlay { z-index: 1302; }

.mobile-menu-btn,
.mobile-search-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: var(--prime-text, #fff);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.mobile-menu-btn:hover,
.mobile-search-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 168, 225, 0.55);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    margin: 4px 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

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

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

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

.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav-menu {
    display: none;
    position: fixed;
    top: 0;
    left: -320px;
    width: min(82vw, 300px);
    height: 100dvh;
    padding: 84px 14px 16px;
    background: linear-gradient(180deg, rgba(7, 12, 20, 0.98) 0%, rgba(7, 12, 20, 0.95) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 22px 0 46px rgba(0, 0, 0, 0.5);
    transition: left 0.28s ease;
    overflow-y: auto;
}

.mobile-nav-menu.active {
    left: 0;
}

.mobile-nav-menu .nav-item + .nav-item {
    margin-top: 8px;
}

.mobile-nav-menu .nav-item a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border-radius: 10px;
    color: var(--prime-text, #fff);
    text-decoration: none;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.mobile-nav-menu .nav-item a:hover,
.mobile-nav-menu .nav-item a.active {
    background: rgba(0, 168, 225, 0.14);
    border-color: rgba(0, 168, 225, 0.42);
}

.mobile-nav-menu .nav-item i {
    color: #9fcde0;
    width: 18px;
    text-align: center;
}

.mobile-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s ease;
    padding: 68px 14px 16px;
}

.mobile-search-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-search-container {
    max-width: 720px;
    margin: 0 auto;
}

.mobile-search-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.mobile-search-close {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: var(--prime-text, #fff);
    cursor: pointer;
}

.mobile-search-input {
    width: 100%;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(11, 17, 27, 0.92);
    color: var(--prime-text, #fff);
    padding: 0 14px;
    font-size: 15px;
    outline: none;
}

.mobile-search-input:focus {
    border-color: rgba(0, 168, 225, 0.65);
    box-shadow: 0 0 0 3px rgba(0, 168, 225, 0.18);
}

.mobile-search-results {
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
    border-radius: 12px;
    background: rgba(8, 12, 19, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-search-results .search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.mobile-search-results .search-result-item:last-child {
    border-bottom: 0;
}

.mobile-search-results .search-result-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.mobile-search-results .search-result-poster {
    width: 42px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
}

.mobile-search-results .search-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
}

.mobile-search-results .search-result-title {
    font-size: 14px;
    color: var(--prime-text, #fff);
    font-weight: 600;
}

.mobile-search-results .search-result-meta {
    margin-top: 3px;
    font-size: 12px;
    color: var(--prime-text-secondary, #aaa);
}

.mobile-search-results .search-section-title {
    padding: 10px 14px 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--prime-text-secondary, #aaa);
    font-size: 11px;
    font-weight: 700;
}

.mobile-search-results .search-empty,
.mobile-search-results .search-loading {
    padding: 20px;
    text-align: center;
    color: var(--prime-text-secondary, #aaa);
}

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

@keyframes headerBeam {
    0% { opacity: 0.62; transform: translateX(0); }
    50% { opacity: 0.88; transform: translateX(10px); }
    100% { opacity: 0.62; transform: translateX(0); }
}

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

    .header-content {
        height: 56px;
        padding: 0;
        gap: 8px;
    }

    .header.scrolled .header-content {
        width: 100%;
        max-width: 1920px;
        height: 56px;
        padding: 0;
        border-radius: 0;
        border-color: transparent;
        background: linear-gradient(180deg, rgba(6, 10, 18, 0.94) 0%, rgba(6, 10, 18, 0.92) 100%);
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.44);
        backdrop-filter: blur(12px) saturate(130%);
    }

    .logo {
        z-index: 1220;
        margin-right: auto;
    }

    body.has-mobile-header .header-content nav,
    body.has-mobile-header .header-content .nav-menu,
    body.has-mobile-header .header-content .search-container {
        display: none;
    }

    body.has-mobile-header .header-content .mobile-menu-btn,
    body.has-mobile-header .header-content .mobile-search-btn {
        display: inline-flex;
    }

    .mobile-nav-overlay,
    .mobile-nav-menu,
    .mobile-search-overlay {
        display: block;
    }

    .header-actions {
        gap: 8px;
        min-width: 0;
        padding-left: 0;
    }

    .header-actions .login-btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    .header-actions .user-avatar {
        width: 32px;
        height: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header,
    .header::before,
    .nav-menu a,
    .nav-menu a::after,
    .search-input-wrapper,
    .search-icon,
    .search-dropdown,
    .mobile-menu-btn,
    .mobile-search-btn {
        animation: none !important;
        transition: none !important;
    }
}
