/* ── iSupply Currency Switcher ─────────────────────────────────────────── */

:root {
  --fx-bg:        #ffffff;
  --fx-border:    #e2e8f0;
  --fx-text:      #1a202c;
  --fx-muted:     #718096;
  --fx-primary:   #1a1a2e;
  --fx-accent:    #e94560;
  --fx-hover:     #f7fafc;
  --fx-active-bg: #ebf4ff;
  --fx-active:    #0f3460;
  --fx-shadow:    0 4px 20px rgba(0,0,0,0.12);
  --fx-radius:    10px;
  --fx-font:      'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Floating container (auto-injected) ─────────────────────────────────── */
#isupply-fx-floating {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 9999;
}

/* ── Switcher wrapper ────────────────────────────────────────────────────── */
.isupply-fx-switcher {
  position: relative;
  display: inline-block;
  font-family: var(--fx-font);
  font-size: 14px;
}

/* ── Toggle button ───────────────────────────────────────────────────────── */
.isupply-fx-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 10px;
  background: var(--fx-bg);
  border: 1.5px solid var(--fx-border);
  border-radius: var(--fx-radius);
  cursor: pointer;
  font-family: var(--fx-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--fx-text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  outline: none;
  user-select: none;
}
.isupply-fx-toggle:hover,
.isupply-fx-toggle:focus {
  border-color: var(--fx-active);
  box-shadow: 0 2px 8px rgba(15,52,96,0.12);
}
.isupply-fx-switcher.fx-open .isupply-fx-toggle {
  border-color: var(--fx-active);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  box-shadow: 0 -2px 8px rgba(15,52,96,0.08);
}

.isupply-fx-flag   { font-size: 16px; line-height: 1; }
.isupply-fx-code   { font-weight: 700; letter-spacing: 0.03em; color: var(--fx-primary); }

.isupply-fx-caret {
  margin-left: 2px;
  color: var(--fx-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.isupply-fx-switcher.fx-open .isupply-fx-caret { transform: rotate(180deg); }

/* ── Dropdown ────────────────────────────────────────────────────────────── */
.isupply-fx-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: var(--fx-bg);
  border: 1.5px solid var(--fx-active);
  border-top: none;
  border-bottom-left-radius: var(--fx-radius);
  border-bottom-right-radius: var(--fx-radius);
  box-shadow: var(--fx-shadow);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  z-index: 10000;
  animation: fx-drop-in 0.15s ease;
}
@keyframes fx-drop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.isupply-fx-switcher.fx-open .isupply-fx-dropdown { display: block; }

/* ── Options ─────────────────────────────────────────────────────────────── */
.isupply-fx-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
  color: var(--fx-text);
}
.isupply-fx-option:hover { background: var(--fx-hover); }
.isupply-fx-option.isupply-fx-active {
  background: var(--fx-active-bg);
  color: var(--fx-active);
  font-weight: 600;
}
.isupply-fx-option .isupply-fx-flag { font-size: 18px; }
.isupply-fx-option .isupply-fx-name {
  font-weight: 700;
  font-size: 13px;
  min-width: 36px;
}
.isupply-fx-option .isupply-fx-label {
  font-size: 12px;
  color: var(--fx-muted);
  flex: 1;
}
.isupply-fx-option.isupply-fx-active .isupply-fx-label { color: var(--fx-active); }

/* Checkmark for active */
.isupply-fx-option.isupply-fx-active::after {
  content: '✓';
  color: var(--fx-active);
  font-weight: 700;
  font-size: 13px;
  margin-left: auto;
}

/* ── Updating overlay (flashes while page reloads) ───────────────────────── */
.isupply-fx-updating {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.2s;
}

/* ── Price update animation ──────────────────────────────────────────────── */
.woocommerce .price,
.woocommerce-Price-amount {
  transition: opacity 0.3s ease;
}
.isupply-fx-price-flash {
  animation: fx-price-flash 0.4s ease;
}
@keyframes fx-price-flash {
  0%   { opacity: 1; }
  40%  { opacity: 0.2; }
  100% { opacity: 1; }
}

/* ── Toast notification ──────────────────────────────────────────────────── */
#isupply-fx-toast {
  position: fixed;
  bottom: 90px;
  right: 24px;
  background: var(--fx-primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--fx-font);
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 99999;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
#isupply-fx-toast.fx-toast-show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Inline switcher (when used via shortcode in content) ────────────────── */
.isupply-fx-switcher:not(#isupply-fx-floating .isupply-fx-switcher) {
  vertical-align: middle;
}

/* ── Kadence header integration ──────────────────────────────────────────── */
.kb-header .isupply-fx-switcher .isupply-fx-toggle,
.site-header .isupply-fx-switcher .isupply-fx-toggle {
  background: transparent;
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.kb-header .isupply-fx-code,
.site-header .isupply-fx-code { color: #fff; }
.kb-header .isupply-fx-toggle:hover,
.site-header .isupply-fx-toggle:hover { border-color: rgba(255,255,255,0.7); }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #isupply-fx-floating { top: 12px; right: 12px; }
  .isupply-fx-toggle   { padding: 6px 10px; font-size: 12px; }
  .isupply-fx-option .isupply-fx-label { display: none; }
  .isupply-fx-dropdown { min-width: 160px; }
}
