/* Reset base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0b0f14;
  --bg-2: #0f1623;
  --card: rgba(255, 255, 255, 0.04);
  --card-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.10);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #e5e7eb;
  --muted: #9aa4b2;
  --accent: #7c3aed; /* violet */
  --accent-2: #22d3ee; /* cyan */
  --success: #22c55e;
  --danger: #ef4444;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.35);
}

html, body {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1000px 600px at 20% -10%, #12203a 0%, transparent 60%),
              radial-gradient(800px 500px at 110% 0%, #1a103a 0%, transparent 55%),
              linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  padding: 28px 20px 40px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(11, 15, 20, 0.85), rgba(11, 15, 20, 0.55));
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-logo { display: block; }
.brand-name { font-weight: 800; letter-spacing: 0.2px; font-size: 1.05rem; }

.nav-links { display: flex; gap: 18px; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.98rem; }
.nav-links a:hover { color: #c7d2fe; }

/* Header */
/* Hero */
.hero {
  text-align: center;
  margin: 36px 0 26px;
}
.hero-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.4px;
  background: linear-gradient(90deg, #e9d5ff 0%, #a78bfa 50%, #22d3ee 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-subtitle {
  margin-top: 8px;
  font-size: 1.05rem;
  color: var(--muted);
}

/* Card base */
.converter-card,
.popular-cryptos {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.converter-card { margin-bottom: 28px; }
.popular-cryptos { margin-bottom: 20px; }

/* Inputs */
.input-group { margin-bottom: 22px; }

.input-group label,
.currency-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--muted);
}

.input-group input,
.currency-group select {
  width: 100%;
  padding: 14px 14px;
  font-size: 1.05rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.input-group input::placeholder {
  color: #7b8696;
}

.input-group input:focus,
.currency-group select:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.65);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.currency-row {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 22px;
}

.currency-group { flex: 1; }

.currency-group select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-left: 48px;
}

.select-with-icon {
  position: relative;
}
.select-with-icon .select-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* Swap button */
.swap-btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  color: var(--text);
  border: 1px solid var(--border);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.35s ease, box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
  margin-bottom: 2px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.swap-btn:hover {
  transform: rotate(180deg) scale(1.03);
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.25);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.22), rgba(255, 255, 255, 0.03));
}

/* Convert button */
.convert-btn {
  width: 100%;
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 45%, #22d3ee 120%);
  color: #0b0f14;
  border: none;
  padding: 17px 18px;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.25s ease, box-shadow 0.25s ease;
  margin-bottom: 22px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 15px 40px rgba(139, 92, 246, 0.35);
}

.convert-btn:hover { transform: translateY(-1.5px); filter: brightness(1.02); }
.convert-btn:active { transform: translateY(0); filter: brightness(0.98); }
.convert-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; filter: none; }

.loading {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top: 2px solid #0b0f14;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
}

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

/* Result */
.result {
  text-align: center;
  padding: 18px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.035));
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  margin-bottom: 12px;
}

.result-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.result-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.result-amount {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, #dbeafe 0%, #c7d2fe 40%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}

.result-label {
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 600;
}

/* Rate info */
.rate-info { text-align: center; color: var(--muted); }
.rate-info small { font-size: 0.95rem; }

/* Popular cryptos */
.popular-cryptos h3 {
  margin-bottom: 18px;
  color: var(--text);
  text-align: center;
  font-size: 1.1rem;
  letter-spacing: 0.3px;
}

.crypto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.crypto-item {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
  padding: 14px;
  border-radius: 12px;
  text-align: center;
  transition: transform 0.18s ease, box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
  border: 1px solid var(--border-soft);
}

.crypto-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-bottom: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.crypto-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.35);
}

.crypto-name {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--muted);
  letter-spacing: 0.4px;
}

.crypto-price {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
}

.crypto-change {
  font-size: 0.92rem;
  margin-top: 6px;
}

.positive { color: rgba(34, 197, 94, 0.95); }
.negative { color: rgba(239, 68, 68, 0.95); }

/* Footer */
footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

footer a {
  color: #c7d2fe;
  text-decoration: none;
  border-bottom: 1px dashed rgba(199, 210, 254, 0.3);
}

footer a:hover { border-bottom-style: solid; }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 0 12px; }
  .brand-name { display: none; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.95rem; }
  .hero-title { font-size: 2.1rem; }
  .converter-card { padding: 20px; }
  .currency-row { flex-direction: column; gap: 16px; }
  .swap-btn { align-self: center; transform: rotate(90deg); }
  .result-amount { font-size: 2rem; }
  .crypto-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
