/* ============================================================
   Lodwar TVC Academic System — app.css
   Blue & White professional theme
   ============================================================ */

:root {
  --blue-900: #042C53;
  --blue-800: #0C447C;
  --blue-700: #185FA5;
  --blue-500: #378ADD;
  --blue-200: #B5D4F4;
  --blue-50:  #E6F1FB;
  --green-800: #27500A;
  --green-600: #3B6D11;
  --green-50:  #EAF3DE;
  --green-200: #C0DD97;
  --amber-800: #633806;
  --amber-600: #854F0B;
  --amber-50:  #FAEEDA;
  --amber-200: #FAC775;
  --red-800:   #791F1F;
  --red-600:   #A32D2D;
  --red-50:    #FCEBEB;
  --red-200:   #F7C1C1;
  --gray-50:   #F8F9FA;
  --gray-100:  #F1F3F5;
  --gray-200:  #E9ECEF;
  --gray-300:  #DEE2E6;
  --gray-500:  #ADB5BD;
  --gray-700:  #495057;
  --gray-900:  #212529;
  --white:     #FFFFFF;
  --sidebar-w: 230px;
  --topbar-h:  56px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--gray-900);
  background: var(--gray-50);
}

/* ── App shell ─────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue-800);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: transform 0.25s;
  z-index: 200;
}

.sidebar-brand {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--blue-700);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-name { display: block; font-size: 13px; font-weight: 600; color: #fff; }
.brand-sub  { display: block; font-size: 10px; color: rgba(255,255,255,0.55); }

.sidebar-user {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.user-name  { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.user-role  { font-size: 11px; color: rgba(255,255,255,0.55); }

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-section {
  padding: 12px 16px 4px;
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.08em;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.13); color: #fff; border-left-color: var(--blue-500); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; }
.nav-icon svg { width: 16px; height: 16px; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 6px 0;
}
.btn-logout:hover { color: #fff; }

/* ── Main area ─────────────────────────────────────────────── */
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  flex-shrink: 0;
}
.menu-toggle {
  display: none; background: none; border: none; cursor: pointer; color: var(--gray-700);
  padding: 4px;
}
.page-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.date-display { font-size: 12px; color: var(--gray-500); }

.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Metric cards ──────────────────────────────────────────── */
.metric-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.metric-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 16px;
}
.metric-label { font-size: 12px; color: var(--gray-500); margin-bottom: 6px; }
.metric-value { font-size: 26px; font-weight: 700; }
.metric-sub   { font-size: 12px; color: var(--gray-500); margin-top: 3px; }
.metric-value.good { color: var(--green-600); }
.metric-value.warn { color: var(--amber-600); }
.metric-value.bad  { color: var(--red-600); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-actions { display: flex; gap: 8px; }

/* ── Grid layouts ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none; color: var(--gray-700);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--gray-100); border-color: var(--gray-400); }
.btn-primary { background: var(--blue-700); color: #fff; border-color: var(--blue-700); }
.btn-primary:hover { background: var(--blue-800); }
.btn-danger  { background: var(--red-600); color: #fff; border-color: var(--red-600); }
.btn-danger:hover { background: var(--red-800); }
.btn-success { background: var(--green-600); color: #fff; border-color: var(--green-600); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
label { font-size: 12px; font-weight: 600; color: var(--gray-700); }
input[type=text], input[type=email], input[type=password],
input[type=date], input[type=number], select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--gray-900);
  background: var(--white); width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(55,138,221,0.15);
}
textarea { resize: vertical; min-height: 80px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 9px 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200); background: var(--gray-50);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--blue-50); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 9px;
  border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-green  { background: var(--green-50);  color: var(--green-800); }
.badge-red    { background: var(--red-50);    color: var(--red-800); }
.badge-amber  { background: var(--amber-50);  color: var(--amber-800); }
.badge-blue   { background: var(--blue-50);   color: var(--blue-800); }
.badge-gray   { background: var(--gray-100);  color: var(--gray-700); }

/* ── Progress ───────────────────────────────────────────────── */
.progress { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; background: var(--blue-700); }
.progress-bar.good { background: var(--green-600); }
.progress-bar.warn { background: var(--amber-600); }
.progress-bar.bad  { background: var(--red-600); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-info    { background: var(--blue-50);  color: var(--blue-800);  border: 1px solid var(--blue-200); }
.alert-success { background: var(--green-50); color: var(--green-800); border: 1px solid var(--green-200); }
.alert-warning { background: var(--amber-50); color: var(--amber-800); border: 1px solid var(--amber-200); }
.alert-danger  { background: var(--red-50);   color: var(--red-800);   border: 1px solid var(--red-200); }

/* ── Geo banner ─────────────────────────────────────────────── */
.geo-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px;
}
.geo-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.geo-ok      { background: var(--green-50); color: var(--green-800); border: 1px solid var(--green-200); }
.geo-fail    { background: var(--red-50);   color: var(--red-800);   border: 1px solid var(--red-200); }
.geo-checking{ background: var(--blue-50);  color: var(--blue-800);  border: 1px solid var(--blue-200); }

/* ── Attendance grid ─────────────────────────────────────────── */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(100px,1fr)); gap: 8px; margin: 14px 0; }
.att-chip {
  padding: 10px 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200); text-align: center;
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.att-chip:hover { border-color: var(--blue-500); }
.att-chip.present { background: var(--green-50); border-color: var(--green-200); }
.att-chip.absent  { background: var(--red-50);   border-color: var(--red-200); }
.att-chip.late    { background: var(--amber-50);  border-color: var(--amber-200); }
.att-chip .chip-name   { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-chip .chip-adm    { font-size: 10px; color: var(--gray-500); }
.att-chip .chip-status { font-size: 11px; margin-top: 4px; font-weight: 600; }
.att-chip.present .chip-status { color: var(--green-600); }
.att-chip.absent  .chip-status { color: var(--red-600); }
.att-chip.late    .chip-status { color: var(--amber-600); }

/* ── Upload zone ─────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  color: var(--gray-500);
  cursor: pointer; font-size: 13px;
  transition: all 0.15s;
}
.upload-zone:hover { background: var(--blue-50); border-color: var(--blue-500); color: var(--blue-700); }

/* ── Stars ───────────────────────────────────────────────────── */
.stars { display: inline-flex; gap: 2px; }
.star { width: 14px; height: 14px; }
.star.filled { color: #F5A623; fill: #F5A623; }
.star.empty  { color: var(--gray-300); fill: var(--gray-300); }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--gray-200); margin-bottom: 16px; }
.tab-btn {
  padding: 8px 18px; font-size: 13px; font-weight: 500;
  color: var(--gray-500); background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer;
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--blue-700); border-bottom-color: var(--blue-700); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
}
.login-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 380px;
  max-width: 95vw;
  box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-img { width: 52px; height: 52px; border-radius: 12px; background: var(--blue-700); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.login-title { font-size: 18px; font-weight: 700; color: var(--blue-800); }
.login-sub   { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ── Rate row ────────────────────────────────────────────────── */
.rate-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--gray-100);
}
.rate-row:last-child { border-bottom: none; }
.rate-name   { font-size: 13px; font-weight: 600; }
.rate-detail { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ── Remedial card ───────────────────────────────────────────── */
.remedial-card {
  background: var(--blue-50);
  border-left: 3px solid var(--blue-700);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}

/* ── Flash messages ──────────────────────────────────────────── */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; }
.flash-success { background: var(--green-50); color: var(--green-800); border: 1px solid var(--green-200); }
.flash-error   { background: var(--red-50);   color: var(--red-800);   border: 1px solid var(--red-200); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  .menu-toggle { display: block; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .btn, .card-actions { display: none !important; }
  .page-content { padding: 0; }
  .card { border: none; box-shadow: none; }
}
