/* ============================================================
   VisaAlert DZ — Unified Design System
   All pages import this file.
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700;800;900&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand greens */
  --green:       #16A34A;
  --green-hover: #15803D;
  --green-light: #22C55E;
  --green-soft:  #DCFCE7;
  --green-dim:   rgba(22, 163, 74, 0.08);
  --green-glow:  rgba(22, 163, 74, 0.14);

  /* Text */
  --text:   #111827;
  --text-2: #374151;
  --muted:  #6B7280;
  --subtle: #9CA3AF;

  /* Surfaces */
  --bg:      #FFFFFF;
  --soft:    #F9FAFB;
  --surface: #FFFFFF;
  --soft-2:  #F3F4F6;

  /* Borders — 1px, no shadows */
  --border:   #E2E8F0;
  --border-2: #CBD5E1;

  /* Danger / warn */
  --danger: #EF4444;
  --warn:   #F59E0B;
  --info:   #3B82F6;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Fonts */
  --font:    "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;
  --font-ar: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --container: 1180px;

  /* Transitions */
  --t: 150ms ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; overflow-x: hidden; max-width: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[lang="ar"] body,
html[dir="rtl"] body,
[dir="rtl"] { font-family: var(--font-ar); }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--green); }
img, svg { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; outline: none; }
input, select, textarea { font-family: inherit; }
*:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ── Layout helpers ────────────────────────────────────────── */
.container {
  width: min(var(--container), calc(100% - 40px));
  margin-inline: auto;
}
.container-sm {
  width: min(760px, calc(100% - 40px));
  margin-inline: auto;
}

/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.4rem, 2.5vw, 2rem);  font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
p  { color: var(--muted); line-height: 1.65; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.label {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 11px 22px;
  font-size: 0.875rem; font-weight: 700;
  border-radius: var(--r); border: 1px solid transparent;
  cursor: pointer; transition: var(--t); white-space: nowrap;
  line-height: 1; font-family: inherit;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(180deg, #1DBF5A 0%, #15803D 100%);
  color: #fff;
  border-color: var(--green);
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.38);
  color: #fff;
}

.btn-secondary {
  background: var(--bg); color: var(--text);
  border-color: var(--border-2);
}
.btn-secondary:hover:not(:disabled) {
  border-color: #94A3B8; background: var(--soft);
  color: var(--text);
}

.btn-ghost {
  background: transparent; color: var(--muted);
  border-color: transparent; padding: 8px 12px;
}
.btn-ghost:hover:not(:disabled) { background: var(--soft); color: var(--text); }

.btn-danger {
  background: rgba(239,68,68,0.07); color: var(--danger);
  border-color: rgba(239,68,68,0.25);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.13); color: var(--danger); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--r-lg); min-height: 50px; }
.btn-full { width: 100%; }
.btn-icon {
  width: 36px; height: 36px; padding: 0; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg);
  color: var(--muted);
}
.btn-icon:hover { background: var(--soft); color: var(--text); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card-sm { padding: 16px; border-radius: var(--r); }
.card:hover { border-color: var(--border-2); }

/* ── Form elements ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-2);
}
.form-hint { font-size: 0.75rem; color: var(--muted); }
.form-required { color: var(--danger); margin-inline-start: 2px; }

.input {
  width: 100%; height: 44px; padding: 0 13px;
  font-size: 0.875rem; font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg); color: var(--text);
  transition: border-color var(--t);
  outline: none;
}
.input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}
.input::placeholder { color: var(--subtle); }
.input.error { border-color: var(--danger); }

.textarea {
  width: 100%; padding: 10px 13px;
  font-size: 0.875rem; font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--r); resize: vertical;
  background: var(--bg); color: var(--text);
  outline: none; min-height: 90px;
  transition: border-color var(--t);
}
.textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }

.select {
  width: 100%; height: 44px; padding: 0 13px;
  font-size: 0.875rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--text);
  outline: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
[dir="rtl"] .select { background-position: left 12px center; }
.select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; display: inline-block;
  width: 40px; height: 22px; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #D1D5DB; border-radius: 999px;
  cursor: pointer; transition: .2s ease;
}
.toggle-slider::before {
  content: ""; position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: .2s ease;
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  border: 1px solid transparent;
}
.badge-green  { background: var(--green-soft); color: var(--green-hover); border-color: rgba(22,163,74,.2); }
.badge-red    { background: rgba(239,68,68,.08); color: var(--danger); border-color: rgba(239,68,68,.2); }
.badge-yellow { background: rgba(245,158,11,.08); color: #B45309; border-color: rgba(245,158,11,.2); }
.badge-blue   { background: rgba(59,130,246,.08); color: #1D4ED8; border-color: rgba(59,130,246,.2); }
.badge-gray   { background: var(--soft-2); color: var(--muted); border-color: var(--border); }

/* ── Status dots ────────────────────────────────────────────── */
.dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0; display: inline-block;
}
.dot-ok   { background: var(--green); }
.dot-err  { background: var(--danger); }
.dot-warn { background: var(--warn); }
.dot-idle { background: #CBD5E1; }
.dot-pulse { position: relative; }
.dot-pulse::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: rgba(22,163,74,.5);
  animation: pulse-ring 1.6s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 0.8; }
  70%  { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
.table {
  width: 100%; border-collapse: collapse;
  font-size: 0.83rem;
}
.table thead th {
  padding: 10px 14px;
  background: var(--soft); border-bottom: 1px solid var(--border);
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
  text-align: start; white-space: nowrap;
}
.table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text-2);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--soft); }
.table .mono-id { font-family: var(--font-mono); font-size: 0.72rem; color: var(--subtle); }

/* ── Navbar ─────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.navbar {
  height: 220px;
  width: min(var(--container), calc(100% - 40px));
  margin-inline: auto;
  display: flex; align-items: center;
  justify-content: space-between; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; letter-spacing: -0.6px; font-size: 19px;
  white-space: nowrap; color: var(--text);
  flex-shrink: 0;
}
.brand img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; }
.brand span { color: var(--green); }

/* CSS brand-mark fallback */
.brand-mark {
  width: 32px; height: 32px;
  border: 3.5px solid #0A0A0A;
  border-radius: 50% 50% 50% 10px;
  transform: rotate(-45deg);
  position: relative; display: grid; place-items: center;
  flex-shrink: 0;
}
.brand-mark::before {
  content: ""; width: 10px; height: 13px;
  background: #111; border-radius: 5px 5px 3px 3px;
  transform: rotate(45deg); position: absolute;
}
.brand-mark::after {
  content: ""; width: 8px; height: 8px;
  background: var(--green); border: 2.5px solid #fff;
  border-radius: 50%; position: absolute; top: -6px; right: -5px;
}

.nav-links {
  display: flex; align-items: center; gap: 4px; flex: 1;
  padding-inline: 24px;
}
.nav-links a {
  font-size: 0.875rem; font-weight: 600; color: var(--text-2);
  padding: 7px 12px; border-radius: var(--r-sm);
  transition: color var(--t), background var(--t);
}
.nav-links a:hover { color: var(--text); background: var(--soft); }

.lang-switcher { display: flex; align-items: center; gap: 2px; }
.lang-btn {
  padding: 5px 8px; font-size: 0.73rem; font-weight: 600;
  color: var(--muted); border-radius: var(--r-xs);
  border: 1px solid transparent;
  transition: all var(--t); cursor: pointer;
}
.lang-btn:hover  { color: var(--text); border-color: var(--border); }
.lang-btn.active { color: var(--text); border-color: var(--border-2); background: var(--soft); }

.mobile-hamburger {
  display: none; flex-direction: column; gap: 5px;
  width: 36px; height: 36px; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg); cursor: pointer;
}
.mobile-hamburger span {
  display: block; width: 100%; height: 1.5px;
  background: var(--text-2); border-radius: 2px; transition: all var(--t);
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
}
.footer-inner {
  width: min(var(--container), calc(100% - 40px));
  margin-inline: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 32px; padding-bottom: 32px;
}
.footer-col-title,
.footer-title {
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text); margin-bottom: 14px;
}
.footer-col a {
  display: block; font-size: 0.83rem; color: var(--muted);
  margin-bottom: 9px; transition: color var(--t);
}
.footer-col a:hover { color: var(--green); }
.footer-copy,
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 20px;
  font-size: 0.78rem; color: var(--muted); text-align: center;
}

/* ── Spinners / loading ──────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%; animation: spin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--r); font-size: 0.85rem; margin-bottom: 12px; }
.alert-success { background: var(--green-soft); border: 1px solid rgba(22,163,74,.25); color: var(--green-hover); }
.alert-error   { background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.2); color: var(--danger); }
.alert-warn    { background: rgba(245,158,11,.06); border: 1px solid rgba(245,158,11,.2); color: #92400E; }
.alert-info    { background: rgba(59,130,246,.06); border: 1px solid rgba(59,130,246,.2); color: #1E40AF; }

/* ── Responsive navbar ───────────────────────────────────────── */
@media (max-width: 860px) {
  .nav-links, .navbar > .btn { display: none; }
  .mobile-hamburger { display: flex; }
  .navbar.menu-open { height: auto; padding: 16px 0; align-items: flex-start; flex-wrap: wrap; }
  .navbar.menu-open .nav-links {
    display: grid; width: 100%; flex: none; order: 3;
    gap: 0; padding: 0;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--r-lg); overflow: hidden;
  }
  .navbar.menu-open .nav-links a {
    padding: 14px 16px; border-radius: 0;
    border-bottom: 1px solid var(--border);
  }
  .navbar.menu-open .nav-links a:last-child { border-bottom: none; }
}

/* ── Footer responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ── Pill / badge chip ───────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(22,163,74,.3);
  color: var(--green-hover); background: var(--green-dim);
  padding: 6px 14px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700;
}
.pill-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22,163,74,.15);
}

/* ── Stat card ───────────────────────────────────────────────── */
.stat-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px 24px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-value {
  font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em;
  color: var(--text); font-family: var(--font-mono); line-height: 1.1;
}
.stat-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.stat-sub   { font-size: 0.72rem; color: var(--subtle); margin-top: 2px; }
.stat-delta { font-size: 0.72rem; font-weight: 600; margin-top: 2px; }
.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--danger); }

/* ── Section header ──────────────────────────────────────────── */
.section-hd {
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.section-hd-left { display: flex; align-items: center; gap: 10px; }
.section-hd h2 { font-size: 1rem; font-weight: 700; color: var(--text); }
.section-hd .count {
  font-size: 0.72rem; font-weight: 700; padding: 2px 8px;
  background: var(--soft-2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted);
}

/* ── Search input ────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap .search-icon {
  position: absolute; inset-block: 0; inset-inline-start: 11px;
  width: 16px; margin-block: auto;
  color: var(--muted); pointer-events: none;
}
.search-input {
  height: 36px; padding-inline: 34px 12px;
  font-size: 0.83rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text); outline: none;
  transition: border-color var(--t); width: 220px;
}
.search-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.1); }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--green); border-radius: 99px; opacity:.5; }
::-webkit-scrollbar-thumb:hover { background: var(--green-hover); }

/* ── Selection ───────────────────────────────────────────────── */
::selection { background: var(--green); color: #fff; }

/* ── Global transitions ──────────────────────────────────────── */
/* Removed global * transition-timing override — was matching every element on every style recalc */

/* ── Page entrance ───────────────────────────────────────────── */
@keyframes pageFadeIn {
  from { opacity:0; }
  to   { opacity:1; }
}
body { animation: pageFadeIn 0.4s ease both; }

/* ── Button active press ─────────────────────────────────────── */
.btn:active { transform: scale(0.98) !important; }

/* ── Glassmorphism navbar ────────────────────────────────────── */
.site-header {
  background: rgba(255,255,255,0.75) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(22,163,74,0.12) !important;
  box-shadow: 0 1px 40px rgba(0,0,0,0.04);
}

/* ── Premium gradient mesh background ───────────────────────── */
/* Pure CSS radial-gradient — same visual as filter:blur orbs but zero DOM/filter cost */
.gradient-bg {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 700px 600px at -100px -200px, rgba(220,252,231,0.7) 0%, transparent 65%),
    radial-gradient(ellipse 600px 500px at calc(100% + 80px) -120px, rgba(239,246,255,0.6) 0%, transparent 65%),
    radial-gradient(ellipse 800px 700px at 50% calc(100% + 200px), rgba(240,253,244,0.65) 0%, transparent 65%),
    #ffffff;
  pointer-events: none;
}
.orb { display: none; }

/* ── Dot grid overlay ────────────────────────────────────────── */
.dot-grid {
  position: fixed; inset: 0; z-index: -1;
  background-image: radial-gradient(circle, #16A34A18 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.4;
  pointer-events: none;
}

/* ── Decorative floating shapes — disabled (not in use) ─────── */
.deco-shapes { display: none; }

/* ── Dark footer ─────────────────────────────────────────────── */
.footer-dark {
  background: #0F172A;
  border-top: 2px solid var(--green);
  padding: 52px 0 28px;
}
.footer-dark .footer-title { color: #94A3B8; }
.footer-dark .footer-col a { color: #CBD5E1; }
.footer-dark .footer-col a:hover { color: var(--green-light); }
.footer-dark .footer-bottom { border-top-color: #1E293B; color: #64748B; }
.footer-dark .brand { color: #fff; }
.footer-dark p { color: #94A3B8; }

/* ── Telegram CTA button ─────────────────────────────────────── */
.btn-telegram {
  display: inline-flex; align-items: center; gap: 8px;
  background: #229ED9; color: #fff;
  padding: 10px 20px; border-radius: var(--r);
  font-size: .875rem; font-weight: 700;
  transition: background .2s, transform .2s;
  border: none; cursor: pointer;
}
.btn-telegram:hover { background: #1a8bbf; transform: translateY(-2px); color:#fff; }

/* ── Pulse dot ───────────────────────────────────────────────── */
@keyframes ping {
  0%   { transform: scale(1); opacity: 1; }
  75%, 100% { transform: scale(2.2); opacity: 0; }
}
.pulse-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.pulse-ring {
  position: absolute; inset: -4px; border-radius: 50%;
  animation: ping 1.5s cubic-bezier(0,0,.2,1) infinite;
}
.pulse-ring.green { background: rgba(22,163,74,.35); }
.pulse-ring.red   { background: rgba(239,68,68,.35); }
.pulse-ring.yellow{ background: rgba(245,158,11,.35); }

/* ── Responsive utilities ────────────────────────────────────── */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 641px) {
  .show-mobile { display: none !important; }
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
