/**
 * WolfStore Converter — Frontend Switcher Styles
 *
 * @package WolfStore\Converter
 */

/* ── CSS Custom Properties ─────────────────────────────────────────────── */

:root {
  --wsc-primary: #7b2d8b;
  --wsc-primary-hover: #5e2070;
  --wsc-bg: #ffffff;
  --wsc-bg-hover: #f8f5ff;
  --wsc-border: #e0d5eb;
  --wsc-text: #1d1d1f;
  --wsc-text-muted: #6e6e73;
  --wsc-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --wsc-radius: 8px;
  --wsc-radius-sm: 4px;
  --wsc-transition: 0.15s ease;
  --wsc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --wsc-z: 9999;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

.wsc-switcher {
  display: inline-flex;
  font-family: var(--wsc-font);
  font-size: 14px;
  position: relative;
}

.wsc-flag {
  font-size: 1.15em;
  line-height: 1;
}

.wsc-code {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.wsc-symbol {
  font-weight: 500;
  color: var(--wsc-text-muted);
}

.wsc-name {
  color: var(--wsc-text);
}

/* ── Dropdown ──────────────────────────────────────────────────────────── */

.wsc-switcher--dropdown {
  flex-direction: column;
}

.wsc-switcher__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--wsc-bg);
  border: 1.5px solid var(--wsc-border);
  border-radius: var(--wsc-radius);
  color: var(--wsc-text);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--wsc-font);
  font-weight: 500;
  transition: border-color var(--wsc-transition), box-shadow var(--wsc-transition);
  white-space: nowrap;
}

.wsc-switcher__trigger:hover,
.wsc-switcher__trigger:focus-visible {
  border-color: var(--wsc-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(123, 45, 139, 0.15);
}

.wsc-chevron {
  font-size: 10px;
  margin-left: 4px;
  color: var(--wsc-text-muted);
  transition: transform var(--wsc-transition);
}

.wsc-switcher__trigger[aria-expanded="true"] .wsc-chevron {
  transform: rotate(180deg);
}

.wsc-switcher__dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--wsc-bg);
  border: 1.5px solid var(--wsc-border);
  border-radius: var(--wsc-radius);
  box-shadow: var(--wsc-shadow);
  z-index: var(--wsc-z);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow: hidden;
}

.wsc-switcher__dropdown--open {
  display: block;
  animation: wscFadeIn 0.12s ease;
}

.wsc-switcher__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--wsc-transition);
  user-select: none;
}

.wsc-switcher__option:hover {
  background: var(--wsc-bg-hover);
}

.wsc-switcher__option--active {
  background: var(--wsc-bg-hover);
  color: var(--wsc-primary);
}

.wsc-switcher__option--active .wsc-code {
  color: var(--wsc-primary);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.wsc-switcher--buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.wsc-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: var(--wsc-bg);
  border: 1.5px solid var(--wsc-border);
  border-radius: var(--wsc-radius);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--wsc-font);
  transition: all var(--wsc-transition);
}

.wsc-switcher__btn:hover {
  border-color: var(--wsc-primary);
  background: var(--wsc-bg-hover);
}

.wsc-switcher__btn--active {
  background: var(--wsc-primary);
  border-color: var(--wsc-primary);
  color: #fff;
}

.wsc-switcher__btn--active .wsc-symbol,
.wsc-switcher__btn--active .wsc-code,
.wsc-switcher__btn--active .wsc-name {
  color: #fff;
}

/* ── Floating ──────────────────────────────────────────────────────────── */

.wsc-switcher--floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--wsc-z);
}

[dir="rtl"] .wsc-switcher--floating {
  right: auto;
  left: 24px;
}

.wsc-floating__trigger {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--wsc-primary);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(123, 45, 139, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--wsc-transition), box-shadow var(--wsc-transition);
}

.wsc-floating__trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(123, 45, 139, 0.5);
}

.wsc-floating__panel {
  display: none;
  position: absolute;
  bottom: 62px;
  right: 0;
  flex-direction: column;
  gap: 6px;
}

.wsc-floating__panel--open {
  display: flex;
  animation: wscFadeIn 0.12s ease;
}

.wsc-floating__option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--wsc-bg);
  border: 1.5px solid var(--wsc-border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--wsc-font);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  transition: all var(--wsc-transition);
}

.wsc-floating__option:hover,
.wsc-floating__option--active {
  background: var(--wsc-primary);
  border-color: var(--wsc-primary);
  color: #fff;
}

/* ── Animation ─────────────────────────────────────────────────────────── */

@keyframes wscFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RTL Support ───────────────────────────────────────────────────────── */

[dir="rtl"] .wsc-switcher__dropdown {
  left: auto;
  right: 0;
}

/* ── Dark Mode ─────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root {
    --wsc-bg: #1c1c1e;
    --wsc-bg-hover: #2c2c2e;
    --wsc-border: #3a3a3c;
    --wsc-text: #f5f5f7;
    --wsc-text-muted: #aeaeb2;
    --wsc-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}
