/* ============================================
   任务红包后台管理 - 样式表
   ============================================ */

:root {
    --primary: #E83929;
    --primary-dark: #C62828;
    --primary-light: #FFEBEE;
    --gold: #FFD700;
    --gold-dark: #F9A825;
    --bg: #F5F6FA;
    --bg-white: #FFFFFF;
    --text: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #E8E8E8;
    --sidebar-bg: #1A1A2E;
    --sidebar-hover: #16213E;
    --success: #52C41A;
    --warning: #FAAD14;
    --danger: #FF4D4F;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0F3460 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-brand {
    padding: 28px 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon { font-size: 32px; }
.brand-text h1 { font-size: 18px; font-weight: 700; }
.brand-text span { font-size: 12px; opacity: 0.6; }

.sidebar-nav { flex: 1; padding: 16px 12px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7); text-decoration: none;
    font-size: 14px; margin-bottom: 4px;
    transition: var(--transition);
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; box-shadow: 0 4px 12px rgba(232,57,41,0.3);
}
.nav-icon { font-size: 18px; }

.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08);
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: rgba(255,255,255,0.6);
}
.logout-btn { color: var(--danger); text-decoration: none; font-size: 13px; }
.logout-btn:hover { text-decoration: underline; }

/* ---- Main ---- */
.main-content {
    margin-left: 240px; flex: 1; padding: 24px;
    min-height: 100vh;
}
.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px;
}
.page-header h2 { font-size: 22px; font-weight: 700; }
.header-actions { display: flex; gap: 8px; }

/* ---- Cards ---- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-body { padding: 24px; }

/* ---- Stat Cards ---- */
.stat-cards {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 20px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-white); border-radius: var(--radius);
    padding: 24px; display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow); transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.stat-card.highlight {
    background: linear-gradient(135deg, #FFF5F5, #FFEBEE);
    border: 1px solid rgba(232,57,41,0.2);
}
.stat-icon { font-size: 36px; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card.highlight .stat-value { color: var(--primary-dark); }

/* ---- Chart ---- */
.chart-container {
    background: var(--bg-white); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 24px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: var(--transition);
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; box-shadow: 0 2px 8px rgba(232,57,41,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(232,57,41,0.4); }
.btn-outline {
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-outline.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* ---- Inputs ---- */
.input {
    padding: 10px 16px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px;
    outline: none; transition: var(--transition);
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,57,41,0.1); }
.input-sm { width: 180px; padding: 8px 12px; font-size: 13px; }

/* ---- Search Bar ---- */
.search-bar {
    display: flex; gap: 12px; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap;
}

/* ---- Table ---- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: #FAFAFA; padding: 14px 16px;
    text-align: left; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 12px 16px; font-size: 13px;
    border-bottom: 1px solid #F0F0F0;
}
tbody tr:hover { background: #FAFAFA; }

.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-success { background: #F6FFED; color: var(--success); }
.badge-pending { background: #FFF7E6; color: var(--warning); }
.badge-fail { background: #FFF2F0; color: var(--danger); }
.badge-open { background: #FFF7E6; color: var(--warning); }
.badge-closed { background: #F5F5F5; color: var(--text-muted); }

/* ---- Pagination ---- */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 8px; margin-top: 20px;
}
.pagination button {
    padding: 6px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: #fff;
    cursor: pointer; font-size: 13px; transition: var(--transition);
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination span { font-size: 13px; color: var(--text-muted); }

/* ---- Modal ---- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 200;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff; border-radius: var(--radius);
    width: 90%; max-width: 600px; max-height: 80vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; }
.modal-close {
    background: none; border: none; font-size: 20px;
    cursor: pointer; color: var(--text-muted);
}
.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }

/* ---- Ticket Detail ---- */
.ticket-detail-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.ticket-detail-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.ticket-detail-content { background: #FAFAFA; padding: 16px; border-radius: var(--radius-sm); margin-bottom: 16px; line-height: 1.6; }
.reply-item {
    padding: 12px 16px; margin-bottom: 8px;
    border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6;
}
.reply-admin { background: #FFF7E6; border-left: 3px solid var(--gold-dark); }
.reply-user { background: #F0F5FF; border-left: 3px solid #1890FF; }
.reply-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

/* ---- Toast ---- */
.toast {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
    padding: 12px 28px; border-radius: 8px; font-size: 14px;
    z-index: 999; opacity: 0; transition: opacity 0.3s;
    pointer-events: none; color: #fff;
}
.toast.show { opacity: 1; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: #1890FF; }

/* ---- Config Form ---- */
.config-group {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.config-group:last-child { border-bottom: none; }
.config-group-title {
    font-size: 15px; font-weight: 600; margin-bottom: 16px;
    color: var(--primary-dark);
}
.config-item {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 12px;
}
.config-item label {
    width: 160px; font-size: 13px; color: var(--text-secondary);
    text-align: right; flex-shrink: 0;
}
.config-item .input { flex: 1; max-width: 400px; }
.config-item .desc {
    font-size: 12px; color: var(--text-muted);
    width: 100px; flex-shrink: 0;
}

/* ---- Login ---- */
.login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #1A1A2E, #16213E);
}
.login-card {
    background: #fff; border-radius: 20px; padding: 48px 40px;
    width: 380px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-icon { font-size: 56px; margin-bottom: 12px; }
.login-card h2 { font-size: 20px; color: #333; margin-bottom: 32px; }
.login-input {
    width: 100%; margin-bottom: 16px;
    padding: 14px 20px; font-size: 15px;
}
.login-btn {
    width: 100%; margin-top: 8px;
    padding: 14px; font-size: 16px; border-radius: 10px;
}
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 20px; }

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .brand-text, .sidebar .nav-item span, .sidebar-footer { display: none; }
    .sidebar-brand { padding: 16px; justify-content: center; }
    .brand-icon { font-size: 24px; }
    .nav-item { padding: 12px; justify-content: center; }
    .main-content { margin-left: 60px; }
    .stat-cards { grid-template-columns: 1fr; }
}
