/* ============================================================
   MAIN CONVERTER — v3.0 Clean
   ============================================================ */

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 20% 0%, rgba(184,137,42,0.06), transparent),
    radial-gradient(ellipse 50% 30% at 80% 100%, rgba(184,137,42,0.04), transparent);
}

.container { max-width: 1080px; margin: auto; }

/* ── Glass card ─────────────────────────────────────────── */
.glass {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 44px 48px;
  animation: fadeUp 0.55s var(--ease) 0.1s both;
}

/* ── Converter section ──────────────────────────────────── */
.converter-section {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.converter-section input[type="number"] {
  font-family: var(--font-display);
  padding: 16px 18px;
  border: 1.5px solid var(--border-md);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  outline: none;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -moz-appearance: textfield;
}
.converter-section input[type="number"]::-webkit-outer-spin-button,
.converter-section input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.converter-section input[type="number"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
  background: var(--surface);
}

/* Custom searchable select wrapper */
.select-wrapper {
  position: relative;
}

.currency-select-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--border-md);
  border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  user-select: none;
  min-height: 54px;
}
.currency-select-trigger:hover,
.currency-select-trigger.open {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.currency-select-trigger .flag { font-size: 1.3rem; flex-shrink: 0; }
.currency-select-trigger .code {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1rem; color: var(--text);
}
.currency-select-trigger .name { font-size: 0.78rem; color: var(--muted); }
.currency-select-trigger .chevron {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.7rem;
  transition: transform var(--t-fast);
}
.currency-select-trigger.open .chevron { transform: rotate(180deg); }

/* Dropdown */
.currency-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeIn 0.15s var(--ease) both;
  min-width: 240px;
}
.currency-dropdown.open { display: block; }

.currency-search {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  font-family: var(--font-body);
}
.currency-search::placeholder { color: var(--muted); }

.currency-list {
  max-height: 260px;
  overflow-y: auto;
}
.currency-group-label {
  padding: 8px 14px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: var(--surface-2);
}
.currency-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--t-fast);
  font-size: 0.9rem;
}
.currency-option:hover,
.currency-option.focused { background: var(--gold-soft); }
.currency-option.selected { background: var(--gold-soft); font-weight: 600; }
.currency-option .opt-flag { font-size: 1.1rem; }
.currency-option .opt-code { font-weight: 700; font-size: 0.88rem; color: var(--text); min-width: 38px; }
.currency-option .opt-name { color: var(--muted); font-size: 0.82rem; }
.currency-option.hidden { display: none; }

/* Keep original selects hidden (for JS compatibility) */
#from, #to { display: none !important; }

/* ── Result section ─────────────────────────────────────── */
.result-section {
  padding: 24px 28px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  animation: fadeIn 0.3s var(--ease) both;
}
body.dark .result-section {
  background: var(--bg-2);
}

#result {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 4px;
}
#rateInfo {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.swap-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  border: none;
  padding: 9px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 3px 12px var(--gold-glow);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.swap-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--gold-glow); }

/* ── History section ────────────────────────────────────── */
.history-section {
  margin-bottom: 24px;
}
.history-section h4 {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
}

#historyList { list-style: none; display: flex; flex-direction: column; gap: 6px; }

#historyList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), opacity 0.25s;
  opacity: 0;
  transform: translateY(4px);
}
body.dark #historyList li { background: var(--bg-2); }
#historyList li.show { opacity: 1; transform: translateY(0); transition: opacity 0.3s, transform 0.3s; }
#historyList li:hover { border-color: var(--gold); background: var(--gold-soft); }
#historyList li.active { border-color: var(--gold); background: var(--gold-soft); }
#historyList li.removing { opacity: 0; transform: translateX(10px); }

.history-main strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.history-date { font-size: 0.78rem; color: var(--muted); }
.history-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--gold);
  color: #000;
  padding: 2px 8px;
  border-radius: 999px;
}
.history-delete {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background var(--t-fast), color var(--t-fast);
  box-shadow: none;
}
.history-delete:hover { background: rgba(220,38,38,0.1); color: #dc2626; transform: none; }

.history-more { text-align: center; margin-top: 10px; }
#showMoreHistory {
  background: transparent;
  border: 1px solid var(--border-md);
  color: var(--muted);
  font-size: 0.82rem;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
  box-shadow: none;
}
#showMoreHistory:hover { border-color: var(--gold); color: var(--text); }

/* ── SEO text ────────────────────────────────────────────── */
.seo-text {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-bottom: 24px;
}
.seo-text h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.seo-text p { font-size: 0.9rem; color: var(--muted); line-height: 1.75; margin-bottom: 8px; }

/* ── Loader ──────────────────────────────────────────────── */
#loader {
  display: none;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Chart controls ──────────────────────────────────────── */
.chart-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.chart-controls button {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-md);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: none;
}
.chart-controls button:hover { border-color: var(--gold); color: var(--text); }
.chart-controls button.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 3px 12px var(--gold-glow);
}

/* ── Chart section ───────────────────────────────────────── */
.chart-section {
  margin-bottom: 28px;
}
#chart { max-height: 320px; }
#stats {
  text-align: center;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.3s;
}
#stats.visible { opacity: 1; }

/* ── Pocket guide ────────────────────────────────────────── */
.pocket-guide {
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.pocket-guide h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.guide-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color var(--t-fast);
}
body.dark .guide-item { background: var(--bg-2); }
.guide-item:hover { border-color: var(--gold); }
.guide-item span { font-size: 0.82rem; color: var(--gold); font-weight: 700; }
.guide-note { font-size: 0.82rem; color: var(--muted); margin-bottom: 16px; }

.guide-actions-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}
.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.button-group button {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-md);
  background: transparent;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: none;
}
.button-group button:hover { border-color: var(--gold); background: var(--gold-soft); }
.guide-msg { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ── Currency info ────────────────────────────────────────── */
.currency-info-section { max-width: 1080px; margin: 0 auto 40px; }
.section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.currency-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.currency-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: border-color var(--t-base), transform var(--t-base);
}
.currency-card:hover { border-color: var(--gold); transform: translateY(-3px); }
.currency-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.currency-card-header .flag { font-size: 1.6rem; }
.currency-card-header h3 { font-size: 0.95rem; font-weight: 700; }
.currency-card p { font-size: 0.87rem; color: var(--muted); margin-bottom: 10px; }
.info-link { font-size: 0.83rem; font-weight: 600; color: var(--gold); text-decoration: none; }
.info-link:hover { text-decoration: underline; }

/* ── Other converters ─────────────────────────────────────── */
.other-converters { max-width: 1080px; margin: 0 auto 40px; }
.other-converters h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.other-converters .results-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.other-converters .provider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base);
}
.other-converters .provider-card:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.other-converters .provider-header { margin-bottom: 12px; }
.other-converters .provider-name { font-size: 1rem; font-weight: 700; }
.other-converters .provider-box p { font-size: 0.87rem; color: var(--muted); margin-bottom: 8px; }
.other-converters .provider-right { margin-top: 14px; }
.cta {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.87rem;
  box-shadow: 0 3px 12px var(--gold-glow);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 6px 18px var(--gold-glow); }

/* ── Cookie popup ────────────────────────────────────────── */
.cookie-popup {
  display: none;
  position: fixed;
  bottom: 24px; left: 24px;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  animation: fadeUp 0.4s var(--ease) both;
}
.cookie-popup h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; }
.cookie-popup p { font-size: 0.84rem; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.cookie-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cookie-actions button {
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}
#acceptCookies {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none; color: #000;
  box-shadow: 0 3px 10px var(--gold-glow);
}
#configCookies { background: transparent; border: 1px solid var(--border-md); color: var(--text-2); }
.cookie-legal { font-size: 0.78rem; color: var(--muted); }
.cookie-legal a { color: var(--gold); text-decoration: none; }

/* ── AI Chat ────────────────────────────────────────────── */
.ai-chat {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 80px; right: 24px;
  width: 320px; height: 420px;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  overflow: hidden;
}
.ai-header {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 0.9rem;
}
.ai-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 10px 14px; border-radius: var(--r-md); font-size: 0.88rem; max-width: 90%; }
.msg.user { background: var(--gold-soft); border: 1px solid rgba(184,137,42,0.18); align-self: flex-end; }
.msg.bot { background: var(--bg); border: 1px solid var(--border); align-self: flex-start; }
body.dark .msg.bot { background: var(--bg-2); }
.ai-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.ai-input input {
  flex: 1; border: 1px solid var(--border-md); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text);
  padding: 9px 12px; font-size: 0.87rem; outline: none;
}
body.dark .ai-input input { background: var(--bg-2); }
.ai-input input:focus { border-color: var(--gold); }
#aiSend {
  background: var(--gold);
  border: none; color: #000;
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: none;
}
.ai-toggle {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none; color: #000;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--gold-glow);
  z-index: 1000;
  transition: transform var(--t-fast);
  padding: 0;
}
.ai-toggle:hover { transform: scale(1.08); }

/* ── Normal mode wrapper ─────────────────────────────────── */
.normal-mode { max-width: 1080px; margin: 0 auto; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 760px) {
  .glass { padding: 22px 16px; }
  .converter-section { grid-template-columns: 1fr; }
  #result { font-size: 1.4rem; }
  .currency-info-grid { grid-template-columns: 1fr; }
}