/* ============================================================
   مسابقة فلترا الوطنية 95 — CSS
   الهوية الرسمية: #012B24 + شبكة هندسية + ذهبي #f5d050
   "عزنا بطبعنا"
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --ndq-bg:       #012B24;
  --ndq-bg2:      #021f1a;
  --ndq-gold:     #f5d050;
  --ndq-gold2:    #c9a227;
  --ndq-green:    #0d6e3f;
  --ndq-text:     #ffffff;
  --ndq-dim:      rgba(255,255,255,0.55);
  --ndq-border:   rgba(245,208,80,0.22);
  --ndq-radius:   20px;
  --ndq-r-sm:     12px;
}

/* ── Overlay ── */
#ndQuizOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9900;
  background: rgba(0,10,6,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
}
#ndQuizOverlay.active { display: flex; }

/* ── Modal Shell ── */
#ndQuizModal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--ndq-bg);
  border-radius: var(--ndq-radius);
  border: 1.5px solid var(--ndq-border);
  box-shadow:
    0 0 0 1px rgba(245,208,80,0.06),
    0 32px 80px rgba(0,0,0,0.75),
    inset 0 1px 0 rgba(245,208,80,0.12);
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  direction: rtl;
  scrollbar-width: thin;
  scrollbar-color: var(--ndq-green) transparent;
}
#ndQuizModal::-webkit-scrollbar { width: 3px; }
#ndQuizModal::-webkit-scrollbar-thumb { background: var(--ndq-green); border-radius: 3px; }

/* ── الشبكة الهندسية (الهوية الرسمية) ── */
#ndQuizModal::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--ndq-radius);
  background-image:
    linear-gradient(rgba(0,180,80,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,180,80,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* ── Header الشريط العلوي ── */
.ndq-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(245,208,80,0.12);
  background: linear-gradient(180deg, rgba(1,43,36,0.9) 0%, transparent 100%);
}

/* شعار الهوية — النص الرسمي */
.ndq-logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ndq-nd-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #012B24, #0a4a32);
  border: 1.5px solid var(--ndq-gold);
  border-radius: 10px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.ndq-nd-emblem::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(245,208,80,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,208,80,0.08) 1px, transparent 1px);
  background-size: 8px 8px;
}
.ndq-nd-emblem-num {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--ndq-gold);
  line-height: 1;
  position: relative;
  z-index: 1;
}
.ndq-nd-emblem-flag {
  font-size: 0.65rem;
  position: relative;
  z-index: 1;
}
.ndq-brand-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ndq-brand-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ndq-gold);
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.ndq-brand-tagline {
  font-size: 0.68rem;
  color: var(--ndq-dim);
  line-height: 1.2;
}

/* زر الإغلاق */
.ndq-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--ndq-dim);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
  flex-shrink: 0;
}
.ndq-close:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* ── Body ── */
.ndq-body {
  position: relative;
  z-index: 2;
  padding: 22px 22px 26px;
}

/* ── شريط التقدم (مراحل) ── */
.ndq-progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 22px;
}
.ndq-ps-dot {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
  transition: all 0.35s ease;
  width: 18px;
}
.ndq-ps-dot.active {
  width: 32px;
  background: var(--ndq-gold);
  box-shadow: 0 0 8px rgba(245,208,80,0.5);
}
.ndq-ps-dot.done {
  background: #2ecc71;
}

/* ── عنوان الخطوة ── */
.ndq-step-head {
  text-align: center;
  margin-bottom: 20px;
}
.ndq-step-head h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
  line-height: 1.35;
}
.ndq-step-head p {
  font-size: 0.82rem;
  color: var(--ndq-dim);
  margin: 0;
  line-height: 1.55;
}

/* ── شعار عزنا بطبعنا ── */
.ndq-slogan {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ndq-gold);
  letter-spacing: 1.5px;
  margin: 14px 0;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ndq-slogan::before,
.ndq-slogan::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245,208,80,0.35));
}
.ndq-slogan::after {
  background: linear-gradient(90deg, rgba(245,208,80,0.35), transparent);
}

/* ── Welcome Screen ── */
.ndq-welcome-hero {
  text-align: center;
  padding: 4px 0 16px;
}
.ndq-nd95-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(245,208,80,0.15), rgba(245,208,80,0.05));
  border: 1px solid rgba(245,208,80,0.35);
  border-radius: 50px;
  padding: 8px 20px;
  margin-bottom: 18px;
}
.ndq-nd95-badge-flag { font-size: 1.3rem; }
.ndq-nd95-badge-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ndq-gold);
  letter-spacing: 0.5px;
}
.ndq-welcome-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 8px;
  line-height: 1.3;
}
.ndq-welcome-sub {
  font-size: 0.85rem;
  color: var(--ndq-dim);
  margin: 0 0 20px;
  line-height: 1.6;
}

/* Rules box */
.ndq-rules-box {
  background: rgba(245,208,80,0.05);
  border: 1px solid rgba(245,208,80,0.18);
  border-radius: var(--ndq-r-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ndq-rule-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  direction: rtl;
}
.ndq-rule-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.ndq-rule-text {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.78);
  line-height: 1.5;
}
.ndq-rule-text strong { color: var(--ndq-gold); }

/* ── Form Inputs ── */
.ndq-field {
  margin-bottom: 14px;
}
.ndq-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ndq-gold);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.ndq-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: var(--ndq-r-sm);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  direction: rtl;
  box-sizing: border-box;
  transition: border-color 0.22s, box-shadow 0.22s;
}
.ndq-input::placeholder { color: var(--ndq-dim); font-size: 0.85rem; }
.ndq-input:focus {
  outline: none;
  border-color: rgba(245,208,80,0.5);
  box-shadow: 0 0 0 3px rgba(245,208,80,0.08);
  background: rgba(255,255,255,0.07);
}
.ndq-input.err { border-color: #e74c3c !important; }
.ndq-err-msg {
  display: none;
  font-size: 0.73rem;
  color: #e74c3c;
  margin-top: 4px;
  padding-right: 4px;
}

/* ── Buttons ── */
.ndq-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--ndq-r-sm);
  font-size: 0.92rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.22s;
  margin-top: 10px;
  text-decoration: none;
  letter-spacing: 0.2px;
  line-height: 1;
}
/* Primary — ذهبي */
.ndq-btn-primary {
  background: linear-gradient(135deg, var(--ndq-gold), #e6b800);
  color: #012B24;
  box-shadow: 0 4px 18px rgba(245,208,80,0.3);
}
.ndq-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(245,208,80,0.45);
}
.ndq-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
/* WhatsApp */
.ndq-btn-wa {
  background: linear-gradient(135deg, #25d366, #128c4e);
  color: #fff;
  box-shadow: 0 4px 18px rgba(37,211,102,0.3);
  font-size: 1rem;
}
.ndq-btn-wa:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(37,211,102,0.45); }
/* Secondary */
.ndq-btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--ndq-dim);
}
.ndq-btn-secondary:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ── Quiz — السؤال والإجابات ── */
.ndq-quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ndq-q-counter {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ndq-gold);
}
.ndq-diff-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
}
.ndq-diff-1 { background: rgba(46,204,113,0.15); color: #2ecc71; border: 1px solid rgba(46,204,113,0.3); }
.ndq-diff-2 { background: rgba(245,208,80,0.12); color: var(--ndq-gold); border: 1px solid rgba(245,208,80,0.25); }
.ndq-diff-3 { background: rgba(231,76,60,0.12); color: #e74c3c; border: 1px solid rgba(231,76,60,0.25); }

/* شريط التقدم */
.ndq-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-bottom: 20px;
  overflow: hidden;
}
.ndq-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ndq-green), var(--ndq-gold));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* نص السؤال */
.ndq-q-text {
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.6;
  margin-bottom: 18px;
  text-align: right;
  direction: rtl;
}

/* خيارات الإجابة */
.ndq-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.ndq-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.09);
  border-radius: var(--ndq-r-sm);
  color: #fff;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  direction: rtl;
  transition: all 0.18s;
  width: 100%;
  line-height: 1.45;
}
.ndq-opt:hover:not(:disabled) {
  border-color: rgba(245,208,80,0.4);
  background: rgba(245,208,80,0.06);
  transform: translateX(-2px);
}
.ndq-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ndq-dim);
  flex-shrink: 0;
  transition: all 0.18s;
}
/* حالة الصح ── خضراء واضحة جداً */
.ndq-opt.correct {
  border-color: #27ae60 !important;
  background: rgba(39,174,96,0.18) !important;
  color: #2ecc71 !important;
}
.ndq-opt.correct .ndq-opt-letter {
  background: #27ae60 !important;
  color: #fff !important;
  border-color: #27ae60 !important;
}
/* حالة الخطأ ── حمراء واضحة */
.ndq-opt.wrong {
  border-color: #c0392b !important;
  background: rgba(192,57,43,0.15) !important;
  color: #e74c3c !important;
}
.ndq-opt.wrong .ndq-opt-letter {
  background: #c0392b !important;
  color: #fff !important;
  border-color: #c0392b !important;
}
.ndq-opt:disabled { cursor: default; }

/* ── Result Screen ── */
.ndq-result-top {
  text-align: center;
  padding: 10px 0 20px;
}
.ndq-score-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245,208,80,0.15), rgba(245,208,80,0.05));
  border: 3px solid var(--ndq-gold);
  box-shadow: 0 0 30px rgba(245,208,80,0.25), inset 0 0 20px rgba(245,208,80,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.ndq-score-num {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--ndq-gold);
  line-height: 1;
}
.ndq-score-of {
  font-size: 0.72rem;
  color: var(--ndq-dim);
}
.ndq-result-msg {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}
.ndq-stars {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 16px;
  font-size: 1.3rem;
}

/* بطاقة الخصم */
.ndq-discount-card {
  background: linear-gradient(135deg, rgba(245,208,80,0.12), rgba(245,208,80,0.04));
  border: 1.5px solid rgba(245,208,80,0.35);
  border-radius: var(--ndq-r-sm);
  padding: 18px;
  text-align: center;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.ndq-discount-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(245,208,80,0.06);
  pointer-events: none;
}
.ndq-discount-pct {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--ndq-gold);
  line-height: 1;
  margin-bottom: 4px;
}
.ndq-discount-label {
  font-size: 0.8rem;
  color: var(--ndq-dim);
  margin-bottom: 2px;
}
.ndq-discount-detail {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  margin-top: 6px;
}

/* ── Service Grid ── */
.ndq-services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-bottom: 14px;
}
.ndq-svc-card {
  padding: 14px 10px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.09);
  border-radius: var(--ndq-r-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  direction: rtl;
}
.ndq-svc-card:hover {
  border-color: rgba(245,208,80,0.35);
  background: rgba(245,208,80,0.06);
  transform: translateY(-2px);
}
.ndq-svc-card.selected {
  border-color: var(--ndq-gold) !important;
  background: rgba(245,208,80,0.12) !important;
  box-shadow: 0 0 16px rgba(245,208,80,0.2);
}
.ndq-svc-icon { font-size: 1.5rem; margin-bottom: 6px; }
.ndq-svc-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

/* ── Code Box ── */
.ndq-code-box {
  background: rgba(1,43,36,0.8);
  border: 2px dashed rgba(245,208,80,0.4);
  border-radius: var(--ndq-r-sm);
  padding: 18px;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.ndq-code-box:hover { border-color: rgba(245,208,80,0.7); background: rgba(1,43,36,0.95); }
.ndq-code-title { font-size: 0.72rem; color: var(--ndq-dim); margin-bottom: 8px; }
.ndq-code-val {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ndq-gold);
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  margin-bottom: 6px;
}
.ndq-code-hint { font-size: 0.68rem; color: rgba(245,208,80,0.45); }

/* ── Loading Spinner ── */
.ndq-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(245,208,80,0.2);
  border-top-color: var(--ndq-gold);
  border-radius: 50%;
  animation: ndqSpin 0.7s linear infinite;
}
@keyframes ndqSpin { to { transform: rotate(360deg); } }

/* ── الزر العائم ── */
#ndQuizTrigger {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 8800;
  background: linear-gradient(135deg, var(--ndq-bg), #0a4032);
  border: 2px solid var(--ndq-gold);
  border-radius: 50px;
  padding: 12px 20px;
  color: var(--ndq-gold);
  font-size: 0.82rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 0 rgba(245,208,80,0.4);
  animation: ndqPulse 2.5s ease-in-out infinite;
  direction: rtl;
  text-decoration: none;
  transition: transform 0.2s;
}
#ndQuizTrigger:hover { transform: scale(1.05); }
@keyframes ndqPulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 0 rgba(245,208,80,0.35); }
  50%       { box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 10px rgba(245,208,80,0); }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  #ndQuizModal { border-radius: 16px; max-height: 96vh; }
  .ndq-body { padding: 18px 16px 22px; }
  .ndq-header { padding: 16px 16px 14px; }
  .ndq-welcome-title { font-size: 1.3rem; }
  .ndq-score-ring { width: 95px; height: 95px; }
  .ndq-score-num { font-size: 1.9rem; }
  .ndq-discount-pct { font-size: 2.2rem; }
  .ndq-services-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  #ndQuizTrigger { bottom: 16px; left: 16px; padding: 10px 16px; font-size: 0.78rem; }
}
