/*
 * Storefront display currency (Currency Center v2, 2026-10-16).
 * Picker dialog / bottom sheet, currency switch chips and checkout note.
 * Built on the storefront theme tokens so light, dark and admin themes work.
 */

.storefront-v2 [data-currency-switch][hidden] { display: none !important; }

.storefront-v2 .sc-switch-flag { font-size: 1.05em; line-height: 1; }
.storefront-v2 .sc-switch-code { font-weight: 900; letter-spacing: .02em; direction: ltr; unicode-bidi: isolate; }
.storefront-v2 .sc-switch-sep { opacity: .55; }
.storefront-v2 .sc-switch-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.storefront-v2 .sc-switch-caret { font-size: .78em; opacity: .8; }

/* Compact chip (header / guest navigation). */
.storefront-v2 .sc-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--store-radius-pill, 999px);
  border: 1px solid var(--currency-switch-border, var(--store-border-strong, #c9d3df));
  background: var(--currency-switch-bg, var(--store-surface, #fff));
  color: var(--currency-switch-text, var(--store-text, #122033));
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease;
}
.storefront-v2 .sc-chip:hover { transform: translateY(-1px); }
.storefront-v2 .sc-chip:focus-visible,
.storefront-v2 .sidebar-currency-switch:focus-visible {
  outline: 3px solid var(--store-brand, #0877be);
  outline-offset: 2px;
}
.storefront-v2 .sidebar-guest .sc-chip { margin-top: 12px; }

/* Money values never wrap mid-number and keep Latin digit order. */
.storefront-v2 .js-money,
.storefront-v2 .js-live-balance {
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
  white-space: nowrap;
}

/* Checkout: the exact USD amount charged, shown when another currency is displayed. */
.storefront-v2 .co-usd-note,
.co-usd-note {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(52, 211, 153, .45);
  background: rgba(16, 185, 129, .08);
  color: inherit;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.7;
  text-align: center;
  direction: rtl;
}
.co-usd-note[hidden] { display: none !important; }

/* ── Picker dialog ─────────────────────────────────────────────────────── */
html.sc-lock, html.sc-lock body { overflow: hidden !important; }

.sc-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 9, 16, 0);
  backdrop-filter: blur(0);
  transition: background-color 200ms ease, backdrop-filter 200ms ease;
  direction: rtl;
}
.sc-overlay.is-open { background: rgba(2, 9, 16, .62); backdrop-filter: blur(5px); }

.sc-sheet {
  position: relative;
  width: min(460px, 100%);
  max-height: min(640px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--border-color, var(--store-border, #dce3eb));
  background: var(--bg-secondary, var(--store-surface, #ffffff));
  color: var(--text-primary, var(--store-text, #122033));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  transform: translateY(14px) scale(.98);
  opacity: 0;
  transition: transform 220ms cubic-bezier(.2, 0, 0, 1), opacity 180ms ease;
  outline: none;
  font-family: inherit;
}
.sc-overlay.is-open .sc-sheet { transform: none; opacity: 1; }

.sc-grip { display: none; }

.sc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sc-head h2 { margin: 0; font-size: 1.12rem; font-weight: 900; line-height: 1.5; }
.sc-sub { margin: 2px 0 0; font-size: .84rem; color: var(--text-secondary, var(--store-text-soft, #526173)); }
.sc-sub strong { color: var(--text-primary, inherit); }

.sc-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border-color, var(--store-border, #dce3eb));
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
}
.sc-close:hover { background: rgba(127, 127, 127, .1); }

.sc-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border-color, var(--store-border, #dce3eb));
  background: var(--bg-tertiary, var(--store-surface-subtle, #f8fafc));
  color: var(--text-secondary, #526173);
}
.sc-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary, inherit);
  font: inherit;
  font-size: .92rem;
}

.sc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px;
  margin: 0 -2px;
}

.sc-option {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 9px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-color, var(--store-border, #dce3eb));
  background: var(--bg-primary, var(--store-surface-raised, #fff));
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}
.sc-option:hover { transform: translateY(-1px); border-color: var(--accent-primary, var(--store-brand, #0877be)); }
.sc-option:focus-visible { outline: 3px solid var(--accent-primary, var(--store-brand, #0877be)); outline-offset: 2px; }
.sc-option[hidden] { display: none; }
.sc-option.is-active {
  border-color: var(--accent-primary, var(--store-brand, #0877be));
  background: color-mix(in srgb, var(--accent-primary, #0877be) 12%, var(--bg-primary, #fff));
}

.sc-option-flag {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--bg-tertiary, var(--store-surface-subtle, #f1f5f9));
  font-size: 1.45rem;
  color: var(--accent-primary, var(--store-brand, #0877be));
}
.sc-option-flag .fas { font-size: 1.05rem; }

.sc-option-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-option-name { font-weight: 900; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-option-meta { font-size: .76rem; line-height: 1.6; color: var(--text-secondary, var(--store-text-soft, #526173)); overflow-wrap: anywhere; }
.sc-option-sample {
  font-weight: 900;
  font-size: .86rem;
  color: var(--success, var(--store-success, #12805c));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sc-option-check { color: var(--accent-primary, var(--store-brand, #0877be)); opacity: 0; transition: opacity 140ms ease; }
.sc-option.is-active .sc-option-check { opacity: 1; }

.sc-badge {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, .14);
  color: var(--success, #10b981);
  font-style: normal;
  font-size: .7rem;
  font-weight: 800;
  vertical-align: middle;
}

.sc-empty { margin: 0; text-align: center; font-size: .86rem; color: var(--text-secondary, #526173); }

.sc-notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(14, 165, 233, .08);
  border: 1px solid rgba(14, 165, 233, .22);
  font-size: .8rem;
  line-height: 1.75;
  color: var(--text-secondary, var(--store-text-soft, #526173));
}
.sc-notice .fas { color: var(--accent-primary, #0ea5e9); margin-inline-end: 4px; }

.sc-follow {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border-color, var(--store-border, #dce3eb));
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.sc-follow:hover { border-color: var(--accent-primary, #0877be); }

/* Phones: bottom sheet, large touch targets, safe-area aware. */
@media (max-width: 640px) {
  .sc-overlay { align-items: flex-end; padding: 0; }
  .sc-sheet {
    width: 100%;
    max-height: 86vh;
    border-radius: 24px 24px 0 0;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
  }
  .sc-grip {
    display: block;
    width: 44px;
    height: 5px;
    margin: 0 auto 2px;
    border-radius: 999px;
    background: rgba(127, 127, 127, .35);
  }
  .sc-option { grid-template-columns: 40px minmax(0, 1fr) auto 20px; min-height: 64px; }
  .sc-option-flag { width: 40px; height: 40px; }
}

@media (max-width: 360px) {
  .sc-option { grid-template-columns: 36px minmax(0, 1fr) 18px; }
  .sc-option-sample { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-overlay, .sc-sheet, .sc-option, .storefront-v2 .sc-chip { transition: none !important; }
}

/* Toast */
.sc-toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483300;
  max-width: min(92vw, 420px);
  padding: 11px 16px;
  border-radius: 14px;
  background: #0f2a3d;
  color: #f8fafc;
  font-size: .88rem;
  font-weight: 700;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 200ms ease, opacity 200ms ease;
  direction: rtl;
  text-align: center;
}
.sc-toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.sc-toast.is-error { background: #7f1d1d; }
