/* ═══════════════════════════════════════════════════════════════════
   TutorBirdKiller — Admin UI Styles
   Dark theme, teal accent, Inter font
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg: #0e0e12;
  --bg-sidebar: #12121a;
  --bg-card: #18182222;
  --bg-card-hover: #1e1e28;
  --bg-input: #14141c;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --text: #e8e6f0;
  --text-dim: rgba(232,230,240,0.62);
  --text-muted: rgba(232,230,240,0.30);
  --teal: #2a8f8f;
  --teal-bright: #35b0b0;
  --teal-soft: rgba(42,143,143,0.12);
  --teal-glow: rgba(42,143,143,0.25);
  --red: #e05555;
  --red-soft: rgba(224,85,85,0.12);
  --green: #3dba6d;
  --green-soft: rgba(61,186,109,0.12);
  --amber: #d4a030;
  --amber-soft: rgba(212,160,48,0.12);
  --purple: #8b6dd7;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
  --transition: 0.25s ease;
  --sidebar-width: 240px;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

::selection { background: var(--teal); color: #fff; }
a { color: var(--teal-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── LOGIN ─── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg) 0%, #0a1a1a 100%);
  padding: 2rem;
}
.login-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 3rem 2.5rem;
  width: 100%; max-width: 400px; text-align: center;
}
.login-logo {
  font-size: 1.8rem; font-weight: 800; margin-bottom: 0.3rem;
  background: linear-gradient(135deg, var(--teal), var(--teal-bright));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.login-sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }
.login-error { color: var(--red); font-size: 0.82rem; margin-bottom: 1rem; display: none; font-weight: 600; }
.login-error.show { display: block; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 1.2rem; text-align: left; }
.form-group label {
  display: block; font-size: 0.7rem; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 0.4rem;
}
.form-input {
  width: 100%; padding: 0.75rem 0.9rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: inherit; font-size: 0.9rem;
  outline: none; transition: var(--transition);
}
.form-input:focus { border-color: var(--teal); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.4rem; border-radius: 8px;
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: var(--transition); text-decoration: none;
}
.btn-primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-primary:hover { background: var(--teal-bright); border-color: var(--teal-bright); text-decoration: none; }
.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-card-hover); text-decoration: none; }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: rgba(224,85,85,0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--bg-card); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── APP SHELL ─── */
.app { display: none; }
.app.active { display: block; min-height: 100vh; }

/* Sidebar */
.sidebar {
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  padding: 1.5rem 0; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-width);
  z-index: 100; overflow-y: auto;
}
.sidebar-brand {
  padding: 0 1.5rem 1.5rem; border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar-brand h1 {
  font-size: 1.15rem; font-weight: 800;
  background: linear-gradient(135deg, var(--teal), var(--teal-bright));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-brand .tenant-name { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

.sidebar-nav { flex: 1; }
.nav-section { padding: 0.6rem 1.2rem 0.3rem; font-size: 0.62rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); }
.nav-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 1.5rem; margin: 0.1rem 0.5rem;
  border-radius: 8px; cursor: pointer;
  color: var(--text-dim); font-size: 0.88rem; font-weight: 500;
  transition: var(--transition);
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--teal-soft); color: var(--teal-bright); }
.nav-item .icon { width: 18px; text-align: center; font-size: 0.95rem; }
.nav-item .badge {
  margin-left: auto; background: var(--teal-soft); color: var(--teal-bright);
  font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 50px;
}

.sidebar-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-user { font-size: 0.82rem; color: var(--text-dim); }
.sidebar-user .name { color: var(--text); font-weight: 600; }
.sidebar-logout {
  font-size: 0.75rem; color: var(--text-muted); cursor: pointer;
  margin-top: 0.4rem; transition: var(--transition);
}
.sidebar-logout:hover { color: var(--red); }

/* Main content */
.main {
  margin-left: var(--sidebar-width); padding: 2rem 2.5rem;
  min-height: 100vh; overflow-y: auto;
}
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.page-header h2 { font-size: 1.5rem; font-weight: 800; }
.page-header .actions { display: flex; gap: 0.6rem; }

/* ─── CARDS ─── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-title { font-size: 0.68rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 1rem; }

/* ─── STAT CARDS ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem; }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; color: var(--teal-bright); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.4rem; letter-spacing: 0.5px; text-transform: uppercase; }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 0.7rem 1rem; text-align: left;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.8rem 1rem; border-bottom: 1px solid var(--border);
  font-size: 0.88rem; color: var(--text-dim);
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-card); }
tbody tr:hover td { color: var(--text); }

/* ─── STATUS BADGES ─── */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 50px; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.5px;
}
.badge-active { background: var(--green-soft); color: var(--green); }
.badge-trial { background: var(--amber-soft); color: var(--amber); }
.badge-paused { background: var(--red-soft); color: var(--red); }
.badge-archived { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.badge-scheduled { background: var(--teal-soft); color: var(--teal-bright); }
.badge-completed { background: var(--green-soft); color: var(--green); }
.badge-cancelled { background: var(--red-soft); color: var(--red); }
.badge-draft { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.badge-sent { background: var(--amber-soft); color: var(--amber); }
.badge-paid { background: var(--green-soft); color: var(--green); }
.badge-overdue { background: var(--red-soft); color: var(--red); }
.badge-enquiry { background: var(--purple); color: #fff; background: rgba(139,109,215,0.15); color: var(--purple); }

/* ─── MODALS ─── */
.modal-bg {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 2rem; overflow-y: auto;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 600px;
  margin: auto; position: relative;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: none; border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { border-color: var(--red); color: var(--red); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 0.6rem;
}

/* ─── TODAY'S LESSONS LIST ─── */
.lesson-list { list-style: none; }
.lesson-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--border);
}
.lesson-item:last-child { border-bottom: none; }
.lesson-time {
  font-size: 0.85rem; font-weight: 700; color: var(--teal-bright);
  min-width: 100px;
}
.lesson-info { flex: 1; }
.lesson-info .student { font-weight: 600; color: var(--text); }
.lesson-info .subject { font-size: 0.8rem; color: var(--text-muted); }
.lesson-actions { display: flex; gap: 0.4rem; }

/* ─── ATTENDANCE BUTTONS ─── */
.att-btn {
  padding: 0.3rem 0.7rem; border-radius: 6px; border: 1px solid var(--border);
  background: none; color: var(--text-dim); cursor: pointer;
  font-size: 0.72rem; font-weight: 600; transition: var(--transition);
}
.att-btn:hover { border-color: var(--teal); color: var(--teal-bright); }
.att-btn.attended { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.att-btn.absent { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.att-btn.late { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }

/* ─── SEARCH / FILTER BAR ─── */
.filter-bar {
  display: flex; gap: 0.8rem; margin-bottom: 1.5rem; flex-wrap: wrap;
  align-items: center;
}
.search-input {
  flex: 1; min-width: 200px;
  padding: 0.6rem 1rem; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 0.88rem;
  outline: none; transition: var(--transition);
}
.search-input:focus { border-color: var(--teal); }
.search-input::placeholder { color: var(--text-muted); }
.filter-select {
  padding: 0.6rem 0.9rem; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 0.85rem;
  cursor: pointer; outline: none;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state p { font-size: 0.95rem; margin-bottom: 1.5rem; }

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 9999;
  padding: 0.8rem 1.5rem; border-radius: 10px;
  font-size: 0.85rem; font-weight: 600;
  background: var(--teal); color: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px); opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--red); }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .app.active { display: block; }
  .sidebar {
    transform: translateX(-100%); transition: transform 0.3s ease;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 1.5rem; }
  .mobile-menu-btn {
    display: flex !important; position: fixed; top: 1rem; left: 1rem; z-index: 99;
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    align-items: center; justify-content: center; cursor: pointer;
    color: var(--text); font-size: 1.2rem;
  }
}
@media (min-width: 901px) {
  .mobile-menu-btn { display: none !important; }
}
