/* Local Fonts (Zero Tracking) */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../../fonts/inter-regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../../fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../../fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../../fonts/inter-700.woff2') format('woff2'); }

@font-face { font-family: 'Lora'; font-style: normal; font-weight: 400; font-display: swap; src: url('../../fonts/lora-regular.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-style: normal; font-weight: 500; font-display: swap; src: url('../../fonts/lora-500.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-style: normal; font-weight: 600; font-display: swap; src: url('../../fonts/lora-600.woff2') format('woff2'); }

/* Theme Variables */
:root {
  --font-display: 'Lora', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --color-bg: #e4e9e6;
  --color-surface: #ffffff;
  --color-border: rgba(22, 163, 74, 0.25);
  --color-text: #14532d;
  --color-accent: #16a34a;
  --radius: 0.625rem;
  --tr: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 1px 3px rgba(22,163,74,0.06), 0 4px 16px rgba(22,163,74,0.04);
  --shadow-hover: 0 4px 20px rgba(22,163,74,0.10);

  --toast-bg: #14532d;
  --toast-text: #ffffff;

  --banner-bg: rgba(255, 255, 255, 0.85);
  --banner-border: rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] {
  --color-bg: #0f1a14;
  --banner-bg: rgba(20, 30, 25, 0.85);
  --banner-border: rgba(255, 255, 255, 0.1);
  --color-surface: #16241b;
  --color-border: rgba(74, 222, 128, 0.12);
  --color-text: #bbf7d0;
  --color-accent: #4ade80;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.30), 0 4px 16px rgba(0,0,0,0.25);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.35);

  --toast-bg: #bbf7d0;
  --toast-text: #0f1a14;
}

/* Custom Components & Utilities */
.toolbar-btn { width: 36px; height: 36px; border-radius: 0.5rem; border: 1px solid var(--color-border); background: var(--color-surface); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--tr), border-color var(--tr); color: var(--color-text); flex-shrink: 0; }
.toolbar-btn:hover { border-color: var(--color-accent); background: rgba(22, 163, 74, 0.06); }
[data-theme="dark"] .toolbar-btn:hover { background: rgba(74, 222, 128, 0.08); }

.select-wrap { position: relative; display: inline-flex; align-items: center; }
.toolbar-select { height: 36px; border-radius: 0.5rem; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); padding: 0 2.1rem 0 2.2rem; font-size: 0.8125rem; font-weight: 500; font-family: var(--font-body); appearance: none; cursor: pointer; transition: border-color var(--tr), background var(--tr); width: 130px; }
.toolbar-select:hover, .toolbar-select:focus { border-color: var(--color-accent); outline: none; }
.sel-icon-l, .sel-icon-r { position: absolute; pointer-events: none; opacity: 0.65; color: var(--color-text); }
.sel-icon-l { left: 0.65rem; } .sel-icon-r { right: 0.65rem; }

.btn-primary { background: #14532d; color: #fff; border-radius: var(--radius); font-family: var(--font-body); font-weight: 600; font-size: 0.9375rem; padding: 0.75rem 2rem; border: none; cursor: pointer; transition: background var(--tr), transform var(--tr), box-shadow var(--tr); display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-primary:hover:not(:disabled) { background: #064e3b; box-shadow: 0 4px 16px rgba(20, 83, 45, 0.25); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; background: var(--color-text); }
[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: #15803d; }

.btn-secondary { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--radius); font-family: var(--font-body); font-weight: 500; font-size: 0.875rem; padding: 0.625rem 1.25rem; cursor: pointer; transition: background var(--tr), border-color var(--tr); display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-secondary:hover:not(:disabled) { background: rgba(22, 163, 74, 0.05); border-color: var(--color-accent); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }
[data-theme="dark"] .btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.05); }

.drop-zone { border: 3px dashed #15803d; border-radius: var(--radius); cursor: pointer; transition: border-color var(--tr), background var(--tr); padding: 4rem 2rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; position: relative; background: var(--color-surface); }
.drop-zone.drag-active { border-color: var(--color-accent); background: rgba(22, 163, 74, 0.08); }
[data-theme="dark"] .drop-zone { border-color: rgba(74, 222, 128, 0.45); border-width: 2px; }
[data-theme="dark"] .drop-zone.drag-active { background: rgba(74, 222, 128, 0.08); border-color: var(--color-accent); }

.progress-fill { width: 0%; transition: width 0.4s ease; }

.workspace { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-card); display: flex; flex-direction: column; overflow: hidden; }
.workspace-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--color-border); background: rgba(22, 163, 74, 0.02); }
.workspace-body { padding: 1.5rem; background: var(--color-bg); display: flex; flex-direction: column; align-items: center; }
.workspace-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }

/* Results screen footer: downloads on top, "Start a new batch" separated below */
.workspace-footer.results-footer { flex-direction: column; align-items: stretch; }
.results-footer-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; width: 100%; }
.results-footer-divider { border-top: 1px solid var(--color-border); margin: 1rem 0; width: 100%; }
.results-new-batch-btn { align-self: flex-start; }
@media (max-width: 560px) {
  .results-footer-actions { flex-direction: column; }
  .results-footer-actions button { width: 100%; justify-content: center; }
  .results-new-batch-btn { width: 100%; justify-content: center; }
}

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,25,20,0.7); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-box { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-hover); display: flex; flex-direction: column; transform: translateY(20px); transition: transform 0.3s ease; max-height: 90vh; }
.modal-overlay.active .modal-box { transform: translateY(0); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; color: var(--color-accent); }
.modal-close { background: transparent; border: none; color: var(--color-text); opacity: 0.5; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 0.375rem; transition: background 0.2s; }
.modal-close:hover { background: rgba(22, 163, 74, 0.05); opacity: 1; }
[data-theme="dark"] .modal-close:hover { background: rgba(255,255,255,0.05); }
.modal-body { padding: 1.5rem; overflow-y: auto; font-size: 0.9375rem; line-height: 1.6; opacity: 0.9; }

/* Links inside the Privacy Proof modal content only (scoped by id, not .modal-body,
   so the button-styled anchors in other modals like Token/Pre-flight are unaffected) */
#modal-content a { color: var(--color-accent); text-decoration: underline; font-weight: 600; }
#modal-content a:hover { text-decoration: none; }

.fade-up { animation: fadeUp 0.4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.credit-input { width: 100%; padding: 0.75rem 1rem; border-radius: 0.5rem; border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-text); font-family: var(--font-mono); font-size: 0.875rem; outline: none; transition: border-color 0.2s; letter-spacing: 0.5px; font-weight: 600; }
.credit-input:focus { border-color: var(--color-accent); box-shadow: 0 0 0 2px rgba(22,163,74,0.1); }

/* Pre-flight Modal States */
.pf-success-box { background: #f0fdf4; border: 1px solid rgba(22,163,74,0.2); color: #166534; border-radius: var(--radius); padding: 0.875rem 1rem; display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.875rem; margin-bottom: 1.25rem; }
[data-theme="dark"] .pf-success-box { background: #052e16; color: #4ade80; border-color: rgba(74,222,128,0.2); }
.pf-error-box { background: #fef2f2; border: 1px solid rgba(185,28,28,0.2); color: #b91c1c; border-radius: var(--radius); padding: 0.875rem 1rem; display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.875rem; margin-bottom: 1.25rem; }
[data-theme="dark"] .pf-error-box { background: #1f0a0a; color: #f87171; }

.toast-hidden {
  position: fixed; bottom: 2rem; right: 2rem; transform: translateY(100px);
  background: var(--toast-bg); color: var(--toast-text); padding: 0.75rem 1.5rem;
  border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  opacity: 0; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 9999;
  display: flex; align-items: center; gap: 0.5rem; pointer-events: none;
}
.toast-hidden.show { transform: translateY(0); opacity: 1; }

.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Cookie Banner */
#cookie-banner {
  background: var(--banner-bg);
  border-top: 1px solid var(--banner-border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.cookie-banner-hidden { transform: translateY(100%); }

/* ==========================================================================
   BATCH-SPECIFIC COMPONENTS
   ========================================================================== */

/* Overall batch progress bar + counter */
.batch-summary-bar { display: flex; align-items: center; gap: 0.75rem; width: 100%; margin-bottom: 1.25rem; }
.progress-fill-track { flex-grow: 1; height: 6px; border-radius: 99px; background: rgba(22,163,74,0.1); overflow: hidden; }
.batch-counter-text { font-size: 0.8125rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--color-accent); }

/* File row list (used for pre-flight, progress, and results screens) */
.file-row-list { width: 100%; display: flex; flex-direction: column; gap: 0.5rem; max-height: 340px; overflow-y: auto; padding-right: 2px; }
.pf-file-list { max-height: 220px; }

.file-row {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 0.5rem; padding: 0.625rem 0.875rem; font-size: 0.8125rem;
}
.file-row.is-invalid, .file-row.is-error { border-color: rgba(220, 38, 38, 0.35); background: rgba(220, 38, 38, 0.04); }
[data-theme="dark"] .file-row.is-invalid, [data-theme="dark"] .file-row.is-error { background: rgba(220, 38, 38, 0.08); }
.file-row.is-done { border-color: rgba(22, 163, 74, 0.35); }

.file-row-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--color-accent); }
.file-row.is-invalid .file-row-icon, .file-row.is-error .file-row-icon { color: #dc2626; }

.file-row-main { flex-grow: 1; min-width: 0; }
.file-row-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row-detail { font-size: 0.75rem; opacity: 0.6; margin-top: 0.1rem; }
.file-row.is-invalid .file-row-detail, .file-row.is-error .file-row-detail { color: #dc2626; opacity: 0.85; }

.file-row-meta { flex-shrink: 0; font-size: 0.75rem; font-weight: 600; opacity: 0.55; white-space: nowrap; }

.file-row-remove {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: none; background: transparent;
  color: var(--color-text); opacity: 0.4; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, opacity 0.2s;
}
.file-row-remove:hover { opacity: 1; background: rgba(220, 38, 38, 0.1); color: #dc2626; }

.status-badge {
  flex-shrink: 0; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem; border-radius: 99px; white-space: nowrap;
}
.status-badge.waiting  { background: rgba(100,116,139,0.12); color: #64748b; }
.status-badge.active   { background: rgba(22,163,74,0.12); color: var(--color-accent); }
.status-badge.done     { background: rgba(22,163,74,0.15); color: #15803d; }
.status-badge.error    { background: rgba(220,38,38,0.12); color: #dc2626; }
[data-theme="dark"] .status-badge.done { color: #4ade80; }

/* Results row checkbox */
.results-row-checkbox { flex-shrink: 0; width: 18px; height: 18px; border: 2px solid var(--color-border); border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; background: var(--color-surface); transition: all 0.2s; }
.results-row-checkbox.checked { background: var(--color-accent); border-color: var(--color-accent); }
.results-row-checkbox.disabled { opacity: 0.3; cursor: not-allowed; }
.results-row-checkbox:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Results column header (aligned above the right-hand checkbox column) */
.results-header-row { width: 100%; display: flex; justify-content: flex-end; padding: 0 0.875rem 0.4rem; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.5; }

/* Staged file list (persistent, on-page, pre-processing) */
#staged-list-wrap { margin-top: 1.5rem; }
.staging-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.staging-validating { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; opacity: 0.6; }
