/**
 * Ember — Component Library
 * Wizard stages, emotion selector cards, recovery timeline cards, science tooltips
 */

/* ==========================================================================
   WIZARD CONTAINER & PROGRESS BAR
   ========================================================================== */
.wizard-container {
  max-width: 800px;
  margin: 2rem auto 4rem;
  background-color: var(--bg-surface);
  border: var(--card-hairline);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--card-shadow), var(--card-inner-highlight);
  position: relative;
}

.wizard-progress-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  position: relative;
}

.wizard-progress-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--border-subtle);
  transform: translateY(-50%);
  z-index: 1;
}

.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent-ember) 100%);
  width: 25%;
  transition: width var(--transition-normal);
}

.wizard-step-node {
  position: relative;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 2px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.wizard-step-node.active {
  border-color: var(--primary);
  background-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 0 12px var(--primary-glow);
}

.wizard-step-node.completed {
  border-color: var(--accent-emerald);
  background-color: var(--accent-emerald);
  color: #FFFFFF;
}

/* WIZARD PANELS */
.wizard-panel {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.wizard-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-header {
  margin-bottom: 2rem;
  text-align: center;
}

.wizard-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.wizard-header p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ==========================================================================
   STEP 1: EMOTION SELECTOR CARDS
   ========================================================================== */
.emotion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.emotion-card {
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  user-select: none;
  position: relative;
}

.emotion-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.emotion-card.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.emotion-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.emotion-emoji {
  font-size: 1.65rem;
}

.emotion-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.emotion-card.selected .emotion-title {
  color: var(--primary-hover);
}

.emotion-slider-container {
  display: none;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.emotion-card.selected .emotion-slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.emotion-slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.emotion-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   STEP 2: ACADEMIC CONTEXT SELECTORS
   ========================================================================== */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-select, .form-input, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--border-focus);
}

.pill-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill-option {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-raised);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.pill-option:hover {
  border-color: var(--border-strong);
}

.pill-option.active {
  background-color: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.toggle-info h4 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
}

.toggle-info p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-strong);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* ==========================================================================
   STEP 3: TASK DECOMPOSITION INPUT
   ========================================================================== */
.task-input-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.task-item-title {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9375rem;
}

.task-item-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.task-size-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  color: var(--primary);
}

.task-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
}

.task-delete-btn:hover {
  color: var(--accent-rose);
}

/* ==========================================================================
   STEP 4: SYNTHESIS LOADING STATE
   ========================================================================== */
.synthesis-card {
  text-align: center;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.synthesis-flame {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-ember) 0%, var(--primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 30px var(--accent-ember-glow);
  animation: pulse-grow 1.5s infinite alternate ease-in-out;
}

@keyframes pulse-grow {
  from { transform: scale(0.95); }
  to { transform: scale(1.1); }
}

.synthesis-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
  width: 100%;
  text-align: left;
}

.synthesis-step-line {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.synthesis-step-line.done {
  color: var(--accent-emerald);
  font-weight: 700;
}

/* WIZARD ACTIONS FOOTER */
.wizard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 1rem;
}

/* ==========================================================================
   PROTOCOL PAYOFF DASHBOARD (protocol.html)
   ========================================================================== */
.protocol-header-card {
  background-color: var(--bg-surface);
  border: var(--card-hairline);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--card-shadow), var(--card-inner-highlight);
}

.protocol-action-bar {
  display: none;
}

.protocol-badge-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.severity-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.severity-mild { background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0; }
.severity-moderate { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.severity-high { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.severity-critical { background: #450A0A; color: #FCA5A5; border: 1px solid #7F1D1D; animation: pulse-glow 2s infinite; }

.protocol-insight-text {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-top: 1rem;
  font-weight: 500;
  border-left: 3px solid var(--primary);
  padding-left: 1.25rem;
}

/* Crisis Advisory Notice */
.crisis-advisory {
  background-color: var(--accent-amber-bg);
  border: 1px solid var(--accent-amber-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.crisis-text h5 {
  color: #92400E;
  font-weight: 800;
  font-size: 0.9375rem;
}

.crisis-text p {
  color: #B45309;
  font-size: 0.8125rem;
}

/* 48-Hour Timeline Sections */
.timeline-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.timeline-phase-card {
  background-color: var(--bg-surface);
  border: var(--card-hairline);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--card-shadow), var(--card-inner-highlight);
}

.phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.phase-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.phase-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.action-items-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.action-card {
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all var(--transition-fast);
}

.action-card.checked {
  opacity: 0.6;
  text-decoration: line-through;
}

.action-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.action-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  margin-top: 3px;
  cursor: pointer;
}

.action-content {
  flex: 1;
}

.action-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.action-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.action-science-trigger {
  color: var(--primary);
  font-size: 0.75rem;
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
  padding: 0;
}

.action-science-body {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background-color: var(--bg-surface);
  border-left: 2px solid var(--accent-emerald);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8125rem;
  color: var(--text-body);
}

.action-science-body.open {
  display: block;
}

/* Micro-Task Decomposition Section */
.decomposed-tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.subtask-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.subtask-card h5 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.subtask-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-body);
}

.subtask-steps li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


/* WOW FEATURES CSS */

/* Decompress / Panic Button */
.decompress-trigger-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--bg-surface-raised);
  color: var(--primary);
  border: 1px solid var(--border-color);
  padding: 12px 24px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  z-index: 99;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}
.decompress-trigger-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  background: var(--bg-surface);
}
[data-theme="dark"] .decompress-trigger-btn {
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

/* Decompress Modal */
.decompress-modal, .focus-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(15px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.decompress-modal.active, .focus-modal.active {
  opacity: 1;
  pointer-events: all;
}
[data-theme="light"] .decompress-modal, [data-theme="light"] .focus-modal {
  background: rgba(255,255,255,0.85);
}

.decompress-close-btn, .focus-close-btn {
  position: absolute;
  top: 30px;
  right: 40px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-family: var(--font-display);
  cursor: pointer;
}

.decompress-content {
  text-align: center;
  color: var(--text-primary);
}
.decompress-content h2 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.decompress-content p {
  font-family: var(--font-body);
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

.breathing-circle-container {
  width: 250px;
  height: 250px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.breathing-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.8;
  box-shadow: 0 0 50px var(--primary);
  transition: transform 4s ease-in-out;
}

.breathing-instruction {
  margin-top: 3rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: opacity 0.5s ease;
}

/* Focus Modal */
.focus-modal-content {
  text-align: center;
  max-width: 600px;
  width: 100%;
}
.focus-task-title {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--text-primary);
}
.focus-timer {
  font-family: var(--font-mono);
  font-size: 8rem;
  line-height: 1;
  font-weight: 500;
  margin-bottom: 3rem;
  color: var(--primary);
  text-shadow: 0 0 40px rgba(234, 88, 12, 0.3);
}
.focus-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Button override for print inside JS injection */
.focus-mode-btn {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  margin-left: 10px;
  transition: all 0.2s;
  color: var(--text-primary);
}
.focus-mode-btn:hover {
  background: var(--primary);
  color: white;
}
