/* Chat UI styles */
:root {
  --sidebar-w: 280px;
  --chat-bg: #F5F0E8;
  --msg-coach-bg: #EFEBE4;
  --msg-user-bg: #1C1917;
  --msg-user-fg: #F5F0E8;
}

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-alt, #EFEBE4);
  border-right: 1px solid rgba(28,25,23,0.08);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  gap: 28px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
}

.brand {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: #1C1917;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #A8A29E;
  font-weight: 500;
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-btn {
  background: transparent;
  border: 1px solid rgba(28,25,23,0.12);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.mode-btn:hover {
  background: rgba(28,25,23,0.04);
}

.mode-btn.active {
  background: #1C1917;
  border-color: #1C1917;
}

.mode-btn.active .mode-name,
.mode-btn.active .mode-tagline {
  color: #F5F0E8;
}

.mode-name {
  font-size: 14px;
  font-weight: 600;
  color: #1C1917;
  font-family: 'DM Sans', sans-serif;
}

.mode-tagline {
  font-size: 12px;
  color: #78716C;
  font-family: 'DM Sans', sans-serif;
}

/* Goals */
.goals-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.goal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(28,25,23,0.05);
  border-radius: 6px;
  font-size: 13px;
}

.goal-item.completed {
  opacity: 0.5;
  text-decoration: line-through;
}

.goal-text {
  flex: 1;
  color: #57534E;
  line-height: 1.3;
}

.goal-complete {
  background: none;
  border: none;
  color: #A8A29E;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  flex-shrink: 0;
}

.goal-complete:hover {
  color: #D97706;
}

.add-goal {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

#goal-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid rgba(28,25,23,0.15);
  border-radius: 6px;
  background: #F5F0E8;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #1C1917;
  outline: none;
}

#goal-input::placeholder { color: #A8A29E; }
#goal-input:focus { border-color: #D97706; }

#add-goal-btn {
  width: 34px;
  height: 34px;
  background: #1C1917;
  color: #F5F0E8;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.empty-goals {
  font-size: 12px;
  color: #A8A29E;
  padding: 4px 0;
}

/* Main chat */
#chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  min-width: 0;
}

#chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(28,25,23,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.coach-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coach-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
}

#coach-mode-label {
  font-size: 13px;
  font-weight: 500;
  color: #57534E;
}

/* Messages */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Welcome state */
.welcome-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 40px;
}

.welcome-coach-icon { margin-bottom: 8px; }

#welcome-title {
  font-family: 'DM Serif Display', serif;
  font-size: 26px;
  color: #1C1917;
  font-weight: normal;
}

#welcome-subtitle {
  font-size: 15px;
  color: #78716C;
  max-width: 320px;
  line-height: 1.5;
}

.btn-primary {
  background: #1C1917;
  color: #F5F0E8;
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  margin-top: 8px;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.85; }

/* Message bubbles */
.message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 600px;
}

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

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

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.coach-avatar {
  background: rgba(217,119,6,0.12);
}

.user-avatar {
  background: #1C1917;
  color: #F5F0E8;
  font-size: 13px;
  font-weight: 600;
}

.msg-bubble {
  max-width: 480px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
}

.message-coach .msg-bubble {
  background: var(--msg-coach-bg, #EFEBE4);
  color: #1C1917;
  border-bottom-left-radius: 4px;
}

.message-user .msg-bubble {
  background: var(--msg-user-bg, #1C1917);
  color: var(--msg-user-fg, #F5F0E8);
  border-bottom-right-radius: 4px;
}

.msg-bubble p { margin: 0; }

/* Input area */
#input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid rgba(28,25,23,0.08);
  background: var(--chat-bg);
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: #EFEBE4;
  border: 1px solid rgba(28,25,23,0.12);
  border-radius: 12px;
  padding: 8px 8px 8px 16px;
}

#message-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: #1C1917;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}

#message-input::placeholder { color: #A8A29E; }

#send-btn {
  width: 40px;
  height: 40px;
  background: #D97706;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}

#send-btn:hover { opacity: 0.9; }
#send-btn:active { transform: scale(0.95); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Mobile */
@media (max-width: 640px) {
  #app { flex-direction: column; }
  #sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid rgba(28,25,23,0.08);
  }
  .sidebar-section { flex: 1; min-width: 140px; }
  .goals-list { display: none; }
  .add-goal { display: none; }
  .section-label { font-size: 10px; }
  #messages { padding: 16px; }
  #input-area { padding: 12px 16px 16px; }
}