/* client/public/css/main.css */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg-base:        #04080f;
  --bg-deep:        #060d1a;
  --bg-panel:       rgba(8, 18, 42, 0.72);
  --bg-panel-hover: rgba(12, 26, 58, 0.85);
  --bg-input:       rgba(4, 10, 28, 0.8);

  --border-dim:     rgba(30, 70, 180, 0.14);
  --border-mid:     rgba(40, 90, 220, 0.22);
  --border-bright:  rgba(60, 120, 255, 0.38);

  --text-primary:   #d8eaff;
  --text-secondary: rgba(160, 195, 240, 0.7);
  --text-muted:     rgba(100, 140, 210, 0.45);
  --text-tiny:      rgba(80, 115, 180, 0.38);

  --blue:           #4a8fff;
  --blue-dim:       rgba(40, 90, 220, 0.18);
  --blue-glow:      rgba(60, 120, 255, 0.25);

  --green:          #2ed896;
  --green-dim:      rgba(20, 180, 100, 0.14);
  --green-glow:     rgba(30, 200, 110, 0.2);

  --amber:          #f5b730;
  --amber-dim:      rgba(220, 150, 0, 0.14);
  --amber-glow:     rgba(240, 170, 20, 0.2);

  --red:            #f04f5e;
  --red-dim:        rgba(200, 30, 50, 0.14);
  --red-glow:       rgba(220, 40, 60, 0.2);

  --purple:         #9d7dff;
  --purple-dim:     rgba(120, 80, 240, 0.14);

  --discord:        #5865f2;
  --discord-dim:    rgba(88, 101, 242, 0.16);
  --discord-border: rgba(88, 101, 242, 0.32);

  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  --font-display:   'Rajdhani', sans-serif;
  --font-body:      'DM Sans', sans-serif;
  --font-mono:      'JetBrains Mono', monospace;

  --transition:     0.18s ease;
  --transition-slow: 0.35s ease;
}

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

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(40, 80, 180, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(60, 110, 220, 0.4); }

/* ── Background ────────────────────────────────────────────────── */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(30, 70, 200, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 70, 200, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
}

.bg-glow-1 {
  position: absolute;
  top: -15%;
  left: 20%;
  width: 700px;
  height: 700px;
  background: radial-gradient(ellipse, rgba(20, 80, 220, 0.08) 0%, transparent 65%);
}

.bg-glow-2 {
  position: absolute;
  bottom: -20%;
  right: 10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(80, 30, 200, 0.06) 0%, transparent 65%);
}

.bg-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
}

/* ── Glass Panel ────────────────────────────────────────────────── */
.glass {
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.glass-bright {
  background: rgba(10, 22, 55, 0.8);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.015em;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, #1a52d4, #0e34a8);
  border-color: rgba(60, 110, 255, 0.4);
  color: #b8d4ff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2060e8, #1840be);
  border-color: rgba(80, 130, 255, 0.55);
  color: #d0e8ff;
  box-shadow: 0 4px 20px rgba(30, 80, 220, 0.25);
}

.btn-discord {
  background: linear-gradient(135deg, #4a57f0, #3540c8);
  border-color: rgba(88, 101, 242, 0.5);
  color: #c8d0ff;
  font-size: 14px;
  padding: 0.65rem 1.4rem;
}
.btn-discord:hover {
  background: linear-gradient(135deg, #5a67f8, #4550d8);
  color: #dde4ff;
  box-shadow: 0 6px 28px rgba(88, 101, 242, 0.35);
}

.btn-success {
  background: rgba(15, 100, 60, 0.45);
  border-color: rgba(30, 180, 90, 0.3);
  color: #40e0a0;
}
.btn-success:hover {
  background: rgba(15, 120, 70, 0.6);
  border-color: rgba(40, 200, 100, 0.45);
  box-shadow: 0 4px 18px rgba(20, 180, 80, 0.2);
}

.btn-warning {
  background: rgba(120, 85, 10, 0.42);
  border-color: rgba(220, 155, 10, 0.35);
  color: var(--amber);
}
.btn-warning:hover {
  background: rgba(140, 100, 12, 0.58);
  border-color: rgba(240, 175, 20, 0.5);
  box-shadow: 0 4px 18px rgba(230, 165, 15, 0.2);
}

.btn-danger {
  background: rgba(100, 15, 25, 0.45);
  border-color: rgba(200, 40, 60, 0.3);
  color: #f06070;
}
.btn-danger:hover {
  background: rgba(120, 15, 30, 0.65);
  border-color: rgba(220, 50, 70, 0.45);
  box-shadow: 0 4px 18px rgba(200, 30, 50, 0.2);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-mid);
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--blue-dim);
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 11px;
  gap: 5px;
}

.btn-icon {
  padding: 0.45rem;
  width: 34px;
  height: 34px;
  justify-content: center;
}

/* ── Status Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

.badge-pending {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(220, 155, 10, 0.25);
}
.badge-pending .badge-dot { background: var(--amber); box-shadow: 0 0 5px var(--amber); }

.badge-approved {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(20, 190, 100, 0.25);
}
.badge-approved .badge-dot { background: var(--green); box-shadow: 0 0 5px var(--green); }

.badge-denied {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(200, 40, 60, 0.25);
}
.badge-denied .badge-dot { background: var(--red); box-shadow: 0 0 5px var(--red); }

.badge-hicomm {
  background: var(--purple-dim);
  color: var(--purple);
  border: 1px solid rgba(130, 80, 240, 0.28);
  font-size: 9px;
}

.badge-ia {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(50, 110, 240, 0.28);
  font-size: 9px;
}

/* "Changes requested" — a pending case a reviewer bounced back to its submitter.
   Deliberately loud (amber, pulsing) so it stands out in tables and detail. */
.badge-amber,
.badge-changes {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(220, 155, 10, 0.45);
}
.badge-amber .badge-dot,
.badge-changes .badge-dot { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.badge-changes {
  gap: 4px;
  animation: changesPulse 2.2s ease-in-out infinite;
}
.badge-changes i { font-size: 12px; }
@keyframes changesPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--amber-glow); }
  50%      { box-shadow: 0 0 0 4px transparent; }
}

/* Highlight a whole table row that is awaiting submitter changes. */
tr.row-changes > td { background: rgba(240, 170, 20, 0.06); }
tr.row-changes > td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

/* Small "awaiting submitter" chip shown in a reviewer's action column. */
.row-changes-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.18rem 0.55rem;
  margin-bottom: 5px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(220, 155, 10, 0.35);
  white-space: nowrap;
}
.row-changes-chip i { font-size: 12px; }

/* ── Form Controls ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.form-label span { color: var(--red); margin-left: 2px; }

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  resize: vertical;
}

.form-control::placeholder { color: rgba(70, 110, 180, 0.3); }

.form-control:focus {
  border-color: var(--border-bright);
  box-shadow: 0 0 0 3px rgba(50, 100, 240, 0.1);
}

/* ── Toast Notification ─────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.8rem 1.1rem;
  background: rgba(10, 24, 60, 0.95);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  font-size: 12px;
  color: var(--text-primary);
  max-width: 300px;
  pointer-events: all;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  opacity: 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(120%); opacity: 0; }

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-success { border-color: rgba(20, 180, 90, 0.3); }
.toast-error   { border-color: rgba(200, 40, 60, 0.3); }
.toast-info    { border-color: var(--border-bright); }

/* ── Loading Skeleton ───────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    rgba(20, 45, 110, 0.3) 25%,
    rgba(30, 60, 140, 0.45) 50%,
    rgba(20, 45, 110, 0.3) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}

/* ── Animations ─────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

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

.fade-up   { animation: fadeUp 0.4s ease both; }
.fade-in   { animation: fadeIn 0.3s ease both; }
.pulse-anim { animation: pulse 2.2s ease infinite; }

/* ── Shared motion (both themes) ──────────────────────────────────────
 * Gives the Classic UI the same lively feel as Aurora: pages slide/fade in,
 * cards and buttons lift on hover, rows/tabs transition smoothly. Aurora layers
 * its gradients on top of these. Disabled for reduced-motion users. */
.page.active { animation: fadeUp 0.34s ease both; }

.stats-grid > * {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.stats-grid > *:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.btn-primary { transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease, background 0.18s ease; }
.btn-primary:hover { transform: translateY(-1px); }

.glass, .panel { transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.data-table tbody tr { transition: background 0.14s ease; }
.filter-tab { transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease; }
.nav-item { transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease; }
.row-btn  { transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease; }
.row-btn:hover { transform: translateY(-1px); }

@media (prefers-reduced-motion: reduce) {
  .page.active { animation: none; }
  .stats-grid > *:hover, .btn-primary:hover, .row-btn:hover { transform: none; }
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 20, 0.82);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

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

.modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #9ac0ff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}

.modal-close:hover { border-color: var(--border-bright); color: var(--text-primary); }

.modal-body    { padding: 1.4rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-header  { flex-shrink: 0; }
.modal-footer  { padding: 1rem 1.4rem; border-top: 1px solid var(--border-dim); display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Divider ────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-dim); }

/* ── Pill label (top-accent for panels) ─────────────────────────── */
.panel-accent {
  position: absolute;
  top: 0; left: 1.5rem; right: 1.5rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(60, 110, 255, 0.5), transparent);
}

/* ── Spinner ────────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(60, 110, 240, 0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

/* ── Utility ────────────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Light Theme ────────────────────────────────────────────────── */
html[data-theme="light"] {
  --bg-base:        #f0f4fb;
  --bg-deep:        #e6edf8;
  --bg-panel:       rgba(255, 255, 255, 0.82);
  --bg-panel-hover: rgba(240, 246, 255, 0.95);
  --bg-input:       rgba(255, 255, 255, 0.9);

  --border-dim:     rgba(100, 140, 220, 0.18);
  --border-mid:     rgba(80, 120, 200, 0.28);
  --border-bright:  rgba(60, 100, 220, 0.45);

  --text-primary:   #0d1b3e;
  --text-secondary: rgba(30, 60, 130, 0.75);
  --text-muted:     rgba(60, 100, 180, 0.55);
  --text-tiny:      rgba(80, 120, 190, 0.45);

  --blue-dim:       rgba(60, 110, 240, 0.12);
  --blue-glow:      rgba(60, 110, 255, 0.18);
  --green-dim:      rgba(0, 160, 90, 0.10);
  --amber-dim:      rgba(200, 130, 0, 0.12);
  --red-dim:        rgba(200, 30, 50, 0.10);
  --purple-dim:     rgba(110, 70, 230, 0.10);
  --discord-dim:    rgba(88, 101, 242, 0.12);
  --discord-border: rgba(88, 101, 242, 0.30);
}

html[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(rgba(80, 120, 220, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 120, 220, 0.07) 1px, transparent 1px);
}

html[data-theme="light"] .bg-glow-1 {
  background: radial-gradient(ellipse, rgba(80, 130, 255, 0.07) 0%, transparent 65%);
}
html[data-theme="light"] .bg-glow-2 {
  background: radial-gradient(ellipse, rgba(130, 80, 220, 0.05) 0%, transparent 65%);
}
html[data-theme="light"] .bg-scanline {
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.012) 0px, rgba(0,0,0,0.012) 1px,
    transparent 1px, transparent 3px
  );
}

html[data-theme="light"] .glass,
html[data-theme="light"] .glass-bright {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(100, 140, 220, 0.22);
  box-shadow: 0 2px 16px rgba(40, 80, 200, 0.07);
}

html[data-theme="light"] .sidebar {
  background: rgba(240, 246, 255, 0.94);
  border-right-color: rgba(100, 140, 220, 0.18);
}

html[data-theme="light"] .nav-item:hover,
html[data-theme="light"] .nav-item.active {
  background: rgba(60, 110, 240, 0.10);
}

html[data-theme="light"] .form-control {
  background: rgba(255,255,255,0.95);
  border-color: rgba(100,140,220,0.28);
  color: #0d1b3e;
}

html[data-theme="light"] .data-table th {
  background: rgba(230, 240, 255, 0.9);
  color: rgba(30, 60, 140, 0.7);
}

html[data-theme="light"] .data-table td {
  border-bottom-color: rgba(100, 140, 220, 0.10);
  color: #1a2f60;
}

html[data-theme="light"] .data-table tr:hover td {
  background: rgba(60, 110, 240, 0.05);
}

html[data-theme="light"] .stat-card {
  background: rgba(255,255,255,0.82);
  border-color: rgba(100,140,220,0.18);
}

html[data-theme="light"] .modal-overlay > .modal {
  background: rgba(245,250,255,0.97);
  border-color: rgba(100,140,220,0.25);
}

html[data-theme="light"] .sidebar-brand .brand-name,
html[data-theme="light"] .sidebar-brand .brand-sub {
  color: #0d1b3e;
}

html[data-theme="light"] .page-title { color: #0d1b3e; }
html[data-theme="light"] .page-sub   { color: rgba(30,60,130,0.6); }

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(80, 120, 200, 0.22);
}

/* ── Theme toggle button ────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-dim);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--blue-dim);
  border-color: var(--border-bright);
  color: var(--text-primary);
}
