/* ══════════════════════════════════════════════════════════════
   WecomScheduler - 企业微信定时提醒系统
   大厂简约审美，暗紫+黑色主色调，自适应PC/移动端
   ══════════════════════════════════════════════════════════════ */

/* ─── CSS 变量 ─────────────────────────────────────────────── */
:root {
  --primary: #6C5CE7;
  --primary-dark: #5A4BD1;
  --primary-light: #A29BFE;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1c2a4a;
  --bg-input: #0f3460;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0b0;
  --text-muted: #6c6c80;
  --border-color: #2a2a4a;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --info: #74b9ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --transition: all 0.3s ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ─── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--primary);
}

/* ─── 滚动条 ───────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ─── 通用布局 ─────────────────────────────────────────────── */
.page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── 顶部导航 ─────────────────────────────────────────────── */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-light);
}
.navbar-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar-nav a {
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 14px;
  white-space: nowrap;
}
.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background: rgba(108, 92, 231, 0.15);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-user {
  color: var(--text-secondary);
  font-size: 13px;
}
.navbar-user .role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--primary);
  color: #fff;
  margin-left: 6px;
}

/* ─── 按钮 ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: var(--font);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}
.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ─── 表单 ─────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  transition: var(--transition);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}
.form-input::placeholder {
  color: var(--text-muted);
}
.form-textarea {
  resize: vertical;
  min-height: 80px;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-radio-group {
  display: flex;
  gap: 16px;
  padding: 8px 0;
}
.form-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}
.form-radio-label input[type="radio"] {
  accent-color: var(--primary);
}

/* ─── 卡片 ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}
.card:hover {
  border-color: rgba(108, 92, 231, 0.3);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.card-body {
  color: var(--text-secondary);
}

/* ─── 统计卡片 ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}
.stat-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}
.stat-card .stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

/* ─── 表格 ─────────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42, 42, 74, 0.5);
  font-size: 13px;
  color: var(--text-secondary);
}
tbody tr {
  transition: var(--transition);
}
tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ─── Tag/状态标签 ──────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.tag-normal {
  background: rgba(0, 184, 148, 0.15);
  color: var(--success);
}
.tag-paused {
  background: rgba(253, 203, 110, 0.15);
  color: var(--warning);
}
.tag-completed {
  background: rgba(116, 185, 255, 0.15);
  color: var(--info);
}
.tag-success {
  background: rgba(0, 184, 148, 0.15);
  color: var(--success);
}
.tag-failed {
  background: rgba(225, 112, 85, 0.15);
  color: var(--danger);
}
.tag-active {
  background: rgba(0, 184, 148, 0.15);
  color: var(--success);
}
.tag-frozen {
  background: rgba(225, 112, 85, 0.15);
  color: var(--danger);
}
.tag-admin {
  background: rgba(108, 92, 231, 0.2);
  color: var(--primary-light);
}
.tag-user {
  background: rgba(116, 185, 255, 0.15);
  color: var(--info);
}

/* ─── 模态框 ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text-primary);
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── 分页 ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.pagination button {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
}
.pagination button:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pagination .page-info {
  color: var(--text-muted);
  font-size: 13px;
  padding: 0 8px;
}

/* ─── 空状态 ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state p {
  font-size: 14px;
}

/* ─── 提示消息 ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #fff;
  animation: slideIn 0.3s ease;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #333; }
.toast-info { background: var(--info); color: #333; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── 登录/注册页面 ─────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0f0f23 100%);
  padding: 20px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-card .auth-title {
  text-align: center;
  margin-bottom: 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-light);
}
.auth-card .auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}
.auth-card .auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-card .auth-footer a {
  color: var(--primary-light);
}

/* ─── 主内容区域 ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}
.page-header .page-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── 筛选栏 ───────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar .form-select,
.filter-bar .form-input {
  width: auto;
  min-width: 140px;
}

/* ─── 批量操作栏 ─────────────────────────────────────────────── */
.batch-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.batch-bar .batch-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 8px;
}

/* ─── 复选框 ───────────────────────────────────────────────── */
.checkbox-cell {
  width: 40px;
  text-align: center;
}
input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ─── 工具类 ───────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ─── 移动端适配 ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar {
    padding: 0 12px;
  }
  .navbar-nav {
    gap: 0;
  }
  .navbar-nav a {
    padding: 8px 10px;
    font-size: 12px;
  }
  .navbar-brand {
    font-size: 15px;
  }
  .navbar-user {
    display: none;
  }
  .main-content {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-card .stat-value {
    font-size: 22px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    flex-direction: column;
  }
  .filter-bar .form-select,
  .filter-bar .form-input {
    width: 100%;
    min-width: unset;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .card {
    padding: 16px;
  }
  .modal {
    width: 95%;
    max-height: 90vh;
  }
  .auth-card {
    padding: 24px;
  }
  table {
    font-size: 12px;
  }
  thead th,
  tbody td {
    padding: 8px 10px;
  }
  /* 移动端表格自适应 */
  .table-responsive table {
    font-size: 12px;
  }
  .table-responsive thead th,
  .table-responsive tbody td {
    padding: 8px 6px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .navbar-nav a {
    padding: 6px 8px;
    font-size: 11px;
  }
}