/* ─── Bullet Brain — Global Styles ──────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* CSS Custom Properties */
:root {
  --bg-primary:    #0a0a0f;
  --bg-secondary:  #111118;
  --bg-card:       #16161f;
  --bg-card-hover: #1e1e2a;
  --border:        rgba(255, 255, 255, 0.07);
  --border-active: rgba(130, 100, 255, 0.4);

  --accent-purple:  #8b5cf6;
  --accent-blue:    #3b82f6;
  --accent-teal:    #14b8a6;
  --accent-pink:    #ec4899;
  --accent-amber:   #f59e0b;

  --text-primary:   #f0f0f8;
  --text-secondary: #8b8b9e;
  --text-muted:     #55556a;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ─── Layout Helpers ─────────────────────────────────────────────────────────── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Top Navigation Bar ─────────────────────────────────────────────────────── */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.navbar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
  background: transparent;
  cursor: pointer;
}

.back-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: var(--bg-card);
}

.profile-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all var(--transition);
  position: relative;
}

.profile-btn:hover { transform: scale(1.08); border-color: var(--accent-purple); }

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  min-width: 180px;
  box-shadow: var(--shadow-card);
  display: none;
  z-index: 200;
}

.profile-btn:hover .profile-dropdown,
.profile-dropdown:hover { display: block; }

.profile-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.profile-dropdown a:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.profile-dropdown .divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ─── Flash Messages ─────────────────────────────────────────────────────────── */

.flash-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.flash-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid;
  animation: slideIn 0.3s ease;
}

.flash-msg.success {
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.3);
  color: #5eead4;
}

.flash-msg.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Auth Pages ─────────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Ambient background blobs */
.auth-page::before,
.auth-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  pointer-events: none;
}
.auth-page::before {
  width: 500px; height: 500px;
  background: var(--accent-purple);
  top: -150px; left: -150px;
}
.auth-page::after {
  width: 400px; height: 400px;
  background: var(--accent-blue);
  bottom: -100px; right: -100px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.auth-logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: center;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 32px;
}

/* Form Elements */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

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

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
  letter-spacing: 0.2px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

.btn-primary:active { transform: translateY(0); }

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent-purple);
  font-weight: 600;
  transition: color var(--transition);
}

.auth-footer a:hover { color: #a78bfa; }

/* ─── Home Page ──────────────────────────────────────────────────────────────── */

.home-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.home-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  margin-bottom: 14px;
  line-height: 1.15;
}

.home-hero h1 span {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 480px;
  margin: 0 auto 56px;
}

.home-actions {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.action-card {
  width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
}

.action-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(139, 92, 246, 0.2);
}

.action-card-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px;
}

.action-card-icon.purple { background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(59,130,246,0.2)); border: 1px solid rgba(139,92,246,0.3); }
.action-card-icon.teal   { background: linear-gradient(135deg, rgba(20,184,166,0.2), rgba(59,130,246,0.2)); border: 1px solid rgba(20,184,166,0.3); }

.action-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.action-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ─── Enter / Mood Selection Page ───────────────────────────────────────────── */

.page-header {
  padding: 48px 0 32px;
  text-align: center;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
}

.page-header p { color: var(--text-secondary); font-size: 0.95rem; }

.mood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

.mood-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.mood-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.mood-card.focus::before   { background: radial-gradient(circle at top, rgba(139,92,246,0.1), transparent 70%); }
.mood-card.relax::before   { background: radial-gradient(circle at top, rgba(20,184,166,0.1), transparent 70%); }
.mood-card.sleep::before   { background: radial-gradient(circle at top, rgba(59,130,246,0.1),  transparent 70%); }
.mood-card.meditate::before{ background: radial-gradient(circle at top, rgba(236,72,153,0.1),  transparent 70%); }

.mood-card:hover::before   { opacity: 1; }
.mood-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255,255,255,0.14);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.mood-card-icon {
  font-size: 2.8rem;
  margin-bottom: 16px;
  display: block;
}

.mood-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.mood-card p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; }

/* ─── Session Pages ──────────────────────────────────────────────────────────── */

.session-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.badge-focus     { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }
.badge-relax     { background: rgba(20,184,166,0.15);  color: #5eead4; border: 1px solid rgba(20,184,166,0.3); }
.badge-sleep     { background: rgba(59,130,246,0.15);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.badge-meditation{ background: rgba(236,72,153,0.15);  color: #f9a8d4; border: 1px solid rgba(236,72,153,0.3); }

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  transition: all var(--transition);
}

.session-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.session-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.session-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.session-duration {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-weight: 500;
}

.session-description {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Custom Audio Player */
.audio-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

audio {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-sm);
  accent-color: var(--accent-purple);
}

audio::-webkit-media-controls-panel { background: var(--bg-secondary); }

.no-audio-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  text-align: center;
}

/* ─── Chatbot Page ───────────────────────────────────────────────────────────── */

.chatbot-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  gap: 0;
}

.chatbot-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 520px;
}

.chatbot-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.chatbot-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.chatbot-header-info h3 { font-size: 1rem; font-weight: 700; }
.chatbot-header-info p  { font-size: 0.8rem; color: var(--text-secondary); }

.chatbot-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #5eead4;
}

.chatbot-status-dot {
  width: 7px;
  height: 7px;
  background: #5eead4;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chatbot-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.message {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.message.bot  .message-avatar { background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue)); }
.message.user .message-avatar { background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-secondary); }

.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.55;
}

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

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border-bottom-right-radius: 4px;
  color: #fff;
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

.message.bot .message-time { text-align: left; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

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

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

.chatbot-input-area {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

.chatbot-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

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

.chatbot-send-btn {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.mood-redirect-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  font-family: inherit;
}

.mood-redirect-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(139,92,246,0.35); }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .navbar { padding: 14px 20px; }
  .auth-card { padding: 36px 28px; margin: 16px; }
  .home-actions { flex-direction: column; align-items: center; }
  .action-card { width: 100%; max-width: 320px; }
  .mood-grid { grid-template-columns: 1fr 1fr; }
  .sessions-grid { grid-template-columns: 1fr; }
  .chatbot-layout { padding: 16px; }
  .message-bubble { max-width: 85%; }
}

@media (max-width: 420px) {
  .mood-grid { grid-template-columns: 1fr; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-card-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
