/* =============================================
   The Beacon Tutor Centre — Main Stylesheet
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary:       #1b2f57;
  --primary-light: #2a75c5;
  --primary-dark:  #111e3a;
  --accent:        #f47920;
  --accent-light:  #f9a35a;
  --success:       #4cad4c;
  --danger:        #dc3545;
  --warning:       #f5c518;
  --info:          #2e9fd4;
  --bg:            #f0f4f8;
  --card-bg:       #ffffff;
  --text:          #1e2a38;
  --text-muted:    #6c7a8a;
  --border:        #d1dbe6;
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        10px;
  --shadow:        0 2px 12px rgba(27,47,87,0.10);
  --shadow-md:     0 4px 24px rgba(27,47,87,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── LANDING ───────────────────────────────── */

.landing-body {
  display: flex; flex-direction: column; min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
}

.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 3rem; position: sticky; top: 0; z-index: 100;
  background: rgba(18,40,74,0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.landing-nav .brand { display: flex; align-items: center; gap: .75rem; }
.landing-nav .brand img { height: 40px; }
.landing-nav .brand-name { font-size: 1.3rem; font-weight: 700; color: #fff; letter-spacing: .5px; }
.landing-nav .brand-sub  { font-size: .75rem; color: rgba(255,255,255,.55); margin-top: -2px; }
.landing-nav-links { display: flex; gap: 1rem; }

.btn-nav-login {
  background: var(--accent); color: #fff; border: none;
  padding: .55rem 1.4rem; border-radius: 6px; font-weight: 600; font-size: .88rem;
  cursor: pointer; transition: background .2s; display: inline-block;
}
.btn-nav-login:hover { background: var(--accent-light); color: #1e2a38; text-decoration: none; }

.btn-nav-register {
  background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.45);
  padding: .55rem 1.4rem; border-radius: 6px; font-weight: 500; font-size: .88rem;
  cursor: pointer; transition: all .2s; display: inline-block;
}
.btn-nav-register:hover { background: rgba(255,255,255,.1); text-decoration: none; }

.landing-hero {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 4rem 2rem;
}
.landing-hero h1 { font-size: 3rem; font-weight: 700; color: #fff; line-height: 1.15; margin-bottom: 1.2rem; }
.landing-hero h1 span { color: var(--accent-light); }
.landing-hero p {
  font-size: 1.15rem; color: rgba(255,255,255,.75);
  max-width: 580px; margin: 0 auto 2.5rem; line-height: 1.7;
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn-hero-primary {
  background: var(--accent); color: #fff; padding: .85rem 2.2rem;
  border-radius: 8px; font-weight: 700; font-size: 1rem;
  border: none; cursor: pointer; transition: all .2s; display: inline-block;
}
.btn-hero-primary:hover { background: var(--accent-light); color: #1e2a38; text-decoration: none; }

.btn-hero-secondary {
  background: rgba(255,255,255,.12); color: #fff; padding: .85rem 2.2rem;
  border-radius: 8px; font-weight: 600; font-size: 1rem;
  border: 1.5px solid rgba(255,255,255,.35); cursor: pointer; transition: all .2s; display: inline-block;
}
.btn-hero-secondary:hover { background: rgba(255,255,255,.22); text-decoration: none; }

.landing-features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem; padding: 3rem; max-width: 900px; margin: 0 auto;
}
.feature-card {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius); padding: 1.75rem 1.5rem; text-align: center; color: #fff;
}
.feature-card .fi { font-size: 2rem; margin-bottom: 1rem; display: block; }
.feature-card h3  { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.feature-card p   { font-size: .85rem; color: rgba(255,255,255,.65); line-height: 1.6; }

.landing-footer {
  text-align: center; padding: 1.25rem;
  color: rgba(255,255,255,.4); font-size: .8rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ── AUTH ──────────────────────────────────── */

.auth-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
}
.auth-card {
  background: var(--card-bg); border-radius: 14px; box-shadow: var(--shadow-md);
  padding: 2.5rem 2.75rem; width: 100%; max-width: 440px;
}
.auth-logo { text-align: center; margin-bottom: 1.75rem; }
.auth-logo img { height: 52px; margin-bottom: .5rem; }
.auth-logo h2  { font-size: 1.35rem; font-weight: 700; color: var(--primary); }
.auth-logo p   { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }
.auth-title    { font-size: 1.1rem; font-weight: 600; color: var(--primary); margin-bottom: 1.5rem; text-align: center; }

/* ── APP SHELL ─────────────────────────────── */

.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--primary-dark);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200; overflow-y: auto; transition: transform .25s;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.25rem 1.5rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand img { height: 48px; }
.sidebar-brand-text h2  { font-size: 1rem; font-weight: 700; color: #fff; }
.sidebar-brand-text span{ font-size: .7rem; color: rgba(255,255,255,.45); }

.sidebar-user {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-light); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-info strong {
  display: block; font-size: .85rem; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-info span { font-size: .7rem; color: rgba(255,255,255,.45); text-transform: capitalize; }

.sidebar-nav { padding: .75rem 0; flex: 1; }
.sidebar-section {
  font-size: .65rem; font-weight: 700; letter-spacing: 1px;
  color: rgba(255,255,255,.3); text-transform: uppercase;
  padding: .75rem 1.5rem .25rem;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.5rem; color: rgba(255,255,255,.7);
  font-size: .88rem; font-weight: 500;
  transition: all .15s; border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: #fff; background: rgba(255,255,255,.07); border-left-color: var(--accent); text-decoration: none;
}
.sidebar-nav a .nav-icon { width: 18px; text-align: center; }
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer a { display: flex; align-items: center; gap: .75rem; color: rgba(255,255,255,.5); font-size: .85rem; transition: color .15s; }
.sidebar-footer a:hover { color: #fff; text-decoration: none; }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 2rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.topbar-title      { font-size: 1.1rem; font-weight: 600; color: var(--primary); }
.topbar-breadcrumb { font-size: .78rem; color: var(--text-muted); margin-top: 1px; }
.page-body { padding: 1.75rem 2rem; flex: 1; }

/* ── COMPONENTS ────────────────────────────── */

.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: .95rem; font-weight: 600; color: var(--primary); }
.card-body   { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg); }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem; margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--card-bg); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 1.35rem 1.5rem; display: flex; flex-direction: column; gap: .4rem;
}
.stat-card .stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-card .stat-icon  { font-size: 1.4rem; color: var(--primary-light); margin-bottom: .25rem; }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success .stat-value{ color: var(--success); }
.stat-card.danger .stat-value  { color: var(--danger); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  background: var(--bg); color: var(--text-muted);
  font-size: .73rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  padding: .75rem 1.1rem; text-align: left; border-bottom: 1px solid var(--border);
}
td { padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(27,47,87,.03); }

.badge {
  display: inline-flex; align-items: center; padding: .25rem .7rem;
  border-radius: 99px; font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: #d1f5e0; color: #0a6640; }
.badge-danger  { background: #fde2e2; color: #891c1c; }
.badge-warning { background: #fff4d6; color: #7a5100; }
.badge-info    { background: #d6f0fb; color: #0a6089; }
.badge-muted   { background: #e9ecef; color: #495057; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.2rem; border-radius: 7px; font-size: .85rem;
  font-weight: 600; border: none; cursor: pointer; transition: all .15s; text-decoration: none !important;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-light); color: #1e2a38; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { filter: brightness(1.1); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-sm   { padding: .35rem .85rem; font-size: .78rem; }
.btn-icon { padding: .4rem .6rem; }

.form-group   { margin-bottom: 1.1rem; }
.form-label   { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.form-control, .form-select {
  width: 100%; padding: .6rem .9rem; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: .88rem; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(42,117,197,.12);
}
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.alert {
  padding: .9rem 1.1rem; border-radius: 8px; margin-bottom: 1rem;
  font-size: .88rem; display: flex; align-items: flex-start; gap: .6rem;
}
.alert-success { background: #d1f5e0; color: #0a6640; border: 1px solid #a8e6c1; }
.alert-danger  { background: #fde2e2; color: #891c1c; border: 1px solid #f5c0c0; }
.alert-warning { background: #fff4d6; color: #7a5100; border: 1px solid #fde096; }
.alert-info    { background: #d6f0fb; color: #0a6089; border: 1px solid #a8dcf5; }

.score-chip { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; font-size: .88rem; padding: .2rem .65rem; border-radius: 6px; }
.score-chip.pass { background: #d1f5e0; color: #0a6640; }
.score-chip.fail { background: #fde2e2; color: #891c1c; }

.progress-bar-wrap { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; transition: width .4s; }
.progress-bar-fill.pass { background: var(--success); }
.progress-bar-fill.fail { background: var(--danger); }

.ack-box {
  border: 1.5px solid var(--primary); border-radius: var(--radius);
  padding: 1.5rem; background: linear-gradient(135deg, #eef4fb, #fff); margin-top: 2rem;
}
.ack-box h4 { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: .75rem; }
.ack-box p  { font-size: .87rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 1rem; }
.ack-done   { border: 1.5px solid var(--success); background: linear-gradient(135deg, #e6f9ed, #fff); }
.ack-done h4{ color: var(--success); }

.radio-toggle { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.radio-toggle label {
  display: flex; align-items: center; gap: .4rem; cursor: pointer;
  font-size: .88rem; font-weight: 500; padding: .45rem .9rem;
  border-radius: 7px; border: 1.5px solid var(--border); background: #fff; transition: all .15s;
}
.radio-toggle label.selected { border-color: var(--primary); background: var(--primary); color: #fff; }
.radio-toggle input { display: none; }

.section-title {
  font-size: 1rem; font-weight: 700; color: var(--primary);
  margin-bottom: 1rem; padding-bottom: .5rem;
  border-bottom: 2px solid var(--primary-light);
  display: flex; align-items: center; gap: .5rem;
}

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state h4 { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
.empty-state p  { font-size: .85rem; }

.pin-display {
  font-size: 2rem; font-weight: 800; letter-spacing: .4rem;
  color: var(--primary); font-family: monospace;
  background: var(--bg); border: 2px dashed var(--primary-light);
  border-radius: 8px; padding: .75rem 1.5rem; display: inline-block;
}

.link-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.link-card-info h4   { font-size: .95rem; font-weight: 700; color: var(--primary); }
.link-card-info .meta{ font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }
.link-card-info { flex: 1; }

.mark-cb-label { display: inline-flex; align-items: center; cursor: pointer; }
.mark-cb-label input[type="checkbox"] { display: none; }
.mark-cb-box {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--border); background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; transition: all .15s; flex-shrink: 0;
}
.mark-cb-label:hover .mark-cb-box { border-color: var(--primary-light); }
.mark-cb-box.is-acked   { background: var(--success); border-color: var(--success); color: #fff; }
.mark-cb-box.is-pending { background: var(--primary); border-color: var(--primary); color: #fff; }

.mark-row-acked td   { background: rgba(25,135,84,.05); }
.mark-row-pending td { background: rgba(42,117,197,.06); }

.query-flag-btn {
  color: var(--text-muted); border-color: var(--border); padding: .25rem .45rem; font-size: .8rem; line-height: 1; transition: color .15s, border-color .15s, background .15s;
}
.query-flag-btn:hover  { color: var(--danger); border-color: var(--danger); }
.query-flag-btn.flagged{ color: var(--danger); border-color: var(--danger); background: rgba(220,53,69,.08); }
.query-subrow td { background: rgba(220,53,69,.03) !important; }

.select-all-label {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .78rem; color: var(--text-muted); cursor: pointer;
  padding: .3rem .6rem; border-radius: 6px; border: 1.5px solid var(--border);
  background: #fff; user-select: none; white-space: nowrap; transition: all .15s;
}
.select-all-label:hover { border-color: var(--primary-light); color: var(--primary); }
.select-all-label input { accent-color: var(--primary); }

/* Utilities */
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }   .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }.mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: .5rem; }  .gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .82rem; }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }
.w-100 { width: 100%; }
code { font-size: .82rem; background: var(--bg); border-radius: 4px; padding: .1rem .35rem; }

/* Loading spinner */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--primary-light);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh; flex-direction: column; gap: 1rem; color: var(--text-muted);
}

/* Responsive: hide sidebar on mobile */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}
