/* ─── Design Tokens ─── */
:root {
  --bg:          #0a0a0f;
  --surface:     #111118;
  --surface-2:   #18181f;
  --surface-3:   #1e1e28;
  --border:      #2a2a38;
  --border-soft: #20202a;
  --ink:         #f0f0f5;
  --ink-muted:   #8888a0;
  --ink-faint:   #44445a;
  --accent:      #6c63ff;
  --accent-glow: rgba(108,99,255,.18);
  --accent-soft: rgba(108,99,255,.10);
  --green:       #22c55e;
  --green-soft:  rgba(34,197,94,.12);
  --amber:       #f59e0b;
  --amber-soft:  rgba(245,158,11,.10);
  --red:         #ef4444;
  --radius:      10px;
  --radius-lg:   16px;
  --mono:        'JetBrains Mono', 'Fira Code', monospace;
  --sans:        'Inter', system-ui, sans-serif;
  --shadow:      0 4px 24px rgba(0,0,0,.45);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; font-family: var(--sans); }
input, select, textarea { font-family: var(--sans); }

/* ─── Layout ─── */
.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* ─── Header ─── */
header {
  border-bottom: 1px solid var(--border-soft);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(10,10,15,.92);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  text-decoration: none;
  color: var(--ink);
}
.logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(108,99,255,.2);
}

/* ─── Main ─── */
main {
  padding: 40px 32px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Hero strip ─── */
.hero {
  margin-bottom: 40px;
}
.hero h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.hero h1 span { color: var(--accent); }
.hero p {
  color: var(--ink-muted);
  font-size: 15px;
  margin-top: 6px;
}

/* ─── Two-pane layout ─── */
.workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

/* ─── Panel ─── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.panel-body { padding: 20px; }

/* ─── Config panel ─── */
.config-section { margin-bottom: 24px; }
.config-section:last-child { margin-bottom: 0; }
.config-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* ─── Mode tabs ─── */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.mode-tab {
  padding: 9px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  text-align: center;
}
.mode-tab:hover { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.mode-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Country search ─── */
.search-wrap {
  position: relative;
  margin-bottom: 10px;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--ink-faint); }

/* ─── Country list ─── */
.country-list-wrap {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.country-list-wrap::-webkit-scrollbar { width: 4px; }
.country-list-wrap::-webkit-scrollbar-track { background: transparent; }
.country-list-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.country-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .1s;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
}
.country-item:last-child { border-bottom: none; }
.country-item:hover { background: var(--surface-3); }
.country-item.selected { background: var(--accent-soft); }
.country-flag { font-size: 18px; flex-shrink: 0; }
.country-name { flex: 1; font-weight: 500; }
.country-code {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink-faint);
}
.country-capability {
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .35px;
  white-space: nowrap;
  background: var(--green-soft);
  color: var(--green);
}
.country-capability.iban-mobile {
  background: var(--accent-soft);
  color: #a78bfa;
}
.country-capability.iban-only {
  background: var(--amber-soft);
  color: var(--amber);
}
.country-capability.unavailable {
  background: rgba(239,68,68,.10);
  color: #f87171;
}
.country-check {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .1s;
}
.country-item.selected .country-check {
  background: var(--accent);
  border-color: var(--accent);
}
.country-item.selected .country-check::after {
  content: '';
  width: 8px; height: 5px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

/* ─── Selected pills ─── */
.selected-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  min-height: 28px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 6px;
  background: var(--accent-soft);
  border: 1px solid rgba(108,99,255,.2);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.pill-remove {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--ink-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  padding: 0;
  cursor: pointer;
  transition: color .1s;
}
.pill-remove:hover { color: var(--red); }

/* ─── Quantity ─── */
.quantity-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qty-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  line-height: 1;
}
.qty-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.qty-input {
  width: 64px;
  text-align: center;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  outline: none;
}
.qty-input:focus { border-color: var(--accent); }

/* ─── Options toggles ─── */
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.option-row:last-child { border-bottom: none; }
.option-label {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}
.option-hint {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 1px;
}
.toggle {
  width: 36px; height: 20px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: transform .15s;
}
.toggle.on::after { transform: translateX(16px); }

/* ─── Generate button ─── */
.generate-btn {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.generate-btn:hover { background: #7c74ff; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,99,255,.35); }
.generate-btn:active { transform: translateY(0); }
.generate-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─── Results panel ─── */
.results-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.results-count {
  font-size: 13px;
  color: var(--ink-muted);
}
.results-count strong { color: var(--ink); }

/* marks a table restored from the previous session's cache */
.restored-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(108,99,255,.2);
  vertical-align: middle;
}
.toolbar-actions {
  display: flex;
  gap: 8px;
}
.action-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.action-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.action-btn.copied { background: var(--green-soft); border-color: var(--green); color: var(--green); }

/* ─── Results table ─── */
.results-body {
  padding: 0;
  overflow: auto;
  max-height: calc(100vh - 220px);
}
.results-body::-webkit-scrollbar { width: 4px; height: 4px; }
.results-body::-webkit-scrollbar-track { background: transparent; }
.results-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
}
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

.cell-flag { font-size: 20px; }
.cell-country { font-weight: 500; }
.cell-code { color: var(--ink-muted); font-size: 12px; }
.cell-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.type-iban { background: var(--accent-soft); color: var(--accent); }
.type-phone { background: var(--green-soft); color: var(--green); }
.type-both { background: var(--amber-soft); color: var(--amber); }

.cell-value {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.3px;
  color: var(--ink);
}
.cell-value.iban-val { color: #a78bfa; }
.cell-value.phone-val { color: #34d399; }

.copy-cell-btn {
  opacity: 0;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--ink-muted);
  font-size: 11px;
  transition: all .1s;
}
tr:hover .copy-cell-btn { opacity: 1; }
.copy-cell-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-cell-btn.ok { border-color: var(--green); color: var(--green); opacity: 1; }
.value-with-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
}
.value-with-copy .copy-cell-btn { opacity: .72; }
.not-available {
  color: var(--ink-faint);
  font-size: 12px;
  font-style: italic;
}

/* ─── Empty state ─── */
.empty-state {
  padding: 80px 20px;
  text-align: center;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: .5;
}
.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.empty-sub {
  font-size: 13px;
  color: var(--ink-faint);
}

/* ─── Toast ─── */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn .2s ease;
  box-shadow: var(--shadow);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red); color: var(--red); }

/* ─── Footer ─── */
footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-faint);
}
footer a { color: var(--ink-muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  main { padding: 24px 16px; }
  header { padding: 0 16px; }
  .results-body { max-height: 400px; }
}

/* ─── Loader ─── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Highlight on copy ─── */
.flash {
  animation: flash .3s ease;
}
@keyframes flash {
  0%   { background: var(--accent-soft); }
  100% { background: transparent; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
