/* Reflection Feature — MaPaMe */

.reflection-layout {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 64px);
  gap: 0;
}

@media (min-width: 1100px) {
  .reflection-layout {
    flex-direction: row;
  }
}

/* Token canvas panel */
.reflection-token-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #FFF8F0;
  padding: 24px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

@media (min-width: 1100px) {
  .reflection-token-panel {
    width: 45%;
    position: sticky;
    top: 0;
    height: 100vh;
    border-bottom: none;
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
}

.reflection-canvas-wrap {
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: opacity 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reflection-canvas-wrap.fading {
  opacity: 0.25;
}

.reflection-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.reflection-token-meta {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reflection-person-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.reflection-progress-ring {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Question panel */
.reflection-question-panel {
  flex: 1;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

@media (min-width: 1100px) {
  .reflection-question-panel {
    width: 55%;
    padding: 32px 40px;
  }
}

/* Phase content wrapper */
.reflection-phase-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Category bar */
.reflection-cat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.reflection-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s;
  background: var(--bg-card);
}

.reflection-cat-chip:hover {
  border-color: currentColor;
  transform: translateY(-2px);
}

.reflection-cat-chip.active {
  border-color: currentColor;
}

.reflection-cat-chip.done::after {
  content: ' ✓';
  font-weight: 800;
}

/* Person selection screen */
.reflection-person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.reflection-person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 120px;
  text-align: center;
}

.reflection-person-card:active {
  border-color: var(--accent);
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
}

@media (hover: hover) {
  .reflection-person-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.reflection-person-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.reflection-person-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

/* Category selection screen */
.reflection-cat-select-intro {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.reflection-cat-select-subtext {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.reflection-cat-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.reflection-cat-select-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.reflection-cat-select-card:active {
  border-color: currentColor;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
  transform: scale(0.98);
}

@media (hover: hover) {
  .reflection-cat-select-card:hover {
    border-color: currentColor;
    transform: translateY(-2px);
  }
}

.reflection-cat-select-card.selected {
  border-color: currentColor;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

/* Question flow */
.reflection-question-text {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 8px 0;
}

.reflection-person-context {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.reflection-slider-wrap {
  margin: 20px 0;
}

.reflection-slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.reflection-slider {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #E0E0E0, var(--accent));
  outline: none;
  cursor: grab;
}

.reflection-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.15s;
}

.reflection-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.reflection-slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.15s;
}

.reflection-slider::-moz-range-thumb:active {
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.reflection-score-display {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin: 12px 0 20px 0;
}

/* Follow-up inline expansion */
.reflection-followup-area {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.reflection-followup-area.visible {
  max-height: 300px;
  opacity: 1;
  padding: 16px;
  margin-top: 8px;
}

.reflection-probe-question {
  font-size: 1rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 10px;
  min-height: 1.5rem;
}

.reflection-followup-area textarea {
  width: 100%;
  min-height: 80px;
  resize: none;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}

.reflection-followup-area textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Action buttons */
.reflection-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.reflection-btn {
  flex: 1;
  min-width: 140px;
}

.reflection-actions .reflection-btn-secondary {
  flex: 0.5;
}

/* Done screen */
.reflection-done-panel {
  text-align: center;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.reflection-done-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.reflection-done-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.reflection-response-summary {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  margin: 16px 0;
}

.reflection-response-summary h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.reflection-response-item {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 4px 0;
}

.reflection-done-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.reflection-done-actions .btn {
  min-width: 180px;
}

/* Gallery view (reflections list) */
.reflections-empty {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.reflections-empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.reflections-empty-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.reflections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.reflection-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
}

.reflection-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
}

@media (hover: hover) {
  .reflection-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.reflection-card-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #FFF8F0;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.reflection-card-preview canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.reflection-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reflection-card-person {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.reflection-card-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Utility classes */
.reflection-hidden {
  display: none !important;
}

/* Accessibility */
.reflection-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .reflection-question-panel {
    padding: 16px 20px;
  }

  .reflection-cat-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .reflection-question-text {
    font-size: 1.1rem;
  }

  .reflection-score-display {
    font-size: 2rem;
  }

  .reflection-slider {
    height: 6px;
  }

  .reflection-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }

  .reflection-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  .reflection-done-actions {
    flex-direction: column;
  }

  .reflection-done-actions .btn {
    width: 100%;
  }

  .reflections-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}
