/* ===================================================================
   settings.css — صفحة إعدادات الموقع
=================================================================== */
.settings-wrap{ padding-top:10px; padding-bottom:60px; }

.settings-section{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.settings-section h2{
  font-family: var(--font-display); color: var(--gold-bright); font-size:1.1rem;
  display:flex; align-items:center; gap:8px; margin-bottom:6px;
}
.settings-desc{ font-size:.8rem; color: var(--text-dim); margin-bottom:16px; line-height:1.8; }

/* -------- صف إعداد فيه تبديل (Switch) -------- */
.settings-row{
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  padding: 12px 4px; border-top: 1px solid var(--border);
}
.settings-row:first-of-type{ border-top:none; padding-top:0; }
.settings-row .row-label{ font-weight:700; font-size:.9rem; }
.settings-row .row-sub{ font-size:.75rem; color: var(--text-dim); margin-top:2px; }

/* زرار تبديل (يعيد استخدام .switch/.dot العامة) قابل للضغط */
.switch-btn{ background:none; border:none; padding:0; cursor:pointer; flex-shrink:0; display:inline-flex; align-items:center; -webkit-tap-highlight-color:transparent; }
/* السبب القديم: .switch كان span عادي (inline) فعرضه وطوله بيتجاهلوا والنقطة بتطلع برة الكارت. هنا بنخليه block ونحسّن شكله. */
.switch-btn .switch{
  display:block; position:relative; flex-shrink:0; width:54px; height:30px; border-radius:30px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 30%, var(--surface-2)), var(--surface-2));
  border:1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.28);
  transition: background .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.switch-btn .switch .dot{
  top:3px; right:3px; width:22px; height:22px;
  background: radial-gradient(circle at 35% 30%, #ffffff, #e2e2e2 70%, #bdbdbd);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), background .3s ease;
}
.switch-btn .switch.active{
  background: linear-gradient(180deg, color-mix(in srgb, var(--green-bright) 70%, #000), var(--green-bright));
  border-color: var(--green-bright);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.25), 0 0 12px color-mix(in srgb, var(--green-bright) 45%, transparent);
}
.switch-btn .switch.active .dot{ transform: translateX(-24px); background: radial-gradient(circle at 35% 30%, #ffffff, #e2e2e2 70%, #bdbdbd); }
.switch-btn:active .switch .dot{ width:26px; }
.switch-btn:active .switch.active .dot{ transform: translateX(-28px); }

/* -------- صوت الأذان الخاص -------- */
.custom-athan-actions{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin: 12px 0 4px; }
.custom-athan-name{ display:block; font-size:.72rem; color: var(--gold-bright); margin-top:3px; word-break:break-all; font-weight:400; }


/* -------- اختيار حجم الخط -------- */
.choice-row{ display:flex; gap:10px; flex-wrap:wrap; }
.choice-btn{
  padding:9px 18px; border-radius:30px; border:1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight:700; font-size:.85rem;
  transition: all .2s ease;
}
.choice-btn.active{ background: var(--gold); color:#171203; border-color: var(--gold); }

/* -------- اختيار اللون المميز -------- */
.accent-row{ display:flex; gap:14px; flex-wrap:wrap; }
.accent-swatch{
  width:44px; height:44px; border-radius:50%; border:3px solid transparent;
  display:flex; align-items:center; justify-content:center; font-size:1rem;
  transition: transform .2s ease, border-color .2s ease;
}
.accent-swatch:hover{ transform: scale(1.08); }
.accent-swatch.active{ border-color: var(--text); }

/* -------- شبكة الزخارف (4 في الصف) -------- */
.decor-grid{
  display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:10px;
}
.decor-swatch{
  position:relative; aspect-ratio: 1/1; border-radius:14px; overflow:hidden;
  border:2px solid var(--border); background-color: var(--surface-2);
  background-repeat: repeat; cursor:pointer; transition: transform .15s ease, border-color .15s ease;
}
.decor-swatch:hover{ transform: scale(1.05); }
.decor-swatch.active{ border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent); }
.decor-swatch.active::after{
  content:'✓'; position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-size:1.3rem; font-weight:900; color:#fff; background: rgba(0,0,0,.35);
}
.decor-swatch-num{
  position:absolute; bottom:2px; left:4px; font-size:.6rem; color: var(--text-dim);
  background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius:4px; padding:0 3px;
}

.custom-color-row{
  display:flex; align-items:center; gap:10px; margin-top:14px; padding-top:14px;
  border-top:1px dashed var(--border); font-size:.85rem; font-weight:700;
}
.custom-color-row input[type="color"]{
  width:44px; height:44px; padding:0; border:2px solid var(--border); border-radius:50%;
  background:none; cursor:pointer; overflow:hidden;
}
.custom-color-row input[type="color"]::-webkit-color-swatch-wrapper{ padding:0; border-radius:50%; }
.custom-color-row input[type="color"]::-webkit-color-swatch{ border:none; border-radius:50%; }

.intensity-row{
  display:flex; align-items:center; gap:12px; margin-top:10px; font-size:.8rem; color: var(--text-dim);
}
.intensity-row input[type="range"]{ flex:1; accent-color: var(--gold); }

.settings-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; margin-top:6px; }

/* -------- شريط تأكيد المعاينة الحية -------- */
.preview-confirm-bar{
  position: fixed; bottom: 0; left:0; right:0; z-index: 60;
  display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  background: color-mix(in srgb, var(--gold) 16%, var(--surface));
  border-top: 2px solid var(--gold);
  padding: 12px 18px; font-size:.85rem; font-weight:700; color: var(--text);
  box-shadow: 0 -6px 20px rgba(0,0,0,.25);
}
.preview-confirm-bar.hidden{ display:none; }
.preview-confirm-actions{ display:flex; gap:8px; flex-wrap:wrap; }

/* -------- اختيار صوت الأذان -------- */
.athan-options{ display:flex; flex-direction:column; gap:10px; }
.athan-option{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:12px 14px; border-radius:12px; background: var(--surface-2); border:1px solid var(--border);
}
.athan-option-label{ display:flex; align-items:center; gap:8px; font-size:.88rem; }
.athan-option-label input{ width:18px; height:18px; accent-color: var(--gold); }
.athan-option.selected{ border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--surface-2)); }

/* -------- شبكة الخطوط -------- */

/* ===================================================================
   أقسام قابلة للطي + بحث (settings-ui.js)
=================================================================== */
.ss-bar{ display:flex; align-items:center; gap:10px; margin:2px 0 14px; position:sticky; top:8px; z-index:20; }
.ss-search{
  flex:1 1 auto; min-width:0; display:flex; align-items:center; gap:8px; padding:0 12px; height:46px; cursor:text;
  border-radius:14px; background:color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter:blur(10px); backdrop-filter:blur(10px);
  border:1px solid var(--border); box-shadow:var(--shadow);
  transition:border-color .2s ease, box-shadow .2s ease;
}
.ss-search:focus-within{ border-color:var(--gold); box-shadow:0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
.ss-glass{ font-size:1rem; opacity:.8; flex:none; }
.ss-search input{
  flex:1; min-width:0; border:0; outline:0; background:transparent; color:var(--text);
  font-family:inherit; font-size:.9rem; height:100%; padding:0; -webkit-appearance:none; appearance:none;
}
.ss-search input::placeholder{ color:var(--text-dim); opacity:.9; }
.ss-search input::-webkit-search-cancel-button{ display:none; }
.ss-clear{
  flex:none; width:26px; height:26px; border-radius:50%; border:0; cursor:pointer; font-size:.8rem; line-height:1;
  background:var(--surface-2); color:var(--text-dim); font-family:inherit;
}
.ss-clear[hidden]{ display:none; }
.ss-all{
  flex:none; height:46px; padding:0 14px; border-radius:14px; cursor:pointer; font-family:inherit; font-weight:800; font-size:.8rem;
  background:color-mix(in srgb, var(--surface) 94%, transparent); border:1px solid var(--border); color:var(--text-dim);
  white-space:nowrap; box-shadow:var(--shadow);
}
.ss-all:hover{ color:var(--text); border-color:var(--gold); }
.ss-all[hidden]{ display:none; }
.ss-count{ font-size:.78rem; color:var(--text-dim); margin:-4px 4px 12px; }
.ss-count[hidden]{ display:none; }

.ss-empty{ text-align:center; padding:34px 16px; border:1px dashed var(--border); border-radius:var(--radius); color:var(--text-dim); margin-bottom:22px; }
.ss-empty[hidden]{ display:none; }
.ss-empty-ico{ font-size:2rem; margin-bottom:6px; }
.ss-empty-t{ font-family:var(--font-display); color:var(--gold-bright); font-size:1.1rem; margin-bottom:4px; }
[data-theme="light"] .ss-empty-t{ color:color-mix(in srgb, var(--gold-bright) 55%, #000); }
.ss-empty-s{ font-size:.8rem; }

.settings-section.ss-ready{ padding:0; overflow:hidden; scroll-margin-top:70px; margin-bottom:12px; }
.settings-section.ss-hide{ display:none !important; }
.settings-section.ss-ready > h2{ margin:0; display:block; }
.ss-head{
  width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:start;
  padding:16px 18px; background:none; border:0; cursor:pointer; color:inherit; font:inherit; -webkit-tap-highlight-color:transparent;
}
.ss-head:focus-visible{ outline:2px solid var(--gold); outline-offset:-3px; border-radius:var(--radius); }
.ss-text{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.ss-title{ font-family:var(--font-display); color:var(--gold-bright); font-size:1.1rem; font-weight:700; line-height:1.5; }
[data-theme="light"] .ss-title{ color:color-mix(in srgb, var(--gold-bright) 55%, #000); }
.ss-hint{ font-family:var(--font-body); font-size:.76rem; font-weight:500; color:var(--text-dim); }
.ss-chev{
  flex:none; width:30px; height:30px; border-radius:50%; display:grid; place-items:center; font-size:1.25rem; line-height:1;
  background:var(--surface-2); color:var(--text-dim); transform:rotate(0deg); transition:transform .28s ease, color .2s ease, background .2s ease;
}
.ss-head:hover .ss-chev{ color:var(--gold-bright); }
.is-open > h2 .ss-chev{ transform:rotate(-90deg); color:var(--gold-bright); }

.ss-body{ display:grid; grid-template-rows:0fr; visibility:hidden; transition:grid-template-rows .3s ease, visibility 0s linear .3s; }
.is-open > .ss-body{ grid-template-rows:1fr; visibility:visible; transition:grid-template-rows .3s ease, visibility 0s; }
.ss-inner{ min-height:0; overflow:hidden; padding:0 20px; }
.is-open > .ss-body > .ss-inner{ padding:2px 20px 20px; border-top:1px solid var(--border); padding-top:14px; margin:0 0 0; }
.is-open > .ss-body > .ss-inner{ overflow:visible; }
@media (prefers-reduced-motion:reduce){ .ss-body, .ss-chev{ transition:none; } }
[data-reduce-motion="1"] .ss-body, [data-reduce-motion="1"] .ss-chev{ transition:none; }
@media print{ .ss-bar, .ss-count, .ss-empty{ display:none !important; } .ss-body{ grid-template-rows:1fr !important; visibility:visible !important; } }
