/* ===================== RESET & BASE ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(15,23,42,.07);
}

body {
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===================== HEADER ===================== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 32px;
  padding: 0 24px; height: 60px;
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: var(--primary); text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link { padding: 6px 14px; border-radius: 8px; font-size: 14px; color: var(--text-muted); text-decoration: none; transition: all .2s; }
.nav-link:hover, .nav-link.active { color: var(--primary); background: #eff6ff; }
.update-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ===================== HERO ===================== */
.hero { background: linear-gradient(135deg, #1e3a5f 0%, #1a56db 60%, #3b82f6 100%); padding: 48px 0 56px; }
.hero-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start;
}

/* Left */
.pair-label { color: rgba(255,255,255,.75); font-size: 16px; margin-bottom: 8px; }
.big-result { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.big-amount { color: #fff; font-size: 54px; font-weight: 700; line-height: 1; }
.big-currency { color: rgba(255,255,255,.8); font-size: 22px; font-weight: 500; }
.source-time { color: rgba(255,255,255,.55); font-size: 12px; margin-bottom: 24px; }

.converter-card {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.input-row {
  display: flex; align-items: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; overflow: hidden;
}
.input-row input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #fff; font-size: 22px; font-weight: 600; padding: 14px 16px;
  width: 0;
}
.input-row input::placeholder { color: rgba(255,255,255,.4); }
.input-row input::-webkit-outer-spin-button,
.input-row input::-webkit-inner-spin-button { -webkit-appearance: none; }

.currency-select-wrapper {
  border-left: 1px solid rgba(255,255,255,.2);
  padding: 0 4px;
}
.currency-select-wrapper select {
  background: transparent; border: none; outline: none;
  color: #fff; font-size: 14px; font-weight: 600;
  padding: 14px 10px; cursor: pointer; min-width: 140px;
  appearance: none; -webkit-appearance: none;
}
.currency-select-wrapper select option { background: #1e3a5f; color: #fff; }

.converter-middle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px;
}
.swap-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s;
}
.swap-btn:hover { background: rgba(255,255,255,.3); transform: rotate(180deg); }

.rate-badge {
  font-size: 13px; color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.12);
  padding: 5px 12px; border-radius: 20px;
}

.quick-amounts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick-label { color: rgba(255,255,255,.6); font-size: 13px; }
.quick-btn {
  padding: 5px 13px; border-radius: 20px; font-size: 13px; font-weight: 500;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.85); cursor: pointer; transition: all .2s;
}
.quick-btn:hover { background: rgba(255,255,255,.25); color: #fff; }

/* Chart Card */
.chart-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.chart-title { font-size: 15px; font-weight: 600; color: var(--text); }
.chart-periods { display: flex; gap: 4px; }
.period-btn {
  padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500;
  border: none; background: transparent; color: var(--text-muted); cursor: pointer; transition: all .2s;
}
.period-btn.active { background: var(--primary); color: #fff; }
.period-btn:hover:not(.active) { background: #eff6ff; color: var(--primary); }

.chart-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px;
}
.stat { text-align: center; }
.stat-label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.stat-value { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.stat-value.high { color: var(--success); }
.stat-value.low { color: var(--danger); }

.chart-container { position: relative; height: 200px; }

/* ===================== TABS SECTION ===================== */
.tabs-section { max-width: 1200px; margin: 0 auto; padding: 40px 24px; }
.section-inner {}

.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab-btn {
  padding: 10px 20px; border-radius: 8px 8px 0 0; font-size: 14px; font-weight: 500;
  border: none; background: transparent; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: #eff6ff; }
.tab-btn:hover:not(.active) { color: var(--text); background: var(--bg); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Common Currencies */
.common-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; font-size: 14px; color: var(--text-muted);
}
.base-select {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px; outline: none; cursor: pointer;
}

.currency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.currency-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 14px;
}
.currency-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); transform: translateY(-2px); }

.currency-flag { font-size: 28px; line-height: 1; }
.currency-info { flex: 1; min-width: 0; }
.currency-code { font-size: 14px; font-weight: 700; color: var(--text); }
.currency-name { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.currency-rate { font-size: 18px; font-weight: 700; color: var(--primary); text-align: right; }
.currency-inverse { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 2px; }

/* Table */
.table-toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.search-input {
  flex: 1; max-width: 360px; padding: 9px 16px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; outline: none; transition: border-color .2s;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.result-count { font-size: 13px; color: var(--text-muted); }

.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.rate-table { width: 100%; border-collapse: collapse; }
.rate-table thead th {
  background: #f8fafc; padding: 12px 16px;
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.rate-table tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
.rate-table tbody tr:last-child { border-bottom: none; }
.rate-table tbody tr:hover { background: #f0f7ff; }
.rate-table td { padding: 12px 16px; font-size: 14px; }
.flag-cell { font-size: 20px; }
.code-cell { font-weight: 700; color: var(--text); }
.name-cell { color: var(--text-muted); }
.rate-cell { font-weight: 600; color: var(--primary); font-size: 15px; }

.table-btn {
  padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--primary); color: var(--primary);
  background: transparent; cursor: pointer; transition: all .2s;
}
.table-btn:hover { background: var(--primary); color: #fff; }

/* Compare */
.compare-controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 24px; font-size: 14px; color: var(--text-muted);
}
.compare-controls select {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px; outline: none;
}
.multi-select { display: flex; gap: 8px; flex-wrap: wrap; }
.multi-chk { display: flex; align-items: center; gap: 4px; }
.multi-chk input { cursor: pointer; }
.multi-chk label { cursor: pointer; font-size: 13px; }
.compare-chart-wrapper { position: relative; height: 360px; }

/* ===================== FOOTER ===================== */
.footer {
  text-align: center; padding: 40px 24px 30px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
  background-color: #fcfcfc;
}

.seo-text {
  max-width: 800px;
  margin: 0 auto 24px auto;
  text-align: left;
  line-height: 1.6;
}

.seo-text h3 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}

.seo-text p {
  font-size: 12px;
  color: var(--text-muted);
}

.footer p { margin-bottom: 8px; }
.powered-by { font-weight: 500; font-size: 14px; margin-top: 12px; }
.footer a { color: var(--primary); text-decoration: none; font-weight: 600; }
.footer a:hover { text-decoration: underline; }

/* ===================== LOADING / STATUS ===================== */
.loading-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: spin .6s linear infinite;
  vertical-align: middle; margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .chart-stats { grid-template-columns: repeat(2, 1fr); }
  .big-amount { font-size: 38px; }
}
@media (max-width: 600px) {
  .nav { display: none; }
  .currency-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .compare-controls { flex-direction: column; align-items: flex-start; }
}
