/* =========================================================
   MUWAJEH — EXAM / QUESTION PAGE
   Based on the supplied Figma measurements
   ========================================================= */

:root {
  --color-primary: #0a1d38;
  --color-secondary: #c29447;
  --color-tertiary: #1e304c;
  --color-neutral: #f8fafc;

  --color-white: #ffffff;
  --color-text: #44474d;

  --font-headline: "Tajawal", sans-serif;
  --font-body: "Cairo", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;

  direction: rtl;
  text-align: right;

  background: var(--color-neutral);
  color: var(--color-text);

  font-family: var(--font-body);
}

/* =========================================================
   HEADER — SAME HEADER USED THROUGHOUT THE WEBSITE
   ========================================================= */

.top-navigation {
  box-sizing: border-box;

  position: absolute;

  top: 24px;
  left: 50%;

  transform: translateX(-50%);

  width: calc(100% - 48px);
  max-width: 1280px;

  height: 64px;

  padding: 0 24px;

  display: flex;
  flex-direction: row;

  align-items: center;
  justify-content: space-between;

  gap: 24px;

  background: rgba(247, 249, 251, 0.8);

  border: 1px solid rgba(255, 255, 255, 0.2);

  box-shadow: 0px 10px 30px rgba(10, 29, 56, 0.04);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  border-radius: 9999px;

  z-index: 5;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;

  text-decoration: none;
}

.logo img {
  display: block;

  width: auto;
  height: 48px;

  object-fit: contain;
}

.navigation-links {
  display: flex;

  align-items: center;
  justify-content: center;

  gap: 38px;

  height: 100%;

  margin-right: auto;
  margin-left: auto;
}

.nav-link {
  position: relative;

  display: flex;
  align-items: center;

  height: 100%;

  color: #4b4f55;

  font-family: var(--font-body);

  font-size: 18px;
  font-weight: 500;

  white-space: nowrap;

  text-decoration: none;

  transition: color 180ms ease;
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link.active {
  color: var(--color-secondary);
  font-weight: 700;
}

.nav-link.active::after {
  content: "";

  position: absolute;

  bottom: 7px;

  right: 50%;

  transform: translateX(50%);

  width: 5px;
  height: 5px;

  background: var(--color-secondary);

  border-radius: 50%;
}

.login-button {
  display: flex;

  align-items: center;
  justify-content: center;

  flex-shrink: 0;

  height: 48px;

  padding: 0 30px;

  background: var(--color-secondary);

  color: #ffffff;

  border-radius: 9999px;

  font-family: var(--font-body);

  font-size: 18px;
  font-weight: 500;

  text-decoration: none;

  white-space: nowrap;

  transition:
    background-color 180ms ease,
    transform 180ms ease;
}

.login-button:hover {
  background: #b1843d;
  transform: translateY(-1px);
}

/* =========================================================
   MAIN CONTENT CANVAS
   ========================================================= */

.exam-main {
  width: min(1280px, 100%);

  min-height: 100vh;

  margin: 0 auto;

  padding: 134.75px 24px 62.75px;

  display: flex;

  flex-direction: column;

  justify-content: center;

  align-items: center;

  background: var(--color-neutral);
}

/* =========================================================
   QUESTION CARD
   ========================================================= */

.question-card {
  position: relative;

  width: 768px;
  max-width: 100%;

  min-height: 558.5px;

  padding: 48px;

  display: flex;
  flex-direction: column;

  background: rgba(255, 255, 255, 0.7);

  border: 1px solid rgba(10, 29, 56, 0.1);

  box-shadow: 0px 10px 30px rgba(10, 29, 56, 0.04);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  border-radius: 24px;

  overflow: hidden;
}

.question-glow {
  position: absolute;

  width: 128px;
  height: 128px;

  right: -39px;
  top: -39px;

  background: rgba(10, 29, 56, 0.05);

  filter: blur(20px);

  border-radius: 9999px;

  pointer-events: none;
}

.question-container {
  position: relative;

  width: 100%;
  min-height: 0;

  z-index: 1;

  display: flex;
  flex-direction: column;

  align-items: center;
}
/* =========================================================
   CATEGORY PILL
   ========================================================= */

.category-pill {
  min-width: 94px;
  height: 32px;

  padding: 6px 16px;

  display: flex;

  align-items: center;
  justify-content: center;

  gap: 8px;

  background: rgba(30, 48, 76, 0.1);

  color: var(--color-tertiary);

  border-radius: 9999px;

  font-size: 14px;
  font-weight: 600;

  line-height: 20px;
}

.category-pill i {
  font-size: 11px;
}

/* =========================================================
   QUESTION
   ========================================================= */

.question-heading {
  width: 100%;

  min-height: 72px;

  margin-top: 31px;

  padding: 0 37px;

  display: flex;

  align-items: center;
  justify-content: center;

  text-align: center;
}

.question-heading h1 {
  max-width: 596px;

  margin: 0;

  color: #00030c;

  font-family: var(--font-body);

  font-size: 22px;
  font-weight: 700;

  line-height: 36px;

  text-align: center;
}

.question-description {
  width: 100%;

  margin: 31px 0 0;

  color: #44474d;

  font-size: 14px;

  line-height: 20px;

  text-align: center;
}

/* =========================================================
   LIKERT SCALE
   ========================================================= */

.likert-scale {
  width: 100%;

  margin-top: 37px;

  display: flex;

  flex-direction: row;

  justify-content: space-between;

  align-items: center;

  gap: 8px;

  direction: rtl;
}

.answer-option {
  width: 20%;
  min-width: 0;

  height: 80px;

  padding: 16px 8px;

  display: flex;

  flex-direction: column;

  align-items: center;
  justify-content: flex-start;

  gap: 8px;

  background: transparent;

  border: 1px solid rgba(30, 48, 76, 0.2);

  border-radius: 16px;

  color: #44474d;

  font-family: var(--font-body);

  font-size: 14px;

  line-height: 20px;

  cursor: pointer;

  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.answer-option:hover {
  border-color: rgba(194, 148, 71, 0.65);

  background: rgba(194, 148, 71, 0.03);

  transform: translateY(-2px);
}

.answer-option.selected {
  height: 84px;

  background: rgba(194, 148, 71, 0.05);

  border: 2px solid var(--color-secondary);

  box-shadow: 0px 0px 15px rgba(194, 148, 71, 0.2);

  color: #7d570d;
}

.radio-circle {
  width: 16px;
  height: 16px;

  flex: 0 0 16px;

  border: 1px solid rgba(30, 48, 76, 0.3);

  border-radius: 9999px;

  background: transparent;
}

.answer-option.selected .radio-circle {
  background: var(--color-secondary);

  border-color: var(--color-secondary);

  box-shadow: 0 0 0 4px rgba(194, 148, 71, 0.3);
}

/* =========================================================
   QUESTION NAVIGATION
   ========================================================= */

.question-navigation {
  width: 100%;

  margin-top: 40px;
  padding-top: 24px;

  display: flex;

  align-items: flex-start;
  justify-content: space-between;

  border-top: 1px solid rgba(197, 198, 206, 0.2);

  direction: rtl;
}

.previous-button,
.next-button {
  height: 48px;

  border: 0;

  font-family: var(--font-body);

  font-size: 16px;

  cursor: pointer;

  display: flex;

  align-items: center;

  gap: 8px;
}

.previous-button {
  padding: 12px 0;

  background: transparent;

  color: #44474d;
}

.previous-button:hover {
  color: var(--color-primary);
}

.previous-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.next-button {
  padding: 12px 32px;

  background: var(--color-secondary);

  color: #ffffff;

  border-radius: 9999px;

  box-shadow: 0px 4px 14px rgba(194, 148, 71, 0.4);

  transition:
    background-color 180ms ease,
    transform 180ms ease;
}

.next-button:hover {
  background: #b1843d;

  transform: translateY(-1px);
}

/* =========================================================
   PROGRESS SECTION
   ========================================================= */

.progress-section {
  width: 100%;
  max-width: 100%;

  margin-top: 16px;

  padding: 0;
}

.progress-card {
  box-sizing: border-box;

  width: 100%;
  min-height: 154px;

  padding: 24px;

  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 16px;

  background: rgba(255, 255, 255, 0.7);

  border: 1px solid rgba(10, 29, 56, 0.1);

  box-shadow: 0px 10px 30px rgba(10, 29, 56, 0.04);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  border-radius: 16px;
}

.progress-top {
  width: 100%;

  height: 28px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  direction: rtl;
}

.progress-percentage {
  color: #44474d;

  font-size: 14px;
  font-weight: 600;

  line-height: 20px;
}

.question-number {
  padding: 6px 16px;

  background: #1e304c;

  color: #ffffff;

  border-radius: 9999px;

  font-size: 12px;
  font-weight: 500;

  line-height: 16px;
}

.progress-bar {
  position: relative;

  width: 100%;
  height: 8px;

  overflow: hidden;

  background: #e6e8ea;

  border-radius: 9999px;
}

.progress-fill {
  position: absolute;

  top: 0;
  right: 0;

  width: 0%;
  height: 100%;

  background: var(--color-secondary);

  box-shadow: 0px 0px 10px rgba(194, 148, 71, 0.5);

  border-radius: 9999px;

  transition: width 250ms ease;
}

.progress-message {
  width: 100%;

  padding-top: 8px;

  color: #44474d;

  font-size: 14px;

  line-height: 20px;

  text-align: center;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 800px) {

  .exam-main {
    padding: 112px 16px 40px;
  }

  .question-card {
    padding: 32px 24px;

    min-height: auto;
  }

  .question-heading {
    padding: 0 10px;
  }

  .question-heading h1 {
    font-size: 20px;
    line-height: 32px;
  }

  .likert-scale {
    flex-wrap: wrap;
    justify-content: center;
  }

  .answer-option {
    width: calc(33.333% - 8px);
  }

  .answer-option.selected {
    height: 80px;
  }
}

@media (max-width: 560px) {

  .exam-main {
    padding-top: 96px;
  }

  .question-card {
    padding: 28px 16px;

    border-radius: 20px;
  }

  .question-heading {
    margin-top: 25px;
  }

  .question-heading h1 {
    font-size: 18px;
    line-height: 29px;
  }

  .question-description {
    margin-top: 22px;
    font-size: 12px;
  }

  .likert-scale {
    margin-top: 28px;
  }

  .answer-option {
    width: calc(50% - 5px);

    font-size: 12px;
  }

  .question-navigation {
    margin-top: 28px;
  }

  .next-button {
    padding: 10px 22px;
  }

  .previous-button,
  .next-button {
    font-size: 14px;
  }

  .progress-card {
    padding: 18px;
  }
}

.auth-header-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #0a1d38;
  color: #c29447;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: 0.2s ease;
}

.profile-button:hover {
  background: #c29447;
  color: #0a1d38;
  transform: translateY(-2px);
}

.login-button[hidden],
.profile-button[hidden] {
  display: none !important;
}

/* =========================
   ACCOUNT POPUP
   ========================= */

.account-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: flex-start;
  justify-content: center;

  padding-top: 95px;

}

.account-overlay[hidden] {
  display: none !important;
}

.account-popup {
  position: relative;

  width: 360px;
  max-width: calc(100% - 30px);

  padding: 30px;

  background: #ffffff;
  border-radius: 20px;

  box-shadow: 0 15px 45px rgba(10, 29, 56, 0.2);

  text-align: center;

  animation: accountPopupIn 0.2s ease;
}

@keyframes accountPopupIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.account-close {
  position: absolute;
  top: 12px;
  left: 12px;

  width: 32px;
  height: 32px;

  border: none;
  border-radius: 50%;

  background: #f1f3f5;
  color: #555;

  font-size: 22px;
  line-height: 1;

  cursor: pointer;
}

.account-close:hover {
  background: #e5e7eb;
}

.account-avatar {
  width: 64px;
  height: 64px;

  margin: 0 auto 12px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: #0a1d38;
  color: #c29447;

  font-size: 24px;
}

.account-popup h2 {
  margin: 0 0 24px;

  color: #0a1d38;

  font-family: "Tajawal", sans-serif;
  font-size: 25px;
}

.account-info {
  margin-bottom: 22px;

  border: 1px solid #e1e5ea;
  border-radius: 12px;

  overflow: hidden;
}

.account-info-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  gap: 3px;

  padding: 13px 15px;

  text-align: right;
}

.account-info-row + .account-info-row {
  border-top: 1px solid #e1e5ea;
}

.account-info-row span {
  color: #6b7280;
  font-size: 11px;
}

.account-info-row strong {
  width: 100%;

  color: #0a1d38;

  font-size: 14px;

  overflow-wrap: anywhere;
}

.logout-button {
  width: 100%;
  height: 46px;

  border: none;
  border-radius: 999px;

  background: #0a1d38;
  color: #ffffff;

  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 700;

  cursor: pointer;

  transition: 0.2s ease;
}

.logout-button:hover {
  background: #c29447;
  color: #0a1d38;
}

.muwajeh-toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translate(-50%, 20px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    background: #ffffff;
    color: #222;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    z-index: 99999;
    direction: rtl;
}

.muwajeh-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.muwajeh-toast i {
    font-size: 18px;
}

.muwajeh-toast.success i {
    color: #22a06b;
}

.muwajeh-toast.error i {
    color: #d64545;
}

@media (max-width: 600px) {
    .muwajeh-toast {
        width: calc(100% - 32px);
        justify-content: center;
        bottom: 20px;
        text-align: center;
    }
}

/* =========================================================
   FINAL MOBILE HEADER — ALIGNED
   Header only. Uses absolute centering so the hamburger,
   logo and login/profile are ALWAYS on the exact same row.
   ========================================================= */

.mobile-menu-button {
  display: none;
}

@media (max-width: 800px) {

  .top-navigation {
    position: absolute !important;

    top: 14px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;

    width: calc(100% - 28px) !important;
    max-width: none !important;
    height: 58px !important;

    padding: 0 !important;
    margin: 0 !important;

    display: block !important;

    box-sizing: border-box !important;

    z-index: 1000 !important;
  }


  /* =====================================================
     HAMBURGER — RIGHT
     ===================================================== */

  .top-navigation .mobile-menu-button {
    position: absolute !important;

    top: 50% !important;
    right: 12px !important;

    transform: translateY(-50%) !important;

    width: 40px !important;
    height: 40px !important;

    margin: 0 !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;

    color: #0a1d38 !important;

    font-size: 21px !important;
    line-height: 1 !important;

    cursor: pointer !important;

    z-index: 1003 !important;
  }


  /* =====================================================
     LOGO — EXACT CENTER OF HEADER
     ===================================================== */

  .top-navigation .logo {
    position: absolute !important;

    top: 50% !important;
    left: 50% !important;

    transform: translate(-50%, -50%) !important;

    width: auto !important;
    height: auto !important;

    margin: 0 !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    z-index: 1002 !important;
  }

  .top-navigation .logo img {
    display: block !important;

    width: auto !important;
    height: 42px !important;
    max-width: 120px !important;

    margin: 0 !important;
    padding: 0 !important;

    object-fit: contain !important;
  }


  /* =====================================================
     LOGIN / PROFILE — LEFT
     ===================================================== */

  .top-navigation .auth-header-area {
    position: absolute !important;

    top: 50% !important;
    left: 12px !important;

    transform: translateY(-50%) !important;

    width: auto !important;
    height: auto !important;

    margin: 0 !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;

    gap: 7px !important;

    z-index: 1003 !important;
  }


  /* Login */

  .top-navigation .login-button {
    width: auto !important;
    height: 38px !important;

    margin: 0 !important;
    padding: 0 14px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    font-size: 13px !important;
    line-height: 1 !important;

    white-space: nowrap !important;
  }


  /* Profile */

  .top-navigation .profile-button {
    width: 38px !important;
    height: 38px !important;

    margin: 0 !important;
    padding: 0 !important;

    flex: 0 0 38px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }


  /* =====================================================
     HIDE DESKTOP NAVIGATION
     ===================================================== */

  .top-navigation .navigation-links {
    display: none !important;
  }


  /* =====================================================
     OPEN MENU — DIRECTLY UNDER HEADER
     ===================================================== */

  .top-navigation.mobile-menu-open .navigation-links {
    position: absolute !important;

    top: 100% !important;
    right: 0 !important;
    left: 0 !important;

    width: 100% !important;
    height: auto !important;

    margin: 0 !important;
    padding: 7px !important;

    box-sizing: border-box !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;

    gap: 2px !important;

    background: #ffffff !important;

    border: 1px solid rgba(10, 29, 56, 0.08) !important;
    border-top: 0 !important;

    border-radius: 0 0 16px 16px !important;

    box-shadow: 0 14px 32px rgba(10, 29, 56, 0.14) !important;

    z-index: 1001 !important;
  }


  /* =====================================================
     MOBILE NAV LINKS
     ===================================================== */

  .top-navigation.mobile-menu-open
  .navigation-links
  .nav-link {
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;

    margin: 0 !important;
    padding: 0 10px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    box-sizing: border-box !important;

    border-radius: 9px !important;

    font-size: 12px !important;
    line-height: 1 !important;

    white-space: nowrap !important;

    color: #4b4f55 !important;
  }

  .top-navigation.mobile-menu-open
  .navigation-links
  .nav-link:hover {
    background: rgba(194, 148, 71, 0.10) !important;
    color: #0a1d38 !important;
  }

  .top-navigation.mobile-menu-open
  .navigation-links
  .nav-link.active {
    background: rgba(194, 148, 71, 0.12) !important;
    color: #c29447 !important;
    font-weight: 700 !important;
  }

  .top-navigation.mobile-menu-open
  .navigation-links
  .nav-link.active::after {
    display: none !important;
  }


  /* =====================================================
     PROFILE POPUP
     ===================================================== */

  .account-overlay {
    padding-top: 82px !important;
  }

  .account-popup {
    width: 340px !important;
    max-width: calc(100% - 24px) !important;
  }
}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 420px) {

  .top-navigation {
    top: 11px !important;
    width: calc(100% - 20px) !important;
    height: 54px !important;
  }

  .top-navigation .mobile-menu-button {
    right: 9px !important;

    width: 36px !important;
    height: 36px !important;

    font-size: 19px !important;
  }

  .top-navigation .logo img {
    height: 38px !important;
    max-width: 105px !important;
  }

  .top-navigation .auth-header-area {
    left: 9px !important;
    gap: 5px !important;
  }

  .top-navigation .login-button {
    height: 36px !important;
    padding: 0 11px !important;
    font-size: 11px !important;
  }

  .top-navigation .profile-button {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }

  .top-navigation.mobile-menu-open
  .navigation-links
  .nav-link {
    height: 38px !important;
    min-height: 38px !important;
    font-size: 11px !important;
  }
}

/* =========================================================
   MOBILE AUTH VISIBILITY — DO NOT OVERRIDE HIDDEN
   ========================================================= */

@media (max-width: 800px) {

    .top-navigation .login-button[hidden],
    .top-navigation .profile-button[hidden] {
        display: none !important;
    }

    .top-navigation .login-button:not([hidden]) {
        display: flex !important;
    }

    .top-navigation .profile-button:not([hidden]) {
        display: flex !important;
    }
}