:root {
  --primary: #b32025;
  --primary-dark: #8f171c;
  --accent: #111111;
  --bg: #f7f7f8;
  --card: #ffffff;
  --muted: #6b7280;
  --line: #e6e7eb;
  --success: #157347;
  --danger: #b42318;
  --info: #1b3fa8;
  --shadow: 0 14px 40px rgba(17, 17, 17, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", "Tajawal", Arial, sans-serif;
  background: var(--bg);
  color: var(--accent);
}

body.rtl {
  direction: rtl;
  font-family: "Tajawal", "Inter", Arial, sans-serif;
}

a {
  color: inherit;
}

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

.hidden {
  display: none !important;
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: #ffffff !important;
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
}

.topbar.compact {
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}

.logo {
  width: 125px;
  height: 125px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-name {
  font-size: 2.05rem;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
}

.brand-subtitle {
  font-size: 1rem;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f1f4;
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.lang-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
}

.social-icons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.social-link {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(17, 17, 17, 0.08);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.social-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.12);
}

.social-icon-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.back-link {
  font-weight: 700;
  text-decoration: none;
  color: var(--muted);
}

.contact-menu-wrap {
  position: relative;
}

.contact-trigger {
  border: 1px solid var(--line);
  cursor: pointer;
}

.contact-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 260px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 100;
}

body.rtl .contact-dropdown {
  right: auto;
  left: 0;
}

.contact-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
  padding: 14px 16px;
  border-radius: 14px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.contact-dropdown-item:hover {
  background: rgba(179, 32, 37, 0.06);
  transform: translateY(-1px);
}

.contact-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
}

.contact-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent);
  direction: ltr;
  text-align: left;
}

.contact-number {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  display: inline-block;
}

body.rtl .contact-info,
body.rtl .contact-name,
body.rtl .contact-number {
  align-items: flex-start;
  text-align: left;
}

.hero {
  min-height: calc(100vh - 120px);
  background:
    radial-gradient(circle at 20% 20%, rgba(179, 32, 37, 0.18), transparent 26%),
    radial-gradient(circle at 80% 10%, rgba(179, 32, 37, 0.10), transparent 24%),
    linear-gradient(135deg, rgba(17,17,17,0.94), rgba(17,17,17,0.78)),
    url("images/logo.png") no-repeat right 8% center / 30%;
  color: #fff;
}

body.rtl .hero {
  background:
    radial-gradient(circle at 80% 20%, rgba(179, 32, 37, 0.18), transparent 26%),
    radial-gradient(circle at 20% 10%, rgba(179, 32, 37, 0.10), transparent 24%),
    linear-gradient(135deg, rgba(17,17,17,0.94), rgba(17,17,17,0.78)),
    url("images/logo.png") no-repeat left 8% center / 30%;
}

.overlay {
  min-height: inherit;
  display: flex;
  align-items: center;
  padding: 60px 28px;
}

.hero-content {
  width: min(760px, 100%);
}

.eyebrow,
.section-kicker {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.hero .eyebrow {
  background: rgba(255,255,255,0.08);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
}

.hero h1 {
  margin: 18px 0 16px;
  font-size: clamp(2.7rem, 6vw, 5rem);
  line-height: 0.98;
}

.hero p {
  max-width: 680px;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.88);
}

.hero-buttons,
.result-actions,
.test-actions,
.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.hero-btn {
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.hero-btn:hover {
  transform: translateY(-1px);
}

.hero-btn.primary {
  background: var(--primary);
  color: #fff;
}

.hero-btn.primary:hover {
  background: var(--primary-dark);
}

.hero-btn.ghost {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
}

.small-btn {
  padding: 10px 14px;
  font-size: 0.9rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 34px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  color: var(--accent);
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  color: var(--primary);
}

.stat-card span {
  color: var(--muted);
  font-weight: 600;
}

.section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 78px 0;
}

.section-heading h2 {
  margin: 10px 0 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}

.section-copy {
  max-width: 800px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-top: 18px;
}

.center {
  text-align: center;
}

.centered {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.section-underline {
  width: 150px;
  height: 4px;
  border-radius: 999px;
  background: rgba(179, 32, 37, 0.55);
  margin: 18px auto 0;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.doc-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.doc-number {
  display: inline-flex;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: rgba(179, 32, 37, 0.08);
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 12px;
}

.doc-card p {
  margin: 0;
  line-height: 1.75;
  color: var(--accent);
}

.circuit-card {
  background: #fff;
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 26px;
}

.circuit-image {
  width: 100%;
  height: auto;
}

.services-v2-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 42px;
}

.service-v2-card {
  text-align: center;
}

.service-v2-image-wrap {
  border-radius: 34px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.service-v2-image {
  width: 100%;
  aspect-ratio: 1 / 0.8;
  object-fit: cover;
}

.service-v2-body {
  padding: 18px 12px 0;
}

.service-v2-line {
  width: 100px;
  height: 4px;
  border-radius: 999px;
  background: rgba(179, 32, 37, 0.5);
  margin: 12px auto 24px;
}

.service-v2-body h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.service-v2-body p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.service-v2-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}

.license-form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 34px;
  box-shadow: var(--shadow);
}

.license-form-header {
  margin-bottom: 24px;
}

.license-form-header h2 {
  margin: 12px 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.license-form-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.license-form {
  display: grid;
  gap: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field label {
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  background: #fff;
  color: var(--accent);
}

.form-field textarea {
  resize: vertical;
  min-height: 130px;
}

.materials-group + .materials-group {
  margin-top: 42px;
}

.materials-group-title {
  margin: 0 0 18px;
  font-size: 1.35rem;
}

.pdf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.pdf-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--line);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.pdf-icon {
  width: 58px;
  height: 58px;
  min-width: 58px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(179, 32, 37, 0.08);
  color: var(--primary);
  font-weight: 800;
  border: 1px solid rgba(179, 32, 37, 0.15);
}

.pdf-content h3 {
  margin: 0 0 8px;
  color: var(--primary);
}

.pdf-content p {
  margin: 0;
  color: var(--muted);
}

.test-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(27, 63, 168, 0.10), transparent 40%),
    linear-gradient(180deg, #0e1020, #181818);
}

.test-card {
  width: min(760px, 100%);
  background: rgba(27, 27, 27, 0.96);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 28px;
  padding: 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.test-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.test-head h1 {
  margin: 0;
  font-size: 2rem;
}

.test-subtitle {
  margin: 8px 0 0;
  color: rgba(255,255,255,0.76);
}

.separator-dot {
  margin: 0 6px;
}

.timer-box {
  background: rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 14px 16px;
  text-align: center;
}

.timer-box span {
  display: block;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.75);
}

.timer-box strong {
  display: block;
  margin-top: 6px;
  font-size: 1.5rem;
}

.progress-wrap {
  margin-top: 24px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255,255,255,0.82);
  font-weight: 700;
}

.progress-bar {
  margin-top: 12px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: #1b3fa8;
  transition: width 0.2s ease;
}

.question-panel {
  margin-top: 24px;
}

.question-panel h2 {
  margin: 0 0 18px;
  font-size: clamp(1.3rem, 3vw, 2rem);
  line-height: 1.6;
  background: rgba(27, 63, 168, 0.12);
  border: 1px solid rgba(96, 117, 255, 0.35);
  border-radius: 20px;
  padding: 18px;
}

.question-image-wrap {
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
}

.question-image {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #fff;
  border-radius: 18px;
  padding: 10px;
}

.options-list {
  display: grid;
  gap: 14px;
}

.option-btn {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  color: #fff;
  border-radius: 20px;
  padding: 18px;
  font-size: 1.05rem;
  line-height: 1.6;
  cursor: pointer;
  transition: 0.2s ease;
}

.option-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.25);
}

.option-btn.selected {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.28);
}

.option-btn.correct {
  background: rgba(21, 115, 71, 0.35);
  border-color: #17c964;
}

.option-btn.wrong {
  background: rgba(180, 35, 24, 0.30);
  border-color: #ff3b30;
}

.answer-feedback {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  font-weight: 800;
}

.answer-feedback.correct {
  background: rgba(21, 115, 71, 0.18);
  border: 1px solid rgba(23, 201, 100, 0.55);
  color: #81f0b3;
}

.answer-feedback.wrong {
  background: rgba(180, 35, 24, 0.18);
  border: 1px solid rgba(255, 59, 48, 0.55);
  color: #ffb0a8;
}

.test-actions {
  justify-content: space-between;
}

.test-btn {
  min-width: 180px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,0.6);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 80;
}

.modal-card {
  width: min(560px, 100%);
  padding: 32px;
  text-align: center;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.language-popup-grid,
.test-type-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.language-popup-btn,
.test-type-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

body.rtl .language-popup-btn,
body.rtl .test-type-btn {
  text-align: right;
}

.language-popup-btn:hover,
.test-type-btn:hover {
  border-color: rgba(179, 32, 37, 0.38);
  transform: translateY(-1px);
}

.test-type-btn.active,
.language-popup-btn.active {
  border-color: var(--primary);
  background: rgba(179, 32, 37, 0.06);
  color: var(--primary);
}

.result-badge {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 800;
  margin-bottom: 16px;
}

.result-badge.pass {
  background: rgba(21, 115, 71, 0.12);
  color: var(--success);
}

.result-badge.fail {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.result-score {
  font-size: 3rem;
  margin: 10px 0;
  font-weight: 800;
  color: var(--primary);
}

.arabic-only-note {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.site-footer {
  padding: 24px 20px 40px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .top-actions {
    justify-content: center;
  }

  .hero-stats,
  .docs-grid,
  .form-grid,
  .services-v2-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    background:
      linear-gradient(135deg, rgba(17,17,17,0.94), rgba(17,17,17,0.78)),
      url("images/logo.png") no-repeat center 85% / 170px;
  }

  body.rtl .hero {
    background:
      linear-gradient(135deg, rgba(17,17,17,0.94), rgba(17,17,17,0.78)),
      url("images/logo.png") no-repeat center 85% / 170px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 12px 16px;
  }

  .logo {
    width: 98px;
    height: 98px;
  }

  .brand {
    width: 100%;
    justify-content: center;
  }

  .brand-name {
    font-size: 1.5rem;
  }

  .brand-subtitle {
    font-size: 0.92rem;
  }

  .top-actions {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }

  .contact-dropdown {
    right: 50%;
    transform: translateX(50%);
    min-width: 220px;
  }

  body.rtl .contact-dropdown {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .section {
    width: min(100% - 24px, 1180px);
    padding: 64px 0;
  }

  .license-form-card,
  .modal-card,
  .test-card {
    padding: 18px;
  }

  .test-head,
  .test-actions,
  .pdf-actions,
  .hero-buttons,
  .result-actions {
    flex-direction: column;
  }

  .test-btn,
  .hero-btn {
    width: 100%;
  }

  .question-panel h2 {
    font-size: 1.25rem;
  }
}

@media (prefers-color-scheme: dark) {
  .topbar,
  .topbar.compact {
    background: #ffffff !important;
    color: #111111 !important;
  }

  .brand-name {
    color: #111111 !important;
  }

  .brand-subtitle {
    color: #6b7280 !important;
  }

  .social-link,
  .contact-dropdown,
  .language-switch {
    background: #ffffff;
  }
}
body[data-page="home"] .logo {
  width: 135px;
  height: 135px;
}