:root {
  --black: #010203;
  --panel: rgba(6, 7, 9, 0.82);
  --panel-solid: #08090b;
  --white: #f8fafc;
  --muted: #9ca3af;
  --line: rgba(255, 255, 255, 0.11);
  --cyan: #2ee6d6;
  --violet: #9d65ff;
  --pink: #ff4f91;
  --yellow: #ffd166;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--white);
  background:
    radial-gradient(circle at 10% 12%, rgba(157, 101, 255, 0.17), transparent 27rem),
    radial-gradient(circle at 86% 28%, rgba(46, 230, 214, 0.14), transparent 31rem),
    radial-gradient(circle at 46% 92%, rgba(255, 79, 145, 0.1), transparent 30rem),
    var(--black);
  font-family: "Noto Kufi Arabic", system-ui, sans-serif;
  overflow-x: hidden;
}

body {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    radial-gradient(circle at 10% 12%, rgba(157, 101, 255, 0.17), transparent 27rem),
    radial-gradient(circle at 86% 28%, rgba(46, 230, 214, 0.14), transparent 31rem),
    radial-gradient(circle at 46% 92%, rgba(255, 79, 145, 0.1), transparent 30rem);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 340px;
  height: 340px;
  border-radius: 46% 54% 63% 37%;
  filter: blur(70px);
  opacity: 0.17;
  pointer-events: none;
  animation: float 12s ease-in-out infinite alternate;
}

body::before {
  top: -140px;
  right: -90px;
  background: var(--violet);
}

body::after {
  bottom: -170px;
  left: -80px;
  background: var(--cyan);
  animation-delay: -5s;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  width: 160px;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  box-shadow: 0 0 18px rgba(46, 230, 214, 0.45);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--white);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.brand-mark {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  box-shadow: 0 10px 35px rgba(157, 101, 255, 0.3);
  color: white;
  font-size: 1.12rem;
}

.year-pill,
.result-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #d1d5db;
  padding: 9px 16px;
  font-size: 0.7rem;
  font-weight: 600;
  backdrop-filter: blur(16px);
}

.hero {
  min-height: calc(100vh - 86px);
  display: grid;
  place-items: center;
  position: relative;
  padding: 80px 0;
}

.hero::before {
  content: "";
  position: absolute;
  width: min(850px, 100%);
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(46, 230, 214, 0.12), transparent 67%);
  pointer-events: none;
}

.search-card {
  position: relative;
  z-index: 1;
  width: min(850px, 100%);
  padding: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.065), transparent 42%),
    rgba(2, 3, 5, 0.86);
  box-shadow:
    0 35px 90px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(26px) saturate(140%);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.search-card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(46, 230, 214, 0.3);
}

.search-card::before {
  content: "";
  position: absolute;
  inset: -1px auto auto 14%;
  width: 44%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 20px var(--cyan);
}

.search-card label {
  display: block;
  margin-bottom: 13px;
  color: #e5e7eb;
  font-size: 0.76rem;
  font-weight: 700;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 11px;
}

.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  z-index: 1;
  right: 19px;
  top: 50%;
  width: 23px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-width: 1.8;
}

input {
  width: 100%;
  height: 66px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 17px;
  outline: none;
  background: rgba(0, 0, 0, 0.78);
  box-shadow: inset 0 1px 12px rgba(0, 0, 0, 0.45);
  color: var(--white);
  padding: 0 58px 0 18px;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  border-color: rgba(46, 230, 214, 0.68);
  box-shadow:
    0 0 0 4px rgba(46, 230, 214, 0.09),
    0 0 35px rgba(46, 230, 214, 0.09);
}

input::placeholder {
  color: #74777d;
}

button {
  border: 0;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--cyan), #12b9cc);
  box-shadow: 0 15px 35px rgba(46, 230, 214, 0.2);
  color: #031312;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(46, 230, 214, 0.32);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transform: rotate(180deg);
}

#search-hint {
  margin: 13px 2px 0;
  color: #858991;
  font-size: 0.65rem;
}

.results-section {
  min-height: 70vh;
  padding: 85px 0 115px;
  border-top: 1px solid var(--line);
}

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 15px;
  margin-bottom: 30px;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.new-search-button {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
  color: #e5e7eb;
  font-size: 0.65rem;
}

.new-search-button:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

h2 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  letter-spacing: -0.04em;
}

.result-count {
  flex: none;
  color: var(--cyan);
}

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

.load-more {
  display: block;
  width: min(100%, 430px);
  min-height: 54px;
  margin: 28px auto 0;
  border: 1px solid rgba(46, 230, 214, 0.24);
  background:
    linear-gradient(135deg, rgba(46, 230, 214, 0.12), rgba(106, 72, 255, 0.09)),
    rgba(5, 7, 10, 0.78);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.32);
  color: var(--cyan);
  font-size: 0.72rem;
  backdrop-filter: blur(18px);
}

.load-more:hover {
  border-color: rgba(46, 230, 214, 0.42);
  box-shadow: 0 16px 46px rgba(46, 230, 214, 0.08);
}

.load-more:disabled {
  cursor: wait;
  opacity: 0.62;
}

.load-more[hidden] {
  display: none;
}

.result-card {
  position: relative;
  padding: 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.065), transparent 48%),
    var(--panel);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
  animation: rise 0.35s both;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.result-card:hover {
  transform: translateY(-3px);
  border-color: rgba(46, 230, 214, 0.18);
}

.branch-badge {
  display: inline-flex;
  margin-inline-start: 8px;
  padding: 5px 9px;
  border: 1px solid rgba(157, 101, 255, 0.25);
  border-radius: 999px;
  background: rgba(157, 101, 255, 0.1);
  color: #cbb3ff;
  font-size: 0.58rem;
  font-weight: 700;
  vertical-align: middle;
  white-space: nowrap;
}

.result-card::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  left: -50px;
  top: -50px;
  border-radius: 50%;
  background: var(--violet);
  filter: blur(38px);
  opacity: 0.2;
}

.result-card h3 {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  color: #fff;
  font-size: 1rem;
  line-height: 1.9;
}

.seat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  padding: 7px 11px;
  border: 1px solid rgba(157, 101, 255, 0.2);
  border-radius: 999px;
  background: rgba(157, 101, 255, 0.08);
  color: #9ca3af;
  font-size: 0.56rem;
}

.seat-chip b {
  color: #cbb7ff;
  font-size: 0.68rem;
}

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

.result-meta div {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.23);
}

.result-meta .percentage {
  border-color: rgba(46, 230, 214, 0.22);
  background: rgba(46, 230, 214, 0.07);
}

.result-meta span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.58rem;
}

.result-meta strong {
  color: #f3f4f6;
  font-size: 0.75rem;
  word-break: break-word;
}

.result-meta .percentage strong {
  color: var(--cyan);
  font-size: 1rem;
}

.subjects-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.subjects-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(46, 230, 214, 0.22);
  background: rgba(46, 230, 214, 0.08);
  box-shadow: none;
  color: var(--cyan);
  font-size: 0.7rem;
}

.subjects-button:hover {
  background: rgba(46, 230, 214, 0.14);
  box-shadow: 0 10px 28px rgba(46, 230, 214, 0.1);
}

.subjects-title {
  margin-bottom: 13px;
  color: #f9fafb;
  font-size: 0.75rem;
  font-weight: 800;
}

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

.subject-item {
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.23);
}

.subject-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subject-head strong {
  color: #e5e7eb;
  font-size: 0.65rem;
}

.subject-head span {
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 800;
}

.subject-grade {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.62rem;
}

.subject-progress {
  height: 4px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.subject-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 12px rgba(46, 230, 214, 0.35);
}

.subjects-unavailable,
.subjects-error {
  margin: 0;
  color: #7f848c;
  font-size: 0.62rem;
  line-height: 1.8;
}

.subjects-error {
  margin-top: 10px;
  color: #ff8eaf;
}

.status {
  display: none;
  margin: 14px 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  line-height: 1.9;
  backdrop-filter: blur(16px);
}

.status.visible {
  display: block;
}

.loader {
  width: 26px;
  height: 26px;
  margin: 0 auto 12px;
  border: 3px solid rgba(46, 230, 214, 0.18);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

footer {
  min-height: 84px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #767b83;
  font-size: 0.62rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes float {
  to { transform: translate(40px, 30px) rotate(20deg); }
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
  }

  .topbar {
    min-height: 72px;
  }

  .year-pill {
    padding: 7px 11px;
  }

  .hero {
    min-height: calc(100svh - 72px);
    padding: 55px 0;
  }

  .search-card {
    padding: 17px;
    border-radius: 22px;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  button {
    height: 58px;
  }

  .results-section {
    padding: 60px 0 85px;
  }

  .results-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .results-actions {
    width: 100%;
    justify-content: space-between;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .result-card {
    padding: 20px;
  }

  .subjects-grid {
    grid-template-columns: 1fr;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
