/* ═══════════════════════════════════════════════════════════════════
   ClaimAdjudicate — Design System
   Based on MEO brand (meointerview.meoadvisors.com)
   Light theme: clean, clinical, trustworthy
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Colors */
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --text-primary: #0e1424;
  --text-secondary: #5b6477;
  --text-muted: #94a3b8;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;

  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --info: #3b82f6;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-2xl: 36px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radius */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition: 0.15s ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Typography ────────────────────────────────────────────────── */
h1 { font-size: var(--text-2xl); font-weight: 700; color: var(--text-primary); line-height: 1.2; }
h2 { font-size: var(--text-xl); font-weight: 700; color: var(--text-primary); line-height: 1.3; }
h3 { font-size: var(--text-lg); font-weight: 600; color: var(--text-primary); line-height: 1.4; }
p { font-size: var(--text-base); color: var(--text-secondary); }

/* ─── Lists ─────────────────────────────────────────────────────── */
ul, ol {
  margin: 0.5em 0 0.75em 0;
  padding-left: 1.5em;
}
ul { list-style-type: disc; }
ol { list-style-type: decimal; }
li {
  margin-bottom: 0.35em;
  padding-left: 0.25em;
  line-height: 1.7;
}
li:last-child { margin-bottom: 0; }
ul ul, ol ul { list-style-type: circle; margin-top: 0.25em; margin-bottom: 0.25em; }

/* ─── Draft Editor Typography ───────────────────────────────────── */
#draftEditor { font-weight: 400; }
#draftEditor p {
  margin: 0 0 0.75em 0;
  line-height: 1.8;
  color: var(--text-primary);
}
#draftEditor p:last-child { margin-bottom: 0; }

#draftEditor h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin: 1.25em 0 0.5em 0;
  line-height: 1.4;
}
#draftEditor h3:first-child { margin-top: 0; }

#draftEditor ul,
#draftEditor ol {
  margin: 0.4em 0 0.75em 0;
  padding-left: 1.5em;
}
#draftEditor li {
  margin-bottom: 0.3em;
  line-height: 1.7;
  color: var(--text-primary);
}

#draftEditor b, #draftEditor strong { font-weight: 700; }
#draftEditor i, #draftEditor em { font-style: italic; }

/* ─── Layout ────────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Header ────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.header-logo {
  font-size: 24px;
  line-height: 1;
}

.header-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.header-title span {
  color: var(--accent);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.header-nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.header-nav a:hover {
  color: var(--text-primary);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ─── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

/* ─── Enterprise CTA / Inquiry Modal ───────────────────────────── */
.enterprise-cta {
  text-align: center;
  padding: 48px 0;
  margin: 40px 0;
}
.enterprise-cta h2 { margin-bottom: 12px; }
.enterprise-cta p { max-width: 520px; margin: 0 auto 24px; }
.inquiry-modal { max-width: 480px; }

.card-hover {
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  min-height: 40px;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  border-color: #059669;
  color: white;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Status Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pending { background: var(--warning-bg); color: #92400e; border: 1px solid var(--warning-border); }
.badge-approved { background: var(--success-bg); color: #065f46; border: 1px solid var(--success-border); }
.badge-rejected { background: var(--danger-bg); color: #991b1b; border: 1px solid var(--danger-border); }
.badge-drafting { background: var(--info-bg); color: #1e40af; border: 1px solid var(--info-border); }
.badge-uploaded { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-sent { background: var(--success-bg); color: #065f46; border: 1px solid var(--success-border); }
.badge-error { background: var(--danger-bg); color: #991b1b; border: 1px solid var(--danger-border); }

/* ─── Forms ─────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ─── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface-hover);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ─── Tabs ──────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
  overflow-x: auto;
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface-hover);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-left: var(--space-2);
}

.tab.active .tab-count {
  background: var(--accent-light);
  color: var(--accent);
}

/* ─── Appeal Cards (Queue View) ─────────────────────────────────── */
.appeal-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: all var(--transition);
}

.appeal-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.appeal-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.appeal-card-content {
  flex: 1;
  min-width: 0;
}

.appeal-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.appeal-card-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.appeal-card-status {
  flex-shrink: 0;
}

/* ─── Empty State ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

/* ─── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success { background: var(--success-bg); color: #065f46; border: 1px solid var(--success-border); }
.toast-error { background: var(--danger-bg); color: #991b1b; border: 1px solid var(--danger-border); }
.toast-info { background: var(--info-bg); color: #1e40af; border: 1px solid var(--info-border); }

/* ─── Loading ───────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  color: var(--text-secondary);
  gap: var(--space-3);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Footer ────────────────────────────────────────────────────── */
.footer {
  padding: var(--space-6) var(--space-4);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer a:hover {
  color: var(--text-primary);
}

/* ─── Accessibility ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header {
    padding: var(--space-3) var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .header-nav {
    display: none;
  }

  .container {
    padding: 0 var(--space-3);
  }

  .card {
    padding: var(--space-4);
  }

  .modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .appeal-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .tabs {
    gap: 0;
  }

  .tab {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
}

@media (max-width: 390px) {
  .header {
    padding: var(--space-2) var(--space-3);
  }

  .header-title {
    font-size: var(--text-base);
  }

  .btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    min-height: 36px;
  }

  .form-input,
  .form-textarea {
    font-size: 16px; /* Prevents iOS zoom */
  }
}
