/* GradeView custom styles — Tailwind handles most things */

/* ── Buttons ─────────────────────────────────────────────────────────────────
   Note: @apply doesn't work with Tailwind CDN, so all component styles live here */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background-color: #4f46e5;
  color: #ffffff;
  border-radius: 0.5rem;
  padding: 0.5rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary:hover:not(:disabled) { background-color: #4338ca; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background-color: #f3f4f6;
  color: #374151;
  border-radius: 0.5rem;
  padding: 0.5rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background-color 0.15s;
  white-space: nowrap;
}
.btn-secondary:hover { background-color: #e5e7eb; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  background-color: #fee2e2;
  color: #dc2626;
  border-radius: 0.375rem;
  padding: 0.3rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
}
.btn-danger:hover { background-color: #fecaca; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}
.form-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #111827;
  background: #fff;
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
  box-sizing: border-box;
}
.form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Admin layout ───────────────────────────────────────────────────────────── */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1.25rem;
}

/* ── Time filter tabs ───────────────────────────────────────────────────────── */
.time-tab {
  padding: 0.375rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.15s;
}
.time-tab:hover {
  background: #f3f4f6;
  color: #4f46e5;
}
.active-tab {
  background: #4f46e5 !important;
  color: #ffffff !important;
  border-color: #4f46e5 !important;
}

/* ── Subject card hover ─────────────────────────────────────────────────────── */
.subject-card {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.subject-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

/* ── Trend indicators ───────────────────────────────────────────────────────── */
.trend-up   { color: #10b981; }
.trend-down { color: #ef4444; }
.trend-stable { color: #9ca3af; }

/* ── Grade color bands (letter grade — used on subject cards) ───────────────── */
.grade-a { color: #15803d; }
.grade-b { color: #22c55e; }
.grade-c { color: rgb(200,220,50); }
.grade-d { color: #f97316; }
.grade-f { color: #ef4444; }

/* ── Score color bands (percentage — used in assignments table & panel) ─────── */
.score-hi   { color: #15803d; }         /* 90-100 dark green  */
.score-good { color: #22c55e; }         /* 80-89  light green */
.score-ok   { color: rgb(200,220,50); } /* 70-79  yellow-green */
.score-low  { color: #f97316; }         /* 40-69  orange */
.score-bad  { color: #ef4444; }         /* 0-39   red */

/* ── Missing badge ──────────────────────────────────────────────────────────── */
.missing-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fee2e2;
  color: #dc2626;
}

/* ── Admin sidebar nav active ───────────────────────────────────────────────── */
.nav-item.active {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 600;
}

/* ── Table row hover ────────────────────────────────────────────────────────── */
tbody tr:hover {
  background: #f9fafb;
}

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #e5e7eb;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: slide-in 0.2s ease;
}
.toast-success { background: #10b981; color: white; }
.toast-error   { background: #ef4444; color: white; }
.toast-info    { background: #3b82f6; color: white; }
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Assignment detail popup modal ─────────────────────────────────────────── */
.panel-drawer {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(36rem, calc(100vw - 2rem));
  height: fit-content;
  max-height: calc(100vh - 2rem);
  background: #ffffff;
  border-radius: 1.25rem;
  box-shadow: 0 8px 48px rgba(0,0,0,0.22);
  transform: scale(0.95) translateY(12px);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.2s ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  overflow: hidden;
}
.panel-drawer.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
/* On small screens use almost-full-screen */
@media (max-width: 480px) {
  .panel-drawer {
    width: calc(100vw - 1rem);
    height: 85vh;
    max-height: 85vh;
    border-radius: 1rem;
  }
}
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 29;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.panel-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.8125rem;
}
.panel-row:last-child { border-bottom: none; }
.panel-label { color: #9ca3af; font-weight: 500; flex-shrink: 0; }
.panel-value { color: #374151; text-align: right; }

/* ── Incentive award badges ─────────────────────────────────────────────────── */
.award-bill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 0.2rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  background: #15803d;
  letter-spacing: 0.03em;
  cursor: default;
  white-space: nowrap;
}
.award-smile { font-size: 1rem; cursor: default; line-height: 1; }
.award-penalty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: default;
}

/* ── Inline admin form inputs ───────────────────────────────────────────────── */
.form-input-inline {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  color: #111827;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}
.form-input-inline:focus { border-color: #6366f1; }

/* ── Color swatch preview ───────────────────────────────────────────────────── */
.color-swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(0,0,0,0.1);
  display: inline-block;
  vertical-align: middle;
}

/* ── Teacher comment items ───────────────────────────────────────────────────── */
.comment-item {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  max-height: 500px;
  opacity: 1;
}
.comment-item.dismissing {
  max-height: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}
