/* ========== 全局样式 ========== */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-tertiary: #f9fafb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #eff6ff;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* 后台布局 */
.app-wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .link-text { display: none; }
.sidebar.collapsed .sidebar-logo { width: 40px; margin: 0 auto; }
.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-logo { width: 220px; height: 60px; object-fit: contain; }
.sidebar-title { font-size: 16px; font-weight: 600; flex: 1; white-space: nowrap; }
.sidebar-toggle {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: var(--text-secondary); padding: 4px;
}
.sidebar-nav { padding: 16px 0; }
.sidebar-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 20px;
    color: var(--text-secondary); text-decoration: none; transition: all 0.2s;
}
.sidebar-link:hover { background-color: var(--bg-secondary); color: var(--primary-color); }
.sidebar-link.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}
.link-icon { font-size: 20px; width: 24px; text-align: center; }
.link-text { font-size: 14px; font-weight: 500; white-space: nowrap; }
.logout-link { margin-top: 20px; border-top: 1px solid var(--border-color); color: var(--danger-color); }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed-width); }

.top-bar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 99;
}
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.mobile-menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-secondary); }
.page-title { font-size: 20px; font-weight: 600; }
.top-bar-right { display: flex; align-items: center; gap: 20px; }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.username { font-weight: 500; }
.balance {
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}
.theme-switch {
    background: none; border: none; font-size: 20px; cursor: pointer;
    padding: 8px; border-radius: 50%; transition: background 0.2s;
}
.theme-switch:hover { background-color: var(--bg-secondary); }

.content-area { flex: 1; padding: 24px; }

.footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.footer-logo { display: flex; align-items: center; gap: 8px; }
.footer-logo img { height: 24px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--primary-color); }

/* 前台首页 */
.front-container { min-height: 100vh; display: flex; flex-direction: column; }
.front-header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo-area { display: flex; align-items: center; gap: 12px; }
.logo { height: 40px; }
.site-name { font-size: 20px; font-weight: 600; }
.nav { display: flex; align-items: center; gap: 24px; }
.nav-link { color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.nav-link:hover { color: var(--primary-color); }
.btn-login, .btn-register { padding: 8px 20px; border-radius: 30px; }
.btn-login { border: 1px solid var(--border-color); }
.btn-register { background-color: var(--primary-color); color: white; }
.btn-register:hover { background-color: var(--primary-hover); color: white; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 24px; cursor: pointer; }
.mobile-menu {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}
.mobile-menu.show { display: flex; }
.mobile-nav-link { padding: 10px; color: var(--text-secondary); text-decoration: none; text-align: center; }
.front-main { flex: 1; }
.hero {
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-primary) 100%);
}
.hero h1 { font-size: 48px; margin-bottom: 16px; }
.hero p { font-size: 18px; color: var(--text-secondary); margin-bottom: 32px; }
.hero-buttons { display: flex; gap: 16px; justify-content: center; }
.btn {
    display: inline-block; padding: 12px 32px; border-radius: 30px;
    text-decoration: none; font-weight: 500; transition: all 0.2s;
}
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-secondary:hover { border-color: var(--primary-color); color: var(--primary-color); }
.btn-block { width: 100%; text-align: center; }
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
    padding: 60px 32px;
    max-width: 1200px;
    margin: 0 auto;
}
.feature-card {
    text-align: center;
    padding: 32px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.feature-icon { font-size: 48px; margin-bottom: 16px; }
.feature-card h3 { margin-bottom: 12px; }
.feature-card p { color: var(--text-secondary); }

/* 认证表单 */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-secondary) 100%);
    padding: 20px;
}
.auth-card {
    /*background-color: var(--bg-primary);*/
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo { height: 60px; margin-bottom: 16px; }
.auth-header h2 { margin-bottom: 8px; }
.auth-header p { color: var(--text-secondary); }
.auth-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-weight: 500; font-size: 14px; }
.form-group input, .form-group select, .form-group textarea {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}
.alert-error { background-color: #fef2f2; color: var(--danger-color); border: 1px solid #fee2e2; }
.alert-success { background-color: #f0fdf4; color: var(--success-color); border: 1px solid #dcfce7; }
.auth-footer { text-align: center; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border-color); }
.auth-footer a { color: var(--primary-color); text-decoration: none; }

/* 表格 */
.table-container { overflow-x: auto; background-color: var(--bg-primary); border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
.data-table th { background-color: var(--bg-tertiary); font-weight: 600; font-size: 14px; }
.data-table tr:hover { background-color: var(--bg-tertiary); }

/* 卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.stat-card h3 { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; }

/* 响应式 */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .mobile-menu-toggle { display: block; }
    .mobile-menu-btn { display: block; }
    .nav { display: none; }
    .hero h1 { font-size: 32px; }
    .features { padding: 40px 20px; }
    .auth-card { padding: 24px; }
    .footer { flex-direction: column; text-align: center; }
    .footer-links { flex-wrap: wrap; justify-content: center; }
}
/* 首页增强样式 */
.front-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0 0 30px 30px;
    margin-bottom: 20px;
}

.hero h1 {
    color: white;
}

.hero p {
    color: rgba(255, 255, 255, 0.9);
}

.hero-buttons .btn-primary {
    background: blue;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hero-buttons .btn-primary:hover {
    background: #8A2BE2;
    transform: translateY(-2px);
}

.hero-buttons .btn-secondary {
    background: transparent;
    border: 2px solid white;
    color: white;
}

.hero-buttons .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
/* 移动端侧边栏样式 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 1000;
        background: var(--bg-primary);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    .sidebar.show {
        left: 0;
    }
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: var(--text-primary);
        padding: 8px;
    }
    .main-content {
        margin-left: 0 !important;
    }
}

/* ========== 多语言切换器样式 ========== */
.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.lang-current:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.lang-flag {
    font-size: 16px;
}

.lang-name {
    font-size: 13px;
}

.lang-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.lang-switcher:hover .lang-arrow {
    transform: rotate(180deg);
}

.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    min-width: 140px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.lang-menu.show {
    display: block;
    animation: fadeInDown 0.2s ease;
}

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

.lang-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
    font-size: 13px;
}

.lang-item:hover {
    background: var(--bg-secondary);
}

.lang-item.active {
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.08));
    color: var(--primary-color);
    font-weight: 500;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .lang-current {
        padding: 4px 10px;
    }
    
    .lang-name {
        display: none;
    }
    
    .lang-current .lang-name {
        display: none;
    }
    
    .lang-menu {
        min-width: 130px;
    }
}