/**
 * css/views/chat-workspace.css
 * ----------------------------
 * Chat Workspace & Start Screen (Ai-Tools & ChatGPT style):
 * - #chatWorkspace with .is-new-chat bottom/center alignment
 * - #newChatHero greeting, title, and quick action chips
 * - #chatInputGroup with context status bar, URL input, and action triggers
 * - #chatArea scrollable container for messages and full-width audit reports
 */

.chat-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-dark);
  position: relative;
  width: 100%;
  height: 100%;
  align-items: stretch;
}

/* User Profile Button: Oblong Circle / Rounded Rectangle Pill in Top Right Corner (Ai-Tools style) */
.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 20px; /* oblong pill / rounded rectangle */
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.user-profile-pill:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.2);
}

.user-profile-pill .avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  font-weight: 800;
}

.user-profile-pill .chevron-icon {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-left: 2px;
}
  font-weight: 800;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
  transition: all 0.2s ease;
}

.user-avatar:hover {
  transform: scale(1.06);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(6, 182, 212, 0.35));
}

/* Profile Context Menu (Ai-Tools style) */
.profile-menu {
  position: absolute;
  top: 48px;
  right: 0;
  width: 310px;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(13, 18, 31, 0.98);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  z-index: 10001;
  display: none;
  flex-direction: column;
  animation: menuFadeIn 0.2s ease-out;
}

.profile-menu.show {
  display: flex;
}

@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-menu-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.user-email {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}

.user-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-small {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.user-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.user-plan {
  font-size: 0.72rem;
  color: var(--accent-emerald);
  font-family: var(--font-mono);
}

.profile-usage {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.015);
}

.profile-menu-items {
  padding: 8px 0;
}

.menu-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.menu-item i {
  width: 16px;
  color: var(--text-dim);
  font-size: 0.88rem;
  text-align: center;
}

.menu-item:hover {
  background: rgba(16, 185, 129, 0.12);
  color: #fff;
}

.menu-item:hover i {
  color: var(--accent-emerald);
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

.model-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.model-badge i {
  color: var(--accent-emerald);
}

.status-indicator-pill {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 4px 10px;
  border-radius: 8px;
}

.status-indicator-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
}

/* Scrollable Chat Area */
.chat-scroll-area {
  flex: 1 1 0%;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  scroll-behavior: smooth;
  padding: 72px 20px 20px 20px;
}

.messages-column-v4 {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1100px;
  gap: 24px;
}

/* User & Assistant Message Bubbles */
.chat-msg {
  display: flex;
  gap: 14px;
  width: 100%;
  animation: msgSlideUp 0.3s ease-out;
}

@keyframes msgSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.user {
  justify-content: flex-end;
}

.chat-msg.user .msg-bubble {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #fff;
  border-radius: 16px 16px 2px 16px;
  padding: 12px 18px;
  max-width: 650px;
  font-size: 0.9rem;
}

.chat-msg.assistant .msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.chat-msg.assistant .msg-content-wrapper {
  flex: 1;
  min-width: 0;
}

/* AI Conversational Response Card */
.ai-response-card {
  background: rgba(13, 18, 31, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 20px;
  color: var(--text-main);
  font-size: 0.9rem;
  line-height: 1.6;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ai-response-card h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-response-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 12px;
}

.ai-response-card ul {
  margin: 8px 0 14px 20px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.ai-response-card li {
  margin-bottom: 6px;
}

.ai-response-card li strong {
  color: var(--text-main);
}

.ai-metric-callout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.ai-metric-item {
  display: flex;
  flex-direction: column;
}

.ai-metric-item .lbl {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.ai-metric-item .val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
}

.ai-response-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ════ NEW CHAT / START SCREEN STATE ════ */
.chat-workspace.is-new-chat {
  justify-content: center;
  align-items: center;
  padding-top: 56px;
  padding-bottom: 38px;
}

.chat-workspace.is-new-chat .chat-scroll-area {
  display: none !important;
}

.main-input-group {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0 auto;
}

.chat-workspace.is-new-chat .main-input-group {
  flex: 0 0 auto;
}

/* Active Chat State: pinned at bottom right above the 38px footer */
.chat-workspace:not(.is-new-chat) .main-input-group {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-color);
  padding: 12px 20px 12px 20px;
  margin-bottom: 38px;
  z-index: 50;
}

.chat-workspace:not(.is-new-chat) .new-chat-hero {
  display: none !important;
}

/* New Chat Hero Greeting */
.new-chat-hero {
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-vector-badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--accent-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 16px;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.35);
}

.new-chat-hero h1 {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.new-chat-hero h1 span.highlight {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.new-chat-hero p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.5;
}

/* Task Chips */
.task-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.task-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.task-chip:hover {
  background: rgba(16, 185, 129, 0.12);
  color: #fff;
  border-color: rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

/* Chat Input Container */
.chat-input-container {
  width: 100%;
  max-width: 860px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-container:focus-within {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.15);
}

/* Context Status Bar */
.context-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.platform-mini-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.platform-mini-pill.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.35);
}

.horizon-mini-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.horizon-mini-pill.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.35);
}

/* Input Area */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-input-row i.link-icon {
  color: var(--text-dim);
  font-size: 1rem;
}

.chat-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.92rem;
  font-family: var(--font-sans);
}

.chat-input-row input::placeholder {
  color: var(--text-dim);
}

.chat-send-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: #fff;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.chat-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.5);
}

