/* ============================================================
   SpinMac CN — Shared Utility Stylesheet
   Covers: base reset, nav-bar, mobile menu, dropdown, scrollbar
   Colors match the blue/white corporate theme in components.js.
   ============================================================ */

/* ---- Base reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; }
button { font-family: inherit; }

/* ---- Utility ---- */
.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Nav bar base ----
   components.js re-declares these with !important, so this
   only sets the initial state before JS is parsed (no flash). */
.nav-bar {
    position: fixed; top: 0; left: 0; right: 0; width: 100%; z-index: 1000;
    height: 64px;
    background: rgba(255,255,255,0.82);
    border-bottom: 1px solid transparent;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.nav-bar.nav-scrolled {
    background: rgba(255,255,255,0.97);
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 2px 16px rgba(0,0,0,0.05);
}

/* Nav link base */
.nav-link {
    color: #404040;
    font-weight: 500;
    font-size: 0.88rem;
    border-radius: 8px;
    padding: 7px 14px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.18s ease, color 0.18s ease;
    display: inline-block;
}
.nav-link:hover { background: #f5f5f7; color: #0d0d0d; }
.nav-link.nav-active {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #bfdbfe;
    font-weight: 700;
}

/* Mobile nav links */
.mobile-nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #404040;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.mobile-nav-link:hover { background: #f5f5f7; color: #0d0d0d; }

.mobile-lang-item {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #404040;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.mobile-lang-item:hover { background: #f5f5f7; color: #0d0d0d; }

/* Nav dropdown panel */
.nav-dropdown-panel {
    position: absolute;
    top: calc(100% + 6px);
    border-radius: 12px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 12px 40px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05);
    padding: 5px 0;
    background: #fff;
    display: none;
    min-width: 160px;
    z-index: 100;
}
.nav-dropdown-panel.open { display: block; }

.nav-dd-lang-item {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    margin: 2px 5px;
    width: calc(100% - 10px);
    color: #404040;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-dd-lang-item:hover { background: #f5f5f7; color: #0d0d0d; }

/* Header placeholder spacer (matches nav height) */
#header-placeholder { height: 64px; flex-shrink: 0; }

/* ---- Shared user pill (nav + console top bar) ---- */
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #5a6578;
    padding: 5px 12px 5px 5px;
    background: #f8f9fc;
    border: 1px solid rgba(15, 20, 25, 0.08);
    border-radius: 999px;
}

.user-pill__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0052D9 0%, #1a6bff 100%);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 82, 217, 0.18);
}

.user-pill__label {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.user-pill--link {
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

a.user-pill--link:hover {
    box-shadow: 0 2px 8px rgba(15, 20, 25, 0.05);
    border-color: rgba(15, 20, 25, 0.12);
}

.user-pill--mobile {
    width: fit-content;
    max-width: 100%;
}

/* Scrollbar */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(37,99,235,0.22); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(37,99,235,0.42); }
