/* style.css — Class Schedule Page
   Playful student-dashboard mood: vibrant accent, rounded cards, soft shadows.
   Mobile-first, plain CSS (no build step, no framework). */

/* =====================
   Color palette
   ===================== */
:root {
  --bg: #f9fafb;
  --bg-deep: #fefbff;
  --surface: #ffffff;
  --text: #1f2937;
  --text-secondary: #4b5563;
  --primary: #4f46e5;     /* indigo-600 — 6.3:1 on white, passes WCAG AA */
  --primary-hover: #4338ca;
  --accent: #f97316;     /* coral — energetic accent */
  --accent-dark: #c2410c;  /* darker coral for text on light bg */
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06),
            0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08),
               0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --radius-pill: 999px;
}

/* =====================
   Base / typography
   ===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 1.5rem 1rem;
  max-width: 960px;
  margin: 0 auto;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

/* Centered content container */
.page-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* =====================
   Header
   ===================== */
.page-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--primary);
}

.subtitle {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
}

.sample-notice {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}

/* =====================
   Next upcoming class
   ===================== */
.next-class {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.next-class .section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.next-class-placeholder {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0;
}

/* =====================
   Day filter
   ===================== */
.day-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.filter-btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  min-height: 44px;
  min-width: 44px;
}

.filter-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.filter-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.filter-btn.active:hover {
  background: var(--primary-hover);
}

/* =====================
   Schedule grid
   ===================== */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Mobile: single column */
@media (max-width: 600px) {
  .schedule-grid {
    grid-template-columns: 1fr;
  }

  .primary-btn {
    width: 100%;
    align-self: stretch;
  }
}

/* Day group headers (shown when "All" is selected) */
.day-group-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1.25rem 0 0.5rem;
  grid-column: 1 / -1; /* span full width of the grid */
}

/* =====================
   Class cards
   ===================== */
.class-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  cursor: default;
}

.class-card:hover {
  box-shadow: var(--shadow);
}

.class-card:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.card-day {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.card-time {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 0.25rem;
}

.card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.card-room {
  font-size: 0.9rem;
  color: var(--accent-dark);
  font-weight: 600;
  margin: 0;
}

/* Hidden details — revealed on hover/tap */
.card-details {
  display: none;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
}

.card-details p {
  margin: 0.15rem 0;
  color: var(--text-secondary);
}

/* Card action buttons (Edit / Delete) */
.card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.edit-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  background: var(--bg);
  min-height: 44px;
  min-width: 44px;
  transition: all 0.15s ease;
}

.edit-btn:hover {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

.edit-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.delete-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: #dc2626;
  background: var(--bg);
  min-height: 44px;
  min-width: 44px;
  transition: all 0.15s ease;
}

.delete-btn:hover {
  background: #fef2f2;
  border-color: #dc2626;
}

.delete-btn:focus-visible {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

/* Empty state message */
.empty-message {
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem;
  font-size: 1rem;
}

/* =====================
   Add Class Form
   ===================== */
.add-class-form {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.add-class-form h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-row label,
.form-row .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-row input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  min-height: 44px;
}

.form-row input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-color: var(--primary);
}

.day-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.day-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}

.primary-btn {
  appearance: none;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  min-height: 44px;
  min-width: 44px;
  align-self: flex-start;
}

.primary-btn.update-mode {
  background: #16a34a; /* emerald — signals "save/update" context */
  border-color: #16a34a;
}

.primary-btn.update-mode:hover {
  background: #15803d;
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.primary-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* =====================
   Footer
   ===================== */
.page-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
