/* ========================================
   胖鹅去水印 - 管理后台样式
   设计风格：简洁、专业、蓝色系
   ======================================== */

/* ===== CSS 变量 ===== */
:root {
    --primary: #2979FF;
    --primary-dark: #1a5cc8;
    --primary-light: #e8f0fe;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2979FF;
    --radius: 12rpx;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.05);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ===== Login ===== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-logo { text-align: center; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 24px; font-weight: 700; color: var(--text); }
.login-subtitle { text-align: center; font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }
.login-form .form-group { margin-bottom: 20px; }

/* ===== Admin Layout ===== */
.admin-layout { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand { font-size: 18px; font-weight: 700; color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-footer {
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
    background: rgba(41,121,255,0.12);
    color: #fff;
    border-left-color: var(--sidebar-active);
}
.nav-parent.active { color: #fff; }
.nav-arrow { margin-left: auto; transition: transform 0.25s; }
.nav-parent.open .nav-arrow { transform: rotate(180deg); }
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.15);
}
.nav-parent.open + .nav-submenu,
.nav-submenu.open { max-height: 200px; }
.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px 9px 52px;
    color: var(--sidebar-text);
    font-size: 13px;
    transition: all 0.2s;
}
.nav-sub-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-sub-item.active { color: var(--sidebar-active); }
.nav-dot {
    display: inline-block;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    margin-right: 12px;
    display: none;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-admin {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: var(--bg);
    border-radius: 20px;
}
.content-body { flex: 1; padding: 24px; max-width: 1200px; width: 100%; }

/* ===== Page Header ===== */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-desc { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ===== Stats Cards ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-blue .stat-icon { background: #e8f0fe; color: var(--primary); }
.stat-green .stat-icon { background: #e8faf0; color: var(--success); }
.stat-indigo .stat-icon { background: #eef2ff; color: #6366f1; }
.stat-red .stat-icon { background: #fef2f2; color: var(--danger); }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.stats-row-mini {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Charts ===== */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.chart-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.chart-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

/* ===== Form ===== */
.form-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: var(--shadow);
}
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(41,121,255,0.1);
}
.form-input:disabled {
    background: var(--bg);
    color: var(--text-muted);
}
select.form-input { cursor: pointer; appearance: auto; }
textarea.form-input { min-height: 100px; resize: vertical; }
.required { color: var(--danger); }
.section-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.section-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    line-height: 1;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ===== Table ===== */
.table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafafa; }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: 'SF Mono', 'Menlo', monospace; font-size: 13px; }
.text-center { text-align: center; }
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Badge ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #e8faf0; color: #16a34a; }
.badge-danger { background: #fef2f2; color: #dc2626; }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    background: #fff;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Alert ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}
.alert-success { background: #e8faf0; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ===== Search & Filter ===== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}
.search-input { max-width: 320px; }
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-input { max-width: 180px; }

/* ===== User Avatar ===== */
.user-avatar-sm {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.user-avatar-placeholder {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--border);
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0;
    background: var(--bg);
    border-radius: 10px;
    padding: 3px;
}
.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: center;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-form { margin-top: 20px; }

/* ===== Avatar Preview ===== */
.avatar-preview { margin: 8px 0 16px; }
.avatar-preview-img {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}
.avatar-placeholder {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle { display: block; }
    .main-content { margin-left: 0; }
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .chart-row {
        grid-template-columns: 1fr;
    }
    .content-body { padding: 16px; }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .filter-bar { flex-direction: column; }
    .filter-input { max-width: 100%; }
    .search-bar { flex-direction: column; align-items: stretch; }
    .search-input { max-width: 100%; }
}
