/**
 * Positive Affirmations — page-specific styles (Phase 1 migration)
 *
 * Extracted from a ~1180-line inline <style> block. Dropped along the way:
 * - The old hidden header (.container-page-header, display:none — the
 *   live header is chrome.css's #stars-header) and everything scoped only
 *   to it: .nav-logo/.nav-title/#staffName/.theme-btn/.dropdown, .badge,
 *   plus its own .page-subtitle override (white text for a gradient hero
 *   background that no longer exists).
 * - body::before/::after decorative radial-gradient + noise-texture
 *   overlays, and the custom body background gradient/font-size — same
 *   "chrome-fighting bloat" pattern dropped from timeout/classroom-tools/
 *   outofclass, base.css already provides the page background.
 * - .dark-mode.* rules — this page's own toggleTheme()/initializeTheme()
 *   toggle a body.dark-mode class, but no #themeToggle button exists in
 *   the live markup (only the hidden old header referenced one), so
 *   these never had a way to fire from user interaction. Theming here is
 *   now handled the same way as every other migrated page: data-theme
 *   attribute via js/dark-mode-toggle.js + dark.css.
 * - .toast/.toast-close and friends — showToast() on this page is a thin
 *   wrapper that unconditionally delegates to window.UnifiedToast (see
 *   toast-manager.js); the static #toast div and its styling were never
 *   actually used.
 * - .unified-action-btn* overrides — only ever used inside the hidden old
 *   header; components.css already provides the real .unified-action-btn
 *   aliases used elsewhere in the app.
 * - .skeleton/.skeleton-text/.skeleton-title/.skeleton-card — duplicated
 *   what css/loading-skeletons.css (still loaded) already provides.
 *
 * --accent (#660000, this page's maroon brand colour) is scoped locally
 * here rather than added to tokens.css, matching how outofclass.html
 * scopes --card-color locally rather than adding a one-page value to the
 * shared token file.
 */

:root {
  --accent: #660000;
  --accent-light: #cc3333;
}

/* ===== Layout ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--sp-6);
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

/* ===== Wizard progress ===== */
.wizard-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--sp-8);
  position: relative;
}
.wizard-progress::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
  transform: translateY(-50%);
  z-index: var(--z-behind);
}
.progress-line {
  position: absolute;
  top: 50%;
  left: 0;
  height: 4px;
  background: var(--accent);
  transform: translateY(-50%);
  width: 0%;
  transition: width 0.5s ease;
  z-index: var(--z-behind);
}
.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  background: var(--bg);
  padding: 0 var(--sp-4);
  min-width: 120px;
}
.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}
.step-label { font-weight: 500; color: var(--text-2); transition: color 0.3s ease; }
.step-description { font-size: 0.8rem; color: var(--text-2); text-align: center; opacity: 0.7; transition: opacity 0.3s ease; }
.wizard-step.active .step-circle { border-color: var(--accent); color: var(--accent); }
.wizard-step.active .step-label { color: var(--accent); font-weight: 600; }
.wizard-step.active .step-description { opacity: 1; color: var(--text-2); }
.wizard-step.completed .step-circle { background: var(--accent); border-color: var(--accent); color: white; }
.wizard-step.completed .step-circle::after { content: "✓"; font-size: 1rem; }

/* ===== Weekly stats line ===== */
.weekly-affirmation-stats {
  text-align: center;
  font-size: 1rem;
  color: var(--text);
  background-color: var(--surface);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  display: inline-block;
  margin-bottom: var(--sp-8);
  box-shadow: var(--sh-sm);
}
#totalWeeklyAffirmationsCount { font-weight: bold; color: var(--accent); }
#totalWeeklyAffirmationsCount.stat-error { color: #b45309; font-weight: 600; font-size: 0.9rem; }

/* ===== Form sections ===== */
.form-section {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  box-shadow: var(--sh-lg);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  margin-bottom: var(--sp-6);
}
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  letter-spacing: -0.01em;
}
.section-title::before {
  content: "";
  width: 5px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: 3px;
}

/* ===== Student search ===== */
.student-search-container { position: relative; margin-bottom: var(--sp-6); }
.search-input {
  width: 100%;
  padding: var(--sp-4) var(--sp-6);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  font-size: 1rem;
  transition: var(--dur-base) var(--ease-out);
  background: var(--surface);
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), var(--sh-md);
}
.search-input:hover:not(:focus) { box-shadow: var(--sh-sm); }
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  display: none;
  margin-top: 4px;
}
.student-option {
  padding: var(--sp-4) var(--sp-6);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--dur-base) var(--ease-out);
}
.student-option:hover { background-color: var(--surface-2); transform: translateX(4px); }
.student-option:last-child { border-bottom: none; }

.selected-students {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  min-height: 120px;
  padding: var(--sp-4);
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
}
.student-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--border);
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.student-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--sh-lg);
  border-color: var(--accent);
}
.student-photo { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); margin-bottom: var(--sp-2); }
.student-name { font-weight: 600; text-align: center; color: var(--text); font-size: 0.9rem; margin-bottom: var(--sp-1); }
.student-details { font-size: 0.8rem; color: var(--text-2); text-align: center; }
.remove-student { background: none; border: none; color: white; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0; margin-left: var(--sp-1); }
.remove-student:hover { opacity: 0.7; }

/* ===== PB4L categories ===== */
.pb4l-categories { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
.category-section {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--sh-sm);
  transition: all 0.3s ease;
}
.category-section:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.category-header {
  background: linear-gradient(135deg, var(--accent), #800000);
  color: white;
  padding: var(--sp-6);
  font-weight: 600;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
}
.category-header:hover { background: linear-gradient(135deg, #800000, var(--accent)); }
.category-toggle { font-size: 1.4rem; transition: transform 0.3s ease; }
.category-content { background: var(--surface); padding: var(--sp-6); display: none; border-top: 1px solid var(--border); }
.category-content.expanded { display: block; }
.context-section { margin-bottom: var(--sp-6); }
.context-section:last-child { margin-bottom: 0; }
.context-title { font-size: 1rem; font-weight: 600; color: var(--accent); margin-bottom: var(--sp-4); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border); }
.affirmation-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-2); }
.affirmation-item { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-4); border-radius: var(--r-sm); cursor: pointer; transition: all 0.2s ease; border: 2px solid transparent; }
.affirmation-item:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); border-color: color-mix(in srgb, var(--accent) 10%, transparent); }
.affirmation-item.selected { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent); }
.affirmation-checkbox { margin-top: 4px; transform: scale(1.2); accent-color: var(--accent); flex-shrink: 0; }
.affirmation-text { font-size: 0.95rem; line-height: 1.5; flex: 1; }
.affirmation-number { font-weight: 600; color: var(--accent); margin-right: var(--sp-2); flex-shrink: 0; }

/* ===== Summary step ===== */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
.summary-section h4 { color: var(--accent); margin-bottom: var(--sp-4); font-size: 1.1rem; }
.summary-list { background: var(--surface-2); border-radius: var(--r-sm); padding: var(--sp-4); min-height: 100px; max-height: 200px; overflow-y: auto; }
.summary-item { padding: var(--sp-2); margin-bottom: var(--sp-1); background: var(--surface); border-radius: 4px; border-left: 3px solid var(--accent); font-size: 0.9rem; }

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
  padding: var(--sp-6);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, transparent);
}
.summary-stat-card {
  text-align: center;
  padding: var(--sp-6);
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.summary-stat-card:hover { transform: translateY(-4px) scale(1.03); box-shadow: var(--sh-lg); }
.summary-stat-card.highlight { background: linear-gradient(135deg, var(--accent), #800000); color: white; }
.summary-stat-card .stat-number { font-size: 2rem; font-weight: 700; margin-bottom: var(--sp-1); }
.summary-stat-card .stat-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; }

.summary-student-info { display: flex; flex-direction: column; gap: 4px; }
.summary-student-details { font-size: 0.8rem; color: var(--text-2); }
.summary-affirmation-count {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 2px 8px;
  border-radius: 12px;
  align-self: flex-start;
}

/* ===== Buttons ===== */
.btn {
  padding: var(--sp-4) var(--sp-8);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  letter-spacing: 0.3px;
  box-shadow: var(--sh-sm);
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #800000; transform: translateY(-1px); box-shadow: var(--sh-lg); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--text-2); color: white; transform: translateY(-1px); box-shadow: var(--sh-lg); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; background: var(--text-2); box-shadow: none; }
.action-buttons { display: flex; gap: var(--sp-6); justify-content: center; margin-top: var(--sp-8); margin-bottom: var(--sp-8); flex-wrap: wrap; }

.loading { display: inline-flex; align-items: center; gap: var(--sp-2); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top: 2px solid var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }

/* ===== Affirmation history ===== */
#affirmationHistorySection { margin-top: var(--sp-8); }
.history-controls { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-6); align-items: flex-end; }
.history-controls .search-input { flex-grow: 1; }
.history-list-item {
  background: var(--surface-2);
  padding: var(--sp-4);
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-4);
  border-left: 4px solid var(--info-500);
  transition: all 0.2s ease;
}
.history-list-item:hover { transform: translateY(-1px); box-shadow: var(--sh-sm); }
.history-list-item p { margin: var(--sp-1) 0; }
.history-list-item strong { color: var(--accent); }
.history-list-item .affirmation-text-history { font-style: italic; color: var(--text-2); }
#affirmationHistoryList { max-height: 300px; overflow-y: auto; padding-right: 10px; }

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-2);
  padding-bottom: var(--sp-1);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 10%, transparent);
}
.history-date { font-size: 0.85rem; color: var(--text-2); background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 2px 8px; border-radius: 12px; }
.history-affirmations ul { margin: 8px 0; padding-left: 20px; }
.history-affirmations li { margin-bottom: 4px; font-style: italic; color: var(--text-2); }
.history-footer { margin-top: var(--sp-2); padding-top: var(--sp-1); border-top: 1px solid color-mix(in srgb, var(--accent) 10%, transparent); }
.history-staff { font-size: 0.85rem; color: var(--accent); font-weight: 500; }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .summary-grid { grid-template-columns: 1fr; gap: var(--sp-8); }
}
@media (max-width: 768px) {
  .container { padding: var(--sp-4); gap: var(--sp-4); }
  .form-section { padding: var(--sp-4); margin-bottom: var(--sp-4); }
  .action-buttons { flex-direction: column; align-items: center; gap: var(--sp-2); }
  .btn { width: 100%; max-width: 280px; padding: var(--sp-4); }
  .history-controls { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
  .summary-grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .selected-students { grid-template-columns: 1fr; gap: var(--sp-2); }
}
@media (max-width: 480px) {
  .section-title { font-size: 1.3rem; }
  .form-section { padding: var(--sp-2); }
  .container { padding: var(--sp-2); }
  .btn { padding: var(--sp-2) var(--sp-4); }
}

/* ===== Focus ring ===== */
.search-input:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
