/* ==========================================================
   مساعد التحقق الرقمي — Design Tokens
   Cybersecurity / Trust / Privacy identity — بدون مبالغة بالأحمر
   أو مظهر "هاكر". هادئ، احترافي، واضح للمستخدم العادي.
   ========================================================== */
:root {
  --bg: #080b12;
  --bg-elevated: #0e131d;
  --surface: #131a26;
  --surface-2: #1a2331;
  --border: #232c3d;
  --border-soft: #1b2330;
  --text: #f2f6fa;
  --text-dim: #8c9ab0;
  --text-faint: #5c6a80;
  --teal: #17e8c6;
  --teal-deep: #0b9e8a;
  --green: #2ecc71;
  --yellow: #f2a93b;
  --red: #ff5a5f;
  --gray: #9aa5b3; /* لحالة "تعذّر الفحص" ⚪ */
  --on-teal: #05221d;
  --on-red: #2a0707;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-display: 'Almarai', 'IBM Plex Sans Arabic', sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Tahoma', sans-serif;
  --max-w: 640px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% 0%, #10192a 0%, #05070c 55%);
  color: var(--text);
  font-family: var(--font-body);
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

img, svg { max-width: 100%; display: block; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 18px;
}

/* ---------- Top App Bar ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(8, 11, 18, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.appbar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.appbar-logo { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(145deg, var(--teal), var(--teal-deep)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.appbar-nav { display: none; gap: 18px; font-size: 13.5px; color: var(--text-dim); }
.appbar-nav a:hover { color: var(--teal); }
@media (min-width: 720px) { .appbar-nav { display: flex; } }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--teal); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 16px; padding: 14px 22px; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: var(--font-body); transition: transform .1s, opacity .15s, background .15s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: var(--on-teal); }
.btn-primary:hover:not(:disabled) { background: #22f5d1; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--teal); }
.btn-danger { background: var(--red); color: var(--on-red); }
.btn-block { width: 100%; }

/* ---------- Hero / Home ---------- */
.hero { padding: 44px 0 28px; text-align: center; }
.hero-title { font-family: var(--font-display); font-size: 30px; font-weight: 800; margin: 0 0 12px; line-height: 1.3; }
.hero-sub { color: var(--text-dim); font-size: 14.5px; line-height: 1.8; max-width: 440px; margin: 0 auto; }

.trust-strip { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin: 22px 0 6px; font-size: 11.5px; color: var(--text-faint); }
.trust-strip span { display: flex; align-items: center; gap: 6px; }

.action-cards { display: grid; gap: 14px; margin: 26px 0; grid-template-columns: 1fr; }
@media (min-width: 560px) { .action-cards { grid-template-columns: 1fr 1fr; } }

.action-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 22px; text-align: right; cursor: pointer; transition: border-color .15s, transform .1s;
}
.action-card:hover { border-color: var(--teal-deep); transform: translateY(-1px); }
.action-card-icon { width: 42px; height: 42px; border-radius: 13px; background: rgba(23,232,198,.12); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.action-card h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; }
.action-card p { margin: 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.7; }

.url-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.input-row { display: flex; align-items: center; gap: 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px; }
.input-row input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; direction: ltr; text-align: left; font-family: monospace; }
.input-row input::placeholder { color: var(--text-faint); }

.privacy-note { display: flex; align-items: flex-start; gap: 8px; font-size: 11.5px; color: var(--text-dim); background: var(--surface); border: 1px solid var(--border-soft); padding: 11px 13px; border-radius: 12px; line-height: 1.7; }

/* ---------- Screens (app flow inside index.html) ---------- */
.app-screen { display: none; padding: 24px 0 60px; animation: fadeIn .3s ease; }
.app-screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.screen-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.screen-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; }

/* ---------- Camera / QR ---------- */
.camera-wrap { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #000; border: 1px solid var(--border); aspect-ratio: 3/4; max-width: 380px; margin: 0 auto; }
.camera-wrap video { width: 100%; height: 100%; object-fit: cover; }
.camera-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-faint); font-size: 12.5px; background: var(--surface); text-align: center; padding: 24px; }
.scan-frame { position: absolute; inset: 40px; pointer-events: none; }
.corner { position: absolute; width: 26px; height: 26px; border: 2.5px solid var(--teal); }
.corner.tl { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 8px 0 0 0; }
.corner.tr { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 0 8px 0 0; }
.corner.bl { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 0 8px; }
.corner.br { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 8px 0; }
.scan-line { position: absolute; right: 0; left: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--teal), transparent); animation: scan 2.1s ease-in-out infinite; box-shadow: 0 0 10px var(--teal); }
@keyframes scan { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }

/* ---------- Analyzing ---------- */
.analyzing-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 60px 20px; text-align: center; }
.spinner-ring { position: relative; width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; }
.spinner-ring .track { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--teal); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.analyzing-steps { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }
.analyzing-steps .done { color: var(--teal); }

/* ---------- Result ---------- */
.result-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 30px; font-size: 13.5px; font-weight: 700; }
.badge-simulated { background: rgba(242,169,59,.12); border: 1px solid rgba(242,169,59,.4); color: var(--yellow); font-size: 10.5px; }

.score-ring-wrap { position: relative; width: 150px; height: 150px; }
.score-ring-wrap svg { transform: rotate(-90deg); }
.score-ring-track { fill: none; stroke: var(--border); stroke-width: 10; }
.score-ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.4,0,.2,1); }
.score-ring-value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring-value strong { font-family: var(--font-display); font-size: 30px; font-weight: 800; }
.score-ring-value span { font-size: 11px; color: var(--text-dim); }

.domain-chip { background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); font-size: 12px; padding: 5px 12px; border-radius: 20px; direction: ltr; }

.info-section { width: 100%; text-align: right; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 16px 18px; }
.info-section h4 { margin: 0 0 8px; font-size: 13.5px; font-family: var(--font-display); }
.info-section ul { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 6px; }
.info-section li { font-size: 12.5px; color: rgba(242,246,250,.85); line-height: 1.7; }

.check-section { width: 100%; text-align: right; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 14px 16px; }
.check-section-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; font-family: var(--font-display); margin-bottom: 8px; }
.check-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 12px; color: rgba(242,246,250,.82); line-height: 1.65; }

.result-disclaimer { display: flex; gap: 7px; align-items: flex-start; background: var(--surface); border: 1px dashed var(--border-soft); border-radius: 12px; padding: 10px 12px; font-size: 10.5px; color: var(--text-faint); text-align: right; line-height: 1.7; }

/* ---------- History ---------- */
.history-row { display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 15px; padding: 12px; cursor: pointer; text-align: right; width: 100%; }
.history-icon { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.history-mid { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-mid strong { font-size: 13px; }
.history-mid span { font-size: 11px; color: var(--text-dim); }
.history-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.history-date { font-size: 10.5px; color: var(--text-faint); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 60px 30px; color: var(--text-dim); }
.empty-state p { margin: 0; font-weight: 700; color: var(--text); font-size: 14px; }
.empty-state span { font-size: 12px; color: var(--text-faint); line-height: 1.6; }

/* ---------- Settings rows ---------- */
.settings-row { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px; padding: 13px 14px; cursor: pointer; margin-bottom: 8px; width: 100%; }
.settings-row-left { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(3,5,9,.7); display: none; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 20px; padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; max-width: 320px; }
.modal h4 { margin: 6px 0 0; font-family: var(--font-display); font-size: 15px; }
.modal p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-dim); line-height: 1.7; }
.modal-actions { display: flex; gap: 8px; width: 100%; }
.modal-actions .btn { flex: 1; padding: 11px; font-size: 13px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); margin-top: 40px; padding: 26px 0 40px; text-align: center; color: var(--text-faint); font-size: 12px; }
.site-footer nav { display: flex; justify-content: center; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.site-footer a:hover { color: var(--teal); }

/* ---------- Static content pages ---------- */
.page-content { padding: 36px 0 50px; }
.page-content h1 { font-family: var(--font-display); font-size: 24px; margin-bottom: 18px; }
.page-content h2 { font-family: var(--font-display); font-size: 16px; margin: 26px 0 10px; }
.page-content p, .page-content li { font-size: 13.5px; line-height: 1.9; color: rgba(242,246,250,.85); }
.page-content ul { padding-inline-start: 20px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); padding: 10px 18px; border-radius: 30px; font-size: 12.5px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; right: -999px; top: 0; background: var(--teal); color: var(--on-teal); padding: 10px 16px; border-radius: 0 0 12px 12px; z-index: 100; }
.skip-link:focus { right: 0; }
