/* ==========================================================================
   Reusable Components Styling
   ========================================================================== */

/* --------------------------------------------------------------------------
   Save Indicator Component
   -------------------------------------------------------------------------- */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-light);
  transition: all var(--transition-normal);
  user-select: none;
}

.save-indicator.saving {
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}

.save-indicator.saved {
  color: var(--color-success);
  border-color: var(--color-success);
}

.save-indicator.error {
  color: var(--color-error);
  border-color: var(--color-error);
  cursor: pointer;
}

.save-indicator-icon {
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
}

/* --------------------------------------------------------------------------
   Progress Dots & Progress Bar Component
   -------------------------------------------------------------------------- */
.progress-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  padding: var(--space-xs) 0;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background-color: var(--color-border);
  border: 2px solid transparent;
  transition: all var(--transition-bounce);
  cursor: pointer;
  padding: 0;
  min-width: 12px;
  min-height: 12px;
}

.progress-dot:hover {
  transform: scale(1.25);
}

.progress-dot.active {
  background-color: var(--color-primary);
  border-color: #FFFFFF;
  transform: scale(1.4);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.3);
}

.progress-dot.completed {
  background-color: var(--color-calm);
  border-color: #FFFFFF;
}

/* Mobile Progress Bar Alternate */
.progress-bar-mobile {
  display: none;
  width: 100%;
  height: 8px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-calm));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* --------------------------------------------------------------------------
   Navigation Circle Buttons
   -------------------------------------------------------------------------- */
.nav-arrow-btn {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-md);
  border: none;
  transition: all var(--transition-fast);
}

.nav-arrow-btn:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
  transform: scale(1.08);
  box-shadow: var(--shadow-lg);
}

.nav-arrow-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.nav-arrow-btn:disabled {
  background-color: var(--color-border);
  color: var(--color-text-light);
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.nav-arrow-btn.finish-btn {
  background: linear-gradient(135deg, var(--color-calm) 0%, var(--color-success) 100%);
  width: auto;
  padding: 0 var(--space-lg);
  font-size: var(--text-base);
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   Loading Overlay & Spinner
   -------------------------------------------------------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(255, 249, 240, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  gap: var(--space-md);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary-dark);
}

/* --------------------------------------------------------------------------
   1. Text Input Component
   -------------------------------------------------------------------------- */
.form-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
}

.form-input-label {
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.form-text-input {
  width: 100%;
  min-height: 52px;
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all var(--transition-fast);
}

.form-text-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
  outline: none;
}

textarea.form-text-input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.4;
}

.form-input-counter {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  text-align: right;
}

/* --------------------------------------------------------------------------
   2. Chip Selector Component (Single & Multi Select)
   -------------------------------------------------------------------------- */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  width: 100%;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px 18px;
  min-height: 48px;
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.chip-btn:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-primary-light);
  transform: translateY(-1px);
}

.chip-btn.selected {
  background-color: #EFEBFF;
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
  box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.25);
  animation: bounceIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chip-icon {
  font-size: 1.25rem;
}

.chip-check {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-left: 2px;
}

/* --------------------------------------------------------------------------
   3. Feeling Selector Component (Cards Grid)
   -------------------------------------------------------------------------- */
.feeling-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  width: 100%;
}

.feeling-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-sm);
  border-radius: var(--radius-lg);
  border: 3px solid transparent;
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
  min-height: 110px;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  user-select: none;
}

.feeling-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.feeling-card:active {
  transform: scale(0.96);
}

/* Card Feeling-Specific Backgrounds & Borders */
.feeling-card[data-feeling="happy"] {
  background-color: rgba(var(--color-happy-rgb), 0.18);
}
.feeling-card[data-feeling="happy"].selected {
  border-color: var(--color-happy);
  box-shadow: 0 0 0 3px rgba(var(--color-happy-rgb), 0.4);
}

.feeling-card[data-feeling="sad"] {
  background-color: rgba(var(--color-sad-rgb), 0.18);
}
.feeling-card[data-feeling="sad"].selected {
  border-color: var(--color-sad);
  box-shadow: 0 0 0 3px rgba(var(--color-sad-rgb), 0.4);
}

.feeling-card[data-feeling="angry"] {
  background-color: rgba(var(--color-angry-rgb), 0.18);
}
.feeling-card[data-feeling="angry"].selected {
  border-color: var(--color-angry);
  box-shadow: 0 0 0 3px rgba(var(--color-angry-rgb), 0.4);
}

.feeling-card[data-feeling="worried"] {
  background-color: rgba(var(--color-worried-rgb), 0.18);
}
.feeling-card[data-feeling="worried"].selected {
  border-color: var(--color-worried);
  box-shadow: 0 0 0 3px rgba(var(--color-worried-rgb), 0.4);
}

.feeling-card[data-feeling="excited"] {
  background-color: rgba(var(--color-excited-rgb), 0.18);
}
.feeling-card[data-feeling="excited"].selected {
  border-color: var(--color-excited);
  box-shadow: 0 0 0 3px rgba(var(--color-excited-rgb), 0.4);
}

.feeling-card[data-feeling="calm"] {
  background-color: rgba(var(--color-calm-rgb), 0.18);
}
.feeling-card[data-feeling="calm"].selected {
  border-color: var(--color-calm);
  box-shadow: 0 0 0 3px rgba(var(--color-calm-rgb), 0.4);
}

.feeling-emoji {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1;
  margin-bottom: var(--space-xs);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.feeling-label {
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--color-text);
  text-transform: capitalize;
}

.feeling-audio-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.feeling-audio-btn:hover {
  background-color: #FFFFFF;
  transform: scale(1.15);
}

@media (max-width: 600px) {
  .feeling-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   4. Audio Player Component
   -------------------------------------------------------------------------- */
.audio-player-wrapper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 6px 16px 6px 8px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}

.audio-play-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #FFFFFF;
  font-size: 1.1rem;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.audio-play-btn:hover {
  background: var(--color-primary-dark);
  transform: scale(1.08);
}

.audio-progress-bar-container {
  width: 120px;
  height: 6px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  cursor: pointer;
}

.audio-progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}

.audio-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

.audio-time {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-light);
  min-width: 32px;
}

/* --------------------------------------------------------------------------
   5. Voice Recorder Component
   -------------------------------------------------------------------------- */
.recorder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  width: 100%;
  gap: var(--space-md);
  text-align: center;
}

.recorder-prompt {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.record-action-btn {
  width: 68px;
  height: 68px;
  min-width: 68px;
  min-height: 68px;
  border-radius: 50%;
  border: none;
  font-size: 1.75rem;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-bounce);
}

.record-action-btn.start-rec {
  background: var(--color-error);
}

.record-action-btn.start-rec:hover {
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(244, 67, 54, 0.4);
}

.record-action-btn.stop-rec {
  background: #2D2D2D;
  animation: pulseGlow 1.5s infinite;
}

.recording-timer {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--color-error);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.recorder-actions-row {
  display: flex;
  gap: var(--space-md);
  width: 100%;
  justify-content: center;
  margin-top: var(--space-sm);
}

/* --------------------------------------------------------------------------
   6. Breathing Activity Component
   -------------------------------------------------------------------------- */
.breathing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #F4FFF8 0%, #E8F8F0 100%);
  border: 2px solid var(--color-calm);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  width: 100%;
  gap: var(--space-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.breathing-circle-outer {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.breathing-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-calm) 0%, #A5F0C8 100%);
  box-shadow: 0 0 30px rgba(126, 214, 166, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  transition: transform 4s ease-in-out;
}

.breathing-circle.inhale {
  transform: scale(1.9);
}

.breathing-circle.exhale {
  transform: scale(1);
}

.breathing-instruction {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: #246B46;
}

.breathing-cycle-badge {
  font-size: var(--text-sm);
  font-weight: 800;
  color: #246B46;
  background: #FFFFFF;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-calm);
}

/* --------------------------------------------------------------------------
   7. Drag & Match Component
   -------------------------------------------------------------------------- */
.drag-match-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  width: 100%;
}

.match-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.match-item-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  min-height: 64px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.match-item-card:hover:not(.matched) {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.match-item-card.active-selection {
  border-color: var(--color-primary);
  background-color: #EFEBFF;
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.3);
}

.match-item-card.matched {
  border-color: var(--color-success);
  background-color: #F1FBF4;
  color: #246B46;
  cursor: default;
}

/* --------------------------------------------------------------------------
   8. Feelings Wheel Component
   -------------------------------------------------------------------------- */
.feelings-wheel-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
}

.wheel-svg-container {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1;
  position: relative;
}

.wheel-svg {
  width: 100%;
  height: 100%;
  transform-origin: center;
}

.wheel-slice {
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  stroke: #FFFFFF;
  stroke-width: 3px;
}

.wheel-slice:hover {
  opacity: 0.85;
}

.wheel-slice.active-slice {
  stroke: var(--color-primary);
  stroke-width: 5px;
}

/* --------------------------------------------------------------------------
   9. Confetti Celebration Component
   -------------------------------------------------------------------------- */
.confetti-canvas-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* --------------------------------------------------------------------------
   10. Action Badges (Consistent Visual Language)
   -------------------------------------------------------------------------- */
.action-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
  width: fit-content;
}

.action-badge.badge-look {
  background: #EBF5FF;
  color: #1A56DB;
  border: 1.5px solid #C3DDFD;
}

.action-badge.badge-think {
  background: #FEF9C3;
  color: #854D0E;
  border: 1.5px solid #FDE047;
}

.action-badge.badge-choose {
  background: #F3E8FF;
  color: #6B21A8;
  border: 1.5px solid #E9D5FF;
}

.action-badge.badge-create {
  background: #FFE4E6;
  color: #BE123C;
  border: 1.5px solid #FECDD3;
}

.action-badge.badge-record {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1.5px solid #FECACA;
}

.action-badge.badge-breathe {
  background: #E8F8F0;
  color: #15803D;
  border: 1.5px solid #BBF7D0;
}

.action-badge.badge-say {
  background: #FFEDD5;
  color: #C2410C;
  border: 1.5px solid #FED7AA;
}

/* Large Start Button for Page 1 */
.start-booklet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #FFFFFF;
  font-size: var(--text-xl);
  font-weight: 800;
  padding: 16px 36px;
  min-height: 60px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.35);
  transition: all var(--transition-bounce);
}

.start-booklet-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 25px rgba(var(--color-primary-rgb), 0.45);
}

.start-booklet-btn:active {
  transform: scale(0.96);
}

