/* ==========================================================
   Design tokens
   ========================================================== */
:root {
  --bg: #0b1220;
  --bg-soft: #101a2e;
  --surface: #16213a;
  --surface-2: #1c2a47;
  --border: #263758;
  --text: #eef2fb;
  --text-muted: #9aa8c7;
  --primary: #4f7cff;
  --primary-dark: #3a5fe0;
  --accent: #22d3c5;
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #16224a 0%, var(--bg) 45%) fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================
   RTL / Arabic support
   ========================================================== */
html[dir="rtl"] body {
  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* Language switcher */
.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.lang-switch a {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .03em;
}
.lang-switch a.active {
  background: var(--primary);
  color: #fff;
}
.lang-switch a:not(.active):hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ==========================================================
   Topbar
   ========================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(11,18,32,0.85);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  max-width: 1100px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  min-width: 0;
  flex: 1 1 auto;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #06101f;
  font-size: 16px;
  flex-shrink: 0;
}
.brand-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 6px 20px rgba(79,124,255,0.35);
}
.btn-primary:hover { opacity: 0.92; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--primary); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 16px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }

/* ==========================================================
   Hero
   ========================================================== */
.hero {
  padding: 56px 0 32px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  margin: 0 0 10px;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.hero p {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto;
}

/* ==========================================================
   Search cards
   ========================================================== */
.search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 32px 0 48px;
}
@media (max-width: 640px) {
  .search-grid { grid-template-columns: 1fr; }

  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }
  .brand {
    font-size: 16px;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  .brand-name {
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.25;
  }
  .topbar-controls {
    width: 100%;
    justify-content: space-between;
  }
  .lang-switch a {
    padding: 8px 10px;
    font-size: 12px;
  }
  .btn-admin-login {
    padding: 10px 14px;
    font-size: 13px;
  }
}
.search-card {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.search-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
}
.search-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79,124,255,0.15);
  color: var(--primary);
  font-size: 22px;
}
.search-card h3 { margin: 0; font-size: 19px; }
.search-card p { margin: 0; color: var(--text-muted); font-size: 14px; }
.search-card .btn { margin-top: 6px; }

/* ==========================================================
   News
   ========================================================== */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 20px;
}
.section-title h2 {
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.02em;
}
.news-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 50px;
}
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.news-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.news-card .news-time {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: block;
}
.news-card .news-body {
  color: #cdd6ec;
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ==========================================================
   Forms
   ========================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.form-page {
  max-width: 460px;
  margin: 60px auto;
  padding: 0 20px;
}
.form-group { margin-bottom: 18px; }
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
}
input[type=text], input[type=password], input[type=tel], input[type=url], textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
textarea { min-height: 140px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
.error-box {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
}
.success-box {
  background: var(--success-bg);
  border: 1px solid rgba(34,197,94,0.4);
  color: #86efac;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
}

/* ==========================================================
   Result page
   ========================================================== */
.result-badge {
  text-align: center;
  padding: 40px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.result-badge.approved {
  background: var(--success-bg);
  border: 1px solid rgba(34,197,94,0.4);
}
.result-badge.declined {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.4);
}
.result-badge .status-word {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.result-badge.approved .status-word { color: var(--success); }
.result-badge.declined .status-word { color: var(--danger); }
.result-icon { font-size: 42px; margin-bottom: 10px; }
.result-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.result-details h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.result-details p { margin: 0 0 16px; }
.result-details .map-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid transparent;
}
.result-details .map-link:hover { border-color: var(--accent); }

/* ==========================================================
   Admin layout
   ========================================================== */
.admin-shell {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-sidebar .brand { padding: 0 8px 24px; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav a {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-nav a:hover { background: var(--surface); color: var(--text); }
.admin-nav a.active { background: var(--primary); color: #fff; }
.admin-main {
  flex: 1;
  padding: 32px;
  max-width: 900px;
}
.admin-topbar-mobile { display: none; }

@media (max-width: 860px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar {
    position: static;
    height: auto;
    width: 100%;
    display: none;
  }
  .admin-sidebar.open { display: block; }
  .admin-main { padding: 20px; }
  .admin-topbar-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
  }
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}
th { color: var(--text-muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.row-actions { display: flex; gap: 8px; }
.row-actions .btn { padding: 8px 12px; font-size: 13px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.instructions {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 24px;
}
.instructions h4 { margin-top: 0; }
.instructions ol { padding-left: 20px; }
.instructions li { margin-bottom: 10px; font-size: 14.5px; color: #cdd6ec; }
.instructions code {
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--accent);
}

/* ==========================================================
   Footer
   ========================================================== */
footer {
  text-align: center;
  padding: 30px 20px 50px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================
   Back link
   ========================================================== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}
.back-link:hover { color: var(--text); }
