/* ========================================
   Settings Page — Redesigned
   ======================================== */

/* Group headers */
.settings-group {
  margin-bottom: 36px;
}

.settings-group__title {
  font-family: var(--font-display, inherit);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-group__title--danger {
  color: var(--btn-again);
  border-color: var(--btn-again);
  opacity: 0.7;
}

.settings-heading {
  font-family: var(--font-display, inherit);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.setting-group {
  margin-bottom: 20px;
}

.setting-group--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
}

.setting-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.setting-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ========================================
   Language Options
   ======================================== */

.lang-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-option {
  cursor: pointer;
}

.lang-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.lang-option__label {
  display: block;
  padding: 10px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius, 6px);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.lang-option input:checked + .lang-option__label {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light, var(--bg-highlight));
}

.lang-option__label:hover {
  border-color: var(--accent);
}

/* ========================================
   Theme Preview Cards — Full-color mini UI
   ======================================== */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.theme-preview {
  cursor: pointer;
  text-align: center;
}

.theme-preview input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-preview__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  border: 2px solid transparent;
  height: 80px;
  transition: all 0.15s ease;
  overflow: hidden;
}

.theme-preview input:checked + .theme-preview__card {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 105, 20, 0.15);
}

.theme-preview__card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Mini UI elements inside preview */
.theme-preview__header {
  height: 6px;
  border-radius: 2px;
  width: 100%;
}

.theme-preview__line {
  height: 4px;
  border-radius: 1px;
}

.theme-preview__line--ar {
  width: 70%;
  margin-inline-start: auto;
}

.theme-preview__line--en {
  width: 50%;
}

.theme-preview__dots {
  display: flex;
  gap: 4px;
  margin-top: auto;
}

.theme-preview__dots span {
  flex: 1;
  height: 10px;
  border-radius: 2px;
}

/* Per-theme colors */
.theme-preview__card--light {
  background: #f5f0e6;
}
.theme-preview__card--light .theme-preview__header { background: #1e1710; }
.theme-preview__card--light .theme-preview__line--ar { background: #2c1810; }
.theme-preview__card--light .theme-preview__line--en { background: #ddd4c4; }
.theme-preview__card--light .theme-preview__dots span:nth-child(1) { background: #a83232; }
.theme-preview__card--light .theme-preview__dots span:nth-child(2) { background: #b87a1e; }
.theme-preview__card--light .theme-preview__dots span:nth-child(3) { background: #2d7a4a; }
.theme-preview__card--light .theme-preview__dots span:nth-child(4) { background: #2e5c8a; }

.theme-preview__card--dark {
  background: #13110e;
}
.theme-preview__card--dark .theme-preview__header { background: #0a0908; }
.theme-preview__card--dark .theme-preview__line--ar { background: #e8e0d4; }
.theme-preview__card--dark .theme-preview__line--en { background: #302a22; }
.theme-preview__card--dark .theme-preview__dots span:nth-child(1) { background: #a83232; }
.theme-preview__card--dark .theme-preview__dots span:nth-child(2) { background: #b87a1e; }
.theme-preview__card--dark .theme-preview__dots span:nth-child(3) { background: #2d7a4a; }
.theme-preview__card--dark .theme-preview__dots span:nth-child(4) { background: #2e5c8a; }

.theme-preview__card--sepia {
  background: #f0e6d0;
}
.theme-preview__card--sepia .theme-preview__header { background: #3a2a1c; }
.theme-preview__card--sepia .theme-preview__line--ar { background: #3a2a1c; }
.theme-preview__card--sepia .theme-preview__line--en { background: #d4c4a4; }
.theme-preview__card--sepia .theme-preview__dots span:nth-child(1) { background: #a83232; }
.theme-preview__card--sepia .theme-preview__dots span:nth-child(2) { background: #b87a1e; }
.theme-preview__card--sepia .theme-preview__dots span:nth-child(3) { background: #2d7a4a; }
.theme-preview__card--sepia .theme-preview__dots span:nth-child(4) { background: #2e5c8a; }

.theme-preview__card--manuscript {
  background: #FDF6E3;
}
.theme-preview__card--manuscript .theme-preview__header { background: #3b3229; }
.theme-preview__card--manuscript .theme-preview__line--ar { background: #3b3229; }
.theme-preview__card--manuscript .theme-preview__line--en { background: #e6dcc3; }
.theme-preview__card--manuscript .theme-preview__dots span:nth-child(1) { background: #dc322f; }
.theme-preview__card--manuscript .theme-preview__dots span:nth-child(2) { background: #cb4b16; }
.theme-preview__card--manuscript .theme-preview__dots span:nth-child(3) { background: #268BD2; }
.theme-preview__card--manuscript .theme-preview__dots span:nth-child(4) { background: #2aa198; }

.theme-preview__card--olive {
  background: #F1F3F0;
}
.theme-preview__card--olive .theme-preview__header { background: #2D3436; }
.theme-preview__card--olive .theme-preview__line--ar { background: #2D3436; }
.theme-preview__card--olive .theme-preview__line--en { background: #d1d8cf; }
.theme-preview__card--olive .theme-preview__dots span:nth-child(1) { background: #c0392b; }
.theme-preview__card--olive .theme-preview__dots span:nth-child(2) { background: #d4870e; }
.theme-preview__card--olive .theme-preview__dots span:nth-child(3) { background: #6B8E23; }
.theme-preview__card--olive .theme-preview__dots span:nth-child(4) { background: #8B4513; }

.theme-preview__card--night {
  background: #0c0c0c;
}
.theme-preview__card--night .theme-preview__header { background: #050505; }
.theme-preview__card--night .theme-preview__line--ar { background: #E0E0E0; }
.theme-preview__card--night .theme-preview__line--en { background: #2a2a2a; }
.theme-preview__card--night .theme-preview__dots span:nth-child(1) { background: #cf6679; }
.theme-preview__card--night .theme-preview__dots span:nth-child(2) { background: #FFB74D; }
.theme-preview__card--night .theme-preview__dots span:nth-child(3) { background: #00BFA5; }
.theme-preview__card--night .theme-preview__dots span:nth-child(4) { background: #BB86FC; }

.theme-preview__card--academic {
  background: #FAFAFA;
}
.theme-preview__card--academic .theme-preview__header { background: #1A73E8; }
.theme-preview__card--academic .theme-preview__line--ar { background: #202124; }
.theme-preview__card--academic .theme-preview__line--en { background: #dadce0; }
.theme-preview__card--academic .theme-preview__dots span:nth-child(1) { background: #ea4335; }
.theme-preview__card--academic .theme-preview__dots span:nth-child(2) { background: #F9AB00; }
.theme-preview__card--academic .theme-preview__dots span:nth-child(3) { background: #34a853; }
.theme-preview__card--academic .theme-preview__dots span:nth-child(4) { background: #5F6368; }

.theme-preview__card--high-contrast {
  background: #000000;
}
.theme-preview__card--high-contrast .theme-preview__header { background: #ffcc00; }
.theme-preview__card--high-contrast .theme-preview__line--ar { background: #ffffff; }
.theme-preview__card--high-contrast .theme-preview__line--en { background: #555555; }
.theme-preview__card--high-contrast .theme-preview__dots span:nth-child(1) { background: #ff4444; }
.theme-preview__card--high-contrast .theme-preview__dots span:nth-child(2) { background: #ffcc00; }
.theme-preview__card--high-contrast .theme-preview__dots span:nth-child(3) { background: #44ff44; }
.theme-preview__card--high-contrast .theme-preview__dots span:nth-child(4) { background: #4444ff; }

.theme-preview__name {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ========================================
   Quick Presets — Categorized chips
   ======================================== */

.preset-category {
  margin-bottom: 16px;
}

.preset-category:last-child {
  margin-bottom: 0;
}

.preset-category__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.preset-chip--active {
  border-color: var(--accent);
  background: var(--accent-light, var(--bg-highlight));
  color: var(--accent);
}

.preset-chip__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid;
  flex-shrink: 0;
}

/* ========================================
   Typography — Split pane
   ======================================== */

.typography-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.typography-controls {
  min-width: 0;
}

.typography-preview {
  position: sticky;
  top: 80px;
  padding: 24px;
  background: var(--bg-accent, #ede6d6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 10px);
  text-align: center;
}

.typography-preview__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
}

.arabic-preview {
  font-family: var(--arabic-font, 'Amiri', serif);
  font-size: var(--arabic-size, 28px);
  direction: rtl;
  text-align: right;
  line-height: 2;
  color: var(--text-arabic, #1a0e06);
  margin-bottom: 12px;
}

.typography-preview__translation {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
}

/* ========================================
   Font Options
   ======================================== */

.font-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.font-option {
  cursor: pointer;
}

.font-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.font-option__label {
  display: block;
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius, 6px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.font-option input:checked + .font-option__label,
.font-option input:checked ~ .font-option__label {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light, var(--bg-highlight));
}

.font-option__label:hover {
  border-color: var(--accent);
}

.font-option__preview {
  display: block;
  font-size: 18px;
  direction: rtl;
  margin-top: 4px;
  color: var(--text-primary);
}

/* Urdu preview */
.urdu-preview {
  font-family: var(--urdu-font, 'Noto Nastaliq Urdu', serif);
  font-size: 20px;
  direction: rtl;
  text-align: right;
  line-height: 2.2;
  padding: 16px;
  background: var(--bg-accent);
  border-radius: var(--radius, 6px);
  color: var(--text-primary);
}

/* Slider */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  transition: opacity 0.2s;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Number input */
.number-input {
  width: 80px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius, 6px);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
}

.number-input:focus {
  border-color: var(--accent);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .typography-split {
    grid-template-columns: 1fr;
  }

  .typography-preview {
    position: static;
  }
}

@media (max-width: 480px) {
  .theme-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .theme-preview__card {
    height: 60px;
    padding: 8px;
  }

  .preset-row {
    flex-direction: column;
  }
}
