:root {
  --bg-primary: #0e0f12;
  --bg-secondary: #14161d;
  --bg-tertiary: #16213e;
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.4);
  --primary-gradient: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  --secondary-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --success-gradient: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --danger-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 9999px;
  --font-ui: "Inter", monospace;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: rgba(255, 255, 255, 0.8);
  --bg-tertiary: rgba(241, 245, 249, 0.9);
  --bg-glass: rgba(0, 0, 0, 0.02);
  --bg-glass-hover: rgba(0, 0, 0, 0.05);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #94a3b8;
  --border: rgba(0, 0, 0, 0.06);
  --border-light: rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.08);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, .logo-text {
  font-family: var(--font-display);
}

button {
  font-family: var(--font-body);
  letter-spacing: 0.2px;
}

/* Premium Organic Aurora Background */
.background-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(ellipse at bottom, #111827 0%, #090a0f 100%);
  z-index: -2;
}

.light-theme .background-gradient {
  background: radial-gradient(ellipse at bottom, #e2e8f0 0%, #f8fafc 100%);
}

.floating-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.4;
}

.shape {
  position: absolute;
  border-radius: 50%;
  animation: auroraFloat 25s infinite alternate ease-in-out;
}

.shape-1 {
  width: 60vw;
  height: 60vw;
  background: rgba(16, 185, 129, 0.4);
  top: -20%;
  left: -10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 50vw;
  height: 50vw;
  background: rgba(14, 165, 233, 0.3);
  bottom: -10%;
  right: -10%;
  animation-delay: -5s;
  animation-direction: alternate-reverse;
}

.shape-3 {
  width: 40vw;
  height: 40vw;
  background: rgba(99, 102, 241, 0.3);
  top: 30%;
  left: 40%;
  animation-delay: -10s;
}

@keyframes auroraFloat {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  33% { transform: translate(5vw, -5vh) scale(1.1) rotate(15deg); }
  66% { transform: translate(-5vw, 5vh) scale(0.9) rotate(-15deg); }
  100% { transform: translate(2vw, -2vh) scale(1.05) rotate(5deg); }
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--spacing-md);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Glassmorphism Common */
.glass-panel {
  background: var(--bg-secondary);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-xl);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-lg);
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--text-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.icon-btn {
  width: 44px;
  height: 44px;
  background: var(--bg-glass);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  border: 1px solid var(--border);
}

.icon-btn.active {
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-glow);
  border-color: transparent;
}

.icon-btn:hover:not(.active) {
  background: var(--bg-glass-hover);
  transform: translateY(-2px);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-base);
}

.icon-btn:hover svg {
  transform: scale(1.1);
}

/* Chat Layout */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-xl) var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.message {
  display: flex;
  gap: var(--spacing-sm);
  max-width: 85%;
  animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(15px);
}

.message.no-anim {
  animation: none;
  opacity: 1;
  transform: translateY(0);
}

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

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bot-message {
  align-self: flex-start;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}

.user-message .message-avatar { display: none; }

.avatar-icon {
  width: 20px;
  height: 20px;
}

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

.user-message .message-content { align-items: flex-end; }

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  line-height: 1.5;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.bot-message .message-bubble {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}

.user-message .message-bubble {
  background: var(--primary-gradient);
  color: white;
  border-top-right-radius: 4px;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 10px;
  padding: var(--spacing-sm) var(--spacing-lg);
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(to top, var(--bg-secondary) 0%, transparent 100%);
}
.quick-actions::-webkit-scrollbar { display: none; }

.quick-action-btn {
  flex: 0 0 auto;
  padding: 10px 18px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.quick-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.danger-btn {
  background: rgba(225, 29, 72, 0.1);
  color: #fb7185;
  border-color: rgba(225, 29, 72, 0.2);
}
.danger-btn:hover {
  background: rgba(225, 29, 72, 0.2);
  border-color: #fb7185;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
}

/* Input Area */
.input-container {
  padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-lg);
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--border);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-lg);
  background: var(--bg-secondary);
}

.message-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  padding: 8px 0;
}

.message-input::placeholder {
  color: var(--text-muted);
}

.input-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.input-icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.input-icon-btn.recording {
  color: #fb7185;
  animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(225, 29, 72, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}

.send-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--primary-gradient);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.send-btn:hover:not(.disabled) {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.send-btn.disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-md);
}

.modal.active {
  display: flex;
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-secondary);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  opacity: 0;
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  overflow: hidden;
}

@keyframes scaleIn {
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* Mood Options */
.mood-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: var(--spacing-lg);
}

.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.mood-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-sm);
}

.mood-emoji { font-size: 2rem; }
.mood-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }
.mood-btn:hover .mood-label { color: var(--text-primary); }

.mood-history-section {
  padding: 0 var(--spacing-lg) var(--spacing-lg);
}

/* Breathing */
.breathing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  min-height: 360px;
}

.breathing-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--primary-gradient);
  box-shadow: 0 0 40px var(--accent-glow);
  transition: all 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.breathing-circle.inhale {
  transform: scale(1.6);
  box-shadow: 0 0 80px var(--accent-glow);
}

.breathing-circle.hold {
  transform: scale(1.6);
  border: 4px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 100px var(--accent-glow);
}

.breathing-circle.exhale {
  transform: scale(0.9);
  box-shadow: 0 0 20px var(--accent-glow);
  opacity: 0.8;
}

/* Settings & Login */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.login-content {
  background: var(--bg-secondary);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  animation: pulseRecording 3s infinite;
}

.login-content h1 {
  font-size: 2rem;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group input {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.input-group button {
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary-gradient);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.input-group button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.settings-content {
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-item:last-child { border: none; }

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: var(--bg-tertiary);
  border-radius: 26px;
  transition: 0.3s;
  border: 1px solid var(--border);
}

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

input:checked + .toggle-slider { background: var(--accent); border-color: transparent; }
input:checked + .toggle-slider:before { transform: translateX(22px); background: white; }

.settings-action-btn {
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.resources-content { padding: var(--spacing-lg); }
.resource-card {
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.2);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .app-container { padding: 0; height: 100dvh; border-radius: 0; border: none; gap: 0; }
  .chat-container { border-radius: 0; border-left: none; border-right: none; border-bottom: none; }
  .app-header { border-radius: 0; border: none; border-bottom: 1px solid var(--border); }
  .logo-text, .header-btn span { display: none; }
  .modal-content { max-height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; align-self: flex-end; transform: none; animation: slideUp 0.3s ease-out forwards; }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .mood-options { grid-template-columns: repeat(3, 1fr); }
}