/* ─────────────────────────────────────────────────────────────────────────
   Currency.tn — Main Stylesheet
   ───────────────────────────────────────────────────────────────────────── */

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  /* Brand */
  --brand-primary:   #1a56db;
  --brand-hover:     #1648c7;
  --brand-light:     #eff6ff;
  --brand-glow:      rgba(26,86,219,.12);

  /* Neutrals */
  --color-bg:        #f8fafc;
  --color-surface:   #ffffff;
  --color-surface2:  #f1f5f9;
  --color-border:    #e2e8f0;
  --color-border2:   #cbd5e1;
  --color-text:      #0f172a;
  --color-muted:     #64748b;
  --color-subtle:    #94a3b8;

  /* Semantic */
  --color-green:     #10b981;
  --color-green-bg:  #ecfdf5;
  --color-red:       #ef4444;
  --color-red-bg:    #fef2f2;
  --color-amber:     #f59e0b;
  --color-amber-bg:  #fffbeb;

  /* Sizing */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);
  --shadow-xl:  0 24px 60px rgba(0,0,0,.14);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Layout */
  --container: 1200px;
  --header-h:  64px;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --dur:  200ms;
}

/* Dark mode */
[data-theme="dark"] {
  --color-bg:       #0b1120;
  --color-surface:  #141c2f;
  --color-surface2: #1a2540;
  --color-border:   #1e2d45;
  --color-border2:  #263553;
  --color-text:     #f1f5f9;
  --color-muted:    #94a3b8;
  --color-subtle:   #64748b;
  --brand-light:    rgba(26,86,219,.18);
  --brand-glow:     rgba(26,86,219,.20);
  --shadow:         0 4px 16px rgba(0,0,0,.3);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.4);
  --shadow-xl:      0 24px 60px rgba(0,0,0,.5);
  --color-green-bg: rgba(16,185,129,.12);
  --color-red-bg:   rgba(239,68,68,.12);
  --color-amber-bg: rgba(245,158,11,.12);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul, ol { list-style: none; }
input, select, textarea { font: inherit; }
table { border-collapse: collapse; }

/* ── Utilities ────────────────────────────────────────────── */
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: absolute; top: -9999px; left: 1rem; padding: .5rem 1rem; background: var(--brand-primary); color: #fff; border-radius: var(--radius); z-index: 9999; }
.skip-link:focus { top: 1rem; }
.text-green  { color: var(--color-green); }
.text-red    { color: var(--color-red); }
.text-muted  { color: var(--color-muted); }
.text-mono   { font-family: var(--font-mono); }
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem;
  font-size: .75rem; font-weight: 600; line-height: 1.4;
  border-radius: var(--radius-full);
}
.badge-green  { background: var(--color-green-bg);  color: var(--color-green); }
.badge-red    { background: var(--color-red-bg);    color: var(--color-red); }
.badge-amber  { background: var(--color-amber-bg);  color: var(--color-amber); }
.badge-blue   { background: var(--brand-light);     color: var(--brand-primary); }
.badge-neutral{ background: var(--color-surface2);  color: var(--color-muted); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.25rem;
  font-size: .9rem; font-weight: 600; line-height: 1;
  border-radius: var(--radius);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform 80ms var(--ease), opacity var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); box-shadow: 0 4px 16px var(--brand-glow); }
.btn-secondary { background: var(--color-surface2); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border); }
.btn-ghost { color: var(--color-muted); }
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface2); }
.btn-danger { background: var(--color-red-bg); color: var(--color-red); border: 1px solid rgba(239,68,68,.2); }
.btn-danger:hover { background: var(--color-red); color: #fff; }
.btn-lg { padding: .8rem 1.75rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: .35rem .9rem; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-icon { padding: .55rem; border-radius: var(--radius); aspect-ratio: 1; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-padded { padding: 1.5rem; }
.card-hover { transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* ── Forms ────────────────────────────────────────────────── */
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--color-muted); margin-bottom: .4rem; letter-spacing: .02em; text-transform: uppercase; }
.form-input, .form-select {
  width: 100%; padding: .7rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border2);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: .95rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-glow); }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9rem center; padding-right: 2.5rem; cursor: pointer; }

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px) saturate(1.5);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--dur) var(--ease);
}
[data-theme="dark"] .site-header {
  background: rgba(11,17,32,.92);
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.header-inner {
  height: 100%;
  display: flex; align-items: center; gap: 1.5rem;
}
.site-logo {
  display: flex; align-items: center; gap: .55rem;
  font-size: 1.15rem; font-weight: 800;
  color: var(--color-text);
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.logo-icon { color: var(--brand-primary); }
.logo-dot { color: var(--brand-primary); }

.primary-nav { flex: 1; }
.nav-list { display: flex; align-items: center; gap: .25rem; }
.nav-link {
  display: flex; align-items: center;
  padding: .45rem .8rem;
  font-size: .88rem; font-weight: 500;
  color: var(--color-muted);
  border-radius: var(--radius);
  transition: color var(--dur), background var(--dur);
}
.nav-link:hover, .nav-link.active { color: var(--color-text); background: var(--color-surface2); }
.nav-link.active { color: var(--brand-primary); }

.header-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-shrink: 0; }
.btn-theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  color: var(--color-muted);
  transition: color var(--dur), background var(--dur);
}
.btn-theme-toggle:hover { color: var(--color-text); background: var(--color-surface2); }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

.hamburger { display: none; flex-direction: column; gap: 5px; padding: .5rem; border-radius: var(--radius); flex-shrink: 0; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--color-text); border-radius: 2px; transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
/* Mobile auth list item: hidden on desktop, visible inside mobile dropdown */
.nav-mobile-auth { display: none; }


/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #1a56db 100%);
  padding: 4rem 0 3rem;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 60% 40%, rgba(99,160,255,.18) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; text-align: center; }
.hero-tag {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .3rem .9rem; margin-bottom: 1.25rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-full);
  font-size: .8rem; font-weight: 600; color: rgba(255,255,255,.85);
  letter-spacing: .04em; text-transform: uppercase;
}
.hero-tag-dot {
  width: 6px; height: 6px;
  background: var(--color-green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.3)} }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.75rem); font-weight: 800; color: #fff; letter-spacing: -.03em; line-height: 1.15; margin-bottom: .75rem; }
.hero p { font-size: 1rem; color: rgba(255,255,255,.7); max-width: 520px; margin: 0 auto 2rem; }

/* ── Converter Widget ─────────────────────────────────────── */
.converter-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 2rem;
  max-width: 780px;
  margin: 0 auto;
  border: 1px solid var(--color-border);
}
/* Amount row */
.conv-amount-row { margin-bottom: 1rem; }
.conv-label { display: block; font-size: .78rem; font-weight: 700; color: var(--color-muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: .5rem; }
/* Selectors row: [from] [swap] [to] */
.conv-selectors-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
/* Legacy class kept for JS compatibility */
.converter-fields { display: none; }
.converter-field { display: flex; flex-direction: column; gap: .5rem; }
.converter-field label { font-size: .78rem; font-weight: 700; color: var(--color-muted); letter-spacing: .06em; text-transform: uppercase; }
.converter-amount {
  font-size: 1.5rem; font-weight: 700;
  padding: .8rem 1rem;
  border: 2px solid var(--color-border2);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  width: 100%; transition: border-color var(--dur);
}
.converter-amount:focus { outline: none; border-color: var(--brand-primary); }
.currency-selector {
  display: flex; align-items: center; gap: .5rem;
  padding: .8rem 1rem;
  border: 2px solid var(--color-border2);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer; transition: border-color var(--dur), box-shadow var(--dur);
  min-width: 0;
}
.currency-selector:hover { border-color: var(--color-border2); background: var(--color-surface2); }
.currency-selector.open { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-glow); }
.flag-emoji { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }
.currency-code { font-size: 1.1rem; font-weight: 700; }
.currency-name-small { font-size: .78rem; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selector-caret { margin-left: auto; color: var(--color-subtle); flex-shrink: 0; }
.swap-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur), color var(--dur), transform var(--dur);
  flex-shrink: 0; margin-bottom: .4rem;
}
.swap-btn:hover { background: var(--brand-primary); color: #fff; transform: rotate(180deg); }

.converter-result {
  padding: 1.25rem 1rem;
  background: var(--brand-light);
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 1.25rem;
}
.result-amount {
  font-size: 2rem; font-weight: 800;
  color: var(--brand-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.result-label { font-size: .85rem; color: var(--color-muted); margin-top: .25rem; }
.result-meta {
  display: flex; justify-content: center; gap: 1.5rem;
  margin-top: .75rem; padding-top: .75rem;
  border-top: 1px solid var(--color-border);
  font-size: .82rem; color: var(--color-muted);
}
.result-meta span strong { color: var(--color-text); }

.converter-actions { display: flex; gap: .75rem; }
.converter-actions .btn { flex: 1; }

/* Currency Search Dropdown */
.currency-dropdown {
  position: absolute;
  z-index: 200;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 320px;
  max-height: 400px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.currency-search-wrap { padding: .75rem; border-bottom: 1px solid var(--color-border); }
.currency-search {
  width: 100%; padding: .55rem .9rem;
  border: 1px solid var(--color-border2);
  border-radius: var(--radius);
  background: var(--color-surface2);
  color: var(--color-text); font-size: .9rem;
}
.currency-search:focus { outline: none; border-color: var(--brand-primary); }
.currency-list { flex: 1; overflow-y: auto; padding: .4rem; }
.currency-group-label { padding: .4rem .6rem; font-size: .72rem; font-weight: 700; color: var(--color-subtle); letter-spacing: .08em; text-transform: uppercase; }
.currency-option {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur);
}
.currency-option:hover, .currency-option.focused { background: var(--color-surface2); }
.currency-option.selected { background: var(--brand-light); }
.currency-option-name { font-size: .85rem; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Rate Table ───────────────────────────────────────────── */
.rate-section { padding: 3rem 0; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.section-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
.section-subtitle { font-size: .85rem; color: var(--color-muted); margin-top: .2rem; }

.rate-filter-tabs {
  display: flex; gap: .35rem;
  background: var(--color-surface2);
  border-radius: var(--radius);
  padding: .3rem;
}
.tab-btn {
  padding: .4rem .9rem;
  font-size: .82rem; font-weight: 600;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  transition: background var(--dur), color var(--dur);
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { background: var(--color-surface); color: var(--brand-primary); box-shadow: var(--shadow-sm); }

.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.rate-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: box-shadow var(--dur), border-color var(--dur), transform var(--dur);
  cursor: pointer;
  text-decoration: none; color: inherit;
}
.rate-card:hover { box-shadow: var(--shadow); border-color: var(--color-border2); transform: translateY(-1px); }
.rate-card-left { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.rate-flag { font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.rate-pair { font-size: .8rem; font-weight: 700; color: var(--color-text); }
.rate-pair-label { font-size: .72rem; color: var(--color-muted); }
.rate-value { text-align: right; flex-shrink: 0; }
.rate-number { font-size: .95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rate-change { font-size: .72rem; font-weight: 600; }
.rate-change.pos { color: var(--color-green); }
.rate-change.neg { color: var(--color-red); }

/* ── Mini Sparkline ───────────────────────────────────────── */
.sparkline { display: inline-block; vertical-align: middle; }

/* ── Pair Page ────────────────────────────────────────────── */
.pair-hero {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  padding: 3rem 0;
  color: #fff;
}
.pair-hero-title { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: .5rem; }
.pair-hero-subtitle { color: rgba(255,255,255,.65); font-size: .95rem; }
.pair-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem; margin-top: 2rem;
}
.pair-stat {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 1rem;
}
.pair-stat-label { font-size: .75rem; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .3rem; }
.pair-stat-value { font-size: 1.2rem; font-weight: 700; }

.pair-content { padding: 3rem 0; }
.pair-grid { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; }
.chart-section { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.5rem; }
.chart-period-tabs { display: flex; gap: .3rem; margin-bottom: 1.5rem; }
.period-btn { padding: .3rem .7rem; font-size: .8rem; font-weight: 600; border-radius: var(--radius-sm); color: var(--color-muted); transition: background var(--dur), color var(--dur); }
.period-btn:hover { color: var(--color-text); background: var(--color-surface2); }
.period-btn.active { background: var(--brand-primary); color: #fff; }
.chart-wrap { position: relative; height: 300px; }

/* ── Crypto Page ──────────────────────────────────────────── */
.crypto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.crypto-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: box-shadow var(--dur), transform var(--dur);
  cursor: pointer;
}
.crypto-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.crypto-card-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.crypto-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--color-surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: var(--brand-primary);
  flex-shrink: 0;
}
.crypto-name { font-weight: 700; font-size: .95rem; }
.crypto-symbol { font-size: .78rem; color: var(--color-muted); }
.crypto-price { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.crypto-change { font-size: .85rem; font-weight: 600; }
.crypto-mcap { font-size: .78rem; color: var(--color-muted); margin-top: .35rem; }

/* ── Strength Meter ───────────────────────────────────────── */
.strength-page { padding: 3rem 0; }
.strength-header { text-align: center; margin-bottom: 3rem; }
.strength-title { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: .5rem; }
.strength-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem; max-width: 1000px; margin: 0 auto;
}
.strength-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}
.strength-flag { font-size: 2rem; margin-bottom: .5rem; }
.strength-currency { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; }
.strength-bar-wrap { height: 8px; background: var(--color-surface2); border-radius: var(--radius-full); overflow: hidden; margin-bottom: .5rem; }
.strength-bar { height: 100%; border-radius: var(--radius-full); transition: width .6s var(--ease); }
.strength-score { font-size: .82rem; font-weight: 600; }

/* ── Historical Page ──────────────────────────────────────── */
.historical-page { padding: 3rem 0; }
.historical-controls {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; align-items: end;
}

/* ── Travel Page ──────────────────────────────────────────── */
.travel-page { padding: 3rem 0; }
.travel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.travel-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.75rem; }
.travel-card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; }
.travel-fee-list { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.travel-fee-item { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; background: var(--color-surface2); border-radius: var(--radius-sm); font-size: .88rem; }
.travel-fee-item strong { font-variant-numeric: tabular-nums; }
.travel-total { display: flex; justify-content: space-between; align-items: center; padding: .9rem; background: var(--brand-light); border-radius: var(--radius); border: 1px solid rgba(26,86,219,.2); font-weight: 700; margin-top: .75rem; }
.travel-total .amount { font-size: 1.15rem; color: var(--brand-primary); }

/* ── Alerts Page ──────────────────────────────────────────── */
.alerts-page { padding: 3rem 0; }
.alerts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.alert-form-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.75rem; position: sticky; top: calc(var(--header-h) + 1rem); }
.alert-form-card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1.5rem; }
.alert-form-fields { display: flex; flex-direction: column; gap: 1rem; }
.alert-pair-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: end; }
.direction-toggle { display: flex; border: 1px solid var(--color-border2); border-radius: var(--radius); overflow: hidden; margin-top: .4rem; }
.direction-btn { flex: 1; padding: .6rem; font-size: .82rem; font-weight: 600; color: var(--color-muted); background: var(--color-surface); transition: background var(--dur), color var(--dur); }
.direction-btn.active { background: var(--brand-primary); color: #fff; }

/* ── Page: 404 ────────────────────────────────────────────── */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; text-align: center; padding: 3rem; }
.error-code { font-size: 5rem; font-weight: 900; color: var(--brand-primary); line-height: 1; }
.error-title { font-size: 1.5rem; font-weight: 700; margin: .5rem 0; }
.error-desc { color: var(--color-muted); margin-bottom: 1.5rem; }

/* ── Features Strip ───────────────────────────────────────── */
.features-strip { padding: 3rem 0; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.feature-card { display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.feature-icon { width: 42px; height: 42px; border-radius: var(--radius); background: var(--brand-light); color: var(--brand-primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.feature-title { font-size: .92rem; font-weight: 700; margin-bottom: .25rem; }
.feature-desc { font-size: .82rem; color: var(--color-muted); line-height: 1.5; }

/* ── Popular Pairs ────────────────────────────────────────── */
.popular-pairs { padding: 2rem 0 3rem; }
.pairs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.pair-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .88rem; font-weight: 600;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur);
}
.pair-link:hover { background: var(--brand-light); border-color: rgba(26,86,219,.25); box-shadow: var(--shadow-sm); }
.pair-link-flags { font-size: 1rem; }
.pair-link-rate { font-size: .8rem; font-weight: 700; color: var(--color-muted); font-variant-numeric: tabular-nums; }

/* ── Toast ────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1.2rem;
  background: var(--color-text); color: var(--color-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .875rem; font-weight: 500;
  max-width: 360px; pointer-events: all;
  animation: toast-in .25s var(--ease);
}
.toast.success { background: var(--color-green); color: #fff; }
.toast.error   { background: var(--color-red);   color: #fff; }
.toast.out     { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in  { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:none} }
@keyframes toast-out { to{opacity:0;transform:translateY(12px)} }

/* ── Loader ───────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--color-border2);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: inline-block;
}
@keyframes spin { to{transform:rotate(360deg)} }
.loading-overlay { display: flex; align-items: center; justify-content: center; min-height: 200px; }

/* ── Table ────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem; font-weight: 700; color: var(--color-muted);
  letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--color-surface2); }
.data-table-wrap { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }
.table-scroll { overflow-x: auto; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .4rem; justify-content: center; padding: 1.5rem 0; }
.page-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); font-size: .85rem; font-weight: 600;
  color: var(--color-muted); border: 1px solid var(--color-border);
  transition: background var(--dur), color var(--dur), border-color var(--dur);
  background: var(--color-surface);
}
.page-btn:hover { color: var(--color-text); border-color: var(--color-border2); }
.page-btn.active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.page-btn:disabled { opacity: .4; pointer-events: none; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 3.5rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem; margin-bottom: 2.5rem;
}
.footer-logo { font-size: 1.15rem; font-weight: 800; margin-bottom: .7rem; display: block; color: var(--color-text); }
.footer-logo span { color: var(--brand-primary); }
.footer-tagline { font-size: .88rem; color: var(--color-muted); line-height: 1.6; margin-bottom: .75rem; }
.footer-note { font-size: .78rem; color: var(--color-subtle); line-height: 1.5; }
.footer-heading { font-size: .78rem; font-weight: 700; color: var(--color-muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .9rem; }
.footer-links ul { display: flex; flex-direction: column; gap: .5rem; }
.footer-links a { font-size: .88rem; color: var(--color-muted); transition: color var(--dur); }
.footer-links a:hover { color: var(--color-text); }
.footer-bottom { border-top: 1px solid var(--color-border); padding-top: 1.25rem; font-size: .8rem; color: var(--color-subtle); text-align: center; }

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--color-muted); margin-bottom: 1rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--color-muted); transition: color var(--dur); }
.breadcrumb a:hover { color: var(--color-text); }
.breadcrumb-sep { color: var(--color-subtle); }

/* ── Ticker Bar ───────────────────────────────────────────── */
.ticker-bar {
  background: var(--color-surface2);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden; height: 36px;
  position: relative;
}
.ticker-track {
  display: flex; align-items: center; gap: 2rem;
  height: 100%; white-space: nowrap;
  animation: ticker-scroll 40s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-item { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 500; padding: 0 .5rem; }
.ticker-pair { color: var(--color-muted); }
.ticker-rate { font-variant-numeric: tabular-nums; font-weight: 700; }
.ticker-chg { font-size: .72rem; font-weight: 600; }
@keyframes ticker-scroll { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .pair-grid { grid-template-columns: 1fr; }
  .alerts-grid { grid-template-columns: 1fr; }
  .travel-grid { grid-template-columns: 1fr; }
}

/* ── Tier badge next to username in header ─────────────────── */
.header-tier-badge {
  display: inline-block;
  margin-left: .375rem;
  padding: .1rem .4rem;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  vertical-align: middle;
  line-height: 1.4;
}

@media (max-width: 768px) {
  /* ── Header: logo | (flex gap) | theme-toggle | hamburger ── */
  .header-inner { gap: .5rem; padding: 0 1rem; overflow: hidden; }
  .site-logo { flex-shrink: 0; }

  /* Hide Login + Sign Up buttons from header bar */
  .nav-link--desktop-only { display: none !important; }

  /* Show hamburger button */
  .hamburger { display: flex; flex-shrink: 0; }

  /* Mobile nav overlay */
  .primary-nav {
    display: none;
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
    padding: .5rem .75rem .85rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    z-index: 9999;
  }
  .primary-nav.open { display: block; }
  .nav-list { flex-direction: column; gap: .1rem; }
  .nav-link { padding: .75rem 1rem; border-radius: var(--radius); display: block; }

  /* Auth section inside hamburger menu */
  .nav-mobile-auth {
    display: block;
    margin-top: .5rem;
    padding-top: .6rem;
    border-top: 1px solid var(--color-border);
  }

  /* ── Converter ── */
  .converter-card { padding: 1.25rem; }
  .converter-result .result-meta { flex-direction: column; gap: .5rem; }
  .rate-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .hero { padding: 2.5rem 0 2rem; }
  .historical-controls { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .converter-card { padding: 1.25rem; border-radius: var(--radius-lg); }
  .result-amount { font-size: 1.5rem; }
  .converter-actions { flex-direction: column; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .ticker-bar, .converter-actions, .btn { display: none !important; }
  body { background: #fff; color: #000; }
}

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

/* ════════════════════════════════════════════════════════════
   BANKS DIRECTORY
   ════════════════════════════════════════════════════════════ */

/* Hero */
.page-hero--banks {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 3rem 0 2.5rem;
  text-align: center;
}
.page-hero__title { font-size: 2rem; font-weight: 700; margin: 0 0 .5rem; }
.page-hero__sub   { color: rgba(255,255,255,.7); margin: 0; font-size: 1rem; }

/* Layout: sidebar + results */
.banks-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  align-items: start;
}

/* Filters sidebar */
.banks-filters {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem;
  position: sticky;
  top: 80px;
}
.banks-filters__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.banks-filters__title { font-size: .95rem; font-weight: 600; margin: 0; }
.banks-filters__close { display: none; background: none; border: none; cursor: pointer; font-size: 1rem; color: #64748b; }
.filter-group { margin-bottom: 1rem; }
.filter-label { display: block; font-size: .8rem; font-weight: 500; color: #64748b; margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .04em; }
.filter-input,
.filter-select { width: 100%; padding: .5rem .75rem; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; font-size: .875rem; background: var(--surface, #fff); color: var(--text, #0f172a); box-sizing: border-box; }
.filter-input:focus, .filter-select:focus { outline: 2px solid var(--primary, #2563eb); outline-offset: -1px; }
.btn-full { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; border: 1px solid var(--border, #e2e8f0); color: var(--text, #0f172a); }
.btn-ghost:hover { background: var(--surface-raised, #f8fafc); }

/* Toolbar */
.banks-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.banks-toolbar__count { font-size: .875rem; color: #64748b; }
#filters-open { display: none; }

/* Banks grid */
.banks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.bank-card {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, border-color .15s, transform .15s;
  position: relative;
  overflow: hidden;
}
.bank-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); border-color: var(--primary, #2563eb); transform: translateY(-1px); }
.bank-card__flag { flex-shrink: 0; margin-top: 2px; }
.bank-card__body { flex: 1; min-width: 0; }
.bank-card__name { font-size: .9rem; font-weight: 600; margin: 0 0 .25rem; line-height: 1.3; }
.bank-card__meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .25rem; }
.bank-card__country { font-size: .75rem; color: #64748b; }
.bank-card__type { font-size: .72rem; background: #eff6ff; color: #2563eb; padding: .1rem .4rem; border-radius: 4px; font-weight: 500; }
.bank-card__hq { font-size: .75rem; color: #94a3b8; display: flex; align-items: center; gap: .3rem; }
.bank-card__assets { font-size: .75rem; color: #16a34a; font-weight: 500; margin-top: .2rem; }
.bank-card__featured-badge { position: absolute; top: .5rem; right: .5rem; font-size: .8rem; color: #f59e0b; }

/* Empty state */
.banks-empty { text-align: center; padding: 3rem 1rem; color: #64748b; }
.banks-empty svg { opacity: .3; margin-bottom: 1rem; }
.banks-empty p { margin: 0 0 1rem; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: .4rem; margin-top: 2rem; flex-wrap: wrap; }
.pagination__btn { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 .5rem; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; text-decoration: none; font-size: .85rem; color: var(--text, #0f172a); background: var(--surface, #fff); transition: all .15s; }
.pagination__btn:hover, .pagination__btn.active { background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb); }
.pagination__dots { display: inline-flex; align-items: center; color: #94a3b8; padding: 0 .25rem; }

/* ── Bank detail page ── */
.bank-detail { padding: 1.5rem 0 3rem; }
.breadcrumb { font-size: .8rem; color: #64748b; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--primary, #2563eb); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: #cbd5e1; }

.bank-detail__layout { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; align-items: start; }

.bank-detail__main { background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: var(--radius-lg, 12px); padding: 1.75rem; }
.bank-detail__header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap; }
.bank-detail__flag-name { display: flex; align-items: center; gap: .75rem; }
.bank-detail__name { font-size: 1.5rem; font-weight: 700; margin: 0; }
.bank-detail__name-local { font-size: .9rem; color: #64748b; margin: .2rem 0 0; }

.bank-type-badge { display: inline-block; padding: .3rem .8rem; border-radius: 20px; font-size: .8rem; font-weight: 500; background: #eff6ff; color: #2563eb; white-space: nowrap; }
.bank-type-badge--central    { background: #fef3c7; color: #92400e; }
.bank-type-badge--investment { background: #f0fdf4; color: #166534; }
.bank-type-badge--islamic    { background: #f0fdfa; color: #134e4a; }
.bank-type-badge--private    { background: #faf5ff; color: #6b21a8; }

.bank-detail__desc { color: #475569; line-height: 1.7; margin-bottom: 1.5rem; }

.bank-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.bank-fact { background: var(--surface-raised, #f8fafc); border-radius: 8px; padding: .75rem 1rem; }
.bank-fact__label { display: block; font-size: .73rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-bottom: .25rem; }
.bank-fact__value { font-size: .9rem; font-weight: 500; color: var(--text, #0f172a); }
.bank-fact__value a { color: var(--primary, #2563eb); text-decoration: none; }
.bank-fact__value a:hover { text-decoration: underline; }
.bank-fact__value code { font-family: 'JetBrains Mono', monospace; background: #f1f5f9; padding: .1rem .3rem; border-radius: 3px; font-size: .85rem; }

.bank-converter-cta { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); border-radius: 10px; padding: 1rem 1.25rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.bank-converter-cta p { margin: 0; flex: 1; min-width: 180px; font-size: .875rem; color: #1e40af; }

/* Sidebar */
.bank-detail__sidebar { display: flex; flex-direction: column; gap: 1rem; }
.bank-related { background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: var(--radius-lg, 12px); padding: 1.25rem; }
.bank-related__title { font-size: .9rem; font-weight: 600; margin: 0 0 .75rem; }
.bank-related__list { list-style: none; margin: 0 0 .75rem; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.bank-related__list li a { font-size: .85rem; color: var(--text, #0f172a); text-decoration: none; display: flex; justify-content: space-between; align-items: center; padding: .3rem 0; border-bottom: 1px solid var(--border, #e2e8f0); }
.bank-related__list li a small { color: #94a3b8; font-size: .75rem; }
.bank-related__list li a:hover { color: var(--primary, #2563eb); }
.bank-related__all { font-size: .8rem; color: var(--primary, #2563eb); text-decoration: none; }
.bank-related__all:hover { text-decoration: underline; }
.bank-sidebar-cta { background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: var(--radius-lg, 12px); padding: 1.25rem; text-align: center; }
.bank-sidebar-cta h3 { font-size: .9rem; margin: 0 0 .4rem; }
.bank-sidebar-cta p { font-size: .8rem; color: #64748b; margin: 0 0 .75rem; }

.bank-back { margin-top: 2rem; }
.bank-back a { font-size: .875rem; color: var(--primary, #2563eb); text-decoration: none; }
.bank-back a:hover { text-decoration: underline; }

/* ── Responsive banks ── */
@media (max-width: 1024px) {
  .banks-layout { grid-template-columns: 1fr; }
  .banks-filters { position: fixed; top: 0; left: -320px; width: 300px; height: 100vh; z-index: 200; overflow-y: auto; border-radius: 0; transition: left .25s ease; }
  .banks-filters.open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  .banks-filters__close { display: block; }
  #filters-open { display: inline-flex; }
  .bank-detail__layout { grid-template-columns: 1fr; }
  .bank-detail__sidebar { order: -1; }
}
@media (max-width: 640px) {
  .banks-grid { grid-template-columns: 1fr; }
  .bank-facts { grid-template-columns: 1fr 1fr; }
  .bank-detail__header { flex-direction: column; }
  .page-hero__title { font-size: 1.5rem; }
}
