/* ============================================
   电脑计费系统 - 拓客后台风格 (Lumina Admin)
   ============================================ */

:root {
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: 'Consolas', 'Courier New', 'SF Mono', 'Fira Code', monospace;

    --bg-page: #f0f3f7;
    --bg-card: #ffffff;
    --bg-sidebar: #1b1c2a;
    --bg-sidebar-active: #2d2f45;
    --bg-table-header: #f8fafc;
    --bg-hover: #f8fafc;
    --bg-input-disabled: #f8fafc;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;
    --text-placeholder: #94a3b8;
    --text-disabled: #cbd5e1;

    --brand: #3b82f6;
    --brand-hover: #2563eb;
    --brand-active: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;

    --border: #e2e8f0;
    --divider: #f1f5f9;
    --light-bg: #f1f5f9;

    --shadow-card: 0 1px 3px 0 rgba(0,0,0,0.06), 0 1px 2px -1px rgba(0,0,0,0.04);
    --shadow-btn: 0 1px 2px 0 rgba(59,130,246,0.3);
    --ring: 0 0 0 3px rgba(59,130,246,0.1);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --sidebar-width: 240px;
}

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

body {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-page);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==================== 布局 ==================== */
.layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-sidebar-active);
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 1px;
    position: relative;
    transition: all 0.15s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-sidebar-active);
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--brand);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.logout-btn:hover {
    color: var(--danger) !important;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-bar {
    height: 44px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.top-bar-right {
    font-size: 13px;
    color: var(--text-secondary);
}

.content-area {
    padding: 20px;
    max-width: 1200px;
}

/* ==================== 页面头部 ==================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.page-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==================== 统计卡片 ==================== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-box.blue { background: rgba(59,130,246,0.1); color: var(--brand); }
.stat-icon-box.green { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon-box.orange { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon-box.purple { background: rgba(139,92,246,0.1); color: var(--purple); }

/* ==================== 卡片 ==================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--divider);
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 16px 20px;
}

/* ==================== 表格 ==================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--bg-table-header);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider);
    text-transform: uppercase;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider);
    font-size: 14px;
    color: var(--text-primary);
}

.table tbody tr { height: 48px; }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:nth-child(even) { background: #fafbfc; }
.table tbody tr:nth-child(even):hover { background: var(--bg-hover); }

/* ==================== 徽章 ==================== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

.badge.green { background: #ecfdf5; color: var(--success); }
.badge.red { background: #fef2f2; color: var(--danger); }
.badge.blue { background: #eff6ff; color: var(--brand); }
.badge.orange { background: #fffbeb; color: var(--warning); }
.badge.gray { background: var(--light-bg); color: var(--text-secondary); }

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
    gap: 6px;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-active); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-hover); border-color: #d1d5db; }

.btn-ghost {
    background: transparent;
    color: #475569;
    font-weight: 500;
    border-radius: var(--radius-sm);
}
.btn-ghost:hover { background: var(--light-bg); }

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 1px 2px 0 rgba(16,185,129,0.3);
}
.btn-success:hover { background: #059669; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 3px 10px; font-size: 12px; font-weight: 500; }

/* ==================== 表单 ==================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 4px; }

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="email"] {
    width: 100%;
    height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-group input:focus {
    border-color: var(--brand);
    box-shadow: var(--ring);
}

.form-group input::placeholder { color: var(--text-placeholder); }

/* ==================== 提示框 ==================== */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 20px;
}

.alert-error { background: #fef2f2; color: var(--danger); }
.alert-success { background: #ecfdf5; color: var(--success); }

/* ==================== API地址 ==================== */
.api-url-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-url-box code {
    flex: 1;
    background: var(--light-bg);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--brand);
    word-break: break-all;
    border: 1px solid var(--border);
}

/* ==================== 信息行 ==================== */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== 金额 ==================== */
.amount-green { color: var(--success); font-weight: 600; }
.amount-red { color: var(--danger); font-weight: 600; }

/* ==================== 空状态 ==================== */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==================== 操作按钮列 ==================== */
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar .brand-text { display: none; }
    .sidebar .nav-item span { display: none; }
    .sidebar .nav-item { justify-content: center; padding: 12px; }
    .sidebar .nav-icon { margin-right: 0; }
    .sidebar .nav-item.active::before { display: none; }
    .main-content { margin-left: 64px; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .content-area { padding: 16px; }
    .table { font-size: 12px; }
    .table thead th, .table tbody td { padding: 8px 10px; }
    .action-btns { flex-direction: column; gap: 4px; }
}
