:root {
  --primary: #4f2a66;
  --primary-dark: #352044;
  --accent: #5f9048;
  --text: #213547;
  --muted: #667085;
  --surface: #ffffff;
  --line: #e5e7eb;
  --danger: #a4262c;
  --danger-bg: #fff1f2;
  --success: #267447;
  --success-bg: #edf8f1;
  --gold: #c79a3b;
  --shadow: 0 18px 45px rgba(28, 25, 38, 0.14);
}

* { box-sizing: border-box; }

html { direction: rtl; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(95, 144, 72, 0.25), transparent 31%),
    radial-gradient(circle at 88% 82%, rgba(79, 42, 102, 0.18), transparent 36%),
    linear-gradient(135deg, #fbf9fc, #eef5eb);
  background-attachment: fixed;
}

.page-shell {
  width: min(100% - 28px, 720px);
  margin: 0 auto;
  padding: 42px 0;
}

.card {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(79, 42, 102, 0.1);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.search-card {
  width: min(100%, 440px);
  margin: 6vh auto 0;
  padding: 34px;
  text-align: center;
  border-top: 5px solid var(--primary);
  animation: rise-in 0.55s ease-out both;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo {
  display: block;
  width: 116px;
  height: 116px;
  object-fit: contain;
  margin: 0 auto 18px;
  padding: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 10px 25px rgba(79, 42, 102, 0.12);
}

.logo-small {
  width: 82px;
  height: 82px;
  margin: 0;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
}

.school-name {
  margin: 2px auto 9px;
  color: var(--primary-dark);
  font-size: clamp(1.2rem, 3vw, 1.62rem);
  font-weight: 900;
  line-height: 1.7;
  text-align: center;
}

.exam-title {
  max-width: 620px;
  margin-inline: auto;
  text-align: center;
}

.exam-title span {
  display: block;
}

.search-card .exam-title {
  position: relative;
  max-width: 370px;
  margin: 18px auto 26px;
  padding-top: 18px;
  color: var(--primary);
  font-size: clamp(1.18rem, 3.6vw, 1.42rem);
  font-weight: 800;
  line-height: 1.85;
  letter-spacing: 0;
}

.search-card .exam-title::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 72px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: translateX(-50%);
}

.search-intro {
  margin: -10px 0 24px;
  color: var(--muted);
  font-size: 0.92rem;
}

h1 {
  margin: 0 0 26px;
  color: var(--primary);
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.55;
}

h2 {
  margin: 24px 0 12px;
  color: var(--primary);
  font-size: 1.1rem;
}

form { text-align: right; }

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

input[type="tel"] {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #c9cdd4;
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  font-size: 1.05rem;
  direction: ltr;
  text-align: right;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="tel"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 42, 102, 0.14);
  outline: none;
}

.field-hint {
  margin: 7px 2px 20px;
  color: var(--muted);
  font-size: 0.82rem;
}

button,
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 9px 20px rgba(53, 32, 68, 0.2);
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

button { width: 100%; padding: 14px; }
button:hover, .back-link:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(53, 32, 68, 0.27);
}

.honeypot {
  position: absolute !important;
  inset-inline-start: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.alert {
  padding: 15px;
  line-height: 1.8;
  text-align: center;
}

.search-card .alert { margin-bottom: 20px; }

.alert-error {
  border-color: #fecdd3;
  color: var(--danger);
  background: var(--danger-bg);
}

.results-page { width: min(100% - 28px, 760px); }

.page-header {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 9px;
  margin-bottom: 24px;
  padding: 28px 28px 25px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(145deg, #593470 0%, #432554 58%, #315936 145%);
  box-shadow: 0 18px 42px rgba(53, 32, 68, 0.22);
  overflow: hidden;
}

.page-header::before,
.page-header::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.page-header::before {
  width: 230px;
  height: 230px;
  top: -145px;
  inset-inline-start: -80px;
  background: rgba(255, 255, 255, 0.08);
}

.page-header::after {
  width: 170px;
  height: 170px;
  bottom: -115px;
  inset-inline-end: -45px;
  background: rgba(95, 144, 72, 0.25);
}

.page-header > * {
  position: relative;
  z-index: 1;
}

.page-header h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.28rem, 3.3vw, 1.72rem);
  line-height: 1.75;
}

.page-header .school-name {
  margin: 0;
  color: #fff;
  font-size: clamp(1.18rem, 3vw, 1.5rem);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.page-header .logo-small {
  width: 86px;
  height: 86px;
  margin: 2px 0;
  padding: 6px;
  border: 3px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.page-header .eyebrow {
  margin: 2px 0 0;
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #f4e7b6;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

.result-card {
  position: relative;
  margin-bottom: 24px;
  padding: 28px;
  overflow: hidden;
  border-top: 5px solid var(--primary);
  animation: rise-in 0.5s ease-out both;
}

.result-card.status-accepted { border-top-color: var(--success); }
.result-card.status-rejected { border-top-color: var(--danger); }

.result-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url('logo.png') center / 46% no-repeat;
  opacity: 0.035;
  pointer-events: none;
}

.result-card > * { position: relative; z-index: 1; }

.student-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 10px 20px;
  border-bottom: 2px solid rgba(95, 144, 72, 0.28);
  text-align: center;
}

.student-caption {
  display: block;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.student-name {
  color: var(--primary);
  font-size: clamp(1.75rem, 5vw, 2.3rem);
  font-weight: 900;
  line-height: 1.55;
  text-align: center;
}

.status-badge {
  display: inline-flex;
  min-width: 92px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
}

.status-badge.status-accepted { color: var(--success); background: var(--success-bg); }
.status-badge.status-rejected { color: var(--danger); background: var(--danger-bg); }

.result-list { margin: 10px 0 0; }

.result-list > div {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, auto);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}

.result-list > div:last-child { border-bottom: 0; }
.result-list dt { font-weight: 700; }
.result-list dd { margin: 0; text-align: left; font-weight: 700; }

.weighted-results {
  padding: 4px 16px;
  border-radius: 12px;
  border: 1px solid #e6eee5;
  background: linear-gradient(145deg, #fbfdfb, #f3f8f2);
}

.weighted-results .final-row {
  color: var(--primary);
  font-size: 1.08rem;
  font-weight: 800;
  margin: 4px -10px 0;
  padding: 15px 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(79, 42, 102, 0.08);
}

.weighted-results .final-row dd strong { font-size: 1.42rem; }
.weighted-results .final-row dd span { color: var(--muted); font-size: 0.92rem; }

.weighted-results .status-row {
  font-size: 1.12rem;
  font-weight: 800;
}

.weighted-results .status-row.status-accepted { color: var(--success); }
.weighted-results .status-row.status-rejected { color: var(--danger); }

.regulation-note {
  margin-top: 24px;
  padding: 24px 28px;
  border-inline-start: 5px solid var(--accent);
  font-size: 0.93rem;
  line-height: 2;
}

.regulation-note h2 { margin-top: 0; }
.regulation-note p { margin: 8px 0; }
.regulation-note ul { margin: 8px 0; padding-inline-start: 24px; }

.back-link {
  min-width: 150px;
  margin: 24px auto 0;
  padding: 12px 20px;
}

/* صفحة النتيجة: تصميم مؤسسي مستوحى من النموذج المعتمد */
.results-page {
  width: min(100% - 24px, 660px);
  padding-top: 18px;
}

.results-page .page-header {
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px 20px 26px;
  border: 0;
  border-radius: 0;
  color: var(--primary);
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.results-page .page-header::before,
.results-page .page-header::after {
  display: none;
}

.results-page .page-header .school-name {
  max-width: 460px;
  margin: 0 auto;
  padding-bottom: 13px;
  color: var(--primary);
  font-size: clamp(1.02rem, 2.8vw, 1.28rem);
  line-height: 1.75;
  text-shadow: none;
}

.results-page .page-header .school-name::after {
  content: "✦";
  display: block;
  width: 105px;
  margin: 10px auto 0;
  color: var(--gold);
  background: linear-gradient(var(--gold), var(--gold)) center / 100% 1px no-repeat;
  font-size: 0.85rem;
  line-height: 1;
  text-shadow: 0 0 0 #fff, 0 0 0 #fff;
}

.results-page .page-header .logo-small {
  order: -1;
  width: 96px;
  height: 96px;
  margin: 0 0 5px;
  padding: 4px;
  border: 0;
  box-shadow: 0 7px 20px rgba(53, 32, 68, 0.14);
}

.results-page .page-header h1 {
  max-width: 480px;
  color: var(--primary);
  font-size: clamp(1.18rem, 3.3vw, 1.48rem);
  font-weight: 800;
  line-height: 1.7;
}

.results-page .page-header .eyebrow {
  margin-top: 2px;
  padding: 6px 16px;
  border: 0;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 5px 14px rgba(79, 42, 102, 0.18);
}

.results-page .result-card {
  margin-bottom: 20px;
  padding: 24px;
  border: 1px solid rgba(79, 42, 102, 0.08);
  border-top: 0;
  border-radius: 17px;
  box-shadow: 0 14px 34px rgba(28, 25, 38, 0.12);
}

.results-page .result-card::after {
  background-size: 58%;
  opacity: 0.025;
}

.results-page .student-heading {
  gap: 5px;
  padding: 0 8px 19px;
  border-bottom: 0;
}

.results-page .student-caption {
  color: var(--primary);
  font-size: 0.8rem;
}

.results-page .student-name {
  color: #10284f;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  line-height: 1.5;
}

.results-page .status-badge {
  min-width: 110px;
  margin-top: 3px;
  padding: 6px 16px;
  border-width: 1px;
  font-size: 1rem;
}

.student-details {
  margin: 0;
  padding: 4px 15px;
  border: 1px solid #ece7de;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.student-details > div {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 2px;
  border-bottom: 1px solid #eeeae4;
}

.student-details > div:last-child { border-bottom: 0; }
.student-details dt { color: #33253b; font-size: 0.9rem; font-weight: 700; }
.student-details dd { margin: 0; color: #10284f; direction: ltr; font-weight: 800; }

.detail-icon {
  display: inline-flex;
  width: 22px;
  justify-content: center;
  margin-inline-end: 5px;
  color: var(--gold);
}

.score-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
  border: 1px solid #e5dfd4;
  border-radius: 13px;
  background: #fff;
  overflow: hidden;
}

.score-tile {
  display: flex;
  min-width: 0;
  min-height: 134px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 8px;
  border-inline-start: 1px solid #e7e2da;
  text-align: center;
}

.score-tile:first-child { border-inline-start: 0; }
.score-symbol {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.35rem;
}

.score-label { min-height: 34px; font-size: 0.76rem; font-weight: 700; line-height: 1.55; }
.score-tile strong { font-size: 1.42rem; direction: ltr; }
.score-tile small { font-size: 0.72em; }
.score-report { color: #a66e10; background: #fffdf7; }
.score-report .score-symbol { background: #fbf4df; }
.score-written { color: var(--primary); background: #fdfaff; }
.score-written .score-symbol { background: #f1e9f5; }
.score-interview { color: var(--success); background: #f9fdf9; }
.score-interview .score-symbol { background: #eaf5e8; }
.score-tile .not-nominated {
  max-width: 150px;
  font-size: 0.78rem;
  line-height: 1.55;
}

.final-score-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  padding: 17px;
  border: 1px solid #bfd5b7;
  border-radius: 13px;
  color: var(--success);
  background: linear-gradient(145deg, #f9fcf8, #eff7ec);
  text-align: center;
}

.final-score-panel.status-rejected {
  border-color: #efb7bd;
  color: var(--danger);
  background: linear-gradient(145deg, #fffafa, #fff0f1);
}

.final-score-panel > span { font-size: 1rem; font-weight: 800; }
.final-score-panel > strong { font-size: clamp(2.1rem, 7vw, 2.75rem); line-height: 1.15; direction: ltr; }
.final-score-panel small { font-size: 0.65em; }

.results-page .regulation-note {
  margin-top: 16px;
  padding: 18px 22px;
  border: 1px solid #e2c98d;
  border-inline-start: 4px solid var(--gold);
  border-radius: 12px;
  background: #fffdf8;
  box-shadow: 0 7px 20px rgba(83, 63, 24, 0.07);
  font-size: 0.8rem;
  line-height: 1.9;
}

.results-page .regulation-note h2 { color: #8a6014; }

.results-page .back-link {
  display: flex;
  width: min(100%, 230px);
  margin-top: 18px;
}

@media (max-width: 560px) {
  .page-shell { padding: 22px 0; }
  .search-card { padding: 26px 20px; }
  .search-card .exam-title {
    max-width: 310px;
    font-size: 1.16rem;
    line-height: 1.9;
  }
  .page-header { padding: 23px 15px 21px; text-align: center; border-radius: 19px; }
  .page-header .logo-small { width: 74px; height: 74px; }
  .result-card, .regulation-note { padding: 20px 16px; }
  .student-heading { align-items: center; }
  .status-badge { min-width: 80px; padding: 7px 10px; }
  .result-list > div { grid-template-columns: 1fr; gap: 5px; }
  .result-list dd { text-align: right; }
  .results-page .page-header { padding: 8px 10px 20px; }
  .results-page .result-card { padding: 19px 14px; }
  .student-details { padding-inline: 10px; }
  .student-details > div { grid-template-columns: 1fr; gap: 4px; }
  .student-details dd { text-align: right; }
  .score-tile {
    min-height: 120px;
    gap: 6px;
    padding: 10px 5px;
  }
  .score-symbol { width: 38px; height: 38px; }
  .score-label { font-size: 0.68rem; }
  .score-tile strong { font-size: 1.17rem; }
  .score-tile .not-nominated { font-size: 0.65rem; }
}

@media (max-width: 370px) {
  .score-tiles { grid-template-columns: 1fr; }
  .score-tile {
    min-height: 0;
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 8px;
    padding: 10px;
    border-inline-start: 0;
    border-bottom: 1px solid #e7e2da;
    text-align: right;
  }
  .score-tile:last-child { border-bottom: 0; }
  .score-label { min-height: 0; }
}
