/* =========================================================
   READY SET DRIVE - FULLY STRUCTURED CSS
   (All original styles preserved, grouped with headings)
========================================================= */

:root {
  --primary: #1E3A8A;
  --bg: #F9FAFB;
  --card-bg: #FFFFFF;
  --border: #E5E7EB;
  --text-main: #111827;
  --text-muted: #6B7280;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 32px 20px;
}

h1, h2, h4 { margin-bottom: 10px; }

form:not(.student-form) {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

form input, form select { padding: 8px; font-size: 14px; }
form button { grid-column: 1 / -1; padding: 10px; background: var(--primary); color: white; border: none; border-radius: 6px; font-size: 15px; cursor: pointer; }
form button:disabled { background: #999; cursor: not-allowed; }
.delete-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.delete-btn:hover {
    background: #b91c1c;
}
table { width: 100%; background: white; border-collapse: collapse; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.05); margin-bottom: 20px; }
th, td { padding: 10px; text-align: left; }
th {
  background: #F3F4F6;
  font-weight: 600;
}
#students-table thead th {
  background: var(--primary);   /* modern blue */
  color: white;
  font-weight: 600;
}
#students-table {
  border-radius: 10px;
}
#toggle-student-form {
  margin-bottom: 20px;
}

/* ===== Branded Primary Action ===== */
.actions-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s ease;
}

.actions-btn:hover {
  opacity: 0.9;
}

tr:nth-child(even) { background: #fafafa; }
.overlap { background: #fee2e2 !important; }
.warning { color: #b91c1c; font-size: 14px; font-weight: 600; margin-bottom: 10px; }

/* Start of css for weekly calendar view */
.weekly-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* ===== Weekly Summary ===== */

.week-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.week-summary-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.week-label {
  color: var(--primary);
  font-weight: 700;
}

.week-summary-stats {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--text-muted);
}

#week-total {
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
}

#week-lessons,
#week-tests {
  color: var(--text-main);
  font-weight: 700;
}

.summary-separator {
  color: var(--border);
}

/* ===== Week Navigation Buttons ===== */

.week-nav {
  display: flex;
  gap: 8px;
}

.week-nav button {
  background: white;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s ease;
}

.week-nav button:hover {
  background: #F3F4F6;
}

/* Branded Today button */
#today-week {
  background: var(--primary);
  color: white;
  border: none;
}

#today-week:hover {
  opacity: 0.9;
}


/* ======================
   WEEKLY CALENDAR
====================== */
.weekly-calendar{
  background:#fff;
  border-radius:10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  max-height: 70vh;
  overflow: auto;
}

.weekly-header {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: #F9FAFB;

  position: sticky;
  top: 0;
  z-index: 40;
}

.day-head {
  padding: 12px;
  font-weight: 600;
  font-size: 13px;
  border-left: 1px solid var(--border);
}

.weekly-body{
  display:grid;
  grid-template-columns: 80px 1fr;
}

.time-col{
  border-right: 1px solid var(--border);
  background:#fff;
}

.time-row{
  padding:6px 10px;
  font-size:12px;
  color:#666;
  border-color: var(--border);
  box-sizing:border-box;
}

.days-grid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  position: relative;
}

.day-col{
  position:relative;
  border-color: var(--border);
  background:
    linear-gradient(to bottom, #F3F4F6 1px, transparent 1px);
  background-size: 100% 60px; /* hour lines */
}

/* ===== Current Time Indicator ===== */

.current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #dc2626;
  z-index: 30;
  pointer-events: none;
}

.current-time-line::before {
  content: "";
  position: absolute;
  left: var(--today-position, 0%);
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc2626;
  transform: translateX(-5px);
}

.time-col {
  position: sticky;
  left: 0;
  z-index: 25;
  border-right: 1px solid var(--border);
  background: #fff;
}

.header-spacer {
  padding: 10px;
  position: sticky;
  left: 0;
  z-index: 30;
  background: #F9FAFB;
}

/* ===== Lesson Blocks ===== */

/* ======================
   LESSON BLOCKS
====================== */
.lesson-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: 12px;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
  transition: 0.15s ease;
}


/* ======================
   LESSON BLOCKS
====================== */
.lesson-block:hover {
  transform: scale(1.02);
}


/* ======================
   LESSON BLOCKS
====================== */
.lesson-block[data-paid="false"] {
  border-left: 4px solid #e74c3c;
}


/* ======================
   LESSON BLOCKS
====================== */
.lesson-block[data-paid="true"] {
  border-left: 4px solid #2ecc71;
}

.lesson-block[data-type="Test"] {
  /*background: #436492;*/
  border: 5px solid #f5a00d;
}

/* ===== Lesson Typography Refinement ===== */

.lb-time {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.lb-student {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-title{ font-weight:700; }
.lb-time{ opacity:0.9; margin-top:2px; }
/* End of css for weekly view calendar */

/* ===== Modal Overlay ===== */

/* ======================
   MODAL
====================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45); /* soft dark */
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}


/* ======================
   MODAL
====================== */
.modal-overlay.hidden{ display:none; }

/* ===== Modal Container ===== */
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: modalFadeIn 0.18s ease;
}

/* ===== Modal Header Refinement ===== */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-header button {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  transition: 0.15s ease;
}

.modal-header button:hover {
  color: var(--text-main);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.blocked-block{
  position:absolute;
  left:6px;
  right:6px;
  border-radius:8px;
  padding:8px;
  background:#6b7280;
  color:#fff;
  font-size:12px;
  box-sizing:border-box;
  overflow:hidden;
  opacity: 0.55;
  pointer-events: none;
}

.form-input {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  box-sizing: border-box;
  font-size: 14px;
}

.modal label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.btn-primary {
  background:var(--primary);
  color:white;
  border:none;
  padding:6px 12px;
  border-radius:6px;
  cursor:pointer;
}

.btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-danger {
  background:#dc2626;
  color:white;
  border:none;
  padding:6px 12px;
  border-radius:6px;
  cursor:pointer;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row > div {
  flex: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-right: 12px;
}

.page-header h2 {
  margin: 0;
}


.page-action {
  border: none;
  background: none;
  color: #2563eb;
  padding: 6px 0;
  line-height: 1.4;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

.page-action:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.page-action:focus-visible {
  outline: none;
  text-decoration: underline;
}
/* ===== Student Creation Form ===== */
.student-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  background: rgba(15, 23, 42, 0.45);
  overflow-y: auto;
}

.student-form-card {
  background: #ffffff;
  margin-top: 14px;
  margin-bottom: 18px;
  width: min(760px, 100%);
  margin: 0;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.student-form-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.student-form-header h3 {
  margin: 0;
  font-size: 20px;
  color: #111827;
}

.student-form-header p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.student-form-badge {
  background: #0f172a;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

#student-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-section-title {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field label {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
}

#student-form input,
#student-form select,
#student-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  font-size: 14px;
}

#student-form input:focus,
#student-form select:focus,
#student-form textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-field.full-width {
  grid-column: 1 / -1;
}

.form-field.wide {
  grid-column: span 1;
}

.student-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 6px;
}

#student-form button {
  min-width: 160px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.student-form-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.student-modal-badge {
  background: #2563eb;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

.student-modal-close {
  border: none;
  background: #f1f5f9;
  color: #334155;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.student-modal-close:hover {
  background: #e2e8f0;
}

.delete-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #DC2626;
  padding: 6px;
  border-radius: 8px;
  transition: 0.15s ease;
}

.delete-btn:hover {
  background: #FEE2E2;
}

.delete-btn svg {
  width: 16px;
  height: 16px;
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions-btn,
.delete-btn {
  flex-shrink: 0;
}

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}


/* ======================
   STUDENTS
====================== */
.student-card {
  border-top: 3px solid var(--primary);
  background: white;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.04);
  transition: 0.2s ease;
}


/* ======================
   STUDENTS
====================== */
.student-card:hover {
  transform: translateY(-3px);
   box-shadow: 0 6px 16px rgba(0,0,0,0.12);
   cursor: pointer;
}

.student-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.student-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.student-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

/* ===== Student Card Layout Refinement ===== */

.student-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.student-header [class^="badge-"] {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.badge-active {
  background: #dcfce7;
  color: #166534;
}

.badge-inactive {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-completed {
  background: #dbeafe;
  color: #1e40af;
}

.student-name {
  font-size: 15px;
  font-weight: 600;
}

.student-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.student-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}


/* ======================
   STUDENTS
====================== */
.student-card {
  position: relative;
  overflow: hidden;
}


/* ======================
   STUDENTS
====================== */
.student-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--border);
  pointer-events: none;
  transition: 0.2s ease;
}


/* ======================
   STUDENTS
====================== */
.student-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.06);
}

.today-column {
  background-color: rgba(30, 58, 138, 0.05);
}

.today-column::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
}

/* ===== Week Transition Animation ===== */


/* ======================
   WEEKLY CALENDAR
====================== */
.weekly-calendar {
  transition: opacity 0.18s ease, transform 0.18s ease;
}


/* ======================
   WEEKLY CALENDAR
====================== */
.weekly-calendar.fade-out {
  opacity: 0;
  transform: translateX(-8px);
}


/* ======================
   WEEKLY CALENDAR
====================== */
.weekly-calendar.fade-in {
  opacity: 1;
  transform: translateX(0);
}

/* ===== App Navigation ===== */

.app-nav {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.nav-brand {
  font-weight: 600;
  font-size: 16px;
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links button {
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  position: relative;
  padding: 6px 0;
  transition: 0.15s ease;
}

.nav-links button:hover {
  color: var(--text-main);
}

.nav-links button.active {
  color: var(--primary);
  font-weight: 600;
}

.nav-links button.active::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* ===== Dashboard ===== */


/* ======================
   DASHBOARD
====================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.dashboard-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.04);
  transition: 0.2s ease;
}

.dashboard-card:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 18px rgba(0,0,0,0.08);
  transition:all .15s ease;
}

.dash-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dash-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-main);
}

/* Dashboard Hierarchy Upgrade */

.dashboard-section {
  margin-top: 24px;
}

.today-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f2f2f2;

  max-height: 180px;
  overflow-y: auto;

  /* ✅ Fix mobile scroll */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.today-item {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
}

.today-item:last-child {
  border-bottom: none;
}

.today-name {
  opacity: 0.8;
}

.today-empty {
  padding: 12px;
  text-align: center;
  opacity: 0.6;
}

.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.dashboard-section h2 {
  font-size: 16px;
  margin-bottom: 6px;
}

.dash-top i {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.dash-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

.upnext-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upnext-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.upnext-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upnext-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.upnext-showing-label {
  font-size: 12px;
  opacity: 0.7;
  line-height: 1;
}

.upnext-controls select {
  height: 26px;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 12px;
  background: #fff;
  cursor: pointer;
}

.upnext-title-row .dash-label {
  margin: 0;
  line-height: 1;
}

.lb-price {
  font-size: 0.85rem;
  margin-top: 4px;
  font-weight: 600;
}

.lb-paid {
  font-size: 0.7rem;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 12px;
  background: #2ecc71;
  /*color: #155724;*/
  display: inline-block;
}

.lb-unpaid {
  font-size: 0.7rem;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 12px;
  background: #e74c3c;
  /*color: #e74c3c;*/
  display: inline-block;
}

.form-display {
  padding: 10px 12px;
  background: #f5f7fa;
  border-radius: 6px;
  font-weight: 600;
}

.lb-mark-paid {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
}

.lb-mark-paid:hover {
  opacity: 1;
}

.finance-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.lesson-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.lesson-table th,
.lesson-table td {
  padding: 8px;
  border-bottom: 1px solid #ddd;
  text-align: left;
}

.lesson-table th {
  background: #f5f5f5;
}

.status-paid {
  background: #e6f7ec;
  color: #1f7a3e;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status-unpaid {
  background: #fdecea;
  color: #b42318;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.hidden-pay {
  visibility: hidden;
}

.lesson-filters {
  margin-bottom: 10px;
}

.lesson-filters button {
  margin-right: 8px;
  padding: 5px 10px;
  border: 1px solid #ddd;
  background: #f7f7f7;
  cursor: pointer;
  border-radius: 4px;
}

.lesson-filters button:hover {
  background: #eee;
}

.progress-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.progress-label {
  font-size: 12px;
  color: #666;
}

.progress-value {
  font-size: 20px;
  font-weight: 600;
}

.student-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
}

#save-notes:hover{
  background:#1d4ed8;
}

.student-top-grid{
  display:grid;
  grid-template-columns: 1.2fr 1.6fr 1.2fr 0.8fr;
  gap:20px;
  margin-bottom:30px;
  align-items:stretch;
}

.finance-row,
.progress-row{
  display:flex;
  justify-content:space-between;
  padding:6px 0;
}

#student-notes{
  width:100%;
  min-height:70px;
  margin-top:10px;
  padding:10px;
  border-radius:6px;
  border:1px solid #ddd;
  font-family:inherit;
  font-size:14px;
  resize:vertical;
  box-sizing:border-box;
}

.notes-card button{
  margin-top:6px;
}

.back-btn{
  margin-bottom:20px;
  background:none;
  border:none;
  color:#2563eb;
  cursor:pointer;
  font-size:14px;
}

.status-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:6px 0;
}

#student-detail{
  max-width:1200px;
  margin:auto;
}

.section-header{
  margin-top:25px;
  margin-bottom:10px;
}

.student-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* TOP ROW */
.student-top-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.student-filters {
  display: flex;
  gap: 10px;
}

.student-filters,
.student-search,
.student-toolbar {
  white-space: nowrap;
}

.filter-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}

.filter-btn.active {
  background: #1f2937;
  color: white;
  border-color: #1f2937;
}

.student-search input {
  margin-right: 15px;
  margin-left: 15px;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  width: 220px;
}

.student-search,
.student-toolbar {
  flex-shrink: 0; /* prevents wrapping */
}

.student-search {
  margin-left: auto;
}

.student-count {
  font-size: 14px;
  color: #666;
}

.student-progress {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 13px;
  color: #555;
}


/* ======================
   STUDENTS
====================== */
.student-card {
  border-left: 5px solid #ddd;
}

.readiness-ready {
  border-left-color: #22c55e;
}

.readiness-progress {
  border-left-color: #f59e0b;
}

.readiness-beginner {
  border-left-color: #3b82f6;
}

.student-readiness {
  font-size: 13px;
  margin-top: 6px;
  font-weight: 500;
}

.student-next-lesson {
  margin-top: 6px;
  font-size: 13px;
  color: #444;
}

.student-balance {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
}

.student-balance.owing {
  color: #dc2626;
}

.student-balance.paid {
  color: #16a34a;
}

.student-section-title {
  margin: 24px 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: #444;
  border-bottom: 1px solid #eee;
  padding-bottom: 6px;
}

.student-section {
  width: 100%;
  margin-bottom: 30px;
}

#students-list {
  display: block;
}

.student-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-limit-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.student-limit-control select {
  height: 28px; /* keeps it aligned with text */
}

#student-count {
  display: flex;
  align-items: center;
}

.student-toolbar {
  margin-bottom: 15px;
}

.students-title {
  margin-top: 20px;
}

.student-tests-card{
  display:flex;
  flex-direction:column;
}

.student-tests-card table{
  display:block;
  overflow-y:auto;
  flex:1;
}

.tests-table tbody{
  display:block;
  max-height:120px;
  overflow-y:auto;
}

.tests-table thead,
.tests-table tbody tr{
  display:table;
  width:100%;
  table-layout:fixed;
}

.tests-table th {
  font-weight: 600;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.tests-table {
  width: 100%;
  border-collapse: collapse;
}

.tests-table th,
.tests-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.tests-table th {
  text-align: left;
  font-weight: 600;
  color: #555;
}

.test-result.pass {
  color: green;
  font-weight: 600;
}

.test-result.fail {
  color: red;
  font-weight: 600;
}

.test-result.pending {
  color: #999;
}

.notes-card {
  grid-column: 1 / -1;
  margin-top: 20px;
  min-height: unset;
  height: auto;
}

.tests-table tbody::-webkit-scrollbar{
  width:6px;
}

.tests-table tbody::-webkit-scrollbar-thumb{
  background:#ccc;
  border-radius:6px;
}

.student-search-results{
  border:1px solid #ddd;
  border-radius:6px;
  max-height:150px;
  overflow-y:auto;
  background:white;
  margin-top:4px;
}

.student-search-item{
  padding:8px 10px;
  cursor:pointer;
}

.student-search-item:hover{
  background:#f5f5f5;
}

.test-toggle {
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.test-toggle.pass {
  background: #d4edda;
}

.test-toggle.fail {
  background: #f8d7da;
}

.test-toggle.pending {
  background: #fff3cd;
}

.app-message {
  background: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 9999;
  pointer-events: none;
}

.app-message.hidden {
  display: none;
}

.status-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.status-not-ready {
  background: #f8d7da;
  color: #721c24;
}

.status-in-progress {
  background: #fff3cd;
  color: #856404;
}

.status-ready {
  background: #d4edda;
  color: #155724;
}

.status-completed {
  background: #cce5ff;
  color: #004085;
}

.student-test-status {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.highlight-ready {
  border: 1px solid #16a34a;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.15);
}

.student-test-attempts {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}

.highlight-struggling {
  border: 2px solid #dc2626;
  /*box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.15);*/
}

.priority-filters {
  display: flex;
  gap: 8px;
}

.priority-btn {
  margin-right: 6px;
  padding: 6px 10px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
}

.priority-btn.active {
  border-color: #2563eb;
  background: #eff6ff;
}


/* ======================
   ACCOUNTS
====================== */
.accounts-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 20px;
}


/* ======================
   ACCOUNTS
====================== */
.accounts-cards .card {
  padding: 20px;
}

.text-red {
  color: #e53935;
  font-weight: 600;
}

.text-green {
  color: #2e7d32;
  font-weight: 600;
}

.lesson-list {
  margin-top: 20px;
}

.lesson-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}

.lesson-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lesson-right {
  text-align: right;
}

.paid {
  color: #2e7d32;
  font-weight: 600;
}

.unpaid {
  color: #e53935;
  font-weight: 600;
}

.section-title {
  margin-top: 30px;
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 600;
}

.student-group {
  margin-bottom: 25px;
}

.student-group h3 {
  margin-bottom: 10px;
}

.lesson-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.accounts-container {
  max-width: 1000px;
  margin: 20px auto;
  padding: 0 20px;
}

/* Current student lesson (highlight) */
.lesson-current {
  border: 2px solid #3b82f6; /* nice blue */
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
  z-index: 2;
}

.lesson-current:hover {
  transform: scale(1.02);
}

/* Other students (greyed out) */
.lesson-other {
  opacity: 0.35;
  filter: grayscale(40%);
  cursor: not-allowed;
}

/* Optional: prevent hover effects */
.lesson-other:hover {
  transform: none;
  box-shadow: none;
}

/* ========================================
   STUDENT OPERATIONS
======================================== */

.operations-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.operations-toolbar > div {
  flex: 1;
  max-width: 320px;
}

.operations-toolbar label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}

.operations-table-wrap {
  width: 100%;
  overflow-x: auto;
}

#operationsTable {
  width: 100%;
  border-collapse: collapse;
}

#operationsTable th,
#operationsTable td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

#operationsTable th {
  font-size: 13px;
  font-weight: 600;
}

#operationsTable td {
  font-size: 14px;
}

#operationsTable .empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 12px;
}

/* ========================================
   OPERATIONS TOOLBAR
======================================== */

.operations-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.operations-actions {
  display: flex;
  gap: 10px;
}

/* ========================================
   READY SET DRIVE — INVOICE OPTIONS MODAL
   v0.1 — Invoice issuance and discounts
   ======================================== */

.invoice-options-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  background: rgba(15, 23, 42, 0.45);
  overflow-y: auto;
}

.invoice-options-card {
  width: min(480px, 100%);
  box-sizing: border-box;
  margin: 14px 0 18px;
  padding: 22px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15);
}

.invoice-options-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid #e5e7eb;
}

.invoice-options-header h3 {
  margin: 0;
  color: #111827;
  font-size: 20px;
}

.invoice-options-header p {
  margin: 5px 0 0;
  color: #6b7280;
  font-size: 13px;
}

#invoiceOptionsForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#invoiceOptionsForm .form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

#invoiceOptionsForm input,
#invoiceOptionsForm select,
#invoiceOptionsForm textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  font-size: 14px;
}

#invoiceOptionsForm input:focus,
#invoiceOptionsForm select:focus,
#invoiceOptionsForm textarea:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.invoice-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.invoice-options-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #f1f5f9;
  border-radius: 10px;
}

.invoice-options-total {
  padding-top: 12px;
  border-top: 1px solid #cbd5e1;
  color: #0f172a;
  font-size: 17px;
}

.invoice-options-note {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.invoice-options-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.invoice-options-actions button {
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
}

/* ========================================
   RSD Environment Indicator
   DEV / LIVE identification
   ======================================== */

.rsd-environment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  line-height: 1.4;
  vertical-align: middle;
}

.rsd-environment-badge[hidden] {
  display: none;
}

.rsd-env-live {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.rsd-env-dev {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}