/* ============================================================
   ثمانية — صفحة إدارة الاشتراك البريدي
   الخطوط الرسمية + ألوان shasha/web (أسود/أبيض + أخضر النجاح)
   ============================================================ */

@font-face { font-family: "Thmanyah Serif Display"; src: url("assets/fonts/Thmanyahserifdisplay12-Bold.woff2") format("woff2"), url("assets/fonts/Thmanyahserifdisplay12-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("assets/fonts/Thmanyahsans12-Regular.woff2") format("woff2"), url("assets/fonts/Thmanyahsans12-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("assets/fonts/Thmanyahsans12-Medium.woff2") format("woff2"), url("assets/fonts/Thmanyahsans12-Medium.otf") format("opentype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("assets/fonts/Thmanyahsans12-Bold.woff2") format("woff2"), url("assets/fonts/Thmanyahsans12-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("assets/fonts/IBMPlexSansArabic-Regular.woff2") format("woff2"), url("assets/fonts/IBMPlexSansArabic-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("assets/fonts/IBMPlexSansArabic-Medium.woff2") format("woff2"), url("assets/fonts/IBMPlexSansArabic-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --background: #000; --foreground: #fff;
  --surface: #000; --surface-subtle: rgba(255, 255, 255, .06);
  --surface-strong: rgba(255, 255, 255, .10); --skeleton: rgba(255, 255, 255, .08);
  --muted: rgba(255, 255, 255, .75); --muted-soft: rgba(255, 255, 255, .60);
  --border: rgba(255, 255, 255, .1216); --input-border: rgba(255, 255, 255, .20);
  --green: #00BC6D; --green-ink: #8BE4B9; --green-bg: rgba(0, 188, 109, .14);
  --coral-ink: #FF9B8F; --coral-bg: rgba(239, 68, 68, .14);
  --font-display: "Thmanyah Serif Display", "IBM Plex Sans Arabic", "Times New Roman", serif;
  --font-body: "Thmanyah Sans", "IBM Plex Sans Arabic", Tahoma, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh; display: flex; flex-direction: column;
  background: var(--background); color: var(--foreground);
  font-family: var(--font-body); font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: rgba(255, 255, 255, .22); }
a { color: var(--foreground); }
a:hover { opacity: .75; }
a:focus-visible { outline: 2px solid var(--foreground); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- الهيكل العام ---------- */
.wrap {
  width: 100%; max-width: 664px; margin: 0 auto; flex: 1;
  display: flex; flex-direction: column;
  padding-top: clamp(32px, 8vw, 64px);
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  padding-inline: max(20px, env(safe-area-inset-left), env(safe-area-inset-right));
}
.logo { display: block; margin: 0 auto clamp(24px, 5vw, 40px); height: clamp(26px, 4vw, 34px); width: auto; filter: invert(1); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: clamp(16px, 2vw, 20px);
  padding: clamp(26px, 5vw, 40px) clamp(18px, 5vw, 48px) clamp(28px, 5.5vw, 48px);
}
.view { display: flex; flex-direction: column; gap: clamp(20px, 3vw, 24px); }
.view-top { margin-top: clamp(20px, 3vw, 24px); }
.view-success { gap: 16px; }

h1, h2 {
  margin: 0; font-family: var(--font-display); font-weight: 700;
  letter-spacing: -0.01em; line-height: 1.45;
  font-size: clamp(22px, 2.2vw + 14px, 29px); text-wrap: pretty;
}
h1:focus, h2:focus { outline: none; }
.support { margin: 10px 0 0; font-size: clamp(14.5px, .5vw + 13px, 16px); line-height: 1.85; color: var(--muted); text-wrap: pretty; }
.noscript-note { margin: 0 0 16px; font-size: 15px; line-height: 1.8; }

/* ---------- الحقول والمجموعات ---------- */
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.legend-label { padding: 0; margin-bottom: 10px; }
.email-input {
  display: block; width: 100%; border: 1px solid var(--input-border); background: var(--surface-subtle); color: var(--foreground);
  border-radius: 14px; padding: 14px 16px; font: 500 14.5px/1.4 var(--font-body);
  direction: ltr; text-align: left;
}
.email-input:focus-visible { outline: 2px solid var(--foreground); outline-offset: 2px; }
.email-echo {
  margin: 0; background: var(--surface-subtle); color: var(--foreground); border: 1px solid var(--input-border); border-radius: 14px;
  padding: 14px 16px; font: 500 14.5px/1.5 var(--font-body);
  direction: ltr; text-align: left; overflow-wrap: anywhere;
}

fieldset.groups { border: 0; padding: 0; margin: 0; min-width: 0; }
.group-list { display: flex; flex-direction: column; gap: 10px; }
.group {
  display: flex; gap: 12px; align-items: flex-start; background: var(--surface-subtle); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 16px; cursor: pointer; transition: opacity 150ms ease-out;
}
.group:hover { opacity: .85; }
.group input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
.cb {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 7px;
  border: 1.5px solid rgba(255, 255, 255, .35); background: transparent; color: var(--background);
  display: grid; place-items: center; transition: background 150ms ease-out, border-color 150ms ease-out;
}
.cb svg { opacity: 0; transition: opacity 150ms ease-out; }
.group input:checked ~ .cb { background: var(--foreground); border-color: var(--foreground); }
.group input:checked ~ .cb svg { opacity: 1; }
.group input:focus-visible ~ .cb { outline: 2px solid var(--foreground); outline-offset: 2px; }
.group-text { flex: 1; min-width: 0; }
.group-name { display: block; font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--foreground); overflow-wrap: anywhere; }
.group-desc { display: block; font-size: 13px; line-height: 1.6; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

/* ---------- الأزرار ---------- */
.btn {
  appearance: none; border: 0; width: 100%; min-height: 52px; padding: 13px 24px;
  border-radius: 999px; background: var(--foreground); color: var(--background);
  font: 500 16px/1.3 var(--font-body); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: opacity 150ms ease-out;
}
.btn:hover:not(:disabled) { opacity: .85; }
.btn:focus-visible { outline: 2px solid var(--foreground); outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn[aria-busy="true"] { opacity: 1; cursor: progress; }
.btn-secondary { background: transparent; color: var(--foreground); border: 1px solid var(--input-border); min-height: 48px; font-size: 15.5px; margin-top: 14px; }
.btn-ghost { background: transparent; color: var(--foreground); border: 1px solid var(--input-border); min-height: 48px; font-size: 15.5px; }
.btn-ghost:focus-visible { outline-offset: 2px; }
.btn-text {
  appearance: none; border: 0; background: transparent; color: var(--foreground);
  font: 500 14.5px/1.3 var(--font-body); text-decoration: underline; text-underline-offset: 3px;
  min-height: 44px; padding: 10px 2px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
  transition: opacity 150ms ease-out; border-radius: 6px;
}
.btn-text:hover:not(:disabled) { opacity: .7; }
.btn-text:focus-visible { outline: 2px solid var(--foreground); outline-offset: 3px; }
.btn-text:disabled { opacity: .45; cursor: not-allowed; }

.spinner {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, .28); border-top-color: var(--background);
  animation: spin .8s linear infinite;
}
.btn-secondary .spinner, .btn-text .spinner { border-color: rgba(255, 255, 255, .28); border-top-color: var(--foreground); }

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.unsub-cap { margin: 0 0 10px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- التنبيهات ضمن الصفحة ---------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start; border-radius: 14px;
  padding: 12px 14px; font-size: 14px; font-weight: 500; line-height: 1.6; margin-bottom: 20px;
}
.banner svg { flex: none; margin-top: 3px; }
.banner-success { background: var(--green-bg); color: var(--green-ink); }
.banner-error { background: var(--coral-bg); color: var(--coral-ink); }

/* ---------- التحميل والنجاح ---------- */
.skel { background: var(--skeleton); border-radius: 14px; animation: pulse 1.6s ease-in-out infinite; }
.skel-label { width: 38%; height: 13px; border-radius: 6px; }
.skel-input { height: 48px; }
.skel-row { height: 66px; border-radius: 16px; }
.skel-btn { height: 48px; border-radius: 999px; margin-top: 4px; }
.skel-btn-lg { height: 52px; border-radius: 999px; }
.success-disc { width: 54px; height: 54px; border-radius: 50%; background: var(--green); display: grid; place-items: center; }
.success-email { margin: 0; font-size: 13.5px; font-weight: 500; color: var(--muted); direction: ltr; text-align: right; overflow-wrap: anywhere; }

/* ---------- التذييل ---------- */
.foot { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: clamp(26px, 4vw, 32px); }
.tent { height: 15px; width: auto; opacity: .60; filter: invert(1); }
.privacy-link { font-size: 13px; color: var(--muted-soft); text-underline-offset: 3px; padding: 10px 12px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
