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

:root {
  --indigo:   #4f46e5;
  --indigo-d: #3730a3;
  --indigo-l: #eef2ff;
  --slate:    #1e1b4b;
  --text:     #374151;
  --muted:    #9ca3af;
  --border:   #e5e7eb;
  --white:    #ffffff;
  --bg:       #f8faff;
  --green:    #10b981;
  --radius:   20px;
  --shadow:   0 20px 60px rgba(79,70,229,0.12), 0 4px 16px rgba(0,0,0,0.06);
  --ease:     cubic-bezier(.4,0,.2,1);
}

/* ── Body & background ─────────────────────────────────── */
body {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
}

/* Soft background blobs */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.18), transparent 70%);
  top: -150px; left: -150px;
  animation: blobDrift 12s ease-in-out infinite alternate;
}
.blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(167,139,250,0.14), transparent 70%);
  bottom: -100px; right: -100px;
  animation: blobDrift 16s ease-in-out infinite alternate-reverse;
}
@keyframes blobDrift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.1); }
}

/* ── Card ──────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  border: 1px solid rgba(79,70,229,0.08);
  animation: cardIn 0.5s var(--ease) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Card header ───────────────────────────────────────── */
.card-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.75rem;
}
.logo {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--indigo), #7c3aed);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(79,70,229,0.35);
}
.card-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate);
  letter-spacing: -0.02em;
}
.subtitle {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.subtitle::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.25);
  animation: livePulse 2s ease infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,0.25); }
  50%       { box-shadow: 0 0 0 5px rgba(16,185,129,0.08); }
}

/* ── Form ──────────────────────────────────────────────── */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Amount field ──────────────────────────────────────── */
.field label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.45rem;
}
.input-wrap {
  display: flex;
  align-items: center;
  background: var(--indigo-l);
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 0 1rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input-wrap:focus-within {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
  background: #fff;
}
.input-prefix {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--indigo);
  margin-right: 0.35rem;
  min-width: 16px;
  transition: color .2s;
}
input[type="number"] {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate);
  padding: 0.75rem 0;
  width: 100%;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Currency dropdowns ────────────────────────────────── */
.dropdown {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
}
.currency-block {
  flex: 1;
  min-width: 0;
}
.currency-block label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.45rem;
}
.select-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  cursor: pointer;
}
.select-container:focus-within {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.select-container img {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  transition: transform .25s var(--ease);
}
.select-container:focus-within img { transform: scale(1.1); }
.select-container select {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate);
  cursor: pointer;
  flex: 1;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
}

/* ── Swap button ───────────────────────────────────────── */
.swap-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--indigo);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: background .2s, border-color .2s, box-shadow .2s, transform .3s var(--ease);
}
.swap-btn:hover {
  background: var(--indigo-l);
  border-color: var(--indigo);
  box-shadow: 0 4px 14px rgba(79,70,229,0.18);
}
.swap-btn:active { transform: scale(0.92); }
.swap-btn.spinning i {
  animation: spinSwap 0.45s var(--ease) forwards;
}
@keyframes spinSwap {
  from { transform: rotate(0deg); }
  to   { transform: rotate(180deg); }
}

/* ── Result card ───────────────────────────────────────── */
.result-card {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  color: white;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.result-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}
.result-card::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -20px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

/* Loading state */
.result-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease);
  position: absolute;
}
.result-loading p { font-size: 0.78rem; opacity: 0.7; }

.result-loading.visible { opacity: 1; }

.dot-spinner { display: flex; gap: 5px; }
.dot-spinner span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  animation: dotBounce 1.2s ease infinite;
}
.dot-spinner span:nth-child(2) { animation-delay: .15s; }
.dot-spinner span:nth-child(3) { animation-delay: .3s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-7px); opacity: 1; }
}

/* Result body */
.result-body {
  text-align: center;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  position: relative;
  z-index: 1;
  width: 100%;
}
.result-body.fading { opacity: 0; transform: translateY(6px); }

.result-amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.result-number {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.result-currency {
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.75;
}
.msg {
  font-size: 0.78rem;
  opacity: 0.65;
  margin-top: 0;
}

/* ── Convert button ────────────────────────────────────── */
.convert-btn {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, var(--indigo), #7c3aed);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 20px rgba(79,70,229,0.35);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), opacity .18s;
  outline: none;
}
.convert-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(79,70,229,0.45);
}
.convert-btn:active { transform: translateY(0); box-shadow: none; }
.convert-btn i { transition: transform .4s var(--ease); }
.convert-btn:hover i { transform: rotate(180deg); }
.convert-btn.loading { opacity: 0.75; pointer-events: none; }

/* ── Footer note ───────────────────────────────────────── */
.footer-note {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 1.25rem;
}
.footer-note a { color: var(--indigo); text-decoration: none; }
.footer-note a:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 460px) {
  .container { padding: 1.5rem; border-radius: 16px; }
  .result-number { font-size: 1.8rem; }
}
