/* Modern Light Theme - Steam Support Case Manager */
:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-raised: #f1f5f9;
  --bg-surface-hover: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-muted: #cbd5e1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-text: #ffffff;

  /* Semantic status colors (crisp, high legibility in light theme) */
  --status-replied-bg: #fff1f2;
  --status-replied-border: #fecdd3;
  --status-replied-text: #be123c;
  --status-replied-dot: #e11d48;

  --status-monitoring-bg: #eff6ff;
  --status-monitoring-border: #bfdbfe;
  --status-monitoring-text: #1d4ed8;
  --status-monitoring-dot: #2563eb;

  --status-inprogress-bg: #fffbeb;
  --status-inprogress-border: #fde68a;
  --status-inprogress-text: #b45309;
  --status-inprogress-dot: #d97706;

  --status-success-bg: #f0fdf4;
  --status-success-border: #bbf7d0;
  --status-success-text: #15803d;
  --status-success-dot: #16a34a;

  --status-neutral-bg: #f8fafc;
  --status-neutral-border: #e2e8f0;
  --status-neutral-text: #475569;
  --status-neutral-dot: #64748b;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Lucide Icon helper */
.icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.75;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Auth / Login View */
.login-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--bg-page);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-brand-icon {
  width: 34px;
  height: 34px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
}

.login-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Header */
.navbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  width: 28px;
  height: 28px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status Indicator Dot */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
}
.status-dot.dot-online {
  background-color: #10b981;
}
.status-dot.dot-danger {
  background-color: #e11d48;
}
.status-pill.status-pill-danger {
  background-color: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

/* Buttons */
.btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  line-height: 1.4;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: var(--accent-text);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background-color: var(--bg-page);
  color: var(--text-primary);
  border-color: var(--border-muted);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
}

.btn-danger {
  background-color: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}
.btn-danger:hover {
  background-color: #ffe4e6;
  border-color: #fda4af;
}

.btn-success {
  background-color: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}
.btn-success:hover {
  background-color: #dcfce7;
  border-color: #86efac;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 8px 14px;
}

/* Container */
.main-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 28px;
  flex: 1;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-muted);
  box-shadow: var(--shadow-md);
}

.stat-card.active {
  border-color: var(--accent-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.stat-card.card-replied {
  border-color: #fecdd3;
}
.stat-card.card-replied.has-unread {
  background-color: #fff8f8;
  border-color: #fda4af;
}

.stat-header {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-count {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.stat-count.text-rose {
  color: #be123c;
}
.stat-count.text-emerald {
  color: #15803d;
}
.stat-count.text-blue {
  color: #1d4ed8;
}

/* Control Bar */
.control-bar {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.search-icon-pos {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.select-control {
  padding: 7px 12px;
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.select-control:focus {
  border-color: var(--accent-primary);
}

/* Table Card */
.table-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.cases-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.cases-table th {
  background-color: #f8fafc;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.cases-table td {
  padding: 13px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  background-color: #ffffff;
}

.cases-table tr:hover td {
  background-color: #f8fafc;
}

.cases-table tr.row-replied td {
  background-color: #fff8f8;
}
.cases-table tr.row-replied:hover td {
  background-color: #fff1f2;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.badge-replied {
  background-color: var(--status-replied-bg);
  border-color: var(--status-replied-border);
  color: var(--status-replied-text);
}
.badge-replied .dot { background-color: var(--status-replied-dot); }

.badge-monitoring {
  background-color: var(--status-monitoring-bg);
  border-color: var(--status-monitoring-border);
  color: var(--status-monitoring-text);
}
.badge-monitoring .dot { background-color: var(--status-monitoring-dot); }

.badge-inprogress {
  background-color: var(--status-inprogress-bg);
  border-color: var(--status-inprogress-border);
  color: var(--status-inprogress-text);
}
.badge-inprogress .dot { background-color: var(--status-inprogress-dot); }

.badge-success {
  background-color: var(--status-success-bg);
  border-color: var(--status-success-border);
  color: var(--status-success-text);
}
.badge-success .dot { background-color: var(--status-success-dot); }

.badge-failed {
  background-color: var(--status-neutral-bg);
  border-color: var(--status-neutral-border);
  color: var(--status-neutral-text);
}
.badge-failed .dot { background-color: var(--status-neutral-dot); }

.badge-completed {
  background-color: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}
.badge-completed .dot { background-color: #94a3b8; }

/* Platform Badges */
.badge-platform {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.badge-platform-xianyu {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
}

.badge-platform-taobao {
  background-color: #fff7ed;
  border: 1px solid #ffedd5;
  color: #c2410c;
}

.badge-platform-wework {
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.badge-platform-mail {
  background-color: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #6d28d9;
}

.webhook-card {
  background-color: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 14px;
}
.webhook-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.webhook-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.ticket-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticket-code {
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  max-width: 220px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.ticket-code:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background-color 0.15s;
}
.icon-btn:hover {
  color: var(--text-primary);
  background-color: #f1f5f9;
}

.reply-snippet {
  font-size: 12px;
  color: #be123c;
  background-color: #fff1f2;
  border: 1px solid #fecdd3;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius-xs);
}
.close-btn:hover {
  color: var(--text-primary);
  background-color: #f1f5f9;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-label .required {
  color: #e11d48;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 7px 11px;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.form-textarea {
  min-height: 70px;
  resize: vertical;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Timeline Notes */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.timeline-item {
  background-color: #f8fafc;
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
  white-space: pre-wrap;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  min-width: 260px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.toast.toast-danger {
  border-left: 3px solid #e11d48;
}

.toast.toast-success {
  border-left: 3px solid #10b981;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-icon {
  margin-bottom: 8px;
  color: #94a3b8;
}
.empty-text {
  font-size: 13px;
}
