/* --- Admin Global Styles --- */
:root {
  --bg-admin-dark: #090d16;
  --bg-admin-card: #121826;
  --bg-admin-surface: #1a2234;
  --bg-admin-input: #0e1422;
  
  --primary-orange: #ff6b1a;
  --primary-glow: rgba(255, 107, 26, 0.3);
  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-subtle: rgba(255, 255, 255, 0.08);

  --font-heading: 'Cabinet Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-cn: 'Noto Sans SC', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-admin-dark);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

.hidden {
  display: none !important;
}

/* --- Admin Header --- */
.admin-header {
  background: #0f1523;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.admin-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}

.mgb-admin-logo {
  width: 48px;
  height: 48px;
}

.sba-admin-logo {
  width: 48px;
  height: 48px;
  background: transparent !important;
}

.admin-logo-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 0.25rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--primary-orange);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-division-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .admin-division-badge {
    display: none;
  }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary-orange);
  color: #fff;
}
.btn-primary:hover {
  background: #e0580d;
}

.btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.1);
}
.btn-secondary:hover {
  background: #334155;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}
.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-danger-ghost {
  background: transparent;
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
}

/* --- Metrics Grid --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-admin-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.bg-orange-glow { background: rgba(255, 107, 26, 0.15); border: 1px solid rgba(255, 107, 26, 0.3); }
.bg-emerald-glow { background: var(--emerald-bg); border: 1px solid rgba(16, 185, 129, 0.3); }
.bg-amber-glow { background: var(--amber-bg); border: 1px solid rgba(245, 158, 11, 0.3); }
.bg-blue-glow { background: var(--blue-bg); border: 1px solid rgba(59, 130, 246, 0.3); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin: 0.15rem 0;
}

.text-emerald { color: #34d399; }
.text-amber { color: #fbbf24; }
.text-blue { color: #60a5fa; }

.stat-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Toolbar Card --- */
.table-toolbar-card {
  background: var(--bg-admin-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
  flex: 1;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.55rem 2.2rem 0.55rem 2.5rem;
  background: var(--bg-admin-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.clear-search-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.clear-search-btn:hover {
  color: #fff;
}

.filter-select-wrap {
  position: relative;
}

.filter-select {
  padding: 0.55rem 1.8rem 0.55rem 0.85rem;
  background: var(--bg-admin-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  appearance: none;
}

.filter-select:focus {
  border-color: var(--primary-orange);
}

.filter-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.9rem;
}

/* --- Table Container --- */
.table-container-card {
  background: var(--bg-admin-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}

.table-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.entries-counter {
  font-weight: 600;
  color: var(--text-secondary);
}

.table-quick-tip {
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .table-quick-tip {
    display: none;
  }
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.admin-table th {
  background: #0f1624;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  color: #cbd5e1;
}

.admin-table tbody tr {
  transition: background-color 0.15s ease;
}

.admin-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Table Column Enhancements */
.school-cell-title {
  font-weight: 700;
  color: #fff;
  font-size: 0.92rem;
}

.school-cell-sub {
  font-size: 0.75rem;
  color: var(--primary-orange);
}

.pic-cell-name {
  font-weight: 600;
  color: #e2e8f0;
}

.contact-pill-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.contact-pill-phone {
  font-size: 0.82rem;
  color: #34d399;
  text-decoration: none;
  font-weight: 600;
}
.contact-pill-phone:hover {
  text-decoration: underline;
}

.contact-pill-email {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
}
.contact-pill-email:hover {
  color: #fff;
  text-decoration: underline;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.status-badge.approved {
  background: var(--emerald-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.pending {
  background: var(--amber-bg);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.waitlist {
  background: var(--red-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Facility Badges */
.facility-pill {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: inline-block;
  white-space: nowrap;
}

.facility-pill.covered {
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.facility-pill.outdoor {
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.2);
}

/* Action Dropdown & Buttons */
.action-buttons-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-icon-approve:hover {
  background: var(--emerald-bg);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.btn-icon-delete:hover {
  background: var(--red-bg);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.35rem;
}

.empty-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* --- Modal Overlay & Dialog --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 9, 17, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-card {
  background: #141d2e;
  border: 1px solid rgba(255, 107, 26, 0.3);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  padding: 1.85rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.modal-close-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-icon:hover {
  color: #fff;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 540px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.35rem;
}

.required {
  color: var(--primary-orange);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  background: var(--bg-admin-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: #fff;
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* --- Admin Mobile Responsiveness & Screen Auto-Fit --- */
@media (max-width: 768px) {
  .admin-header {
    padding: 0.75rem 1rem;
  }

  .admin-logo, .mgb-admin-logo, .sba-admin-logo {
    width: 38px;
    height: 38px;
  }

  .admin-logo-divider {
    height: 22px;
  }

  .logo-title {
    font-size: 1rem;
  }

  .header-right {
    gap: 0.4rem;
  }

  .header-right .btn span:not(.btn-icon) {
    display: none;
  }

  .container {
    padding: 1rem 0.85rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .table-toolbar-card {
    padding: 0.85rem;
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left, .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .search-input-wrap {
    min-width: 100%;
    max-width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .filter-select-wrap {
    flex: 1;
  }

  .toolbar-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .toolbar-right .btn {
    width: 100%;
    font-size: 0.82rem;
  }

  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
}

