/* ══════════════════════════════════════════════════
   SETTINGS OVERLAY
══════════════════════════════════════════════════ */

.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.settings-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* ── Panel ────────────────────────────────────────── */

.settings-panel {
  width: 580px;
  max-width: calc(100vw - 40px);
  height: calc(100vh - 80px);
  max-height: 860px;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s ease;
  box-shadow: 0 8px 40px rgba(0,0,0,0.10);
}

.settings-backdrop.open .settings-panel {
  transform: translateY(0) scale(1);
}

.settings-panel::before {
  content: '';
  display: block;
  height: 3px;
  background: #ED1C24;
  flex-shrink: 0;
}

.settings-panel::after {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #ED1C24 0%, #004C97 55%, #e8e8e8 100%);
  flex-shrink: 0;
}

/* ── Header ───────────────────────────────────────── */

.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #ebebeb;
  flex-shrink: 0;
}

.sp-eyebrow {
  font-size: 10px;
  color: #ED1C24;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
}

.sp-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #111111;
  letter-spacing: 0.02em;
  line-height: 1;
}

.sp-close {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #e8e8e8;
  border-radius: 3px;
  cursor: pointer;
  color: #888888;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sp-close:hover {
  background: #fff0f0;
  border-color: #ED1C24;
  color: #ED1C24;
}

.sp-close svg { pointer-events: none; }

/* ── Scrollable body ──────────────────────────────── */

.sp-body {
  flex: 1;
  overflow-y: scroll;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #dddddd transparent;
}

.sp-body::-webkit-scrollbar       { width: 5px; }
.sp-body::-webkit-scrollbar-track { background: #f5f5f5; }
.sp-body::-webkit-scrollbar-thumb { background: #dddddd; border-radius: 3px; }

/* ── Sections ─────────────────────────────────────── */

.sp-section {
  border: 1px solid #e8e8e8;
  border-radius: 4px;
}

.sp-section-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.sp-section-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.sp-section-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sp-audio   .sp-section-icon,
.sp-audio   .sp-section-label { color: #ED1C24; }
.sp-display .sp-section-icon,
.sp-display .sp-section-label { color: #555555; }
.sp-access  .sp-section-icon,
.sp-access  .sp-section-label { color: #ED1C24; }
.sp-account .sp-section-icon,
.sp-account .sp-section-label { color: #004C97; }

/* ── Rows ─────────────────────────────────────────── */

.sp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f5f5f5;
  gap: 16px;
}

.sp-row:last-child { border-bottom: none; }

.sp-row-info {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.sp-row-label {
  font-size: 13px;
  font-weight: 500;
  color: #111111;
  letter-spacing: 0.01em;
  display: block;
  margin-bottom: 5px;
}

.sp-row-desc {
  font-size: 11px;
  color: #bbbbbb;
  letter-spacing: 0.01em;
  line-height: 1.5;
  display: block;
}

/* ── Toggle ───────────────────────────────────────── */

.sp-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.sp-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.sp-toggle-track {
  position: absolute;
  inset: 0;
  background: #dddddd;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.sp-toggle input:checked ~ .sp-toggle-track {
  background: #004C97;
}

.sp-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.sp-toggle input:checked ~ .sp-toggle-track .sp-toggle-thumb {
  transform: translateX(18px);
}

/* ── Slider ───────────────────────────────────────── */

.sp-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  width: 160px;
}

.sp-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: #e0e0e0;
  outline: none;
  cursor: pointer;
}

.sp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ED1C24;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.sp-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: none;
  border-radius: 50%;
  background: #ED1C24;
  cursor: pointer;
}

.sp-slider-val {
  font-size: 11px;
  font-weight: 500;
  color: #888888;
  min-width: 34px;
  text-align: right;
}

/* ── Select ───────────────────────────────────────── */

.sp-select {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #111111;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 8px 10px;
  background: #ffffff;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  min-width: 130px;
  transition: border-color 0.15s;
}

.sp-select:hover,
.sp-select:focus { border-color: #004C97; }

/* ── Key tag ──────────────────────────────────────── */

.sp-keybind { display: flex; gap: 4px; flex-shrink: 0; }

.sp-key {
  font-size: 11px;
  font-weight: 500;
  color: #555555;
  background: #f4f4f4;
  border: 1px solid #dddddd;
  border-radius: 3px;
  padding: 3px 9px;
}

/* ── Static ───────────────────────────────────────── */

.sp-static {
  font-size: 12px;
  color: #aaaaaa;
  font-weight: 500;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* ── Logout button ────────────────────────────────── */

.sp-logout {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid #e8e8e8;
  border-radius: 3px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #ED1C24;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.sp-logout:hover {
  background: #fff5f5;
  border-color: #ED1C24;
}

/* ── Footer ───────────────────────────────────────── */

.sp-footer {
  padding: 14px 24px;
  border-top: 1px solid #ebebeb;
  flex-shrink: 0;
  background: #ffffff;
}

.sp-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 1px solid #e8e8e8;
  border-radius: 3px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #ED1C24;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.sp-reset:hover {
  background: #fff5f5;
  border-color: #ED1C24;
}

/* ── Toast ────────────────────────────────────────── */

.sp-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #111111;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 9px 20px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 300;
  white-space: nowrap;
}

.sp-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ───────────────────────────────────── */

@media (max-width: 640px) {
  .settings-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 32px);
    max-height: none;
  }
  .sp-body    { padding: 14px 16px; }
  .sp-header  { padding: 16px; }
  .sp-footer  { padding: 12px 16px; }
  .sp-row     { padding: 12px 16px; flex-wrap: wrap; }
  .sp-slider-wrap { width: 130px; }
  .sp-select  { min-width: 110px; }
}