/* ════════════════════════════════════════════════════════════════════════════
   HARAMAIN COMPANION · Settings CSS (Mockup #6 · 1:1)
   ────────────────────────────────────────────────────────────────────────────
   Madinah-Grün #14946a · Gold #c9a14a · Inter Bold · JetBrains Mono · Amiri
   
   Alle Klassen mit `hc-` prefixed um Konflikte mit bestehendem Code zu
   vermeiden.
   
   v1.0 · 30.04.2026
   ════════════════════════════════════════════════════════════════════════════ */

/* ── MODAL CONTAINER ─────────────────────────────────────────────────────── */
#hc-settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  /* v406: z-index 11000 (war 10000) — über .hcj-modal damit Settings sichtbar wird */
  z-index: 11000;
  -webkit-font-smoothing: antialiased;
}

.hc-settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 240ms ease-out;
}
.hc-settings-modal--open .hc-settings-overlay {
  opacity: 1;
}

/* ── SCREEN (Mobile-Phone-like Container) ─────────────────────────────────── */
.hc-settings-screen {
  position: absolute;
  inset: 0;
  margin: 0 auto;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(20, 148, 106, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(201, 161, 74, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, #0f1f1a 0%, #0d1814 50%, #0a130f 100%);
  color: #f0f4f1;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  transform: translateY(100%);
  transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
}
.hc-settings-modal--open .hc-settings-screen {
  transform: translateY(0);
}

/* ── STATUSBAR ─────────────────────────────────────────────────────────── */
#hc-settings-modal .hc-statusbar {
  flex-shrink: 0;
  padding: 8px 18px 4px;
  padding-top: max(8px, env(safe-area-inset-top, 8px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  letter-spacing: 0.02em;
}
#hc-settings-modal .hc-offline-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 999px;
  color: #4ade80;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#hc-settings-modal .hc-offline-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  background: #4ade80;
  border-radius: 50%;
}

/* ── HEADER ───────────────────────────────────────────────────────────── */
#hc-settings-modal .hc-hdr {
  flex-shrink: 0;
  padding: 6px 18px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#hc-settings-modal .hc-hdr-back {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(20, 148, 106, 0.12);
  border: 1px solid rgba(20, 148, 106, 0.25);
  color: #f0f4f1;
  transition: background 160ms;
  padding: 0;
}
#hc-settings-modal .hc-hdr-back:active {
  background: rgba(20, 148, 106, 0.22);
}
#hc-settings-modal .hc-hdr-back svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.8;
}
#hc-settings-modal .hc-hdr-mid {
  flex: 1;
  min-width: 0;
  text-align: center;
}
#hc-settings-modal .hc-settings-hdr-title {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.015em;
}

/* ── CANVAS ───────────────────────────────────────────────────────────── */
#hc-settings-modal .hc-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 8px 18px 80px;
  padding-bottom: max(80px, env(safe-area-inset-bottom, 80px));
  -webkit-overflow-scrolling: touch;
}

/* ── SECTION ─────────────────────────────────────────────────────────── */
#hc-settings-modal .hc-set-section {
  margin-bottom: 10px;
}
#hc-settings-modal .hc-set-section-title {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
  padding: 0 4px;
}

/* ── ITEM ────────────────────────────────────────────────────────────── */
#hc-settings-modal .hc-set-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
  outline: none;
}
#hc-settings-modal .hc-set-item:hover,
#hc-settings-modal .hc-set-item:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(20, 148, 106, 0.25);
}
#hc-settings-modal .hc-set-item:active {
  background: rgba(20, 148, 106, 0.08);
  transform: scale(0.997);
}

#hc-settings-modal .hc-set-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(20, 148, 106, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #14946a;
  flex-shrink: 0;
}
#hc-settings-modal .hc-set-item-icon svg {
  width: 14px;
  height: 14px;
}

#hc-settings-modal .hc-set-item-mid {
  flex: 1;
  min-width: 0;
}
#hc-settings-modal .hc-set-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
#hc-settings-modal .hc-set-item-desc {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
  line-height: 1.3;
}

#hc-settings-modal .hc-set-item-val {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #14946a;
  background: rgba(20, 148, 106, 0.1);
  padding: 4px 9px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── TOGGLE ─────────────────────────────────────────────────────────── */
#hc-settings-modal .hc-set-toggle {
  width: 38px;
  height: 22px;
  background: rgba(20, 148, 106, 0.4);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background 200ms ease;
}
#hc-settings-modal .hc-set-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: right 200ms cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
#hc-settings-modal .hc-set-toggle.off {
  background: rgba(255, 255, 255, 0.15);
}
#hc-settings-modal .hc-set-toggle.off::before {
  right: 18px;
}

/* ── SIZE BUTTONS (A− Aa A+) ─────────────────────────────────────────── */
#hc-settings-modal .hc-size-buttons {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
#hc-settings-modal .hc-size-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 160ms ease;
}
#hc-settings-modal .hc-size-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
#hc-settings-modal .hc-size-btn.active {
  background: rgba(20, 148, 106, 0.2);
  border-color: #14946a;
  color: #14946a;
}

/* ════════════════════════════════════════════════════════════════════════
   PICKER (Bottom-Sheet für Sprache/Theme/Madhhab/Rezitator)
   ════════════════════════════════════════════════════════════════════════ */
#hc-settings-picker {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 11001; /* v406: war 10001 */
}
#hc-settings-picker .hc-picker-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#hc-settings-picker .hc-picker-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  max-width: 480px;
  background: linear-gradient(180deg, #15302a 0%, #0d1814 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px 18px 0 0;
  padding: 12px 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
  max-height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 240ms cubic-bezier(0.32, 0.72, 0, 1);
  font-family: 'Inter', sans-serif;
}
#hc-settings-picker .hc-picker-sheet--open {
  transform: translateY(0);
}
#hc-settings-picker .hc-picker-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 4px auto 12px;
}
#hc-settings-picker .hc-picker-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  padding: 0 4px;
}
#hc-settings-picker .hc-picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#hc-settings-picker .hc-picker-item {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 11px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: #fff;
  transition: all 160ms ease;
}
#hc-settings-picker .hc-picker-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
#hc-settings-picker .hc-picker-item.active {
  background: rgba(20, 148, 106, 0.15);
  border-color: rgba(20, 148, 106, 0.4);
}
#hc-settings-picker .hc-picker-item-mid {
  flex: 1;
  min-width: 0;
}
#hc-settings-picker .hc-picker-item-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
}
#hc-settings-picker .hc-picker-item-sub {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}
#hc-settings-picker .hc-picker-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #14946a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#hc-settings-picker .hc-picker-check svg {
  width: 12px;
  height: 12px;
}

/* ════════════════════════════════════════════════════════════════════════
   GLOBALE FONT-SIZE-ATTRIBUTE (data-hc-font auf <html>)
   ════════════════════════════════════════════════════════════════════════ */
html[data-hc-font="small"]  { --hc-font-scale: 0.875; }
html[data-hc-font="normal"] { --hc-font-scale: 1.0; }
html[data-hc-font="large"]  { --hc-font-scale: 1.15; }

/* Anwendung auf Du'a- und Vergleichs-Texte (optional, soft) */
[data-hc-translit="off"] .hc-translit { display: none; }

/* ════════════════════════════════════════════════════════════════════════
   THEME (Light Mode) — Default ist Dark, Light wird via [data-hc-theme="light"] aktiv
   ════════════════════════════════════════════════════════════════════════ */
html[data-hc-theme="light"] #hc-settings-modal .hc-settings-screen {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(20, 148, 106, 0.08) 0%, transparent 55%),
    linear-gradient(180deg, #f8f5ed 0%, #f2efe5 100%);
  color: #2a2a2a;
}
html[data-hc-theme="light"] #hc-settings-modal .hc-settings-hdr-title { color: #2a2a2a; }
html[data-hc-theme="light"] #hc-settings-modal .hc-set-section-title { color: rgba(0, 0, 0, 0.5); }
html[data-hc-theme="light"] #hc-settings-modal .hc-set-item {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}
html[data-hc-theme="light"] #hc-settings-modal .hc-set-item-title { color: #2a2a2a; }
html[data-hc-theme="light"] #hc-settings-modal .hc-set-item-desc { color: rgba(0, 0, 0, 0.5); }
html[data-hc-theme="light"] #hc-settings-modal .hc-hdr-back {
  background: rgba(20, 148, 106, 0.1);
  color: #2a2a2a;
}
html[data-hc-theme="light"] #hc-settings-modal .hc-statusbar { color: rgba(0, 0, 0, 0.5); }
