/* ==============================================================================
   KHOẢNG NGHỈ CẢM XÚC - MINIMALIST AESTHETIC THEME
   Deep Charcoal / Warm Obsidian (#121214), Ivory (#EAE6DF), Muted Amber (#D4A359)
   ============================================================================== */

:root {
  --bg-primary: #121214;
  --bg-surface: #1a1a1e;
  --bg-surface-elevated: #222228;
  --text-primary: #EAE6DF;
  --text-secondary: #9E9AA0;
  --text-muted: #66636B;
  --accent-amber: #D4A359;
  --accent-amber-glow: rgba(212, 163, 89, 0.22);
  --accent-amber-dim: rgba(212, 163, 89, 0.12);
  --border-color: rgba(234, 230, 223, 0.08);
  --border-focus: rgba(212, 163, 89, 0.4);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --font-serif: "Playfair Display", "Cinzel", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Subtle background vignette & stars */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 15%, rgba(212, 163, 89, 0.05) 0%, transparent 60%),
              radial-gradient(circle at 80% 80%, rgba(34, 34, 40, 0.4) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* Header & Nav */
header {
  padding: 24px 0;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: rgba(18, 18, 20, 0.85);
  backdrop-filter: blur(16px);
  z-index: 100;
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo .dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-amber);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-amber);
}

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-btn:hover, .nav-btn.active {
  color: var(--text-primary);
  background-color: var(--border-color);
}

/* Sections */
main {
  flex: 1;
  padding: 40px 0 80px;
}

.view-section {
  display: none;
  animation: fadeIn 0.5s ease-out forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==============================================================================
   3D CARD FLIP COMPONENT
   ============================================================================== */
.card-scene {
  perspective: 1200px;
  margin: 30px auto 40px;
  width: 100%;
  max-width: 440px;
  height: 580px;
}

.card-flipper {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.card-flipper.flipped {
  transform: rotateY(180deg);
  cursor: default;
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 36px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(234, 230, 223, 0.08);
}

/* Card Back (Mặt Úp ban đầu) */
.card-back {
  background: radial-gradient(circle at 50% 40%, #1e1e24 0%, #141418 100%);
  border: 1px solid rgba(212, 163, 89, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.card-back::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(212, 163, 89, 0.12);
  border-radius: calc(var(--radius-lg) - 4px);
  pointer-events: none;
}

.card-back-ornament {
  width: 100px;
  height: 100px;
  border: 1px solid rgba(212, 163, 89, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
}

.card-back-ornament::before {
  content: "";
  width: 60px;
  height: 60px;
  border: 1px dashed rgba(212, 163, 89, 0.4);
  border-radius: 50%;
  position: absolute;
}

.card-back-ornament svg {
  color: var(--accent-amber);
  opacity: 0.85;
}

.card-back-date {
  font-size: 0.82rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-amber);
  margin-bottom: 12px;
}

.card-back-prompt {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
  max-width: 260px;
  line-height: 1.5;
}

.card-back-hint {
  margin-top: 28px;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Card Front (Mặt Ngửa sau khi lật) */
.card-front {
  background: linear-gradient(165deg, #1b1b20 0%, #131316 100%);
  border: 1px solid rgba(234, 230, 223, 0.12);
  transform: rotateY(180deg);
  overflow-y: auto;
}

.card-front-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-amber);
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 20px;
  font-weight: 500;
}

.card-observation {
  font-size: 0.98rem;
  color: #D2CED6;
  line-height: 1.7;
  margin-bottom: 26px;
  font-weight: 300;
}

.card-mirror-box {
  background: rgba(212, 163, 89, 0.06);
  border-left: 2px solid var(--accent-amber);
  padding: 16px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: auto;
}

.card-mirror-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
  margin-bottom: 6px;
  font-weight: 600;
}

.card-mirror-question {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ==============================================================================
   REFLECTION & INTERACTION CONTROLS
   ============================================================================== */
.reflection-controls {
  margin-top: 36px;
  opacity: 0;
  transform: translateY(12px);
  transition: var(--transition-smooth);
}

.reflection-controls.visible {
  opacity: 1;
  transform: translateY(0);
}

.quick-reactions-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: 0.05em;
}

.quick-reactions-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.reaction-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.reaction-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: rgba(212, 163, 89, 0.3);
}

.reaction-btn.selected {
  background: var(--accent-amber-dim);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  font-weight: 500;
}

/* Journal Input & Voice */
.journal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  position: relative;
  transition: var(--transition-smooth);
}

.journal-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

.journal-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  min-height: 70px;
}

.journal-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.journal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(234, 230, 223, 0.05);
}

.voice-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.voice-btn:hover {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}

.voice-btn.recording {
  background: rgba(235, 87, 87, 0.15);
  border-color: #eb5757;
  color: #eb5757;
  animation: pulseRecording 1.4s infinite;
}

@keyframes pulseRecording {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(235, 87, 87, 0.4); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(235, 87, 87, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(235, 87, 87, 0); }
}

.save-note-btn {
  background: var(--accent-amber);
  color: #121214;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.save-note-btn:hover {
  background: #e2b46f;
  transform: translateY(-1px);
}

/* ==============================================================================
   COMPANION CHAT COMPONENT
   ============================================================================== */
.chat-section {
  margin-top: 50px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mode Switcher Toggle */
.mode-toggle {
  display: flex;
  background: var(--bg-primary);
  padding: 3px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
}

.mode-option {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-xl);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.mode-option.active {
  background: var(--bg-surface-elevated);
  color: var(--accent-amber);
  font-weight: 500;
}

.chat-thread {
  padding: 24px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 82%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.6;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(212, 163, 89, 0.08);
  border: 1px solid rgba(212, 163, 89, 0.2);
  color: #F1EDE6;
  border-bottom-left-radius: 4px;
}

.chat-input-row {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  background: rgba(18, 18, 20, 0.4);
}

.chat-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition-smooth);
}

.chat-input:focus {
  border-color: var(--border-focus);
}

.chat-send-btn {
  background: var(--border-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chat-send-btn:hover {
  background: var(--accent-amber);
  color: #121214;
}

/* ==============================================================================
   ONBOARDING SCREENS
   ============================================================================== */
.onboarding-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.step-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.step-dot {
  flex: 1;
  height: 3px;
  background: var(--border-color);
  border-radius: 2px;
  transition: var(--transition-smooth);
}

.step-dot.active {
  background: var(--accent-amber);
}

.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

.form-control:focus {
  border-color: var(--border-focus);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  cursor: pointer;
}

/* Quiz questions styles */
.quiz-option-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.quiz-option-card:hover {
  background: var(--bg-surface-elevated);
  border-color: rgba(212, 163, 89, 0.3);
}

.quiz-option-card.selected {
  background: var(--accent-amber-dim);
  border-color: var(--accent-amber);
}

.quiz-opt-tag {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(234, 230, 223, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.quiz-option-card.selected .quiz-opt-tag {
  background: var(--accent-amber);
  color: #121214;
}

/* History Timeline */
.history-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  transition: var(--transition-smooth);
}

.history-item:hover {
  border-color: rgba(212, 163, 89, 0.25);
  transform: translateY(-2px);
}

.history-date {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
  margin-bottom: 8px;
}

.history-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.history-obs {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.history-badge {
  display: inline-block;
  font-size: 0.8rem;
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-right: 8px;
}

/* Utility buttons */
.btn-primary {
  width: 100%;
  background: var(--accent-amber);
  color: #121214;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-top: 20px;
}

.btn-primary:hover {
  background: #e2b46f;
  transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 600px) {
  .card-scene {
    height: 520px;
  }
  .onboarding-card {
    padding: 24px 20px;
  }
}
