/* ============================================================
   学途 · 应用外壳
   侧栏 / 顶栏 / 内容区 / 头像面板 / 主题选择器。

   注意：安静皮肤下这些样式大部分会被 skin-quiet.css 覆盖
   （深色侧栏 → 白底、玻璃拟态 → 扁平胶囊）。
   本文件保留原样是为了「一行切回旧皮肤」的回滚能力。
   ============================================================ */

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--logo-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: var(--logo-shadow);
    flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-title { color: #fff; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.logo-sub { color: var(--muted); font-size: 0.7rem; opacity: 0.7; letter-spacing: 0.05em; text-transform: uppercase; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.nav-section-label {
    padding: 20px 20px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(199, 210, 254, 0.4);
}

.nav-menu { list-style: none; padding: 0 8px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 6px 0;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 450;
    border-radius: 14px;
    color: var(--muted);
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255,255,255,0.20) 0%, rgba(255,255,255,0.08) 40%, rgba(255,255,255,0.02) 100%);
    border: 1px solid rgba(255,255,255,0.10);
    border-top: 1px solid rgba(255,255,255,0.25);
    border-bottom: 1px solid rgba(0,0,0,0.35);
    box-shadow: 0 4px 16px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.15);
}

.nav-item:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.16) 40%, rgba(255,255,255,0.06) 100%);
    border-color: rgba(255,255,255,0.22);
    border-top-color: rgba(255,255,255,0.40);
    border-bottom-color: rgba(0,0,0,0.45);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.20);
    color: #fff;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(39, 123, 146,0.45) 0%, rgba(39, 123, 146,0.20) 40%, rgba(39, 123, 146,0.06) 100%);
    color: #fff;
    font-weight: 550;
    border-color: rgba(39, 123, 146,0.40);
    border-top-color: rgba(255,255,255,0.30);
    border-bottom-color: rgba(0,0,0,0.35);
    box-shadow: 0 8px 28px rgba(39, 123, 146,0.35), inset 0 1px 0 rgba(255,255,255,0.20);
}

.nav-item.active .nav-icon {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 16px rgba(39, 123, 146,0.60), inset 0 1px 0 rgba(255,255,255,0.22);
}

.nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

.nav-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;

    height: 0;
    background: var(--brand-soft);
    border-radius: 3px;
    transition: height 0.3s;
}

.nav-item.active .nav-indicator { height: 20px; }

.sidebar-footer {
    margin-top: auto;
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-footer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: rgba(199, 210, 254, 0.5);
}

.online-dot { font-size: 0.5rem; color: var(--green); animation: pulse 2s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 用户信息区域 */
.sidebar-footer-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: rgba(199, 210, 254, 0.7);
    font-size: 0.7rem;
    margin-top: 2px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    transform: scale(1.05);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
}

/* ============================================
   Main Content
   ============================================ */
/* 外壳：正好一屏高，滚动只发生在 .content-area 里。
   注意这里是 height 不是 min-height —— 用 min-height 的话容器会随内容长高，
   页面就得各自去写 `calc(100vh - 140px)` 这种手量出来的数字（历史上就是那么干的，
   7 处魔法数字各不相同：140/160/180，窗口一矮全部失准）。 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--canvas);
}

/* Top Bar */
.top-bar {
    background: var(--topbar-bg);
    backdrop-filter: var(--topbar-blur);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--muted);
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    transition: var(--transition);
}

.menu-toggle:hover { background: var(--line); }

.page-title-wrap { flex: 1; }
.page-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.page-subtitle { font-size: 0.8rem; color: var(--faint); margin-top: 2px; }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--canvas);
    border-radius: 100px;
    border: 1px solid var(--line);
    transition: var(--transition);
}

.header-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

.header-search i { color: var(--faint); font-size: 0.8rem; }

.header-search input {
    border: none;
    background: none;
    font-size: 0.825rem;
    font-family: inherit;
    outline: none;
    width: 160px;
    color: var(--ink);
}

.header-search { position: relative; }

.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    box-shadow: var(--sh);
    z-index: 1000;
    max-height: 360px;
    overflow-y: auto;
    min-width: 280px;
}

.search-dropdown.active { display: block; }

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--line);
}

.search-item:last-child { border-bottom: none; }

.search-item:hover { background: var(--brand-tint); }

.search-item-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--brand-tint);
    display: flex; align-items: center; justify-content: center;
    color: var(--brand);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.search-item-info {
    flex: 1;
    min-width: 0;
}

.search-item-title {
    font-weight: 600;
    font-size: 0.84rem;
    color: var(--ink);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-sub {
    font-size: 0.75rem;
    color: var(--faint);
}

.search-item-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 100px;
    background: var(--canvas);
    color: var(--faint);
    flex-shrink: 0;
}

.search-empty {
    padding: 24px;
    text-align: center;
    color: var(--faint);
    font-size: 0.84rem;
}

.header-time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--faint);
    font-size: 0.825rem;
    font-weight: 500;
}

.header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--brand);
    background: var(--brand-tint);
    cursor: pointer;
    transition: var(--transition);
}

.header-avatar:hover { box-shadow: 0 0 0 3px var(--brand-tint); }

/* ============================================
   Avatar Dropdown — 个人信息面板
   ============================================ */
.avatar-dropdown {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--sh);
    min-width: 260px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.avatar-dropdown.active {
    display: block;
    animation: slideUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-dropdown-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--canvas), var(--surface));
}

.avatar-dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--brand);
    flex-shrink: 0;
}

.avatar-dropdown-user {
    flex: 1;
    min-width: 0;
}

.avatar-dropdown-name {
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avatar-dropdown-role {
    font-size: 0.72rem;
    color: var(--faint);
    margin-top: 2px;
}

.avatar-dropdown-divider {
    height: 1px;
    background: var(--line);
    margin: 0;
}

.avatar-dropdown-info {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avatar-info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.avatar-info-label {
    font-size: 0.8rem;
    color: var(--faint);
    font-weight: 500;
}

.avatar-info-value {
    font-size: 0.85rem;
    font-weight: 650;
    color: var(--ink);
}

.avatar-info-value.balance {
    color: var(--green);
    font-weight: 700;
}

.avatar-info-value.points {
    color: var(--brand);
    font-weight: 600;
}

.avatar-dropdown-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--faint);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.avatar-dropdown-logout:hover {
    background: var(--red-soft);
    color: var(--red);
}

.avatar-dropdown-loading {
    padding: 24px;
    text-align: center;
    color: var(--faint);
    font-size: 0.84rem;
}

/* 主题选择器 */
.theme-selector {
    position: relative;
}

.theme-btn {
    background: none;
    border: none;
    color: var(--muted);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn:hover {
    background: var(--brand-tint);
    color: var(--brand);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border-radius: var(--r);
    box-shadow: var(--sh);
    border: 1px solid var(--line);
    padding: 12px;
    min-width: 200px;
    display: none;
    z-index: 1000;
    animation: slideUp 0.2s ease;
}

.theme-dropdown.active {
    display: block;
}

.theme-dropdown-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.theme-option {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    border: 2px solid var(--line);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.theme-option:hover {
    transform: scale(1.1);
    box-shadow: var(--sh);
}

.theme-option.active {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-tint);
}

.theme-option.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 配色色块 —— 每个调色板的主色 → 副色 */
.theme-option[data-palette="qing"]  { background: linear-gradient(135deg, #277b92, #6ba6be); }
.theme-option[data-palette="zhu"]   { background: linear-gradient(135deg, #4b6a3b, #7e9e6a); }
.theme-option[data-palette="xiang"] { background: linear-gradient(135deg, #856012, #ddb44a); }
.theme-option[data-palette="ou"]    { background: linear-gradient(135deg, #8a5670, #c79baf); }
.theme-option[data-palette="dai"]   { background: linear-gradient(135deg, #544874, #7b6e9b); }

/* 明暗切换（柔和暮色，非真暗色） */
.theme-option[data-mode="light"] { background: linear-gradient(135deg, #ffffff, #f7f9f8); border-color: var(--line-2); }
.theme-option[data-mode="dark"]  { background: linear-gradient(135deg, #cdd8d4, #e8eeec); }

/* 选中勾：白勾 + 深色描边阴影 —— 这样在浅色块上（白天）也看得见 */
.theme-option.active::after {
    text-shadow: 0 0 3px rgba(47,52,55,0.75), 0 1px 2px rgba(47,52,55,0.5);
}

/* 唯一的滚动区。
   min-height:0 是必须的：flex 子项默认 min-height:auto 会撑到内容高度，
   那样容器又变成「随内容长高」，滚动条就不出现了。 */
.content-area {
    padding: 28px 32px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Site Footer（页脚备案号） */
.site-footer {
    padding: 12px 32px;
    text-align: center;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: .78rem;
    background: var(--canvas);
}
.site-footer a {
    color: var(--faint);
    text-decoration: none;
}
.site-footer a:hover {
    color: var(--ink);
}
