/* === SHS Finder Ghana — Optimized Styles === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8f9fc;
  color: #111827;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

:root {
  --primary: #112d4e;
  --primary-dark: #0f2439;
  --primary-light: #e7eef8;
  --accent-green: #10b981;
  --accent-green-bg: #ecfdf5;
  --bg: #f8f9fc;
  --surface: #ffffff;
  --text: #111827;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05);
  --header-height: 64px;
}

/* === TOPBAR === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.topbar .brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.topbar nav { display: flex; gap: 28px; }
.topbar nav a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #d1d5db;
  transition: color 0.2s;
  position: relative;
}
.topbar nav a:hover, .topbar nav a.active { color: #fff; }
.topbar nav a.active::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}
.topbar .search-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === LAYOUT === */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}
.content {
  padding: 32px;
  max-width: 1000px;
}

/* === SIDEBAR === */
.sidebar-section { margin-bottom: 28px; }
.sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 4px;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.nav-link:hover { background: var(--primary-light); color: var(--primary); border-color: #e9e3f5; }
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #e9e3f5;
}
.nav-link .arrow { font-size: 1.1rem; color: var(--text-secondary); transition: transform 0.2s; }
.nav-link:hover .arrow { transform: translateX(2px); }
.nav-link.active .arrow { color: var(--primary); }

.filter-group { margin-bottom: 16px; }
.filter-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.filter-group select,
.filter-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17,45,78,0.1);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: #f3f4f6; color: var(--text); border-color: var(--border); }

/* === CONTENT HEADER === */
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  line-height: 1.2;
}
.page-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* === STATS GRID === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.stat-info p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* === TOOLBAR === */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.results-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
.sort-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}
.sort-select:focus { outline: none; border-color: var(--primary); }

/* === TABLE === */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
thead {
  background: var(--primary);
  color: #fff;
}
th {
  text-align: left;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

.school-name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.school-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.school-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-boarding {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #e9e3f5;
}
.badge-day {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border-color: #a7f3d0;
}
.arrow-link {
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: color 0.2s, transform 0.2s;
  display: inline-block;
}
tbody tr:hover .arrow-link {
  color: var(--primary);
  transform: translateX(3px);
}

/* === PAGINATION === */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === MOBILE === */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px;
  }
  .content { padding: 20px; }
  .topbar nav { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  th, td { padding: 12px 16px; }
  .page-header h1 { font-size: 1.5rem; }
  .toolbar { flex-direction: column; align-items: flex-start; }
}

/* === ACCESSIBILITY === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}