/* ========== 1. 全局变量与基础 ========== */
:root {
    --font-primary: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-tertiary: #94A3B8;
    --accent: #3B82F6;
    --gain: #6b8e6b;
    --loss: #c27878;
    --chart-accent: #b87333;
    --card-bg: #FFFFFF;
    --border: #E9E9E9;
    --row-hover: #F8FAFC;
    --card-hover: rgba(0,0,0,0.05);
    --danger: #EF4444;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --chart-grid: rgba(0, 0, 0, 0.08);
    font-size: 16px;
}

html {
    min-width: 320px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font-primary);
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 2. 全面重置 ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

ul,
ol {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========== 3. 导航栏组件 ========== */
.common-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.common-navbar.scrolled {
    background: #ffffff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1500px;
    margin: 0 auto;
    position: relative;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.nav-logo {
    height: 36px;
    width: auto;
}

.logo-span {
    color: #1E293B;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
    align-items: center;
}

.nav-links li a {
    font-weight: 500;
    font-size: 1.125rem;
    padding: 0.5rem 0;
    position: relative;
    color: #334155;
    text-decoration: none;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.nav-links li a:hover,
.nav-links li a.active,
.nav-links li.active a {
    color: #3B82F6;
}

#mobile-menu-btn {
    display: none;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.menu-icon rect,
.close-icon rect {
    fill: #9CA3AF;
}

.close-icon {
    display: none;
}

/* ======================
4. 页面布局（主容器与侧边栏）
   ====================== */
.main-container {
    padding-top: 80px;
    padding-left: 80px;
    min-height: 100vh;
    display: flex;
    transition: padding-left 0.3s ease;
}

.main-container:has(.sidebar-left.expanded) {
    padding-left: 160px;
}

/* 侧边栏 - 固定在左侧 */
.sidebar-left {
    position: fixed;
    top: 80px;
    left: 0;
    width: 80px;
    height: calc(100vh - 80px);
    border-right: 1px solid #E9E9E9;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 40;
    transition: width 0.3s ease;
    padding: 0.4rem;
}

.sidebar-left.expanded {
    width: 160px;
}

.sidebar-login {
    width: 100%;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid #D9D9D9;
}



.sidebar-left:not(.logged-in) .logged-in-view,
.sidebar-left.logged-in .logged-out-view {
    display: none;
}

.sidebar-left.logged-in .logged-in-view {
    display: flex;
}

.sidebar-left.expanded .logged-out-view {
    align-items: center;
}

.sidebar-left.expanded .logged-in-view {
    align-items: center;
    flex-direction: column;
}

.sidebar-left.expanded .logged-in-view .sidebar-item {
    width: auto;
    justify-content: center;
}

.sidebar-left:not(.expanded) .logged-in-view {
    flex-direction: row;
}

.sidebar-left:not(.expanded) .logged-in-view .item-text {
    display: none;
}

.sidebar-left.expanded .sidebar-login {
    align-items: center;
    padding-left: 15px;
}

.sidebar-left.expanded .sidebar-page {
    align-items: flex-start;
}

.sidebar-left.expanded .sidebar-item {
    justify-content: center;
}

.sidebar-left.expanded .sidebar-item .item-text {
    display: block;
    padding-left: 10px;
    text-align: left;
}

.sidebar-left:not(.expanded) .logged-in-view {
    flex-direction: row;
}

.sidebar-left:not(.expanded) .logged-in-view .item-text {
    display: none;
}

.sidebar-left.expanded .sidebar-login {
    align-items: flex-start;
    padding-left: 1.2rem;
}

.sidebar-left.expanded .sidebar-page {
    align-items: flex-start;
    padding-left: 1.2rem;
}

.sidebar-left.expanded .sidebar-item {
    width: auto;
    justify-content: center;
    padding-left: 0;
}

.sidebar-left.expanded .item-text {
    display: block;
}

.sidebar-left.expanded .sidebar-time {
    align-items: center;
}

.sidebar-left.expanded .logged-in-view {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-left:not(.expanded) .logged-in-view {
    flex-direction: column;
    justify-content: center;
    padding-left: 0;
    gap: 0.5rem;
}

.sidebar-page {
    flex: 1;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.sidebar-left svg {
    width: 20px;
    height: 20px;
}

.sidebar-item {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-item.active svg path,
.sidebar-item.active .item-text {
    fill: #3b82f6 !important;
    color: #3b82f6;
}

.item-text {
    display: none;
    color: #4C4C4C;
    padding: 0 1rem;
}

.sidebar-time {
    padding: 1rem 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.time-box {
    text-align: center;
}

.time-time {
    font-size: 1.4rem;
    font-weight: bold;
    color: #d8b4fe;
}

.time-date {
    font-size: 1rem;
    font-weight: bold;
    color: #000000;
}

/* --- 右侧主内容区 --- */
.main-right {
    flex: 1;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 0.5rem;
}

.main-titleText {
    font-size: 1rem;
    color: #64748B;
}

/* ========== 5. 底部 ========== */
.main-footer {
    width: 100%;
    display: flex;
    justify-content: center;
}

.footer-box {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    width: 95%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-copyright {
    font-size: 0.8125rem;
    color: #64748B;
}

.footer-icon {
    display: flex;
    gap: 1rem;
}

.footer-icon svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.footer-policy {
    font-size: 0.8125rem;
    color: #64748B;
}

/* ========== 6. 响应式布局 ========== */
@media (max-width: 768px) {
    .navbar-container {
        padding: 0.8rem 1.2rem;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.5);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .nav-links.show-nav {
        max-height: 400px;
        padding: 1rem 1.2rem;
        background: #ffffff;
    }

    .nav-links li a {
        font-size: 1.15rem;
        color: #1E293B;
        display: block;
        padding: 12px 0;
    }

    .logo-link {
        font-size: 1.5rem;
        gap: 8px;
    }

    .nav-logo {
        height: 28px;
    }

    .sidebar-left {
        display: none;
    }

    #mobile-menu-btn {
        display: block;
        margin-left: auto;
    }
}

@media (max-width: 600px) {
    .main-container {
        padding-left: 0;
        padding-top: 70px;
    }

    .sidebar-left {
        display: none;
    }

    .main-footer {
        margin-top: auto;
    }

    .footer-box {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 1.2rem 1rem;
        text-align: center;
    }

    .footer-copyright,
    .footer-policy {
        font-size: 0.75rem;
    }

    .footer-icon {
        gap: 1.5rem;
    }
}