/* ============================================================
   Satoshi Print — Shared Styles
   ============================================================ */

:root {
  /* Brand */
  --orange: #F7931A;
  --orange-dim: #c97614;
  --orange-glow: rgba(247, 147, 26, 0.25);

  /* Dark theme (default) */
  --bg: #0d0d14;
  --bg-card: #16162a;
  --bg-card-hover: #1e1e38;
  --bg-input: #0d0d14;
  --border: rgba(247, 147, 26, 0.2);
  --border-strong: rgba(247, 147, 26, 0.5);
  --text: #e8e8f0;
  --text-dim: #9090b0;
  --text-muted: #606080;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme="light"] {
  --bg: #f5f5f0;
  --bg-card: #ffffff;
  --bg-card-hover: #fafaf7;
  --bg-input: #ffffff;
  --border: rgba(0,0,0,0.12);
  --border-strong: var(--orange);
  --text: #1a1a2e;
  --text-dim: #555566;
  --text-muted: #999aaa;
  --shadow: 0 2px 12px rgba(0,0,0,0.1);
}

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

html { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  line-height: 1.5;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p  { color: var(--text-dim); }

/* ── Layout ── */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  backdrop-filter: blur(12px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.site-logo .bolt { color: var(--orange); font-size: 1.3rem; }

.header-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ── Nav tabs ── */
.nav-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 1rem 0 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.nav-tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.nav-tab:hover { color: var(--text); }
.nav-tab.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 1rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ── Pill selectors ── */
.pill-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.pill.selected {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-weight: 600;
}

/* ── Checkbox ── */
.checkbox-label {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.1rem;
  accent-color: var(--orange);
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
}

.btn-primary:hover { background: var(--orange-dim); }

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

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--orange); color: var(--orange); }

.btn-ghost {
  background: none;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }

.btn-danger {
  background: none;
  color: #e05555;
  border: 1px solid rgba(224,85,85,0.3);
}

.btn-danger:hover { background: rgba(224,85,85,0.1); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius);
  width: 100%;
}

/* ── Icon button ── */
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s;
}

.btn-icon:hover { color: var(--text); border-color: var(--border-strong); }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Alert / error ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.alert-error {
  background: rgba(224,85,85,0.12);
  border: 1px solid rgba(224,85,85,0.3);
  color: #e08888;
}

.alert-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: #4ade80;
}

/* ── Batch list ── */
.batch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.15s;
}

.batch-card:hover { border-color: var(--border-strong); }
.batch-card + .batch-card { margin-top: 0.75rem; }

.batch-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.batch-card-title { font-weight: 600; font-size: 1rem; }
.batch-card-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

.batch-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

.voucher-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-badge {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 500;
}

.stat-unfunded { background: rgba(150,150,200,0.15); color: var(--text-muted); }
.stat-funded   { background: rgba(247,147,26,0.15);  color: var(--orange); }
.stat-redeemed { background: rgba(34,197,94,0.12);   color: #4ade80; }
.stat-expired  { background: rgba(224,85,85,0.12);   color: #e08888; }

/* ── Setup / Onboarding ── */
.setup-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.setup-card {
  width: 100%;
  max-width: 460px;
}

.setup-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.setup-logo .bolt-big { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.setup-logo h1 { font-size: 1.5rem; }
.setup-logo p { font-size: 0.9rem; margin-top: 0.35rem; }

/* ── Settings panel ── */
.settings-panel {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.danger-zone {
  border: 1px solid rgba(224,85,85,0.25);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1.5rem;
}

.danger-zone h3 { color: #e08888; margin-bottom: 0.5rem; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; }

/* ── Tooltip ── */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; }

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: default;
  margin-left: 0.35rem;
}

.tooltip-text {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #2a2a40;
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 10;
  pointer-events: none;
  max-width: 220px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}

.tooltip-wrap:hover .tooltip-text { display: block; }

/* ============================================================
   PRINT STYLES
   ============================================================ */

@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  body { background: #fff !important; color: #000 !important; }

  .no-print { display: none !important; }
  #preview-area { display: none !important; }

  #print-content { position: static !important; left: auto !important; top: auto !important; }

  .print-page { page-break-after: always; }
  .print-page-last { page-break-after: avoid; }

  .voucher-sheet {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  /* A4 (297mm) minus 10mm top + 10mm bottom margins = 277mm ÷ 4 = 69.25mm per voucher */
  .voucher-card-print {
    width: 100%;
    height: 69.25mm;
    flex-shrink: 0;
    border-top: none;
    border-bottom: 1px dashed #555;
    border-left: 1px dashed #555;
    border-right: 1px dashed #555;
    border-radius: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    page-break-inside: avoid;
  }

  .voucher-sheet > .voucher-card-print:first-child {
    border-top: 1px dashed #555;
  }

  /* Dark card in print */
  /* Gradient splits at exactly 2/3 so the border colour is correct over both sections */
  .voucher-card-print.theme-dark {
    background: linear-gradient(to right, #1a3a5c 66.67%, #F7931A 66.67%) !important;
    color: #e8e8f0 !important;
  }

  /* Zones are transparent — card gradient shows through */
  .voucher-card-print.theme-dark .vc-qr-zone:last-child {
    background: transparent !important;
  }

  /* Separator margins cause blue bleed — remove them in print */
  .voucher-card-print.theme-dark .vc-separator {
    background: rgba(255,255,255,0.15) !important;
    margin: 0 !important;
  }

  .voucher-card-print.theme-dark .vc-qr-zone:last-child .vc-title {
    color: #fff !important;
  }

  .voucher-card-print.theme-light {
    background: #ffffff !important;
    color: #1a1a2e !important;
  }

  .vc-qr-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3mm;
    gap: 1mm;
  }

  /* White rounded QR wrapper — matches the screen card style */
  .vc-qr-zone .qr-wrap {
    background: #fff;
    padding: 3px;
    border-radius: 4px;
    line-height: 0;
  }

  /* Fund QR — smaller, de-emphasised */
  .vc-qr-zone:first-child canvas,
  .vc-qr-zone:first-child img { width: 34mm !important; height: 34mm !important; }

  /* Claim QR — larger, primary action */
  .vc-qr-zone:last-child canvas,
  .vc-qr-zone:last-child img { width: 48mm !important; height: 48mm !important; }

  .vc-qr-label {
    font-size: 6pt;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
  }

  .vc-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3mm 2mm;
    text-align: center;
    gap: 1.5mm;
  }

  .vc-bolt { font-size: 18pt; }

  .vc-title {
    font-size: 11pt;
    font-weight: 700;
    color: #F7931A !important;
    letter-spacing: 0.05em;
  }

  .vc-batch-name {
    font-size: 8pt;
    opacity: 0.75;
  }

  .vc-divider {
    width: 80%;
    height: 0.3mm;
    background: rgba(247,147,26,0.3);
    margin: 0.5mm 0;
  }

  .vc-expiry {
    font-size: 7pt;
    opacity: 0.7;
  }

  .vc-cta {
    font-size: 8pt;
    font-weight: 600;
    color: #F7931A !important;
    margin-top: 1mm;
  }

  .vc-separator {
    width: 0.3mm;
    background: rgba(247,147,26,0.2);
    margin: 3mm 0;
    flex-shrink: 0;
  }

  .batch-fund-inline {
    display: flex;
    align-items: center;
    gap: 4mm;
    border-top: 0.3mm dashed rgba(247,147,26,0.4);
    margin-top: 4mm;
    padding-top: 4mm;
    page-break-inside: avoid;
  }

  .batch-fund-inline-qr { flex-shrink: 0; background: #fff; padding: 2mm; border-radius: 2mm; }
  .batch-fund-inline-qr canvas, .batch-fund-inline-qr img { width: 28mm !important; height: 28mm !important; }

  .batch-fund-inline-info { flex: 1; }

  .batch-fund-inline-title {
    font-size: 9pt;
    font-weight: 700;
    color: #F7931A !important;
  }

  .batch-fund-inline-sub {
    font-size: 7pt;
    opacity: 0.7;
    margin-top: 0.5mm;
  }

  .batch-fund-inline-lnurl {
    font-family: monospace;
    font-size: 5.5pt;
    color: #666;
    word-break: break-all;
    margin-top: 1mm;
  }
}
