/* ============================================================
   Quorum — Reusable Components
   Theme: University of Ghana — Royal Blue & White
   ============================================================ */

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 10px 20px;
  background: var(--accent); color: #fff;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.16s, box-shadow 0.16s, transform 0.1s;
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 18px rgba(0,63,135,0.30);
  color: #fff; text-decoration: none;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary.full { width: 100%; }
.btn-primary.loading { opacity: 0.7; pointer-events: none; }
.btn-primary.loading::after {
  content: ''; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.6s linear infinite;
  margin-left: 6px; display: inline-block; vertical-align: middle;
}

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 9px 18px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.btn-secondary:hover { background: var(--surface2); border-color: var(--border-hover); box-shadow: var(--shadow-sm); }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 9px 18px;
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background 0.14s;
}
.btn-danger:hover { background: rgba(192,57,43,0.13); }

/* ── Form fields ── */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 11.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%); color: var(--muted);
  pointer-events: none; display: flex; align-items: center;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 14px 10px 40px;
  background: var(--surface); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: 14px; outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-light); }
.field select { appearance: none; cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 22px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--ug-blue) 0%, var(--ug-blue-light) 100%);
}
.stat-card .stat-label {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 10px;
}
.stat-card .stat-value {
  font-family: var(--font-display); font-size: 32px;
  font-weight: 500; color: var(--text); line-height: 1;
}
.stat-card .stat-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent;
}
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info-border); }
.badge-muted   { background: var(--surface2);   color: var(--muted);   border-color: var(--border); }

/* ── Alert ── */
.alert {
  display: none; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px; border: 1px solid transparent;
}
.alert.show { display: flex; }
.alert.error   { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.alert.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }

/* ── Table ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
thead th {
  text-align: left; padding: 10px 16px;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1.5px solid var(--border);
  background: var(--ug-blue-ultra);
}
tbody td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--ug-blue-ultra); }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,20,60,0.40); backdrop-filter: blur(4px);
  z-index: 100; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 28px;
  width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg);
  position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 20px; }
.modal-close {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 6px; border-radius: var(--radius-sm);
  display: flex; align-items: center;
  transition: background 0.14s, color 0.14s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

/* ── App layout ── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--ug-blue-deep);
  border-right: none;
  display: flex; flex-direction: column;
  padding: 20px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin-bottom: 32px;
}
.brand-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-display); font-size: 19px;
  font-weight: 500; color: #fff; letter-spacing: -0.01em;
}

.nav-section { margin-bottom: 6px; }
.nav-section-label {
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 0 10px; margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius);
  color: rgba(255,255,255,0.60); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all 0.14s;
  border: none; background: none; width: 100%;
  text-align: left; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.10); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,0.16); color: #fff; font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item svg { opacity: 0.7; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.user-info .user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-info .user-role { font-size: 11px; color: rgba(255,255,255,0.50); text-transform: capitalize; }

/* ── Main content ── */
.main-content {
  padding: 36px 40px; overflow-y: auto; background: var(--bg);
}
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 28px; margin-bottom: 4px; }
.page-header p  { font-size: 14px; color: var(--muted); }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 28px;
}

/* ── Mobile nav ── */
.mobile-nav-bar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ug-blue-deep); border-top: none;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 50; justify-content: space-around;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 14px; color: rgba(255,255,255,0.55); font-size: 11px;
  font-weight: 500; background: none; border: none; cursor: pointer;
  border-radius: var(--radius); transition: color 0.14s;
}
.mobile-nav-item.active { color: #fff; }
.mobile-nav-item svg { width: 20px; height: 20px; }

/* ── Page tabs ── */
.page-tabs {
  display: flex; gap: 2px;
  border-bottom: 1.5px solid var(--border); margin-bottom: 24px;
}
.page-tab {
  padding: 10px 16px; background: none; border: none;
  color: var(--muted); font-family: var(--font-body);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -1.5px;
  transition: all 0.14s;
}
.page-tab:hover { color: var(--text); }
.page-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 52px 24px; color: var(--muted); }
.empty-state svg { margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; margin-top: 6px; }

/* ── Icon button ── */
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.14s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border-hover); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.icon-btn.success:hover { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }

/* ── Section card ── */
.section-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.section-card-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
}
.section-card-header h3 {
  font-family: var(--font-display); font-size: 16px;
  font-weight: 500; color: var(--text);
}
.section-card-header p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Rate bar ── */
.rate-bar-wrap { display: flex; align-items: center; gap: 10px; }
.rate-bar {
  flex: 1; height: 6px; background: var(--surface3);
  border-radius: 99px; overflow: hidden;
}
.rate-bar-fill {
  height: 100%; border-radius: 99px; background: var(--success);
  transition: width 0.5s ease;
}
.rate-bar-fill.warn { background: var(--warning); }
.rate-bar-fill.low  { background: var(--danger); }
.rate-pct { font-size: 13px; font-weight: 600; min-width: 36px; text-align: right; color: var(--text); }

/* ── Loading ── */
.loading-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 60vh; gap: 14px;
  color: var(--muted); font-size: 14px;
}
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--ug-blue-pale);
  border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

/* ── Search ── */
.search-wrap { position: relative; flex: 1; max-width: 300px; }
.search-wrap svg {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%); color: var(--muted); pointer-events: none;
}
.search-wrap input {
  width: 100%; padding: 9px 14px 9px 36px;
  background: var(--surface); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: 13px; outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.search-wrap input::placeholder { color: var(--muted-light); }

/* ── Divider ── */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--muted); font-size: 12px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Pending notice ── */
.pending-notice {
  background: var(--warning-bg); border: 1px solid var(--warning-border);
  border-radius: var(--radius); padding: 14px 16px;
  text-align: center; font-size: 13px; color: var(--warning);
  margin-top: 16px; display: none;
}
.pending-notice strong { display: block; font-size: 14px; color: var(--text); margin-bottom: 4px; }

/* ── Action group ── */
.action-group { display: flex; align-items: center; gap: 6px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-nav-bar { display: flex; }
  .main-content { padding: 24px 18px 80px; }
}
@media (max-width: 560px) {
  .main-content { padding: 20px 14px 80px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { padding: 20px; border-radius: var(--radius-lg); }
}
