﻿:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --brand: #6eb3cf;
  --brand-dark: #3c8bbf;
  --accent: #3c8bbf;
  --text: #0f1f2f;
  --text-muted: #6d7689;
  --border: #e2e8f0;
  --soft-blue: #eaf3ff;
  --soft-green: #e5fbf2;
  --radius-xl: 2rem;
  --radius-lg: 1.75rem;
  --radius-md: 1rem;
  --shadow: 0 25px 60px rgba(15, 35, 75, 0.1);
  --shadow-soft: 0 15px 40px rgba(15, 35, 75, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Tajawal", "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.6;
}

img,
svg {
  display: block;
}

.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: var(--brand);
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.12);
}

.brand-icon img {
  width: 100%;
  height: 100%;
  border-radius: 18px;
}

.brand-text strong {
  font-size: 1.1rem;
  display: block;
}

.brand-text span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lang-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.lang-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px #3c8bbf7d;
}

.icon-globe,
.icon-search {
  width: 18px;
  height: 18px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.icon-globe::before,
.icon-search::before,
.icon-search::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
}

.icon-globe::before {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.icon-globe::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-bottom-color: currentColor;
}

.hero {
  text-align: center;
  padding: 2rem 0 2.5rem;
}

.hero-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 1rem;
  border-radius: 24px;
  background: var(--brand);
  display: grid;
  place-items: center;
  box-shadow: 0 25px 50px #3c8bbf7d;
}

.hero-icon .icon-search {
  color: #fff;
}

.icon-search::before {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid currentColor;
}

.icon-search::after {
  width: 14px;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
  transform: translate(-8px, 7px) rotate(45deg);
}

.hero h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin-bottom: 0.6rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 1rem;
}

.filter-panel {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
}

.field .label {
  font-size: 0.95rem;
  color: var(--text-muted);
  display: block;
}

.grade-field .grade-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  background: #f9fbff;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.grade-field .grade-input:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px #3c8bbf7d;
}

.grade-field .grade-input input {
  border: none;
  background: transparent;
  width: 100%;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.grade-field .grade-input input::-webkit-outer-spin-button,
.grade-field .grade-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.grade-field .grade-input input[type="number"] {
  -moz-appearance: textfield;
}

.grade-field .grade-input span {
  color: var(--text-muted);
  font-weight: 600;
}

.number-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  background: #f9fbff;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.number-input:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px #3c8bbf7d;
}

.number-input input {
  border: none;
  background: transparent;
  width: 100%;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.number-input input::-webkit-outer-spin-button,
.number-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.number-input input[type="number"] {
  -moz-appearance: textfield;
}

.helper-text {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e4e9f2;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  border: 4px solid #fff;
  box-shadow: 0 12px 25px #3c8bbf7d;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  border: 4px solid #fff;
  box-shadow: 0 12px 25px #3c8bbf7d;
  cursor: pointer;
}

.range-scale {
  margin-top: 0.4rem;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.select-field select {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  font-size: 1rem;
  background: #f9fbff;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.select-field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px #3c8bbf7d;
  outline: none;
}

.study-toggle {
  background: #f2f5fb;
  border-radius: var(--radius-md);
  padding: 0.35rem;
  display: flex;
  gap: 0.35rem;
}

.toggle-option {
  flex: 1;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.toggle-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-option span {
  display: block;
  padding: 0.7rem 0.3rem;
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  transition: all 0.2s ease;
}

.toggle-option input:checked + span {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 10px 25px rgba(15, 35, 75, 0.12);
}

.actions {
  gap: 0.8rem;
}

.actions .btn {
  width: 100%;
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 20px 35px #3c8bbf7d;
}

.btn.primary:hover {
  transform: translateY(-2px);
}

.btn.ghost {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
}

.filter-meta {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.sort-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.sort-controls .field {
  display: flex;
  flex-direction: column;
}

.sort-controls .label {
  font-size: 0.95rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.sort-controls select {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  font-size: 1rem;
  background: #f9fbff;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.sort-controls select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px #3c8bbf7d;
  outline: none;
}

.meta-card {
  flex: 1;
  min-width: 180px;
  padding: 0.85rem 1rem;
  background: #f5f8ff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.meta-card.success {
  background: var(--soft-green);
  border-color: rgba(0, 179, 119, 0.3);
}

.meta-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.meta-card strong {
  font-size: 1.75rem;
}

.departments {
  padding-bottom: 3rem;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

.section-head h2 {
  font-size: 1.9rem;
}

.underline {
  width: 110px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.info-card {
  display: flex;
  gap: 1rem;
  padding: 1.4rem;
  border-radius: var(--radius-lg);
  background: var(--soft-blue);
  border: 1px solid rgba(15, 98, 253, 0.15);
  margin-bottom: 2rem;
}

.info-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

.info-card h3 {
  margin-bottom: 0.5rem;
}

.info-card ul {
  color: var(--text-muted);
  list-style: none;
}

.info-card li {
  margin-bottom: 0.3rem;
  position: relative;
  padding-right: 1.2rem;
}

.info-card li::before {
  content: "•";
  color: var(--accent);
  position: absolute;
  right: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-header {
  background: var(--brand);
  color: #fff;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.card-header p {
  margin-bottom: 0.2rem;
  opacity: 0.8;
  font-size: 0.9rem;
}

.card-header h3 {
  font-size: 1.25rem;
}

.card-header span.duration {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  align-self: start;
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.requirements {
  display: grid;
  gap: 0.9rem;
}

.req-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
}

.req-summary strong {
  color: var(--text);
}

.requirement {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
}

.requirement .req-top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.req-bar {
  margin-top: 0.6rem;
  height: 8px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

.req-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.requirement.is-eligible .req-bar span {
  background: var(--brand);
}

.requirement:not(.is-eligible) .req-bar span {
  background: #ff6b6b;
}

.req-status {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.requirement.is-eligible .req-status {
  color: var(--brand-dark);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #f0fff7;
  color: var(--brand-dark);
  font-size: 0.85rem;
}

.card-footer {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-footer button {
  flex: 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.card-footer button.primary-action {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px dashed var(--border);
}

.page-footer {
  text-align: center;
  color: var(--text-muted);
  padding-top: 2rem;
}

@media (max-width: 768px) {
  .filter-panel {
    padding: 1.5rem;
  }

  .card-header {
    flex-direction: column;
  }

  .card-footer button {
    flex: 1 1 100%;
  }

  .top-nav {
    flex-direction: column;
    gap: 1rem;
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.modal-content h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.modal-content ul {
  list-style: none;
  padding: 0;
  margin-bottom: 1.5rem;
}

.modal-content li {
  position: relative;
  padding-right: 1.2rem;
  margin-bottom: 0.5rem;
}

.modal-content li::before {
  content: "•";
  color: var(--accent);
  position: absolute;
  right: 0;
}

.modal-content .btn.primary {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  width: 100%;
}

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(100px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top svg {
  width: 24px;
  height: 24px;
}
