:root {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.08);
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #0284c7;
  --scientific: #0369a1;
  --scientific-bg: #e0f2fe;
  --scientific-border: #bae6fd;
  --literary: #6b21a8;
  --literary-bg: #f3e8ff;
  --literary-border: #e9d5ff;
  --shared: #065f46;
  --shared-bg: #d1fae5;
  --shared-border: #a7f3d0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 24px rgba(0,0,0,0.08);
  --shadow-glow: 0 4px 14px rgba(37,99,235,0.2);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease-in-out;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  height: 100%;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  min-height: 100%;
  line-height: 1.65;
  padding-bottom: 2rem;
}

/* Background Gradients */
body::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 350px;
  background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 100%);
  z-index: -1;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

@media (min-width: 768px) {
  .container {
    padding: 2rem;
  }
}

/* Header & Navbar */
.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.btn-back:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  color: var(--primary);
}

.logo-brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800;
}

/* University Hero Section */
.univ-hero {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.univ-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 6px;
  background: linear-gradient(to left, var(--primary), var(--accent));
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .hero-content {
    flex-direction: row;
    align-items: center;
    gap: 2.5rem;
  }
}

.univ-avatar {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 2px solid var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 3rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.univ-main-info {
  flex: 1;
}

.univ-title {
  font-size: 2rem;
  font-weight: 800;
  color: #1e3a8a;
  line-height: 1.2;
}

.univ-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.univ-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.meta-badge {
  background: #f1f5f9;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-badge--primary {
  background: var(--primary-light);
  color: var(--primary);
}

/* Two Column Layout: Info and Contact */
.grid-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 992px) {
  .grid-details {
    grid-template-columns: 2fr 1fr;
  }
}

.card-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.card-title i {
  color: var(--primary);
}

.about-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.75;
  text-align: justify;
}

/* Contact List */
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.contact-item i {
  width: 32px;
  height: 32px;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.contact-item a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.contact-item a:hover {
  text-decoration: underline;
}

/* Stats Section */
.univ-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 480px) {
  .univ-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* Colleges List Table Section */
.card-colleges {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.search-filter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .search-filter-wrapper {
    flex-direction: row;
    align-items: center;
  }
}

.search-box-container {
  position: relative;
  flex: 1;
}

.search-box-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  background: #f8fafc;
  transition: var(--transition);
}

.search-box-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.search-box-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-btn-group {
  display: flex;
  gap: 0.25rem;
  background: #f1f5f9;
  padding: 0.2rem;
  border-radius: var(--radius-md);
  border: 1.5px solid #cbd5e1;
}

.filter-btn {
  background: none;
  border: none;
  padding: 0.45rem 1rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Responsive Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.colleges-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.9rem;
}

.colleges-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border);
}

.colleges-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.colleges-table tbody tr {
  transition: var(--transition);
}

.colleges-table tbody tr:hover {
  background: #f8fafc;
}

.td-percent {
  font-weight: 800;
  color: var(--primary);
}

.colleges-table tbody tr.eligible-row td.td-percent {
  color: var(--scientific);
}

.track-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

.track-badge.track-scientific { background: var(--scientific-bg); color: var(--scientific); }
.track-badge.track-literary { background: var(--literary-bg); color: var(--literary); }
.track-badge.track-shared { background: var(--shared-bg); color: var(--shared); }

.college-name-with-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}

.college-name-with-icon i {
  color: var(--primary);
  font-size: 0.9rem;
}

/* Vision & Mission Sub-Section */
.vision-mission-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
}

.vision-mission-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.vision-mission-section h3 i {
  color: var(--primary);
  font-size: 1rem;
}

.text-italic {
  font-style: italic;
  color: var(--text-secondary);
}

/* Student Guide Grid */
.student-guide-section {
  margin-top: 2rem;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 768px) {
  .guide-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

.guide-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.guide-card:hover {
  background: white;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.guide-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.guide-card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e3a8a;
}

.guide-card-header i {
  color: var(--primary);
  font-size: 1.1rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-card-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: justify;
  white-space: pre-line; /* preserves newlines in the text description */
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
