/**
 * Currency Switcher — Styles
 * Covers: info banner · floating action button · picker overlay
 *
 * Naming convention: cs- (currency switcher)
 * No dependency on any other stylesheet.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   Box-sizing reset (scoped to switcher elements only)
   ═══════════════════════════════════════════════════════════════════════════ */
#cs-banner,
#cs-banner *,
#cs-fab,
#cs-fab *,
.cs-overlay,
.cs-overlay * {
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════════════
   1. INFO BANNER
   ═══════════════════════════════════════════════════════════════════════════ */
#cs-banner {
  position: relative;
  z-index: 9000;
  width: 100%;
  background: #1e3a5f;
  color: #f0f7ff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;

  /* Start hidden; animated in via JS */
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.35s ease;
}

#cs-banner.cs-banner--visible {
  max-height: 80px;
  opacity: 1;
}

/* Dismissal animation */
#cs-banner.cs-banner--gone {
  max-height: 0;
  opacity: 0;
}

.cs-banner-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 48px;
}

.cs-banner-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.cs-banner-msg {
  flex-shrink: 0;
}

.cs-banner-msg strong {
  color: #ffd76e;
}

/* "Change it" link-style button */
.cs-banner-change {
  flex-shrink: 0;
  background: none;
  border: 1.5px solid rgba(255,255,255,0.45);
  border-radius: 6px;
  color: #f0f7ff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}

.cs-banner-change:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.75);
}

.cs-banner-change:focus {
  outline: 2px solid #ffd76e;
  outline-offset: 2px;
}

/* Dismiss × button — pinned to right edge, doesn't affect centering */
.cs-banner-dismiss {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(240,247,255,0.6);
  font-size: 18px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s ease;
  font-family: inherit;
}

.cs-banner-dismiss:hover {
  color: #f0f7ff;
}

.cs-banner-dismiss:focus {
  outline: 2px solid #ffd76e;
  outline-offset: 2px;
}

/* RTL support */
#cs-banner[dir="rtl"] .cs-banner-inner {
  flex-direction: row-reverse;
}

/* ═══════════════════════════════════════════════════════════════════════════
   2. FLOATING ACTION BUTTON  (bottom-left to avoid collision with lang FAB)
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── FAB — identical to .ls-fab, stacked above it (bottom-right) ── */
.cs-fab {
  position: fixed;
  bottom: 76px;        /* ls-fab height (~44px) + 20px base + 12px gap */
  right: 20px;
  z-index: 9999;
  background: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.75rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #0f172a;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cs-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.3);
}

.cs-fab:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. PICKER OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */
.cs-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;   /* above language switcher overlay */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px 24px;
  background: rgba(15, 23, 42, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  opacity: 0;
  pointer-events: none;
  overflow-y: auto;
  transition: background 0.28s ease, opacity 0.28s ease, backdrop-filter 0.28s ease;
}

.cs-overlay.active {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 1;
  pointer-events: auto;
}

/* ── Dialog box ── */
.cs-box {
  background: #f3f4f6;
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 24px 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;

  opacity: 0;
  transform: translateY(-18px) scale(0.96);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.cs-overlay.active .cs-box {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Header ── */
.cs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.cs-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.cs-close-x {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #111827;
  color: #ffffff;
  border: none;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

.cs-close-x:hover { background: #374151; transform: scale(1.05); }
.cs-close-x:focus { outline: 2px solid #2563eb; outline-offset: 2px; }

/* ── Currency groups ── */
.cs-group {
  margin-bottom: 16px;
}

.cs-group-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #374151;
  margin-bottom: 10px;
  padding-left: 2px;
  text-align: left;
}

.cs-group-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* ── Individual currency item ── */
.cs-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  color: #111827;
  text-align: left;
  font-family: inherit;
  transition:
    background    0.14s ease,
    border-color  0.14s ease,
    box-shadow    0.14s ease,
    transform     0.08s ease;
}

.cs-item:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.cs-item--active {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

.cs-item:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.cs-item-symbol {
  font-size: 15px;
  font-weight: 700;
  min-width: 18px;
  color: #374151;
}

.cs-item-code {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  letter-spacing: 0.04em;
}

.cs-item-name {
  font-size: 12px;
  color: #6b7280;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Footer note ── */
.cs-note {
  margin: 16px 0 0;
  font-size: 11.5px;
  color: #9ca3af;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .cs-overlay {
    padding: 16px 8px 16px;
    align-items: flex-end;          /* sheet slides up from bottom on mobile */
  }

  .cs-box {
    border-radius: 20px 20px 0 0;
    padding: 20px 14px 24px;
    max-width: 100%;
  }

  .cs-group-items {
    grid-template-columns: repeat(2, 1fr);
  }

  .cs-fab {
    padding: 0.5rem 1.25rem;
    font-size: 0.8rem;
    letter-spacing: 1px;
    bottom: 71px;      /* ls-fab mobile height (~38px) + 15px base + 18px gap */
    right: 15px;
  }

  #cs-banner.cs-banner--visible {
    max-height: 120px; /* extra room for wrapping on small screens */
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   5. REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .cs-fab,
  .cs-item,
  .cs-overlay,
  .cs-box,
  #cs-banner {
    transition: none !important;
  }
}


/* ── FABs hidden — use footer/menu links with data-open-currency-switcher instead ── */
#cs-fab { display: none; }
