/*
 * Header, Navigation, and Profile Dropdown Styles
 */

/* --- CORE LAYOUT & HERO STYLES --- */
.universe-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    text-align: center;
    padding: 120px 20px 20px;
}

.hero-section h1 {
    font-size: 4rem;
    margin: 0;
    color: #fff;
}

.hero-section p {
    font-size: 1.2rem;
    color: #ccc;
}

.content-section {
    padding: 100px 20px;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.content-section .section-icon,
.content-section h2,
.content-section p {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.content-section.is-visible .section-icon {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}

.content-section.is-visible h2 {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.content-section.is-visible p {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}


/* --- HEADER CONTAINER & NAVIGATION --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 40px;
    background-color: transparent;
    border-bottom: 1px solid transparent;
    transition: padding 0.35s ease, background-color 0.35s ease, border-color 0.35s ease;
    box-sizing: border-box;
    pointer-events: none;
}

.site-header.scrolled {
    padding: 15px 40px;
    background-color: transparent;
    border-bottom-color: transparent;
}
/* Three separate containers when scrolled (universe theme) */
.site-header.scrolled .header-left,
.site-header.scrolled .header-center,
.site-header.scrolled .header-right {
    background-color: rgba(15, 17, 26, 0.5);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(0) scale(1);
    opacity: 1;
}
.site-header.scrolled .header-center {
    padding-left: 24px;
    padding-right: 24px;
}

@media (max-width: 768px) {
    .header-left,
    .header-center,
    .header-right {
        border-radius: 12px;
        padding: 8px 14px;
    }
    .header-center {
        padding-left: 16px;
        padding-right: 16px;
    }
    .site-header.scrolled .header-left,
    .site-header.scrolled .header-center,
    .site-header.scrolled .header-right {
        padding: 8px 14px;
    }
    .site-header.scrolled .header-center {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header,
    .header-left,
    .header-center,
    .header-right {
        transition: none !important;
        transform: none !important;
    }
}

.site-header nav {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease;
}

.header-left,
.header-center,
.header-right {
    /* Keep stable rounded geometry to avoid rectangular flash */
    flex: 0 0 auto;
    width: fit-content;
    pointer-events: auto;
    padding: 10px 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    background-color: rgba(15, 17, 26, 0);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    backdrop-filter: blur(10px);
    transform: translateY(-2px) scale(0.985);
    opacity: 0.96;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease,
        background-color 0.28s ease, border-color 0.28s ease, box-shadow 0.35s ease;
    will-change: transform, opacity;
}

.header-center {
    text-align: center;
    padding-left: 24px;
    padding-right: 24px;
}

.header-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    box-sizing: border-box;
}

.site-header nav a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    padding: 5px 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.site-header nav a:hover {
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.site-header .site-title {
    font-weight: bold;
    font-size: 1.5rem;
    text-transform: none;
    letter-spacing: 0;
    padding: 0;
}


/* --- LOGO STYLES --- */
.site-logo {
    height: 56px;
    width: auto;
    display: block;
    transition: height 0.4s ease, filter 0.4s ease;
    filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
}

.site-title:hover .site-logo {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.7));
}


/* --- INTERACTIVE PROFILE DROPDOWN --- */
#header-user-profile {
    position: relative;
}

#header-login-button {
    color: #fff;
    background-color: #4a90e2;
    padding: 8px 18px;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
}

#header-login-button:hover {
    background-color: #5aa1f2;
}

.header-profile-button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 0;
    background: none;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    position: relative;  
}

.header-profile-button:hover,
.header-profile-button[aria-expanded="true"] {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.6);
}

#header-profile-picture {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* --- NEW: V2 Profile Dropdown Card --- */
.profile-dropdown-v2 {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 300px; /* Wider */
    background: rgba(21, 24, 38, 0.9); /* More opaque */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    padding: 0; /* Remove padding */
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    overflow: hidden; /* To clip the rounded corners */
}

.profile-dropdown-v2.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 1. Header */
.pd-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.pd-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
}
.pd-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* for text-overflow */
}
.pd-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pd-status {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 2. Body (Status Toggles) */
.pd-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.pd-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
/* Disabled state for the row */
.pd-status-row.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.pd-status-row.is-disabled .pd-status-label {
    cursor: not-allowed;
}

.pd-status-label {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}
.pd-status-label .label-title {
    font-size: 0.95rem;
    color: #fff;
    font-weight: 500;
}
.pd-status-label .label-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

/* 3. Footer (Links) */
.pd-footer {
    padding: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}
.pd-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    color: #ccc;
    text-decoration: none;
    background: none;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    box-sizing: border-box;
}
.pd-link-item .material-symbols-outlined {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s;
}
.pd-link-item:hover {
    background-color: rgba(74, 144, 226, 0.3);
    color: #fff;
}
.pd-link-item:hover .material-symbols-outlined {
    color: #fff;
}

.pd-link-item.is-logout {
    color: #f56c6c;
}
.pd-link-item.is-logout .material-symbols-outlined {
    color: #f56c6c;
}
.pd-link-item.is-logout:hover {
    background-color: rgba(220, 53, 69, 0.3);
    color: #fff;
}
.pd-link-item.is-logout:hover .material-symbols-outlined {
    color: #fff;
}

/* --- UI IMPROVEMENTS --- */
body.account-page-body #logout-button {
    display: none;
}
/* Prevent Auth Flicker in Header */
/* Initially, hide both controls to prevent flicker */
.auth-state-unknown #header-logged-out-links,
.auth-state-unknown #header-user-profile {
    display: none;
}
/* Reserve width only while auth is loading (avoids center nav jump); logged-in/out = fit bell + avatar */
.auth-state-unknown .header-right {
    min-width: 11rem;
    box-sizing: border-box;
}
@media (max-width: 768px) {
    .auth-state-unknown .header-right {
        min-width: 8rem;
    }
}

/* When logged in, SHOW the profile and HIDE the login button */
.auth-logged-in #header-user-profile {
    display: block;
}
.auth-logged-in #header-logged-out-links {
    display: none;
}

/* When logged out, SHOW the login button and HIDE the profile */
.auth-logged-out #header-logged-out-links {
    display: block;
}
.auth-logged-out #header-user-profile {
    display: none;
}

/* --- Universal Themed Scrollbar --- */

/* Firefox Fallback */
html {
    scrollbar-width: thin;
    scrollbar-color: #4a5568 rgba(0, 0, 0, 0.2);
}

/* WebKit Browsers (Chrome, Safari, Edge, etc.) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px; /* For horizontal scrollbars */
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background-color: #4a5568;
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #4a90e2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


/* --- NEW: Header Profile Status Dot --- */
#header-profile-status-dot {
    position: absolute;
    bottom: -2px; /* Adjusted for smaller icon */
    right: -2px; /* Adjusted for smaller icon */
    width: 15px; /* Resized from 20px */
    height: 15px; /* Resized from 20px */
    border-radius: 50%;
    border: 2px solid #0f111a; /* Matches the theme background */
    background-color: #6c757d; /* Default: Offline (grey) */
    transition: background-color 0.3s ease;
}

#header-profile-status-dot.online {
    background-color: #28a745; /* Green */
}
#header-profile-status-dot.afk {
    background-color: #fd7e14; /* Orange */
}
#header-profile-status-dot.busy {
    background-color: #f56c6c; /* Red */
}
#header-profile-status-dot.offline {
    background-color: #6c757d; /* Grey */
}

/* --- NEW: V2 Dropdown Toggle Switch Styles --- */
.dropdown-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.dropdown-toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 28px;
    transition: .4s;
}

.dropdown-toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

/* Checked state */
.dropdown-toggle-switch input:checked + .slider {
    background-color: #4a90e2;
}

.dropdown-toggle-switch input:checked + .slider:before {
    transform: translateX(22px);
}

/* Disabled state (applies to the visual slider) */
.pd-status-row.is-disabled .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Screen-reader only class --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}