/* ========================================
   TVBox 管理后台 - 暗黑主题
   ======================================== */
:root {
  --bg-body: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-hover: rgba(255,255,255,0.04);
  --bg-input: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.1);
  --text: #eee;
  --text-muted: #888;
  --accent: #e74c3c;
  --accent-hover: #c0392b;
  --green: #27ae60;
  --blue: #3498db;
  --amber: #f39c12;
  --purple: #9b59b6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Microsoft YaHei", sans-serif; background: var(--bg-body); color: var(--text); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* --- Layout --- */
.admin-header { background: #1a1a2e; height: 60px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: fixed; top: 0; left: 0; right: 0; z-index: 100; }
.admin-header .logo { color: var(--accent); font-size: 20px; font-weight: bold; }
.admin-header .user-info { color: var(--text-muted); font-size: 13px; }
.admin-header .user-info a { margin-left: 12px; }
.admin-body { display: flex; padding-top: 60px; min-height: 100vh; }
.admin-sidebar { width: 200px; background: #1a1a2e; border-right: 1px solid var(--border); flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 14px 20px; color: var(--text); font-size: 14px; border-left: 3px solid transparent; transition: all .15s; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--bg-hover); border-left-color: var(--accent); color: var(--accent); text-decoration: none; }
.admin-main { flex: 1; padding: 24px; overflow-x: auto; }
.admin-page-title { font-size: 22px; font-weight: bold; color: var(--text); margin-bottom: 20px; }

/* --- Cards --- */
.admin-card { background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border); margin-bottom: 16px; overflow: hidden; }
.admin-card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.admin-card-body { padding: 20px; }

/* --- Stats Grid --- */
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.admin-stat-card { border-radius: 10px; padding: 22px; color: #fff; position: relative; overflow: hidden; }
.admin-stat-card .num { font-size: 30px; font-weight: 700; line-height: 1.2; }
.admin-stat-card .label { font-size: 13px; margin-top: 6px; opacity: 0.85; }
.admin-stat-card .icon { position: absolute; right: 16px; bottom: 12px; font-size: 40px; opacity: 0.15; }
.admin-stat-card.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.admin-stat-card.blue { background: linear-gradient(135deg, #3498db, #2980b9); }
.admin-stat-card.green { background: linear-gradient(135deg, #27ae60, #1e8449); }
.admin-stat-card.amber { background: linear-gradient(135deg, #f39c12, #d68910); }
.admin-stat-card.purple { background: linear-gradient(135deg, #9b59b6, #7d3c98); }
.admin-stat-card.pink { background: linear-gradient(135deg, #e91e63, #c2185b); }

/* --- Table --- */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { background: rgba(255,255,255,0.04); color: var(--text-muted); font-weight: 600; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.admin-table tr:hover td { background: var(--bg-hover); }

/* --- Buttons --- */
.admin-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; border: 1px solid transparent; cursor: pointer; transition: all .2s; line-height: 1.4; text-decoration: none; color: #fff; }
.admin-btn-accent { background: var(--accent); border-color: var(--accent); }
.admin-btn-accent:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.admin-btn-green { background: var(--green); }
.admin-btn-green:hover { background: #1e8449; color: #fff; text-decoration: none; }
.admin-btn-blue { background: var(--blue); }
.admin-btn-blue:hover { background: #2980b9; color: #fff; text-decoration: none; }
.admin-btn-amber { background: var(--amber); }
.admin-btn-amber:hover { background: #d68910; color: #fff; text-decoration: none; }
.admin-btn-sm { padding: 3px 10px; font-size: 12px; }
.admin-btn-xs { padding: 2px 8px; font-size: 11px; }

/* --- Badges --- */
.admin-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.admin-badge-green { background: rgba(39,174,96,0.2); color: #2ecc71; }
.admin-badge-red { background: rgba(231,76,60,0.2); color: #e74c3c; }
.admin-badge-amber { background: rgba(243,156,18,0.2); color: #f39c12; }
.admin-badge-gray { background: rgba(255,255,255,0.08); color: #888; }
.admin-default-label { color: var(--text); font-size: 13px; background: rgba(39,174,96,0.15); padding: 3px 10px; border-radius: 6px; display: inline-block; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.admin-backup-label { color: var(--text); font-size: 13px; background: rgba(243,156,18,0.15); padding: 3px 10px; border-radius: 6px; display: inline-block; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* --- Form --- */
.admin-form-item { margin-bottom: 14px; }
.admin-form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text-muted); }
.admin-input, .admin-textarea, .admin-select { width: 100%; max-width: 400px; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border); font-size: 13px; background: var(--bg-input); color: var(--text); transition: border-color .2s; }
.admin-input:focus, .admin-textarea:focus, .admin-select:focus { outline: none; border-color: var(--accent); }
.admin-textarea { max-width: 600px; min-height: 80px; }

/* --- Search bar --- */
.admin-search { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.admin-search .admin-input { width: 200px; }

/* --- Toolbar --- */
.admin-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.admin-bar-info { font-size: 13px; color: var(--text-muted); }

/* --- Pagination --- */
.admin-pagination { text-align: right; padding: 16px 0 4px; }
.admin-pagination a, .admin-pagination span { display: inline-block; padding: 5px 12px; margin: 0 2px; border-radius: 6px; font-size: 13px; border: 1px solid var(--border); color: var(--text-muted); transition: all .2s; }
.admin-pagination a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.admin-pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }
.admin-pagination .disabled { opacity: 0.4; }

/* --- Empty State --- */
.admin-empty { padding: 60px 20px; text-align: center; color: var(--text-muted); }

/* --- Login --- */
.admin-login-box { width: 380px; margin: 120px auto 0; padding: 40px; background: var(--bg-card); border-radius: 8px; box-shadow: 0 0 30px rgba(0,0,0,0.3); }
.admin-login-title { text-align: center; color: var(--accent); font-size: 28px; font-weight: bold; margin-bottom: 30px; }
.admin-captcha-box { display: flex; gap: 10px; }
.admin-captcha-box .admin-input { flex: 1; }
.admin-captcha-box img { height: 44px; border-radius: 4px; cursor: pointer; }
.admin-err-msg { color: var(--accent); text-align: center; margin-bottom: 15px; font-size: 14px; }

/* ========================================
   模态弹窗
   ======================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 999; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; width: 520px; max-width: 90vw; padding: 28px 30px 24px; position: relative; transform: scale(0.95); opacity: 0; transition: transform .2s, opacity .2s; }
.modal-box.show { transform: scale(1); opacity: 1; }
.modal-title { font-size: 20px; font-weight: bold; color: var(--text); margin-bottom: 22px; }
.modal-box .form-row { margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.modal-box .form-label { width: 100px; text-align: right; font-size: 14px; color: var(--text-muted); flex-shrink: 0; }
.modal-box .form-input { flex: 1; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--border); font-size: 14px; background: var(--bg-input); color: var(--text); transition: border-color .2s; }
.modal-box .form-input:focus { outline: none; border-color: var(--accent); }
.modal-box select.form-input { cursor: pointer; appearance: auto; }
.modal-box .form-row-check .form-label { width: 100px; }
.modal-box .form-row-check { display: flex; align-items: center; gap: 12px; }
.modal-box .form-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-box .form-actions .admin-btn { padding: 8px 24px; }

/* 开关组件 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255,255,255,0.12); border-radius: 24px; transition: .25s; }
.switch-slider:before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s; }
.switch input:checked + .switch-slider { background: var(--green); }
.switch input:checked + .switch-slider:before { transform: translateX(20px); }
