/* ── Google Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;1,600&display=swap');

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

:root {
  --blue:        #1B4F9B;
  --blue-dark:   #133a73;
  --blue-mid:    #2a6abf;
  --blue-light:  #e8f0fb;
  --yellow:      #F5D87A;
  --yellow-dark: #d4a800;
  --yellow-bg:   #fdf8ec;
  --green:       #27ae60;
  --red:         #e74c3c;
  --purple:      #8e44ad;
  --teal:        #16a085;
  --bg:          #f0f4f8;
  --card:        #ffffff;
  --text:        #111827;
  --muted:       #6b7280;
  --border:      #d1d5db;
  --radius:      12px;
  --radius-lg:   18px;
  --shadow:      0 4px 24px rgba(27,79,155,0.09);
  --shadow-lg:   0 10px 44px rgba(27,79,155,0.15);
  --transition:  0.2s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1 { font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 600; }
h2 { font-family: 'Playfair Display', serif; font-size: 1.15rem; margin-bottom: 14px; font-weight: 600; }
label { font-size: .78rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; letter-spacing: .05em; text-transform: uppercase; }

/* ── Form elements ─────────────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27,79,155,0.1); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--yellow);
  color: var(--blue-dark);
  border: 2px solid var(--yellow);
  padding: 10px 24px;
  border-radius: 50px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-primary:hover  { background: #f9e49a; border-color: #f9e49a; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(245,216,122,0.45); }
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
  padding: 10px 24px;
  border-radius: 50px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.btn-secondary:hover { background: var(--blue); color: #fff; transform: translateY(-2px); }

.btn-logout {
  background: transparent;
  color: rgba(255,255,255,.85);
  border: 1.5px solid rgba(255,255,255,.4);
  padding: 7px 16px;
  border-radius: 7px;
  font-size: .85rem;
  cursor: pointer;
  transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.1); }

.btn-sm {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: .8rem;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: opacity .2s;
}
.btn-sm:hover { opacity: .8; }
.btn-edit   { background: #eaf3fb; color: var(--blue); }
.btn-delete { background: #fdecea; color: var(--red); }
.btn-status {
  font-size: .78rem;
  padding: 5px 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: .03em;
  transition: background var(--transition), transform var(--transition);
}
.btn-status:hover { background: var(--blue-dark); transform: translateY(-1px); }

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
  scroll-margin-top: 120px;
  border: 1px solid rgba(27,79,155,0.07);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(27,79,155,0.2);
}
.modal-content h2 { margin-bottom: 20px; color: var(--blue); }
.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}
.form-group { margin-bottom: 14px; }
.form-group-wide { grid-column: 1 / -1; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 500px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-group-wide { grid-column: 1; }
}

.error-msg { color: var(--red); font-size: .85rem; margin-top: 8px; }

/* ── Section header ────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-header h2 { margin-bottom: 0; }
.count-badge {
  background: var(--bg);
  color: var(--muted);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: .82rem;
  font-weight: 600;
}

/* ── Loading / empty ───────────────────────────────────────────────────────── */
.loading, .empty-state {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: .95rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 55%, var(--blue-mid) 100%);
  padding: 20px;
}

.login-container {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  text-align: center;
}

.logo-icon { font-size: 3rem; margin-bottom: 6px; }
.logo h1   { font-family: 'Playfair Display', serif; font-size: 2rem; color: var(--blue); font-weight: 600; }
.subtitle  { color: var(--muted); margin: 6px 0 24px; font-size: .95rem; }

.children-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.child-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  padding: 0;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.child-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.child-btn:active { transform: translateY(0); }

.child-initial {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.child-name-text { font-size: 1rem; }

.parent-section { border-top: 1px solid var(--border); padding-top: 20px; }
.btn-parent {
  background: #2c3e50;
  color: #fff;
  border: none;
  padding: 13px 32px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn-parent:hover  { background: #1a252f; }
.btn-parent:active { transform: scale(.97); }

.pin-input {
  font-size: 1.5rem;
  letter-spacing: .4rem;
  text-align: center;
  padding: 12px;
  margin: 12px 0;
}

/* ════════════════════════════════════════════════════════════════════════════
   SHARED HEADER
   ════════════════════════════════════════════════════════════════════════════ */
.student-header,
.parent-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.student-header,
.parent-header  { background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, var(--blue-mid) 100%); }

.header-content {
  max-width: 1100px;
  margin: auto;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.header-icon { font-size: 1.5rem; }
.header-left h1 { font-family: 'Playfair Display', serif; font-size: 1.3rem; color: #fff; font-weight: 600; letter-spacing: .01em; }

.student-badge {
  background: rgba(255,255,255,.25);
  color: #fff;
  padding: 3px 14px;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 700;
}

/* ════════════════════════════════════════════════════════════════════════════
   STUDENT PAGE
   ════════════════════════════════════════════════════════════════════════════ */
.student-main {
  max-width: 860px;
  margin: 24px auto;
  padding: 0 16px;
}

.add-form-card form { margin-top: 4px; }
.add-form-card .btn-primary { margin-top: 8px; width: 100%; }

/* Legend — info only, not clickable */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.legend-item {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .01em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.5);
}

/* Section nav bar inside header */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 18px 10px;
  justify-content: center;
  border-top: 1px solid rgba(255,255,255,.15);
}
.section-nav-btn {
  display: inline-block;
  min-width: 90px;
  padding: 6px 14px;
  text-align: center;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  transition: filter .15s, transform .1s;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
  letter-spacing: .01em;
}
.section-nav-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.section-nav-btn[href="#sec-assignments"] { background: linear-gradient(135deg,#3b82f6,#2563eb); color:#fff; }
.section-nav-btn[href="#sec-tests"]       { background: linear-gradient(135deg,#8b5cf6,#7c3aed); color:#fff; }
.section-nav-btn[href="#sec-add"]         { background: linear-gradient(135deg,#10b981,#059669); color:#fff; }
.section-nav-btn[href="#sec-calendar"]    { background: linear-gradient(135deg,#f59e0b,#d97706); color:#fff; }
.section-nav-btn[href="#sec-progress"]    { background: linear-gradient(135deg,#ef4444,#dc2626); color:#fff; }

/* Back to top button */
#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 8px 18px;
  border-radius: 50px;
  background: var(--blue);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 999;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: opacity .2s, transform .2s, background .2s;
}
#back-to-top:hover { background: var(--blue-dark); transform: translateY(-2px); }
.legend-completed { background: linear-gradient(135deg,#bbf7d0,#d1fae5); color: #065f46; }
.legend-due-soon  { background: linear-gradient(135deg,#fde68a,#fef3c7); color: #92400e; }
.legend-overdue   { background: linear-gradient(135deg,#fca5a5,#fee2e2); color: #991b1b; }
.legend-upcoming  { background: linear-gradient(135deg,#93c5fd,#dbeafe); color: #1e3a8a; }

/* Assignment cards */
.assignments-list { display: flex; flex-direction: column; gap: 10px; }

.assignment-card {
  border-radius: var(--radius);
  padding: 14px 18px;
  border-left: 4px solid transparent;
  background: #f9fafb;
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1px solid rgba(27,79,155,0.07);
  border-left: 4px solid transparent;
}
.assignment-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.status-completed { background: #eafaf1; border-left-color: var(--green); }
.status-overdue   { background: #fdf3f3; border-left-color: var(--red); }
.status-due-soon  { background: #fefdf0; border-left-color: var(--yellow); }
.status-upcoming  { background: #f0f4fb; border-left-color: var(--blue); }

.assignment-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.assignment-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.status-emoji { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
.assignment-info { flex: 1; min-width: 0; }
.assignment-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.assignment-meta {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 3px;
}
.assignment-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

/* Subject badges */
.subject-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
  color: #fff;
}
/* New subjects */
.subject-algebra  { background: #e74c3c; }
.subject-band     { background: #e67e22; }
.subject-english  { background: #2980b9; }
.subject-health   { background: #27ae60; }
.subject-robotics { background: #8e44ad; }
.subject-science  { background: #16a085; }
/* Legacy subjects (keep for any existing data) */
.subject-math    { background: #e74c3c; }
.subject-history { background: #8e44ad; }
.subject-art     { background: #e67e22; }
.subject-other   { background: #7f8c8d; }

/* ════════════════════════════════════════════════════════════════════════════
   PROGRESS BARS
   ════════════════════════════════════════════════════════════════════════════ */
.progress-bars { display: flex; flex-direction: column; gap: 12px; }

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
}
.progress-fraction {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
}
.progress-track {
  flex: 1;
  height: 11px;
  background: var(--bg);
  border-radius: 20px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 20px;
  transition: width .5s ease;
  min-width: 4px;
}
.progress-pct {
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 38px;
  text-align: right;
}

/* ════════════════════════════════════════════════════════════════════════════
   CALENDAR
   ════════════════════════════════════════════════════════════════════════════ */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-header h2 { margin: 0; font-size: 1.1rem; }

.cal-nav {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 4px 14px;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text);
  transition: background .15s;
}
.cal-nav:hover { background: var(--bg); }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}
.cal-weekdays span {
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  padding: 4px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day {
  min-height: 54px;
  border-radius: 8px;
  padding: 5px 4px;
  cursor: pointer;
  background: #fff;
  display: flex;
  flex-direction: column;
  transition: background .15s, outline .1s;
}
.cal-blank   { background: transparent !important; cursor: default; pointer-events: none; }
.cal-weekend { background: #f3f4f6; }
.cal-day:not(.cal-blank):hover { background: #eaf3ff; }
.cal-today   { background: #eaf3ff !important; outline: 2px solid var(--blue); }
.cal-selected { background: #dbeafe !important; outline: 2px solid #2563eb; }
.cal-has-assignments { background: #f0fdf4; }
.cal-has-assignments.cal-weekend { background: #e8f5e9; }
.cal-today.cal-has-assignments { background: #eaf3ff !important; }
.cal-past:not(.cal-today) { opacity: .55; }

.cal-day-num {
  font-size: .8rem;
  font-weight: 700;
  color: #4a5568;
  line-height: 1;
}
.cal-today .cal-day-num {
  background: var(--blue);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
}
.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}
.cal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.cal-dot-more { font-size: .6rem; color: var(--muted); line-height: 7px; }

.cal-day-detail {
  background: #f8f9fc;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px) } to { opacity:1; transform:none } }

.day-detail-header {
  font-weight: 700;
  font-size: .9rem;
  color: var(--blue);
  margin-bottom: 8px;
}
.day-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  flex-wrap: wrap;
}
.day-detail-row:last-child { border-bottom: none; }
.day-detail-row.completed { opacity: .55; text-decoration: line-through; }
.day-detail-status { margin-left: auto; font-size: .74rem; color: var(--muted); }

.day-filter-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-light);
  border-radius: 50px;
  padding: 5px 14px;
  margin-bottom: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: inline-block;
}

/* ════════════════════════════════════════════════════════════════════════════
   NOTES PANEL
   ════════════════════════════════════════════════════════════════════════════ */
.notes-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  animation: fadeIn .15s ease;
}
.notes-textarea {
  resize: vertical;
  font-size: .88rem;
  line-height: 1.55;
  color: var(--text);
  background: #fdfcff;
  border-color: #d8ccf0;
}
.notes-textarea:focus { border-color: #8e44ad; }
.notes-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.notes-saved { color: var(--green); font-size: .82rem; font-weight: 700; }
.btn-notes        { background: #f4f0ff; color: #6c3fc5; }
.btn-notes:hover  { background: #e8d8ff; }
.btn-notes-active { background: #e0d0ff; color: #5a2baf; font-weight: 700; }
.has-notes-badge  { font-size: .74rem; color: #6c3fc5; font-style: italic; }

/* ════════════════════════════════════════════════════════════════════════════
   PARENT PAGE
   ════════════════════════════════════════════════════════════════════════════ */
.parent-main {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Summary cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 700px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
}
.summary-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
  border-top: 4px solid var(--blue);
  border: 1px solid rgba(27,79,155,0.08);
  border-top: 4px solid var(--blue);
}
.card-overdue   { border-top-color: var(--red); }
.card-due-soon  { border-top-color: var(--yellow); }
.card-completed { border-top-color: var(--green); }

.summary-number {
  font-family: 'Playfair Display', serif;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--blue);
}
.summary-label {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* Filters */
.filters-card .filters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: end;
}
@media (max-width: 700px) {
  .filters-card .filters-grid { grid-template-columns: 1fr 1fr; }
}

/* Charts row */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 800px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-card canvas {
  max-height: 260px;
}

/* Weekly overview */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
@media (max-width: 700px) {
  .week-grid { grid-template-columns: repeat(4, 1fr); }
}
.week-day {
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 6px;
  min-height: 80px;
}
.week-day.today {
  background: #eaf3ff;
  outline: 2px solid var(--blue);
}
.week-day.has-assignments { background: #f0fdf4; }
.week-day.today.has-assignments { background: #eaf3ff; }

.week-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.day-name { font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.day-num  { font-size: .9rem; font-weight: 800; color: var(--text); }
.week-assignment {
  font-size: .7rem;
  background: #d4edff;
  border-radius: 4px;
  padding: 2px 5px;
  margin-top: 3px;
  color: #1a4f7c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.week-assignment.completed { background: #d5f5e3; color: #1a7a45; }
.no-hw { font-size: .7rem; color: #b0c4de; }

/* Table */
.assignments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.assignments-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.assignments-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}
.assignments-table tr:last-child td { border-bottom: none; }
.assignments-table tr:hover td { background: #fafbfd; }

/* Row status highlighting */
.assignments-table tr.status-completed td { background: #f0fdf4; }
.assignments-table tr.status-overdue   td { background: #fff5f5; }
.assignments-table tr.status-due-soon  td { background: #fffdf0; }

.assignments-table td:last-child {
  white-space: nowrap;
  display: flex;
  gap: 5px;
}

.child-pill {
  background: #e8d5f7;
  color: var(--purple);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Status pills */
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-not-started { background: #f0f2f5; color: var(--muted); }
.status-in-progress { background: #fff3cd; color: #856404; }
.status-completed   { background: #d5f5e3; color: #1a7a45; }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .assignment-actions { flex-direction: column; align-items: flex-end; }
  .legend { display: none; }
  .header-left h1 { font-size: 1rem; }
  .assignments-table { font-size: .82rem; }
  .assignments-table th:nth-child(3),
  .assignments-table td:nth-child(3) { display: none; }
}

/* ════════════════════════════════════════════════════════════════════════════
   ON HOLD STATUS
   ════════════════════════════════════════════════════════════════════════════ */
:root {
  --amber:     #f59e0b;
  --amber-bg:  #fffbeb;
  --amber-border: #fcd34d;
}

.status-on-hold {
  background: var(--amber-bg);
  border-left-color: var(--amber);
}

.status-on-hold-row td { background: #fffdf0; }

.status-pill.status-on-hold {
  background: #fef3c7;
  color: #92400e;
}

.hold-reason-display {
  font-size: .78rem;
  color: #92400e;
  background: #fef3c7;
  border-radius: 5px;
  padding: 3px 8px;
  margin-top: 4px;
  display: inline-block;
}

.legend-on-hold { background: linear-gradient(135deg,#fcd34d,#fef3c7); color: #78350f; box-shadow: 0 2px 8px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.5); }
.legend-show-all { background: var(--blue-light,#e8f0fb); color: var(--blue,#1B4F9B); }
.legend-filter-active { outline: 2px solid var(--blue,#1B4F9B); outline-offset: 1px; font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════════
   ASSIGNMENT PERCENTAGE BAR (inline on card)
   ════════════════════════════════════════════════════════════════════════════ */
.assignment-pct-bar {
  height: 5px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 5px;
  max-width: 260px;
}
.assignment-pct-fill {
  height: 100%;
  border-radius: 10px;
  transition: width .4s ease;
  min-width: 3px;
}
.assignment-pct-label {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 700;
  display: inline-block;
  margin-top: 1px;
}

/* ════════════════════════════════════════════════════════════════════════════
   QUICK ACTION BUTTONS (Start / Done / Undo / Hold / Resume)
   ════════════════════════════════════════════════════════════════════════════ */
.btn-status-start  { background: #dbeafe; color: #1d4ed8; }
.btn-status-start:hover  { background: #bfdbfe; }
.btn-status-done   { background: #d1fae5; color: #065f46; }
.btn-status-done:hover   { background: #a7f3d0; }
.btn-status-undo   { background: #f1f5f9; color: var(--muted); }
.btn-status-undo:hover   { background: #e2e8f0; }
.btn-status-hold   { background: #fef3c7; color: #92400e; }
.btn-status-hold:hover   { background: #fde68a; }
.btn-status-resume { background: #ede9fe; color: #5b21b6; }
.btn-status-resume:hover { background: #ddd6fe; }

/* ════════════════════════════════════════════════════════════════════════════
   CALENDAR — VIEW TOGGLE & CHIPS
   ════════════════════════════════════════════════════════════════════════════ */
.cal-view-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cal-view-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.cal-view-btn:hover { background: var(--bg); }
.cal-view-active {
  background: var(--blue) !important;
  color: #fff !important;
  border-color: var(--blue) !important;
}

/* Calendar chips (subject labels inside cells) */
.cal-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
}
.cal-chip {
  font-size: .62rem;
  font-weight: 700;
  border-radius: 3px;
  padding: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.cal-chip-more {
  font-size: .6rem;
  color: var(--muted);
  padding-left: 2px;
}

/* Single-day view cell sizing */
.cal-day-single {
  min-height: 100px !important;
  font-size: .9rem;
}
.cal-day-label {
  font-size: .78rem;
  font-weight: 700;
  color: #4a5568;
}

/* 2-week grid: taller rows to fit chips */
.cal-grid .cal-day {
  min-height: 64px;
}

/* ════════════════════════════════════════════════════════════════════════════
   PERCENTAGE SLIDER (add/edit forms)
   ════════════════════════════════════════════════════════════════════════════ */
.pct-slider-wrap {
  margin-top: 6px;
}
.pct-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--blue, #4a6fa5) 0%, var(--blue, #4a6fa5) 0%, #dce1e7 0%);
  outline: none;
  cursor: pointer;
  transition: background .1s;
}
.pct-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue, #4a6fa5);
  box-shadow: 0 1px 5px rgba(0,0,0,.25);
  cursor: pointer;
  border: 2px solid #fff;
  transition: transform .1s;
}
.pct-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.pct-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue, #4a6fa5);
  box-shadow: 0 1px 5px rgba(0,0,0,.25);
  cursor: pointer;
  border: 2px solid #fff;
}

.form-hint {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 400;
}

/* ════════════════════════════════════════════════════════════════════════════
   TEST TRACKER
   ════════════════════════════════════════════════════════════════════════════ */
.test-add-details {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.test-add-summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: .88rem;
  color: var(--blue);
  background: var(--blue-light);
  user-select: none;
  list-style: none;
  letter-spacing: .03em;
}
.test-add-summary::-webkit-details-marker { display: none; }
.test-add-details[open] .test-add-summary { border-bottom: 1.5px solid var(--border); }
.test-add-details form { padding: 0 14px 14px; }

.tests-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.test-card {
  border-radius: 10px;
  padding: 12px 14px;
  border-left: 5px solid var(--teal);
  background: #f0fdf9;
  transition: box-shadow .2s;
}
.test-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.08); }
.test-past {
  opacity: .65;
  border-left-color: var(--muted);
  background: #f8f9fa;
}

.test-card-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.test-card-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.test-card-info { flex: 1; min-width: 0; }
.test-card-title {
  font-size: .93rem;
  font-weight: 600;
  color: var(--text);
}
.test-card-meta {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 3px;
}
.test-past-badge {
  background: #f1f5f9;
  color: var(--muted);
  border-radius: 10px;
  font-size: .7rem;
  padding: 1px 7px;
  font-weight: 700;
  margin-left: 6px;
}

.test-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.test-progress-track {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 20px;
  overflow: hidden;
  min-width: 80px;
  max-width: 200px;
}
.test-progress-fill {
  height: 100%;
  border-radius: 20px;
  transition: width .4s ease;
  min-width: 3px;
}
.test-progress-pct {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 34px;
}
.test-progress-select {
  width: auto;
  padding: 3px 8px;
  font-size: .78rem;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.test-notes-preview {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 5px;
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
}

.test-card-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════════════════
   PARENT PAGE — PERCENTAGE COLUMN
   ════════════════════════════════════════════════════════════════════════════ */
.parent-pct-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}
.parent-pct-track {
  flex: 1;
  height: 7px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  min-width: 40px;
}
.parent-pct-fill {
  height: 100%;
  border-radius: 10px;
  transition: width .4s ease;
  min-width: 2px;
}

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE ADDITIONS
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .pct-btn-group { gap: 4px; }
  .pct-btn { padding: 5px 10px; font-size: .78rem; }
  .test-card-main { flex-direction: column; }
  .test-card-actions { flex-direction: row; }
  .cal-view-toggle { gap: 3px; }
  .cal-view-btn { padding: 4px 10px; font-size: .75rem; }
  .assignment-pct-bar { max-width: 100%; }
}

/* ── Due date highlight ───────────────────────────────── */
.due-highlight {
  font-size: 1rem;
  font-weight: 400;
  color: #1a2a4a;
  letter-spacing: -.01em;
}

/* ── Archive section ──────────────────────────────────── */
.archive-details {
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.archive-toggle {
  cursor: pointer;
  font-size: .88rem;
  font-weight: 700;
  color: var(--muted);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}
.archive-toggle::-webkit-details-marker { display: none; }
.archive-toggle::before { content: '▶'; font-size: .7rem; transition: transform .2s; }
details[open] .archive-toggle::before { transform: rotate(90deg); }
.archive-details .assignment-card { opacity: .75; }
