/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500;1,600;1,700;1,800&display=swap');

:root {
  --primary: #00356B;
  --primary-hover: #002244;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #f59e0b;
  --btn-grey: #D2D4D1;
  --body-text: #1A1A1A;
  --light-bg: #F5F5F5;
  --white: #FFFFFF;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --radius: 12px;
}

body {
  font-family: 'EB Garamond', serif;
  color: var(--body-text);
  background: var(--light-bg);
  line-height: 1.6;
  font-size: 17px;
}

/* ── Login ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--primary);
}

.login-card {
  background: var(--white);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 420px;
}

.login-card h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
  color: var(--primary);
  font-weight: 700;
}

.login-subtitle { color: var(--gray-500); margin-bottom: 1.5rem; font-size: 1rem; }

.login-logo {
  display: block;
  height: 50px;
  margin: 0 auto 1.5rem;
}

/* ── Forms ── */
label {
  display: block;
  font-weight: 500;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--gray-700);
}

input, select, textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-top: 0.25rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: 'EB Garamond', serif;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 53, 107, 0.1);
}

textarea { resize: vertical; }

/* ── Buttons ── */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  font-family: 'EB Garamond', serif;
  transition: all 0.2s ease;
}

.btn-primary { background: var(--btn-grey); color: var(--primary); }
.btn-primary:hover { background: var(--primary); color: var(--white); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-link { background: none; color: var(--primary); padding: 0; text-decoration: underline; font-size: 0.95rem; }
.btn-small { padding: 0.25rem 0.5rem; font-size: 0.85rem; }
.btn-submit { width: 100%; padding: 0.75rem; font-size: 1.1rem; margin-top: 0.5rem; }
.btn-group { display: flex; gap: 0.5rem; }

/* ── Layout ── */
.navbar {
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  height: 70px;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--white);
  margin-right: 2rem;
}

.nav-links { display: flex; gap: 0.25rem; flex: 1; }

.nav-links a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-links a:hover { background: rgba(255, 255, 255, 0.15); color: var(--white); }
.nav-links a.active { background: rgba(255, 255, 255, 0.2); color: var(--white); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
}

.nav-user .btn-link { color: rgba(255, 255, 255, 0.9); }
.nav-user .btn-link:hover { color: var(--white); }

.main-content { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* ── Banners ── */
.error-banner {
  background: #fef2f2; color: var(--danger); border: 1px solid #fecaca;
  padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.95rem;
}
.success-banner {
  background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0;
  padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.95rem;
}
.warning-banner {
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
  padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.95rem;
}

/* ── Session Form ── */
.session-form {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  max-width: 600px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.entry-method-toggle {
  display: flex;
  margin-bottom: 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  overflow: hidden;
}

.entry-method-toggle button {
  flex: 1; border-radius: 0; background: var(--white); color: var(--gray-700); border: none; padding: 0.5rem;
}
.entry-method-toggle button.active { background: var(--primary); color: var(--white); }

.timer-section {
  text-align: center; padding: 1rem; background: var(--light-bg);
  border-radius: var(--radius); margin-bottom: 1rem;
}

.timer-display {
  font-size: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--primary); margin-bottom: 0.75rem;
}

.timer-controls { display: flex; gap: 0.5rem; justify-content: center; }
.timer-note { margin-top: 0.5rem; font-size: 0.85rem; color: var(--gray-500); }

.duration-inputs {
  display: flex; gap: 1rem; align-items: end; margin-bottom: 1rem;
}
.duration-inputs label { flex: 1; margin-bottom: 0; }
.duration-inputs input { width: 100%; }
.duration-total { font-size: 0.95rem; color: var(--gray-500); white-space: nowrap; padding-bottom: 0.5rem; }

/* ── Tables ── */
.data-table {
  width: 100%; border-collapse: collapse; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; font-size: 0.95rem;
}
.data-table th {
  background: var(--primary); padding: 0.75rem; text-align: left;
  font-weight: 600; border-bottom: 2px solid var(--primary); color: var(--white);
}
.data-table td { padding: 0.75rem; border-bottom: 1px solid var(--gray-100); }
.data-table tbody tr:hover { background: var(--light-bg); }
.empty-row { text-align: center; color: var(--gray-500); padding: 2rem !important; }
.mini-table { font-size: 0.85rem; margin-top: 0.5rem; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #e8f0fe !important; }
.detail-row { background: var(--light-bg); }
.detail-row td { font-size: 0.85rem; color: var(--gray-500); }
.total-row { background: var(--gray-100); font-weight: 600; }
.row-inactive { opacity: 0.6; }

/* ── Status Badges ── */
.status-auto-approved, .status-none { color: var(--success); font-weight: 600; }
.status-pending { color: var(--warning); font-weight: 600; }
.status-approved { color: var(--success); font-weight: 600; }
.status-rejected { color: var(--danger); font-weight: 600; }
.rejection-note { font-size: 0.8rem; color: var(--danger); margin-top: 0.25rem; font-style: italic; }

/* ── Filters ── */
.filters {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
  padding: 1rem; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
}
.filters label { flex: 1; min-width: 150px; margin-bottom: 0; }
.filter-checkboxes { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.checkbox-label {
  display: flex !important; align-items: center; gap: 0.4rem; cursor: pointer;
  font-size: 0.9rem; white-space: nowrap; margin-bottom: 0;
}
.checkbox-label input[type="checkbox"] {
  width: auto; margin: 0; cursor: pointer;
}
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: var(--white); padding: 2rem; border-radius: var(--radius);
  width: 100%; max-width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h3 { margin-bottom: 1rem; color: var(--primary); }
.flag-prompt {
  margin-bottom: 1rem; padding: 0.75rem; background: #fffbeb;
  border-radius: var(--radius); border: 1px solid #fde68a;
}
.flag-prompt p { font-size: 0.95rem; margin-bottom: 0.5rem; color: #92400e; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }

/* ── Admin Tabs ── */
.tab-bar {
  display: flex; gap: 0.25rem; border-bottom: 2px solid var(--gray-200); margin-bottom: 1.5rem;
}
.tab-btn {
  background: none; color: var(--gray-500); padding: 0.75rem 1.25rem;
  border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 0; font-weight: 500;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Approval Cards ── */
.approval-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.approval-header { margin-bottom: 0.5rem; }
.approval-flags { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.flag-badge {
  background: #fef3c7; color: #92400e; padding: 0.2rem 0.6rem;
  border-radius: 999px; font-size: 0.8rem; font-weight: 600; text-transform: capitalize;
}
.approval-reasons { font-size: 0.95rem; color: var(--gray-700); margin-bottom: 0.75rem; }
.approval-reasons p { margin-bottom: 0.25rem; }
.approval-actions textarea { margin-bottom: 0.5rem; }
.spacing-context {
  font-size: 0.9rem; color: var(--primary); background: #e8f0fe;
  padding: 0.5rem 0.75rem; border-radius: var(--radius); margin-bottom: 0.75rem;
  border-left: 3px solid var(--primary);
}

/* ── Student Cards ── */
.student-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1rem; margin-top: 1rem;
}
.student-card {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.student-card.inactive { opacity: 0.6; }
.student-card-header {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.75rem;
}
.student-card-header h4 { font-size: 1.1rem; color: var(--primary); }
.tutor-assignment { font-size: 0.85rem; color: var(--gray-500); }
.badge-inactive {
  font-size: 0.75rem; background: var(--gray-200); color: var(--gray-500);
  padding: 0.15rem 0.5rem; border-radius: 999px; margin-left: 0.5rem;
}
.student-stats { font-size: 0.9rem; color: var(--gray-700); margin-bottom: 0.75rem; }
.student-stats div { margin-bottom: 0.2rem; }
.over-cap { color: var(--danger); font-weight: 600; }
.student-complete { border-left: 4px solid var(--success); }
.badge-complete {
  font-size: 0.75rem; background: #dcfce7; color: var(--success);
  padding: 0.15rem 0.5rem; border-radius: 999px; margin-left: 0.5rem; font-weight: 600;
}

.progress-bar-wrapper {
  background: var(--gray-200); border-radius: 999px; height: 8px; overflow: hidden; margin-bottom: 0.75rem;
}
.progress-bar {
  height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.3s;
}
.progress-bar.over-cap { background: var(--danger); }

/* ── Roster ── */
.roster-controls { margin-bottom: 1rem; }
.inline-form { display: flex; gap: 0.5rem; margin-top: 0.75rem; align-items: end; flex-wrap: wrap; }
.inline-form input, .inline-form select { margin-top: 0; }
.inline-edit { display: flex; gap: 0.25rem; align-items: center; }
.editable { cursor: pointer; border-bottom: 1px dashed var(--gray-300); }
.editable:hover { color: var(--primary); }

/* ── Tutor Flag Stats ── */
.flag-count-link {
  color: var(--warning);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
}
.flag-count-link:hover { color: #d97706; }
.no-flags { color: var(--gray-500); font-style: italic; }

/* ── Flag Timeline ── */
.flag-timeline { display: flex; flex-direction: column; gap: 0.75rem; }
.flag-timeline-entry {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem; background: var(--light-bg); border-radius: var(--radius);
  border-left: 3px solid var(--warning);
}
.flag-timeline-date { font-weight: 600; color: var(--primary); font-size: 0.95rem; }
.flag-timeline-student { font-size: 0.85rem; color: var(--gray-500); margin-top: 0.15rem; }
.flag-timeline-flags { display: flex; gap: 0.25rem; flex-wrap: wrap; }

/* ── Payroll Venmo ── */
.venmo-cell .venmo-display { color: var(--primary); font-size: 0.9rem; }
.venmo-cell .inline-edit { font-size: 0.85rem; }

/* ── Misc ── */
.loading { display: flex; align-items: center; justify-content: center; min-height: 200px; color: var(--gray-500); }
.empty-state { text-align: center; color: var(--gray-500); padding: 3rem; }
h2 { margin-bottom: 1rem; color: var(--primary); }
h3 { margin-bottom: 0.75rem; color: var(--primary); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .data-table { font-size: 0.85rem; }
}

@media (max-width: 768px) {
  .navbar { flex-wrap: wrap; height: auto; padding: 0.75rem; gap: 0.5rem; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; }
  .filters { flex-direction: column; }
  .student-cards { grid-template-columns: 1fr; }
  .duration-inputs { flex-direction: column; }
  .inline-form { flex-direction: column; }
}
