/* =========================================================
   LifeAssist AI — AI Coach Stylesheet
   ========================================================= */

html, body {
  height: 100vh;
  overflow: hidden;
}
.app-shell {
  height: 100vh;
  overflow: hidden;
}
.main-content {
  height: 100vh;
  padding: 24px 32px 24px !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  flex-shrink: 0;
  margin-bottom: 20px !important;
}
.coach-workspace-layout {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Column 1: History Sidebar ---------- */
.coach-history-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  box-shadow: var(--shadow-sm);
}

.new-chat-btn {
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.25);
  border: none;
}
.new-chat-btn:hover {
  background: var(--purple-dark);
}
.new-chat-btn:active {
  transform: scale(0.98);
}

.history-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
}
.history-search i {
  color: var(--text-secondary);
}
.history-search input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
  width: 100%;
}

.conversations-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.conversations-scroll::-webkit-scrollbar {
  width: 4px;
}
.conversations-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  border: 1px solid transparent;
  text-align: left;
  background: none;
  width: 100%;
}
.history-item:hover {
  background: var(--bg);
  transform: translateX(2px);
}
.history-item.active {
  background: var(--purple-soft);
  border-color: rgba(108, 92, 231, 0.15);
}
.history-item i {
  font-size: 16px;
  color: var(--purple);
}
.history-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-details strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-details span {
  font-size: 10px;
  color: var(--text-secondary);
}

.history-item-actions {
  opacity: 0;
  transition: opacity 0.2s;
}
.history-item:hover .history-item-actions {
  opacity: 1;
}
.history-action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 2px;
  font-size: 13px;
}
.history-action-btn:hover {
  color: var(--purple);
}

.history-empty {
  color: var(--text-secondary);
  text-align: center;
  font-size: 12px;
  padding: 20px 10px;
}

/* ---------- Column 2: Chat Main Workspace ---------- */
.coach-chat-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.chat-scroll-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.chat-scroll-wrapper::-webkit-scrollbar {
  width: 5px;
}
.chat-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* --- Welcome Hero --- */
.chat-welcome-block {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 680px;
  margin: auto;
  width: 100%;
}
.welcome-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.welcome-card .bot-avatar {
  width: 44px;
  height: 44px;
  background: var(--purple);
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.welcome-text h3 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 700;
}
.welcome-text p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.suggested-prompts-section h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.suggested-prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.prompt-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.prompt-chip:hover {
  border-color: var(--purple-soft);
  background: var(--purple-soft);
  transform: translateY(-2px);
}
.prompt-chip i {
  color: var(--purple);
}

/* --- Message Bubbles --- */
.chat-messages-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}
.chat-msg {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: msgPop 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes msgPop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bot-avatar, .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.bot-avatar {
  background: var(--purple);
  color: #fff;
}
.user-avatar {
  background: var(--blue-soft);
  color: var(--blue);
}

.msg-bubble {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
  max-width: 85%;
  position: relative;
}
.user-msg {
  flex-direction: row-reverse;
}
.user-msg .msg-bubble {
  background: var(--purple-soft);
  border-color: rgba(108, 92, 231, 0.1);
  border-radius: var(--radius-md) 0 var(--radius-md) var(--radius-md);
}

.msg-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.2s;
}
.chat-msg:hover .msg-actions {
  opacity: 1;
}
.msg-action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.msg-action-btn:hover {
  color: var(--purple);
}

/* Typing indicator bubble */
.typing-indicator-wrapper {
  display: flex;
  gap: 14px;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}
.typing-bubble {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 12px 20px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.typing-bubble span {
  width: 6px;
  height: 6px;
  background: var(--purple);
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

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

/* --- Input Bar --- */
.chat-input-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.input-actions-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}
.input-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
.input-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}
.chat-input-bar textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: var(--text-primary);
  resize: none;
  max-height: 120px;
  padding: 4px 8px;
  font-family: inherit;
}
.send-btn {
  background: var(--purple);
  color: #fff;
  border: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 4px 10px rgba(108, 92, 231, 0.2);
}
.send-btn:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
}
.send-btn:active {
  transform: scale(0.96);
}
.input-disclaimer {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 8px;
}

/* ---------- Column 3: Quick Action Sidebar ---------- */
.coach-quick-actions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  box-shadow: var(--shadow-sm);
}
.coach-quick-actions .section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.action-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}
.action-card:hover {
  background: var(--surface);
  transform: translateY(-2px);
  border-color: var(--purple-soft);
}
.action-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.action-details {
  flex: 1;
  min-width: 0;
}
.action-details strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.action-details span {
  display: block;
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-arrow {
  color: var(--text-muted);
  font-size: 13px;
  transition: transform 0.15s;
}
.action-card:hover .card-arrow {
  transform: translateX(3px);
  color: var(--purple);
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .coach-workspace-layout {
    grid-template-columns: 200px 1fr;
  }
  .coach-quick-actions {
    display: none;
  }
}

@media (max-width: 900px) {
  body {
    height: 100vh;
    overflow: hidden;
  }
  .app-shell {
    height: 100vh;
    overflow: hidden;
  }
  .main-content {
    padding: 12px !important;
    height: calc(100vh - 50px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .topbar {
    margin-bottom: 12px !important;
    flex-shrink: 0;
  }
  .coach-workspace-layout {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: hidden;
  }
  .coach-chat-area {
    height: 100%;
  }
  .chat-scroll-wrapper {
    padding: 14px;
    flex: 1;
    overflow-y: auto;
  }
  .coach-history-sidebar {
    display: none;
  }
  .suggested-prompts-grid {
    grid-template-columns: 1fr;
  }
}
