/* ==========================================================================
   HELLOMYFRD.COM - DESIGN SYSTEM & STYLESHEET
   Harmonious, Glassmorphic, and Highly Aesthetic Mental Wellness Space
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Imports & Global Custom Variables
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Lora:ital,wght@0,400;0,500;1,400&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Common System Values */
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Lora', Georgia, serif;
}

/* 1. DUSK THEME (Dark, Soothing, Starry Night) */
.theme-dusk {
  --bg-primary: #0a0c16;
  --bg-surface: rgba(18, 22, 38, 0.45);
  --bg-surface-hover: rgba(26, 32, 54, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: rgba(147, 197, 253, 0.4);
  --text-primary: #f1f3f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #93c5fd;         /* Soft lavender-blue */
  --accent-rgb: 147, 197, 253;
  --accent-teal: #2dd4bf;    /* Tranquil teal */
  --accent-rose: #fda4af;    /* Sunset rose */
  --glow-color: rgba(147, 197, 253, 0.12);
  --bubble-user: rgba(147, 197, 253, 0.15);
  --bubble-companion: rgba(255, 255, 255, 0.05);
  --chat-status-bg: rgba(255, 255, 255, 0.02);
  --chat-input-bg: rgba(0, 0, 0, 0.12);
  
  /* Aurora Colors */
  --glow-1: rgba(110, 68, 255, 0.15);
  --glow-2: rgba(45, 212, 191, 0.12);
  --glow-3: rgba(244, 63, 94, 0.08);
}

/* 2. ZEN GARDEN THEME (Light, Grounded, Botanical Green) */
.theme-zen {
  --bg-primary: #f3f5f2;
  --bg-surface: rgba(255, 255, 255, 0.45);
  --bg-surface-hover: rgba(255, 255, 255, 0.7);
  --border-color: rgba(0, 0, 0, 0.06);
  --border-color-focus: rgba(46, 125, 50, 0.3);
  --text-primary: #1c271e;
  --text-secondary: #4a5c4e;
  --text-muted: #788a7c;
  --accent: #2e7d32;         /* Deep leaf green */
  --accent-rgb: 46, 125, 50;
  --accent-teal: #00796b;    /* Deep ocean water */
  --accent-rose: #c2185b;    /* Warm terracotta */
  --glow-color: rgba(46, 125, 50, 0.06);
  --bubble-user: rgba(46, 125, 50, 0.12);
  --bubble-companion: rgba(0, 0, 0, 0.04);
  --chat-status-bg: rgba(0, 0, 0, 0.02);
  --chat-input-bg: rgba(0, 0, 0, 0.04);
  
  /* Aurora Colors */
  --glow-1: rgba(46, 125, 50, 0.1);
  --glow-2: rgba(0, 121, 107, 0.08);
  --glow-3: rgba(194, 24, 91, 0.05);
}

/* --------------------------------------------------------------------------
   1. Base Setup & Body Style
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background-color var(--transition-slow);
}

/* Soothing Radial Aurora Glows */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: screen;
  transition: background var(--transition-slow);
}
.theme-zen .ambient-glow {
  mix-blend-mode: multiply;
  filter: blur(120px);
}

.bg-glow-1 {
  width: 50vw;
  height: 50vw;
  background: var(--glow-1);
  top: -10vw;
  right: -10vw;
}

.bg-glow-2 {
  width: 45vw;
  height: 45vw;
  background: var(--glow-2);
  bottom: -5vw;
  left: -10vw;
}

.bg-glow-3 {
  width: 35vw;
  height: 35vw;
  background: var(--glow-3);
  top: 30%;
  left: 30%;
}

/* Glassmorphism Class Helper */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
  transition: background-color var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium);
}

.glass-panel:hover {
  background: var(--bg-surface-hover);
}

/* Dynamic Buttons */
.action-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-teal));
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.2);
  transition: transform var(--transition-fast), filter var(--transition-fast), box-shadow var(--transition-fast);
}
.theme-zen .action-btn {
  color: #ffffff;
}

.action-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.35);
  transform: translateY(-1px);
}

.action-btn:active {
  transform: translateY(1px);
}

.secondary-btn {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.secondary-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   2. Safety Banner & Core Layout
   -------------------------------------------------------------------------- */
.safety-banner {
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.15) 0%, rgba(244, 63, 94, 0.15) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(251, 146, 60, 0.2);
  color: var(--text-primary);
  padding: 10px 24px;
  position: relative;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform var(--transition-medium), opacity var(--transition-medium);
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.safety-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 90%;
  margin: 0 auto;
}

.safety-text {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  text-align: center;
}

.safety-text a {
  color: var(--accent-rose);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: opacity var(--transition-fast);
}

.safety-text a:hover {
  opacity: 0.8;
}

.safety-dismiss {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.safety-dismiss:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.safety-banner.collapsed {
  transform: translateY(-100%);
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

/* App Core Container Grid */
.app-layout {
  display: flex;
  min-height: calc(100vh - 45px); /* Subtract height of safety banner */
  position: relative;
}

/* --------------------------------------------------------------------------
   3. Sidebar & Navigation (Desktop & Responsive Mobile)
   -------------------------------------------------------------------------- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-surface);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid var(--border-color);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 50;
  transition: width var(--transition-medium);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 12px;
  margin-bottom: 40px;
}

.brand-logo {
  font-size: 24px;
  filter: drop-shadow(0 2px 8px var(--glow-color));
}

.brand-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-btn {
  width: 100%;
  background: transparent;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.nav-btn:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-btn.active {
  background-color: var(--bg-surface-hover);
  color: var(--accent);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px -5px rgba(0, 0, 0, 0.05);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

/* Elegant Theme Switcher Button */
.theme-toggle-btn {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 10px -5px rgba(0,0,0,0.05);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  transform: scale(1.02);
}

.theme-toggle-btn:active {
  transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   4. Content Pane & Views Handling
   -------------------------------------------------------------------------- */
.content-pane {
  flex-grow: 1;
  padding: 40px 60px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 45px);
  display: flex;
  flex-direction: column;
}

.app-view {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  animation: viewFadeIn var(--transition-slow) forwards;
}

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

@keyframes viewFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  margin-bottom: 36px;
}

.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.welcome-text {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.subtitle-text {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 300;
  max-width: 700px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   5. View - Dashboard Home
   -------------------------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

.dashboard-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.card-action-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: transform var(--transition-medium), color var(--transition-fast);
}

.card-action-btn:hover {
  transform: rotate(45deg);
  color: var(--accent);
}

/* Affirmation Card */
.affirmation-card {
  grid-column: 1 / 2;
  min-height: 200px;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--bg-surface), rgba(var(--accent-rgb), 0.05));
}

.wisdom-text {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.6;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 12px;
  transition: opacity var(--transition-medium);
}

.wisdom-author {
  font-family: var(--font-sans);
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  transition: opacity var(--transition-medium);
}

/* Mood quick picker */
.mood-prompt-card {
  grid-column: 2 / 3;
  justify-content: center;
}

.card-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-weight: 300;
  line-height: 1.5;
}

.quick-mood-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.quick-mood-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 16px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.quick-mood-btn:hover {
  background: var(--bg-surface);
  transform: translateY(-3px);
  border-color: var(--accent);
}

.quick-mood-label {
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-secondary);
}

.quick-mood-btn:hover .quick-mood-label {
  color: var(--text-primary);
}

/* Gratitude Journal List */
.gratitude-card {
  grid-column: 2 / 3;
}

.gratitude-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.gratitude-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 12px;
  transition: border-color var(--transition-fast);
}

.gratitude-item:focus-within {
  border-color: var(--border-color-focus);
}

.gratitude-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.gratitude-field {
  flex-grow: 1;
  background: transparent;
  border: none;
  padding: 10px 0;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}

.gratitude-field::placeholder {
  color: var(--text-muted);
  font-weight: 300;
}

.gratitude-save-btn {
  align-self: flex-start;
  font-size: 13px;
  padding: 10px 20px;
}

.save-indicator {
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent-teal);
  font-weight: 500;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.save-indicator.visible {
  opacity: 1;
}

/* Core features tiles showcase */
.features-showcase {
  grid-column: 1 / 2;
}

.features-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-tile {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 18px 24px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  text-align: left;
  transition: transform var(--transition-medium), background var(--transition-fast), border-color var(--transition-fast);
}

.feature-tile:hover {
  transform: translateY(-2px);
  background: var(--bg-surface);
  border-color: var(--border-color-focus);
}

.tile-icon {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 10px var(--glow-color));
}

.tile-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tile-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
}

.tile-description {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   6. View - Empathetic Chat (Companion Lyra)
   -------------------------------------------------------------------------- */
.clear-chat-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transition-fast), border var(--transition-fast);
}

.clear-chat-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.chat-container {
  height: calc(100vh - 250px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-status-bar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--chat-status-bg);
}

.companion-avatar-glow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(253, 164, 189, 0.4), rgba(147, 197, 253, 0.4));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 15px var(--glow-color);
  position: relative;
}

.companion-status-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.companion-name {
  font-weight: 600;
  font-size: 15px;
}

.companion-status-indicator {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-teal);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-teal);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Chat logs stream */
.chat-history {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Chat Bubbles */
.chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.chat-bubble-wrapper.user {
  align-self: flex-end;
}

.chat-bubble-wrapper.companion {
  align-self: flex-start;
}

.chat-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
}

.user .chat-bubble {
  background-color: var(--bubble-user);
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.companion .chat-bubble {
  background-color: var(--bubble-companion);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-time-tag {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.user .chat-time-tag {
  text-align: right;
}

/* Typing indicator dot elements */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 20px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  opacity: 0.4;
  animation: typingJolt 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingJolt {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* Quick response chips */
.chat-suggestions-container {
  padding: 12px 24px;
  border-top: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.05);
}

.suggestion-prompt {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}

.chat-suggestions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.suggestion-pill {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.suggestion-pill:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Input Form Bar */
.chat-input-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  background: var(--chat-input-bg);
}

.chat-text-field {
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  padding: 14px 20px;
  border-radius: 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.chat-text-field:focus {
  border-color: var(--border-color-focus);
  background-color: rgba(0, 0, 0, 0.15);
}

.chat-send-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-teal));
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.chat-send-btn:hover {
  filter: brightness(1.05);
  transform: scale(1.02);
}

.chat-send-btn:active {
  transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   7. View - Breathing Guide
   -------------------------------------------------------------------------- */
.breathing-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
}

.breathing-visual-container {
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 450px;
}

.breathing-status-banner {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 30px;
}

/* Glowing Pulsing breathing elements */
.breathing-circle-wrapper {
  position: relative;
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
}

.breathing-progress-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  z-index: 2;
  pointer-events: none;
}

.progress-ring-indicator {
  transition: stroke-dashoffset 0.1s linear;
}

.breathing-core-circle {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(45, 212, 191, 0.1));
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 0 40px -10px var(--glow-color);
  transition: transform 1s ease-in-out, background var(--transition-slow);
}

/* Pulsing effect in breath sync */
.breathing-core-circle.inhale {
  animation: glowPulseInhale 4s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.breathing-core-circle.exhale {
  animation: glowPulseExhale 6s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.breathing-text-instruction {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  transition: color var(--transition-fast);
}

.breathing-time-counter {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}

.breathing-control-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.start-breathing-btn {
  min-width: 180px;
}

.cycle-tally {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Breathing Config Panel */
.breathing-settings-container {
  padding: 32px;
}

.settings-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 20px;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.settings-title-sub {
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
}

.settings-group {
  margin-bottom: 28px;
}

.settings-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 12px;
}

.technique-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tech-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.tech-card:hover {
  background: var(--bg-surface);
}

.tech-card.active {
  border-color: var(--accent);
  background: var(--bg-surface-hover);
}

.tech-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.tech-desc {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.4;
}

/* Web Audio Synthesizer toggle */
.sound-control-panel {
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.sound-toggle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sound-desc {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.4;
  margin-bottom: 16px;
}

.volume-slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Custom volume sliders */
.volume-slider-group input[type="range"] {
  flex-grow: 1;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.06);
  height: 6px;
  border-radius: 3px;
  outline: none;
}

.volume-slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.volume-slider-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Accessible Switch toggle slider */
.switch-control {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.06);
  transition: .3s;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .3s;
  border-radius: 50%;
}

.switch-control input:checked + .switch-slider {
  background-color: rgba(var(--accent-rgb), 0.1);
  border-color: var(--accent);
}

.switch-control input:checked + .switch-slider:before {
  transform: translateX(24px);
  background-color: var(--accent);
}

/* Keyframes animations for breathing */
@keyframes glowPulseInhale {
  from {
    transform: scale(1);
    background: rgba(var(--accent-rgb), 0.1);
  }
  to {
    transform: scale(1.35);
    background: rgba(var(--accent-rgb), 0.25);
    box-shadow: 0 0 50px 0px rgba(var(--accent-rgb), 0.35);
  }
}

@keyframes glowPulseExhale {
  from {
    transform: scale(1.35);
    background: rgba(var(--accent-rgb), 0.25);
    box-shadow: 0 0 50px 0px rgba(var(--accent-rgb), 0.35);
  }
  to {
    transform: scale(1);
    background: rgba(var(--accent-rgb), 0.1);
    box-shadow: 0 0 20px 0px rgba(var(--accent-rgb), 0.1);
  }
}

/* --------------------------------------------------------------------------
   8. View - Mood Log & Worry Dissolving Box
   -------------------------------------------------------------------------- */
.mood-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
}

.mood-logging-zone {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mood-input-card, .mood-history-card {
  padding: 32px;
}

.mood-picker-group {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 24px;
}

.mood-select-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 18px 10px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-fast);
}

.mood-select-btn:hover {
  background: var(--bg-surface);
  transform: translateY(-2px);
}

.mood-select-btn.selected {
  border-color: var(--accent);
  background-color: var(--bg-surface-hover);
  box-shadow: 0 6px 15px -5px rgba(var(--accent-rgb), 0.2);
}

.mood-emoji {
  font-size: 26px;
}

.mood-text-label {
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-secondary);
}

.mood-select-btn.selected .mood-text-label {
  color: var(--accent);
  font-weight: 600;
}

.journal-reason-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.journal-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.journal-field {
  background: rgba(0,0,0,0.08);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 12px;
  min-height: 80px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.journal-field:focus {
  border-color: var(--border-color-focus);
}

.save-mood-btn {
  align-self: flex-start;
}

/* Dynamic SVG Analytics Chart styling */
.mood-trend-chart-wrapper {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 32px;
}

.mood-trend-svg {
  width: 100%;
  height: 220px;
}

.chart-line {
  stroke: var(--accent);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: drawChartLine 1.5s forwards ease-out;
}

@keyframes drawChartLine {
  from { stroke-dasharray: 1000; stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

.chart-gradient-area {
  fill: url(#chartGlow);
}

.chart-dot {
  fill: var(--accent-teal);
  stroke: var(--text-primary);
  stroke-width: 2;
  cursor: pointer;
  transition: r var(--transition-fast), fill var(--transition-fast);
}

.chart-dot:hover {
  r: 6;
  fill: var(--accent);
}

.chart-grid-line {
  stroke: var(--border-color);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart-axis {
  stroke: var(--border-color);
  stroke-width: 1;
}

.chart-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-sans);
  text-anchor: middle;
}

/* Worry Dissolving Box Canvas */
.worry-dissolving-zone {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.worry-interaction-wrapper {
  flex-grow: 1;
  position: relative;
  min-height: 320px;
  margin-top: 24px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color);
}

.worry-canvas {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 5;
  pointer-events: none;
}

.worry-input-box {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
}

.worry-textarea {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
}

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

.dissolve-btn {
  align-self: flex-end;
}

.worry-completion-msg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.worry-completion-msg.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  z-index: 15;
}

.completion-icon {
  font-size: 40px;
  margin-bottom: 16px;
  filter: drop-shadow(0 2px 10px var(--glow-color));
}

.completion-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 8px;
}

.completion-desc {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 300;
  max-width: 280px;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* --------------------------------------------------------------------------
   9. View - Crisis Safety Resources
   -------------------------------------------------------------------------- */
.safety-resources-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.safety-alert-card {
  border-left: 4px solid var(--accent-rose);
  padding: 24px;
}

.warning-title {
  color: var(--accent-rose);
  margin-bottom: 8px;
}

.crisis-card-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  font-weight: 400;
}

.section-subtitle-title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: -12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.crisis-cards-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.crisis-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
}

.crisis-card-badge {
  align-self: flex-start;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.08);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.crisis-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.crisis-info {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-weight: 300;
  margin-bottom: 20px;
}

.crisis-actions {
  display: flex;
  gap: 10px;
}

.crisis-action-btn {
  flex: 1;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.crisis-action-btn:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.crisis-action-btn.primary-action {
  background: var(--accent);
  color: var(--bg-primary);
}

.crisis-action-btn.secondary-action {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --------------------------------------------------------------------------
   10. Media Queries - Responsive Design for Tablets and Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .dashboard-grid, .breathing-grid, .mood-grid {
    grid-template-columns: 1fr;
  }
  .affirmation-card, .mood-prompt-card, .gratitude-card, .features-showcase {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  /* Layout shifts from split screen flex to vertical column */
  .app-layout {
    flex-direction: column;
    min-height: calc(100vh - 105px); /* Extra spacing at the bottom for mobile nav bar */
  }

  /* Bottom sticky navigation bar on mobile */
  .sidebar {
    width: 100%;
    height: 70px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    padding: 0 16px;
    border-right: none;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    align-items: center;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
  }

  .brand, .sidebar-footer, .nav-text {
    display: none; /* Hide desktop specific details */
  }

  .nav-links {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    gap: 0;
  }

  .nav-btn {
    flex-direction: column;
    align-items: center;
    padding: 8px;
    gap: 4px;
    font-size: 10px;
    text-align: center;
    justify-content: center;
  }

  .nav-btn:hover {
    transform: none;
  }

  .nav-icon svg {
    width: 22px;
    height: 22px;
  }

  .content-pane {
    padding: 24px 20px 90px 20px; /* Safe padding for bottom nav */
  }

  .welcome-text {
    font-size: 30px;
  }

  .quick-mood-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .quick-mood-btn {
    flex-basis: 30%;
  }

  .breathing-visual-container {
    padding: 24px;
  }

  .breathing-circle-wrapper {
    width: 200px;
    height: 200px;
  }

  .breathing-core-circle {
    width: 140px;
    height: 140px;
  }

  .breathing-text-instruction {
    font-size: 20px;
  }

  .chat-container {
    height: calc(100vh - 280px);
  }
}
