/* ============================================================
   JOG Data — Shared Design System
   Self-hosted fonts, design tokens, component styles.
   ============================================================ */

/* --- Fonts (self-hosted, GDPR-safe) --- */

/* Plus Jakarta Sans — variable weight (400-700), latin */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/shared/fonts/plus-jakarta-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/shared/fonts/plus-jakarta-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 400 */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/shared/fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/shared/fonts/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 500 */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/shared/fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/shared/fonts/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Design Tokens --- */

:root {
  /* Backgrounds */
  --bg-warm: #faf9f6;
  --bg-card: #ffffff;
  --bg-panel: #f6f5f2;
  --bg-muted: #f0efeb;
  --bg-input: #eceae5;

  /* Accent */
  --accent: #c4704b;
  --accent-hover: #ab5f3d;
  --accent-light: #fdf5f1;
  --accent-muted: #f0ddd4;
  --accent-text: #ffffff;

  /* Borders */
  --border: #e4e2dc;
  --border-strong: #d1cfca;

  /* Text */
  --text-primary: #1c1b18;
  --text-secondary: #5e5c56;
  --text-tertiary: #908d84;

  /* Status */
  --success: #5a8a5e;
  --success-light: #f0f6f0;
  --warn: #a07a22;
  --warn-light: #fdf7ea;
  --error: #b84040;
  --error-light: #fdf0f0;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;

  /* Fonts */
  --font: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

/* --- Base Reset --- */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg-warm);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.h-left { display: flex; align-items: center; gap: 10px; }
.h-mark { width: 5px; height: 20px; background: var(--accent); border-radius: 3px; }
.h-title { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.h-sep { color: var(--border-strong); font-weight: 300; font-size: 16px; }
.h-sub { font-size: 13px; color: var(--text-tertiary); }
.h-right { display: flex; align-items: center; gap: 8px; }
.h-back {
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.12s;
}
.h-back:hover { color: var(--text-secondary); }
.h-back svg { width: 14px; height: 14px; }

/* --- Panels (two-column layout) --- */

.main { flex: 1; display: grid; grid-template-columns: 380px 1fr; min-height: 0; }
.main--single { grid-template-columns: 1fr; }

.panel-l {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel-r {
  background: var(--bg-warm);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.p-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}

.panel-l .p-header { background: var(--bg-panel); }
.panel-r .p-header { background: var(--bg-warm); }

.p-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

.p-acts { display: flex; gap: 4px; }
.p-body { flex: 1; padding: 16px 20px; }

/* --- Buttons --- */

.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all 0.12s;
}
.btn-icon:hover { background: var(--bg-muted); border-color: var(--border); color: var(--text-secondary); }
.btn-icon svg { width: 14px; height: 14px; }

.btn-sm {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
}
.btn-sm:hover { border-color: var(--border-strong); background: var(--bg-muted); }
.btn-sm svg { width: 12px; height: 12px; }

.btn-accent { background: var(--accent-light); border-color: var(--accent-muted); color: var(--accent); }
.btn-accent:hover { background: var(--accent-muted); }

.btn-run {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 18px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-run:hover { background: var(--accent-hover); }
.btn-run:active { transform: scale(0.97); }
.btn-run:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-run:disabled:hover { background: var(--accent); }
.btn-run svg { width: 12px; height: 12px; }

.btn-run.loading { pointer-events: none; opacity: 0.8; }
.btn-run.loading .btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* --- Sections --- */

.w-section + .w-section { margin-top: 20px; }
.w-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

/* --- Dropzone --- */

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-card);
  transition: all 0.15s;
}
.dropzone:hover,
.dropzone.dragover { border-color: var(--accent); background: var(--accent-light); }

.dz-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  transition: all 0.15s;
  margin: 0 auto 12px;
}
.dropzone:hover .dz-icon,
.dropzone.dragover .dz-icon { border-color: var(--accent-muted); background: var(--accent-light); }
.dz-icon svg { width: 14px; height: 14px; color: var(--text-tertiary); }
.dropzone:hover .dz-icon svg,
.dropzone.dragover .dz-icon svg { color: var(--accent); }

.dz-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.dz-hint { font-size: 12px; color: var(--text-tertiary); }
.dz-hint a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* --- File Entry --- */

.file-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.file-ext {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.ext-pdf { background: var(--error-light); color: var(--error); }
.ext-csv { background: var(--success-light); color: var(--success); }
.ext-xlsx { background: var(--success-light); color: var(--success); }

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.file-x {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  transition: all 0.12s;
}
.file-x:hover { background: var(--error-light); color: var(--error); }

/* --- Options / Config --- */

.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
}
.opt-row + .opt-row { border-top: 1px solid var(--bg-muted); }
.opt-text { font-size: 12px; }
.opt-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.sel-sm {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-primary);
  background: var(--bg-card);
  cursor: pointer;
  outline: none;
}
.sel-sm:focus { border-color: var(--accent); }

/* --- Banner --- */

.banner {
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.banner p { font-size: 12px; line-height: 1.5; }
.banner a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.banner--info { background: var(--accent-light); border: 1px solid var(--accent-muted); }
.banner--info p { color: var(--text-secondary); }
.banner--info a { color: var(--accent); }

.banner--success { background: var(--success-light); border: 1px solid #c5dfc7; }
.banner--success p { color: var(--success); }

.banner--warn { background: var(--warn-light); border: 1px solid #e8ddb8; }
.banner--warn p { color: var(--warn); }

.banner--error { background: var(--error-light); border: 1px solid #f0c5c5; }
.banner--error p { color: var(--error); }

/* --- KPIs --- */

.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }

.kpi {
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* --- Results Bar --- */

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.results-count { font-size: 12px; color: var(--text-secondary); }
.results-count strong { color: var(--text-primary); }
.results-btns { display: flex; gap: 6px; }

/* --- Table --- */

.tbl-wrap {
  overflow-x: auto;
  margin-bottom: 32px;
  position: relative;
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, black calc(100% - 32px), transparent);
}
.tbl-wrap.scrolled-end { -webkit-mask-image: none; mask-image: none; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.tbl thead { background: var(--bg-panel); }

.tbl th {
  text-align: left;
  padding: 8px 12px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 2px solid var(--border);
  vertical-align: top;
}

.tbl th.sortable { cursor: pointer; user-select: none; transition: color 0.12s; }
.tbl th.sortable:hover { color: var(--text-primary); }

.sort-arrow { display: inline-block; margin-left: 3px; font-size: 9px; opacity: 0.3; transition: opacity 0.12s; }
.tbl th.sortable:hover .sort-arrow { opacity: 0.6; }
.tbl th.sorted .sort-arrow { opacity: 1; color: var(--accent); }
.tbl th.sorted { color: var(--accent); }

.tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--bg-muted);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.08s; }
.tbl tbody tr:hover td { background: var(--accent-light); }

.tbl .cell-wrap { white-space: normal; min-width: 140px; max-width: 280px; }

.mono { font-family: var(--mono); font-size: 11px; color: var(--text-secondary); }

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tag-base { background: var(--success-light); color: var(--success); }
.tag-variante { background: var(--warn-light); color: var(--warn); }

/* --- Empty State --- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.empty-icon svg { color: var(--border-strong); }

.empty-text { font-size: 13px; color: var(--text-tertiary); line-height: 1.5; max-width: 280px; }
.empty-text strong { color: var(--text-secondary); }

/* --- Processing State (simple bar) --- */

.proc-bar { height: 2px; background: var(--bg-muted); border-radius: 1px; overflow: hidden; margin-bottom: 20px; }
.proc-fill { height: 100%; background: var(--accent); border-radius: 1px; animation: slide 1.8s ease-in-out infinite; }
@keyframes slide { 0%{width:5%;margin-left:0} 50%{width:35%;margin-left:35%} 100%{width:5%;margin-left:95%} }
.proc-msg { text-align: center; font-size: 12px; color: var(--text-tertiary); }

/* --- Stepper (multi-step processing) — fullscreen variant --- */

.proc-fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 32px 24px;
}

.proc-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 340px;
}

.proc-logo {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  margin-bottom: 32px;
  opacity: 0.25;
  animation: logo-breathe 3s ease-in-out infinite;
}
@keyframes logo-breathe {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 0.35; }
}

.stepper { width: 100%; }

.stepper-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

/* Vertical line connecting steps */
.stepper-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 28px;
  bottom: -4px;
  width: 1.5px;
  background: var(--border);
}
.stepper-step.step-done:not(:last-child)::after { background: var(--accent); }

.step-indicator {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.step-check { color: var(--accent); }

.step-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-ring 1.5s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 112, 75, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(196, 112, 75, 0); }
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.step-content { flex: 1; min-width: 0; padding-top: 1px; }

.step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
}
.step-done .step-label { color: var(--text-secondary); }
.step-active .step-label { color: var(--text-primary); font-weight: 600; }

.step-bar-wrap {
  height: 3px;
  background: var(--bg-muted);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}
.step-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: slide 1.8s ease-in-out infinite;
}

.stepper-footer {
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  width: 100%;
}

.timer-value {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
}

.timer-timeout {
  font-size: 11px;
  color: var(--warn);
  margin-top: 6px;
}

/* --- Footer --- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 36px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
}
.f-left, .f-right { font-size: 10px; color: var(--text-tertiary); display: flex; align-items: center; gap: 10px; }
.f-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.f-right a { color: var(--text-tertiary); text-decoration: none; transition: color 0.12s; }
.f-right a:hover { color: var(--text-secondary); }

/* --- Utilities --- */

.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* --- Responsive --- */

@media (max-width: 860px) {
  .main { grid-template-columns: 1fr; }
  .panel-l { border-right: none; border-bottom: 1px solid var(--border); max-height: 50vh; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .h-sep, .h-sub { display: none; }
}

@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
  .header { padding: 0 16px; }
  .p-body { padding: 12px 16px; }
  .footer { padding: 0 16px; }
}
