/* ============================================================
   Satoshi Tips — Styles
   ============================================================ */

:root {
  --orange: #F7931A;
  --orange-dim: #c97614;
  --orange-glow: rgba(247, 147, 26, 0.22);
  --green: #22c55e;
  --red: #ef4444;

  /* Dark theme (default) */
  --bg: #0c0c14;
  --bg-card: #14142a;
  --bg-card-hover: #1c1c38;
  --bg-input: #0c0c14;
  --border: rgba(247, 147, 26, 0.18);
  --border-strong: rgba(247, 147, 26, 0.45);
  --text: #e8e8f0;
  --text-dim: #9090b0;
  --text-muted: #555575;
  --shadow: 0 4px 24px rgba(0,0,0,0.55);
  --radius: 14px;
  --radius-sm: 8px;
}

[data-theme="light"] {
  --bg: #f4f4ef;
  --bg-card: #ffffff;
  --bg-card-hover: #fafaf7;
  --bg-input: #ffffff;
  --border: rgba(0,0,0,0.1);
  --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.2rem; font-weight: 600; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { color: var(--text-dim); }
a { color: var(--orange); text-decoration: none; }

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

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 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.45rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  user-select: none;
}

.site-logo .bolt { color: var(--orange); font-size: 1.3rem; }
.header-actions { display: flex; gap: 0.4rem; align-items: center; }

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

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

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

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

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

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.22); }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; width: 100%; }
.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 1.1rem;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
}
.btn-icon:hover { color: var(--text); background: var(--bg-card-hover); }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.form-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus { border-color: var(--orange); }
.form-input.error { border-color: var(--red); }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.checkbox-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  accent-color: var(--orange);
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Alerts ── */
.alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}
.alert-error { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.alert-success { background: rgba(34,197,94,0.1); color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.alert-info { background: rgba(247,147,26,0.1); color: var(--orange); border: 1px solid var(--border-strong); }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Welcome modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.welcome-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.welcome-logo .bolt-big {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 12px var(--orange));
}
.welcome-logo h1 { margin-bottom: 0.35rem; }
.welcome-logo p { font-size: 0.95rem; }

.welcome-features {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.feature-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}
.feature-icon { color: var(--orange); font-size: 1rem; flex-shrink: 0; }

/* ── Main layout ── */
#main-wrap { display: none; padding-bottom: 3rem; }
#main-wrap.active { display: block; }

/* ── Voucher selector ── */
.voucher-selector {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 53px;
  z-index: 90;
}
.voucher-selector .container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.voucher-selector .container::-webkit-scrollbar { display: none; }

.voucher-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
  font-family: inherit;
}
.voucher-pill:hover { border-color: var(--orange); color: var(--text); }
.voucher-pill.active {
  background: var(--orange-glow);
  border-color: var(--orange);
  color: var(--orange);
  font-weight: 600;
}
.voucher-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.voucher-pill.active .pill-dot { background: var(--orange); }

.btn-new-voucher {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
  font-family: inherit;
}
.btn-new-voucher:hover { background: var(--orange-glow); }

/* ── Main content ── */
.main-content {
  padding-top: 1.5rem;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.section-gap { margin-bottom: 1.5rem; }

/* ── Voucher name ── */
.voucher-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}
.voucher-name-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.2rem 0;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.voucher-name-input:focus { border-bottom-color: var(--orange); }
.voucher-name-input::placeholder { color: var(--text-muted); font-weight: 400; }

/* ── Recipients ── */
.recipient-list { display: flex; flex-direction: column; gap: 0.75rem; }

.recipient-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  transition: border-color 0.15s;
}
.recipient-row:focus-within { border-color: var(--border-strong); }

.recipient-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.recipient-addr-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'Courier New', monospace;
  outline: none;
  padding: 0;
  min-width: 0;
}
.recipient-addr-input::placeholder { color: var(--text-muted); font-family: inherit; }

.recipient-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.share-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.share-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--orange-glow);
}
.share-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.share-pct {
  min-width: 3.5rem;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

.btn-remove-recipient {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.btn-remove-recipient:hover { color: var(--red); }

.add-recipient-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--orange);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: background 0.15s;
  margin-top: 0.5rem;
}
.add-recipient-btn:hover { background: var(--orange-glow); }

/* ── Schedule ── */
.schedule-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.schedule-icon { font-size: 1.4rem; flex-shrink: 0; }
.schedule-desc { flex: 1; min-width: 0; }
.schedule-desc strong { font-size: 0.9rem; display: block; margin-bottom: 0.15rem; }
.schedule-desc span { font-size: 0.8rem; color: var(--text-muted); }
.time-input {
  padding: 0.45rem 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  width: 7rem;
  flex-shrink: 0;
}
.time-input:focus { border-color: var(--orange); }

/* ── QR Code section ── */
.qr-section {
  margin-top: 2rem;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

.qr-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 0 0 1px var(--orange-glow), var(--shadow);
}

.qr-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.qr-canvas-wrap {
  display: inline-block;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.qr-lnurl-text {
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  transition: border-color 0.15s;
  margin-bottom: 1rem;
  display: block;
  text-align: left;
}
.qr-lnurl-text:hover { border-color: var(--orange); }
.qr-lnurl-text.copied { border-color: var(--green); color: var(--green); }

.qr-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Presets ── */
.presets-section {
  margin-top: 1.5rem;
}

.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.preset-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.preset-chip:hover { border-color: var(--orange); color: var(--text); }
.preset-chip .chip-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0 0 0 0.2rem;
  transition: color 0.15s;
  line-height: 1;
}
.preset-chip .chip-del:hover { color: var(--red); }

.preset-save-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.preset-name-input {
  flex: 1;
  padding: 0.45rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.preset-name-input:focus { border-color: var(--orange); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state .bolt-empty { font-size: 3rem; display: block; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h2 { font-size: 1.2rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.9rem; }

/* ── Settings panel ── */
#settings-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(360px, 100vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}
#settings-panel.open { transform: translateX(0); }
#settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}
#settings-overlay.open { display: block; }
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.danger-zone {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(239,68,68,0.2);
}
.danger-zone h3 { color: var(--red); margin-bottom: 0.5rem; }

/* ── Voucher status badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-active { background: rgba(34,197,94,0.12); color: var(--green); }
.status-expired { background: rgba(239,68,68,0.12); color: var(--red); }
.status-draft { background: rgba(247,147,26,0.12); color: var(--orange); }

/* ── Expired / activate banner ── */
.expired-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.expired-banner p { color: #fca5a5; font-size: 0.875rem; }

/* ── Tooltip ── */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; }
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  font-size: 0.65rem;
  color: var(--text-muted);
  cursor: help;
  font-style: normal;
  font-weight: 700;
  user-select: none;
  margin-left: 0.35rem;
}
.tooltip-text {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  width: 200px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
  line-height: 1.4;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.tooltip-wrap:hover .tooltip-text { opacity: 1; }

/* ── Print styles ── */
@media print {
  body * { visibility: hidden !important; }
  #print-modal-overlay,
  #print-modal-overlay * { visibility: visible !important; }
  #print-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
  }
  .print-actions { display: none !important; }
  .print-modal-box {
    box-shadow: none !important;
    border-radius: 0 !important;
    max-height: none !important;
  }
}

/* Print dialog / modal */
.print-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.print-modal-overlay.open { display: flex; }

.print-modal-box {
  background: #fff;
  color: #111;
  border-radius: 16px;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 64px rgba(0,0,0,0.7);
  animation: modalIn 0.2s ease;
}

.print-preview {
  padding: 2rem;
  text-align: center;
  background: #fff;
}

.print-preview-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.25rem;
}

.print-bolt { font-size: 2rem; color: #F7931A; margin-bottom: 0.25rem; }

.print-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #111;
  margin-bottom: 0.15rem;
  letter-spacing: -0.01em;
}

.print-subtitle {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0;
}

.print-qr-wrap {
  display: inline-block;
  background: #fff;
  border: 3px solid #F7931A;
  border-radius: 12px;
  padding: 10px;
  margin: 1.25rem 0;
  box-shadow: 0 4px 16px rgba(247,147,26,0.2);
}

.print-tagline {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 0.25rem;
}
.print-desc {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.4;
}

.print-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  font-size: 0.7rem;
  color: #999;
}

.print-actions {
  display: flex;
  gap: 0.65rem;
  padding: 1rem 2rem 1.5rem;
  background: #f9f9f9;
  border-top: 1px solid #eee;
  border-radius: 0 0 16px 16px;
}

@media print {
  body { background: #fff; }
  .print-modal-overlay { display: none !important; }
  .print-area {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 2rem;
  }
  .print-area * { visibility: visible; color: inherit; }
}
