/*
 * Supply Chain Intelligence & Situation Report Hub — base styles.
 *
 * Aesthetic principles:
 *   1. Restraint with the accent — gold appears on actions, status, key
 *      moments. Not on every border or hover surface.
 *   2. Generous whitespace. Padding is the cheapest design upgrade.
 *   3. Typographic hierarchy via weight + size, not color saturation.
 *   4. Hairline borders. Depth comes from soft shadow, not visible edges.
 *   5. Sharper corners (4-8px) for editorial feel. No pill shapes.
 */

:root {
  /* Resilience Engineers — elegant navy + antique gold */
  --bg: #0a1c2f;
  --surface: #0f2440;
  --surface2: #142a4d;
  --surface3: #1b345e;
  --border: #1d3358;            /* visible but quiet */
  --border-soft: rgba(255,255,255,0.04);  /* hairline */
  --border-strong: #2a4670;
  --text: #f3eee5;
  --subtext: #9aa9be;
  --muted: #5b6b85;
  --primary: #c89b3c;
  --primary-hover: #b3892f;
  --primary-soft: rgba(200,155,60,0.10);
  --primary-glow: rgba(200,155,60,0.16);
  --success: #4ea870;
  --warn: #d4a017;
  --danger: #c8443e;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", "Charter", Georgia, "Times New Roman", serif;

  /* Refined shadows — depth without weight */
  --shadow-card: 0 1px 2px rgba(0,0,0,0.16);
  --shadow-card-hover: 0 4px 16px rgba(0,0,0,0.28);
  --shadow-overlay: 0 24px 48px rgba(0,0,0,0.42);

  /* Radii (sharper for editorial feel) */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;
}

[data-theme="light"] {
  --bg: #faf6ee;
  --surface: #ffffff;
  --surface2: #f4efe4;
  --surface3: #ebe4d4;
  --border: #d6cdba;
  --border-soft: rgba(11,29,51,0.05);
  --border-strong: #b8ad96;
  --text: #0a1c2f;
  --subtext: #4d5a72;
  --muted: #8a8a8a;
  --shadow-card: 0 1px 3px rgba(11,29,51,0.06);
  --shadow-card-hover: 0 4px 16px rgba(11,29,51,0.10);
}

/* ---------------------------------------------------------------------------
   Resets + base
   --------------------------------------------------------------------------- */

* { box-sizing: border-box; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}
input[type="file"] { padding: 8px; }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--muted); }

label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

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

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}

hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------------------------------------------------------------------------
   Typography — editorial serif headlines, sans for UI
   --------------------------------------------------------------------------- */

.serif {
  font-family: var(--font-serif);
  font-feature-settings: "ss01", "lnum", "kern";
  letter-spacing: -0.01em;
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--primary);
}

/* ---------------------------------------------------------------------------
   Buttons — restrained, deliberate
   --------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease, transform 0.06s ease;
  white-space: nowrap;
  font-family: inherit;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn-primary {
  background: var(--primary);
  color: #0a1c2f;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface2);
  border-color: var(--border-strong);
}
.btn-danger {
  background: transparent;
  border-color: rgba(200,68,62,0.35);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(200,68,62,0.08);
  border-color: var(--danger);
}
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------------------------------------------------------------------------
   Tags — quieter, smaller
   --------------------------------------------------------------------------- */

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: var(--surface2);
  color: var(--subtext);
  margin-right: 4px;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
   Status indicators — dot + text, not colored pills
   --------------------------------------------------------------------------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.status::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.status-active::before { background: var(--success); }
.status-warn::before   { background: var(--warn); }
.status-danger::before { background: var(--danger); }
.status-pending::before { background: var(--muted); }

/* ---------------------------------------------------------------------------
   Modal — refined panel, restrained backdrop
   --------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,11,22,0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: backdrop-fade 0.18s ease;
}
@keyframes backdrop-fade { from { opacity: 0; } to { opacity: 1; } }

.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-overlay);
  animation: panel-slide 0.22s ease;
}
@keyframes panel-slide {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-panel.modal-wide { max-width: 880px; }
.modal-panel.modal-xl { max-width: 1160px; }
.modal-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.modal-body { padding: 24px 28px; overflow-y: auto; }
.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

.field { display: flex; flex-direction: column; margin-bottom: 18px; }

/* ---------------------------------------------------------------------------
   Skeletons + empty states — editorial
   --------------------------------------------------------------------------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--subtext);
}
.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
  color: var(--text);
}
.empty-state p { font-size: 14px; max-width: 460px; margin: 0 auto; line-height: 1.65; color: var(--muted); }

/* ---------------------------------------------------------------------------
   Report cards — editorial layout, no emoji thumbnails
   --------------------------------------------------------------------------- */

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.report-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-card);
}
.report-card::before {
  /* Top accent line — only visible on hover. Restrained. */
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.report-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}
.report-card:hover::before { transform: scaleX(1); }

.report-card-body {
  padding: 24px 24px 20px;
  flex: 1;
  display: flex; flex-direction: column; gap: 8px;
}
.report-card-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.report-card-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}
.report-card-summary {
  font-size: 13.5px;
  color: var(--subtext);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  line-height: 1.6;
  margin-top: 4px;
}
.report-card-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 600;
}
.report-card-meta-sep { color: var(--border-strong); }
.report-card-actions {
  display: flex; gap: 6px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.012);
}

/* ---------------------------------------------------------------------------
   Tables — quietly elegant
   --------------------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
th {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
  padding: 14px 16px 11px;
  background: rgba(255,255,255,0.012);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.018); }

/* ---------------------------------------------------------------------------
   Toasts
   --------------------------------------------------------------------------- */

.toast {
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  animation: toast-slide 0.3s ease;
  max-width: 380px;
  box-shadow: var(--shadow-overlay);
  font-weight: 500;
  letter-spacing: 0.1px;
}
@keyframes toast-slide {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ---------------------------------------------------------------------------
   Scrollbars
   --------------------------------------------------------------------------- */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.spin {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
