/**
 * ACS Chat Room Styles
 * Styles for the Limited MCP ACS Chat Room interface
 * Extracted from limited-mcp-chat-room.html for better maintainability
 * Updated to use Fluent 2 Design System variables from styles.css
 */

/* Note: Base styles (*, body font, margin) are handled by styles.css */

body {
  /* Layout specific to ACS Chat Room */
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent body scroll */
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px;
  text-align: center;
  overflow-y: auto;
}

.welcome-screen h2 {
  color: var(--color-brand-primary, #6264a7);
  margin-bottom: 20px;
}

.welcome-screen .form-group {
  margin: 15px 0;
  width: 100%;
  max-width: 400px;
}

.welcome-screen input,
.welcome-screen textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--colorNeutralStroke1, #d1d1d1);
  border-radius: var(--border-radius-small, 4px);
  font-size: 14px;
  background-color: var(--colorNeutralBackground1, #ffffff);
  color: var(--colorNeutralForeground1, #242424);
}

.welcome-screen textarea {
  resize: vertical;
  min-height: 80px;
}

.welcome-screen button {
  background: var(--color-brand-primary, #6264a7);
  color: var(--color-white, white);
  border: none;
  padding: 12px 32px;
  border-radius: var(--border-radius-small, 4px);
  cursor: pointer;
  font-size: 16px;
  margin: 10px 5px;
  transition: background-color 0.2s;
}

.welcome-screen button:hover {
  background: var(--color-brand-primary-hover, #4b4d8c);
}

.welcome-screen button.secondary {
  background: var(--colorNeutralStroke2, #e0e0e0);
  color: var(--colorNeutralForeground1, #333);
}

.welcome-screen button.secondary:hover {
  background: var(--colorNeutralStroke1, #d0d0d0);
}

.rooms-list {
  max-width: 600px;
  width: 100%;
  margin-top: 20px;
}

.room-card {
  background: var(--colorNeutralBackground1, white);
  padding: 15px;
  margin: 10px 0;
  border-radius: var(--border-radius-medium, 8px);
  border: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  cursor: pointer;
  transition: all 0.2s;
}

.room-card:hover {
  border-color: var(--color-brand-primary, #6264a7);
  box-shadow: var(--shadow-hover, 0 2px 8px rgba(98, 100, 167, 0.2));
}

.room-card h3 {
  color: var(--color-brand-primary, #6264a7);
  margin-bottom: 8px;
}

.room-card .room-meta {
  font-size: 13px;
  color: var(--colorNeutralForeground3, #666);
  margin-top: 8px;
}

/* Chat Container - Teams Style */
.chat-container {
  display: none;
  flex: 1;
  flex-direction: column;
  background: var(--colorNeutralBackground2, #f3f2f1);
  height: 100vh;
  overflow: hidden;
}

.chat-container.active {
  display: flex;
}

/* Messages Area - Teams Channel Style */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--colorNeutralBackground2, #f3f2f1);
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

/* Message Container - Teams Channel Style */
.message {
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
  padding: 4px 0;
  animation: slideIn 0.2s ease-out;
}

.message.no-animate {
  animation: none;
}

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

/* Message Avatar - Teams Style with Depth */
.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--colorNeutralBackground2, #f3f2f1);
  color: var(--colorNeutralForeground1, #323130);
  border: 1px solid var(--colorNeutralStroke1, #dcdcdc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  margin-right: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease;
}

.message-avatar:hover {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
}

.message-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.message-avatar-initials,
.message-avatar-emoji {
  font-size: 16px;
}

/* Message Content Container */
.message-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 70%;
  position: relative;
}

/* Ensure message container allows overflow for icons */
.message {
  position: relative;
  overflow: visible;
}

/* Sender Name - Teams Style */
.message .sender {
  font-weight: 600;
  font-size: 13px;
  color: var(--colorNeutralForeground1, #323130);
  margin-bottom: 2px;
  line-height: 1.2;
}

.message.bot .sender {
  color: var(--color-brand-primary, #6264a7);
}

/* Message Bubble - Teams Channel Style Refined with Depth */
.message .content {
  background: var(--colorNeutralBackground1, white);
  padding: 10px 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
  color: var(--colorNeutralForeground1, #242424);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  position: relative;
  transition: box-shadow 0.2s ease;
}

.message .content:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Bot messages - Left aligned with depth */
.message.bot .content {
  background: var(--colorNeutralBackground1, white);
  border: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.message.bot .content:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14), 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* User messages - Right aligned with depth */
.message:not(.bot) {
  flex-direction: row-reverse !important;
}

.message:not(.bot) .message-content-wrapper {
  align-items: flex-end !important;
}

.message:not(.bot) .content {
  background: var(--color-brand-lighter, #f4f4fb) !important;
  color: var(--colorNeutralForeground1, #242424) !important;
  border: 1px solid var(--color-brand-light, #e7e7f4) !important;
  box-shadow: 0 2px 6px rgba(98, 100, 167, 0.15), 0 1px 3px rgba(98, 100, 167, 0.1) !important;
}

.message:not(.bot) .content:hover {
  box-shadow: 0 4px 10px rgba(98, 100, 167, 0.2), 0 2px 5px rgba(98, 100, 167, 0.15) !important;
}

.message:not(.bot) .message-avatar {
  margin-right: 0 !important;
  margin-left: 8px !important;
}

/* Raw Data Icons - Positioned tight to outer right of bot message bubble */
.message.bot {
  position: relative;
}

/* Raw data icons positioned relative to message-content-wrapper */
.message-content-wrapper .raw-data-icons {
  position: absolute;
  right: -32px;
  top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  flex-shrink: 0;
  z-index: 10;
}

/* Ensure fluent messages container allows overflow */
.fluent-messages .message {
  overflow: visible;
  position: relative;
}

.fluent-messages .message-content-wrapper {
  overflow: visible;
}

.fluent-messages .message-content-wrapper .raw-data-icons {
  position: absolute;
  right: -32px;
  top: 4px;
}

.raw-data-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--colorNeutralBackground1, white);
  border: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  color: var(--colorNeutralForeground2, #605e5c);
}

.raw-data-icon:hover {
  background: var(--colorNeutralBackground2, #f3f2f1);
  border-color: var(--color-brand-primary, #6264a7);
  color: var(--color-brand-primary, #6264a7);
  transform: scale(1.1);
}

.raw-data-icon:active {
  transform: scale(0.95);
}

.raw-data-icon svg {
  width: 10px;
  height: 10px;
  display: block;
}

/* Raw Data Modal */
.raw-data-modal {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 99999 !important;
  pointer-events: none;
  align-items: center;
  justify-content: center;
}

.raw-data-modal.active {
  display: flex !important;
  pointer-events: all !important;
}

.raw-data-modal-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(4px);
  z-index: 1;
}

.raw-data-modal-content {
  position: relative !important;
  margin: auto !important;
  width: 90% !important;
  max-width: 800px !important;
  max-height: 90vh !important;
  background: var(--colorNeutralBackground1, white) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 2 !important;
  opacity: 1 !important;
  visibility: visible !important;
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.raw-data-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  background: var(--colorNeutralBackground2, #f3f2f1);
}

.raw-data-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--colorNeutralForeground1, #242424);
}

.raw-data-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  color: var(--colorNeutralForeground2, #605e5c);
  transition: all 0.2s ease;
  padding: 0;
}

.raw-data-modal-close:hover {
  background: var(--colorNeutralBackground3, #edebe9);
  color: var(--colorNeutralForeground1, #242424);
}

.raw-data-modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
}

.raw-data-content {
  margin: 0;
  padding: 16px;
  background: var(--colorNeutralBackground2, #f3f2f1);
  border: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  border-radius: 8px;
  font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--colorNeutralForeground1, #242424);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
}

/* Markdown styling - Tighter spacing */
.message .content h1,
.message .content h2,
.message .content h3 {
  margin-top: 8px;
  margin-bottom: 4px;
  font-weight: 600;
  line-height: 1.2;
}

.message .content p {
  margin: 4px 0;
  line-height: 1.4;
}

.message .content ul,
.message .content ol {
  margin: 4px 0;
  padding-left: 20px;
}

.message .content li {
  margin: 2px 0;
}

/* Input Area - Modern/Teams Style */
.input-area {
  padding: 16px;
  background: var(--colorNeutralBackground1, white);
  border-top: 1px solid var(--colorNeutralStroke2, #edebe9);
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
  z-index: 100;
}

.input-area input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--colorNeutralStroke1, #d1d1d1);
  border-radius: 20px; /* Pill shape */
  font-size: 14px;
  line-height: 1.4;
  background: var(--colorNeutralBackground3, #f5f5f5);
  color: var(--colorNeutralForeground1, #242424);
  transition: all 0.2s;
}

.input-area input:focus {
  outline: none;
  border-color: var(--color-brand-primary, #6264a7);
  background: var(--colorNeutralBackground1, white);
  box-shadow: 0 0 0 2px rgba(98, 100, 167, 0.1);
}

.input-area button {
  background: var(--color-brand-primary, #6264a7);
  color: var(--color-white, white);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
}

.input-area button:hover {
  background: var(--color-brand-primary-hover, #4b4d8c);
}

.input-area button svg {
  width: 16px;
  height: 16px;
  fill: white;
}

/* Send Icon (using text fallback or svg if available) */
.input-area button::after {
  content: '➤';
  font-size: 14px;
  margin-left: 2px;
}

/* Hide text on button to use icon */
.input-area button {
  font-size: 0;
}

.input-area button:disabled {
  background: var(--colorNeutralStroke1, #ccc);
  cursor: not-allowed;
}

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Status Messages - Teams Style */
.status-message {
  text-align: center;
  padding: 10px 16px;
  margin: 12px 16px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
  border: 1px solid;
}

.status-message.info {
  background: var(--color-info-light, #deecf9);
  color: var(--color-info, #004578);
  border-color: #c7e0f4;
}

.status-message.error {
  background: var(--color-danger-light, #fde7e9);
  color: var(--color-danger, #a80000);
  border-color: #f1bbbb;
}

.status-message.success {
  background: var(--color-success-light, #dff6dd);
  color: var(--color-success, #107c10);
  border-color: #92c5f7;
}

/* Typing Indicator - GLYDE Unwrap Animation */
.typing-indicator {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

/* Status text shown next to typing indicator */
.typing-indicator .status-text {
  color: var(--colorNeutralForeground2, #666);
  font-size: 0.85em;
  font-style: italic;
  animation: status-fade-in 0.3s ease-out;
  padding: 4px 10px;
  background: var(--colorNeutralBackground2, #f5f5f5);
  border-radius: var(--border-radius-small, 4px);
  border-left: 3px solid var(--colorNeutralStroke2, #e0e0e0);
}

@keyframes status-fade-in {
  from {
    opacity: 0;
    transform: translateX(-5px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Phase-specific styling for typing indicator status */
.typing-indicator.status-phase-routing .status-text {
  border-left-color: var(--color-info, #0078d4);
}

.typing-indicator.status-phase-executing .status-text {
  border-left-color: var(--color-brand-primary, #6264a7);
}

.typing-indicator.status-phase-processing .status-text {
  border-left-color: var(--color-success, #107c10);
}

.typing-indicator.status-phase-finalizing .status-text {
  border-left-color: var(--color-warning, #ffb900);
}

.typing-indicator.status-phase-error .status-text {
  border-left-color: var(--color-danger, #d13438);
  color: var(--color-danger, #d13438);
}

/* GLYDE Loader - Unwrap Animation for Typing Indicator */
.typing-indicator .glyde-loader {
  --loader-size: 24px;
  --loader-stroke: 2px;
  --loader-color: var(--color-brand-primary, #6264a7);
  --trail-width: calc(var(--loader-size) * 3.14159);
  --animation-duration: 3.5s;

  position: relative;
  width: calc(var(--trail-width) + var(--loader-size));
  height: var(--loader-size);
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.typing-indicator .glyde-loader__ring {
  position: absolute;
  left: 0;
  width: var(--loader-size);
  height: var(--loader-size);
  animation: glyde-ring-position var(--animation-duration) ease-in-out infinite;
}

.typing-indicator .glyde-loader__ring svg {
  width: 100%;
  height: 100%;
  animation: glyde-ring-rotate var(--animation-duration) ease-in-out infinite;
}

.typing-indicator .glyde-loader__ring circle {
  fill: none;
  stroke: var(--loader-color);
  stroke-width: var(--loader-stroke);
  stroke-linecap: round;
  stroke-dasharray: 282.74;
  stroke-dashoffset: 35;
  transform-origin: center;
  animation: glyde-ring-arc var(--animation-duration) ease-in-out infinite;
}

.typing-indicator .glyde-loader__trail {
  position: absolute;
  left: calc(var(--loader-size) / 2);
  top: calc(var(--loader-size) - var(--loader-stroke) / 2);
  height: var(--loader-stroke);
  background: var(--loader-color);
  transform-origin: left center;
  border-radius: calc(var(--loader-stroke) / 2);
  animation: glyde-trail-motion var(--animation-duration) ease-in-out infinite;
}

/* Ring position - moves right during unwrap, stays left during wind-up */
@keyframes glyde-ring-position {
  0%,
  30% {
    left: 0;
  }
  55% {
    left: var(--trail-width);
  }
  64.9% {
    left: var(--trail-width);
  }
  65%,
  93%,
  100% {
    left: 0;
  }
}

/* Ring rotation - clockwise throughout */
@keyframes glyde-ring-rotate {
  0% {
    transform: rotate(0deg);
  }
  30% {
    transform: rotate(720deg);
  }
  55% {
    transform: rotate(1080deg);
  }
  64.9%,
  65% {
    transform: rotate(1080deg);
  }
  93%,
  100% {
    transform: rotate(1440deg);
  }
}

/* Ring arc length - unwinding/winding effect */
@keyframes glyde-ring-arc {
  0%,
  30% {
    stroke-dashoffset: 35;
  }
  55%,
  65% {
    stroke-dashoffset: 282.74;
  }
  93%,
  100% {
    stroke-dashoffset: 35;
  }
}

/* Trail - extend right, retract from right */
@keyframes glyde-trail-motion {
  0%,
  29.9% {
    width: 0;
    transform-origin: left center;
  }
  30% {
    width: 0;
    transform-origin: left center;
  }
  55%,
  65% {
    width: var(--trail-width);
    transform-origin: left center;
  }
  65.1% {
    width: var(--trail-width);
    transform: scaleX(1);
    transform-origin: left center;
  }
  93% {
    width: var(--trail-width);
    transform: scaleX(0);
    transform-origin: left center;
  }
  93.1%,
  100% {
    width: 0;
    transform: scaleX(1);
    transform-origin: left center;
  }
}

/* Note: .hidden is removed as it is handled by styles.css */

/* ============================================
   Status Indicator - LLM Processing Progress
   Shows reasoning-style status messages during
   long-running LLM operations
   ============================================ */

.status-indicator {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  animation: status-fade-in 0.3s ease-out;
}

@keyframes status-fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.status-indicator .status-content {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--colorNeutralBackground2, #f5f5f5);
  border-radius: var(--border-radius-medium, 8px);
  border: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  max-width: 85%;
}

.status-indicator .status-text {
  color: var(--colorNeutralForeground2, #666);
  font-size: 0.85em;
  font-style: italic;
}

.status-indicator .status-step {
  color: var(--colorNeutralForeground3, #999);
  font-size: 0.75em;
  background: var(--colorNeutralBackground3, #e8e8e8);
  padding: 2px 6px;
  border-radius: var(--border-radius-small, 4px);
}

/* Mini loader for status indicator - smaller version of GLYDE loader */
.status-indicator .glyde-loader--mini {
  --loader-size: 16px;
  --loader-stroke: 2px;
  --loader-color: var(--color-brand-primary, #6264a7);

  position: relative;
  width: var(--loader-size);
  height: var(--loader-size);
  flex-shrink: 0;
}

.status-indicator .glyde-loader--mini .glyde-loader__ring {
  position: absolute;
  left: 0;
  width: var(--loader-size);
  height: var(--loader-size);
}

.status-indicator .glyde-loader--mini .glyde-loader__ring svg {
  width: 100%;
  height: 100%;
  animation: status-spin 1s linear infinite;
}

.status-indicator .glyde-loader--mini .glyde-loader__ring circle {
  fill: none;
  stroke: var(--loader-color);
  stroke-width: var(--loader-stroke);
  stroke-linecap: round;
  stroke-dasharray: 200;
  stroke-dashoffset: 60;
  transform-origin: center;
}

@keyframes status-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Phase-specific styling */
.status-indicator.status-phase-routing .status-content {
  border-left: 3px solid var(--color-info, #0078d4);
}

.status-indicator.status-phase-executing .status-content {
  border-left: 3px solid var(--color-brand-primary, #6264a7);
}

.status-indicator.status-phase-processing .status-content {
  border-left: 3px solid var(--color-success, #107c10);
}

.status-indicator.status-phase-finalizing .status-content {
  border-left: 3px solid var(--color-warning, #ffb900);
}

.status-indicator.status-phase-error .status-content {
  border-left: 3px solid var(--color-danger, #d13438);
}

/* Loading State Styles - Consolidated from limited-mcp-chat-room.html */
.loading-container {
  font-size: 48px;
  margin-bottom: 20px;
}

.loading-large {
  width: 60px;
  height: 60px;
  border-width: 5px;
  border-color: rgba(98, 100, 167, 0.3);
  border-top-color: var(--color-brand-primary, #6264a7);
}

.loading-subtitle {
  color: var(--colorNeutralForeground3, #666);
  margin-top: 10px;
}

/* Collapsible citation styles for raw JSON responses */
.message .content details {
  margin: 12px 0;
  border-left: 3px solid var(--color-info, #0078d4);
  background: var(--colorNeutralBackground2, #f8f9fa);
  border-radius: 4px;
  overflow: hidden;
}

.message .content details summary {
  cursor: pointer;
  padding: 10px 14px;
  color: var(--color-info, #0078d4);
  font-size: 0.9em;
  font-weight: 500;
  user-select: none;
  background: var(--color-info-light, #f0f6ff);
  transition: background 0.2s;
  list-style: none;
  line-height: 1.5;
}

.message .content details summary::-webkit-details-marker {
  display: none;
}

.message .content details summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.2s;
  font-size: 0.8em;
}

.message .content details[open] summary::before {
  transform: rotate(90deg);
}

.message .content details summary:hover {
  background: #e6f2ff;
}

.message .content details pre {
  background: var(--colorNeutralBackground1, #ffffff);
  padding: 14px;
  margin: 0;
  border-top: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  overflow-x: auto;
  font-size: 0.85em;
  line-height: 1.5;
}

.message .content details code {
  background: none;
  color: var(--colorNeutralForeground1, #333);
  font-family: 'Courier New', 'Consolas', monospace;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
  body {
    height: 100dvh; /* Dynamic viewport height - accounts for keyboard */
  }

  .chat-container {
    height: 100dvh;
  }

  .input-area {
    position: sticky;
    bottom: 0;
    z-index: 100;
    background: var(--colorNeutralBackground1, white);
  }

  .message {
    margin-bottom: 12px; /* Slightly reduced for mobile */
  }

  .message .content {
    padding: 10px 14px; /* Slightly reduced for mobile */
  }
}

/* Starter Prompts - MS Copilot Style */
.starter-prompts-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 40px;
  width: 100%;
}

.starter-prompts-header {
  text-align: center;
  margin-bottom: 24px;
}

.starter-logo {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 50%;
}

.starter-prompts-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--colorNeutralForeground1, #242424);
  margin: 0;
}

.starter-prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 600px;
  width: 100%;
  padding: 0 16px;
}

.starter-prompt-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px;
  background: var(--colorNeutralBackground1, white);
  border: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  height: 100%;
}

.starter-prompt-card:hover {
  background: var(--colorNeutralBackground1Hover, #f5f5f5);
  box-shadow: var(--shadow-2, 0 2px 8px rgba(0, 0, 0, 0.08));
  border-color: var(--colorNeutralStroke1, #d1d1d1);
  transform: translateY(-2px);
}

.prompt-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.prompt-text {
  font-size: 14px;
  color: var(--colorNeutralForeground1, #242424);
  font-weight: 500;
  line-height: 1.4;
}

@media (max-width: 480px) {
  .starter-prompts-grid {
    grid-template-columns: 1fr;
  }
}

/* Full Mode Container (for general GLYDEBuddy chat) */
.acs-chat-full-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--color-surface-primary, #f3f2f1);
}

.acs-chat-full-container .acs-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Override drawer animation styles - full mode should be visible and scrollable */
  min-height: 0 !important; /* Critical: allows flex item to shrink and enable scrolling */
  opacity: 1 !important; /* Make visible (override drawer hidden state) */
  height: unset !important; /* Remove fixed height from drawer animation */
}

.acs-chat-full-container .input-area {
  flex-shrink: 0;
}

/* -------------------------------------------------------------------------- */
/* Fluent 2 Modern Styling Overrides                                          */
/* -------------------------------------------------------------------------- */

/* 1. Modern Header */
.fluent-header {
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
  border-radius: 12px !important; /* Soft rectangle, not pill */
  margin: 12px 16px !important;
  min-height: 64px !important;
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.title-text {
  font-family: 'Segoe UI Variable Display', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--colorNeutralForeground1);
}

.subtitle-text {
  font-size: 12px;
  color: var(--colorNeutralForeground3);
  display: block;
}

/* 2. Chat Bubbles (Softer & Larger Radius) */
.fluent-messages {
  padding-top: 100px !important; /* Clear the absolute header */
  flex: 1;
  overflow-y: auto;
}

.fluent-messages .message .content {
  border-radius: 16px !important;
  padding: 12px 16px !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
  border: 1px solid rgba(0, 0, 0, 0.03) !important;
  font-size: 14px;
  line-height: 1.5;
  transition: box-shadow 0.2s ease;
}

.fluent-messages .message .content:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* Bot Message - With depth */
.fluent-messages .message.bot .content {
  background: #ffffff !important;
  border: 1px solid var(--colorNeutralStroke2, #e0e0e0) !important;
  border-bottom-left-radius: 4px !important; /* Tail effect */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

.fluent-messages .message.bot .content:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14), 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

/* User Message - With depth */
.fluent-messages .message:not(.bot) {
  flex-direction: row-reverse !important;
}

.fluent-messages .message:not(.bot) .message-content-wrapper {
  align-items: flex-end !important;
}

.fluent-messages .message:not(.bot) .content {
  background: var(--color-brand-lighter, #f4f4fb) !important;
  color: var(--colorNeutralForeground1, #242424) !important;
  border: 1px solid var(--color-brand-light, #e7e7f4) !important;
  border-bottom-right-radius: 4px !important; /* Tail effect */
  box-shadow: 0 2px 6px rgba(98, 100, 167, 0.15), 0 1px 3px rgba(98, 100, 167, 0.1) !important;
}

.fluent-messages .message:not(.bot) .content:hover {
  box-shadow: 0 4px 10px rgba(98, 100, 167, 0.2), 0 2px 5px rgba(98, 100, 167, 0.15) !important;
}

.fluent-messages .message:not(.bot) .message-avatar {
  margin-right: 0 !important;
  margin-left: 8px !important;
}

/* 3. Floating Input Area */
.fluent-input-area {
  margin: 0 16px 16px 16px;
  border-radius: 24px;
  border: 1px solid var(--colorNeutralStroke2) !important;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08) !important;
  background: rgba(255, 255, 255, 0.95) !important;
  padding: 8px 12px !important;
}

.fluent-input {
  border: none !important;
  background: transparent !important;
  padding-left: 12px !important;
  font-size: 14px;
}

.fluent-input:focus {
  box-shadow: none !important;
}

.fluent-send-btn {
  width: 32px !important;
  height: 32px !important;
  background: var(--color-brand-primary) !important;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fluent-send-btn:hover:not(:disabled) {
  transform: scale(1.1);
  background: var(--color-brand-primary-hover) !important;
}

/* 4. Fluent Dropdown (Select) */
.fluent-select-wrapper {
  position: relative;
  display: inline-block;
}

.fluent-select {
  appearance: none;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 28px 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--colorNeutralForeground1);
  cursor: pointer;
  transition: all 0.2s;
}

.fluent-select:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.fluent-chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--colorNeutralForeground3);
  pointer-events: none;
}

/* 5. Icons & Buttons */
.fluent-icon-btn {
  color: var(--colorNeutralForeground2) !important;
  border-radius: 8px !important;
  padding: 8px !important;
  transition: background 0.2s;
}

.fluent-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05) !important;
  color: var(--color-brand-primary) !important;
}

/* 6. Drawer Header Status Indicator */
.drawer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.drawer-status.hidden {
  display: none;
}

.drawer-status .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(98, 100, 167, 0.2);
  border-top-color: var(--color-brand-primary, #6264a7);
  border-radius: 50%;
  animation: drawer-spin 0.8s linear infinite;
}

@keyframes drawer-spin {
  to {
    transform: rotate(360deg);
  }
}

.drawer-status .status-icon {
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
}

.drawer-status .status-icon.success {
  color: var(--color-success, #107c10);
}

.drawer-status .status-icon.error {
  color: var(--color-danger, #a80000);
}

.drawer-status .status-icon.hidden {
  display: none;
}

/* Note: Conflicting .glyde-right-pane, .glyde-center-pane, and .glyde-crm-details overrides have been removed */

/* -------------------------------------------------------------------------- */
/* Voice Toggle Pill Button - Metallic Shine Design                           */
/* -------------------------------------------------------------------------- */

.voice-toggle-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px !important;
  border-radius: 24px !important;
  border: none !important;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  flex-shrink: 0;
  width: auto !important;
  height: auto !important;
  min-width: 120px;

  /* Default state - Dark green metallic */
  background: linear-gradient(135deg, #1a3a2a 0%, #0d2818 50%, #1a3a2a 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.voice-toggle-pill .mic-icon {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.voice-toggle-pill .voice-pill-text {
  white-space: nowrap;
}

/* Metallic shine animation overlay */
.voice-pill-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 40%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.1) 75%,
    transparent 100%
  );
  animation: metallic-shine 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes metallic-shine {
  0% {
    left: -100%;
  }
  50%,
  100% {
    left: 100%;
  }
}

/* Hover state - Show "enable voice" with red background */
.voice-toggle-pill:hover:not(.voice-active) {
  background: linear-gradient(135deg, #8b2635 0%, #6b1d29 50%, #8b2635 100%) !important;
  box-shadow: 0 2px 12px rgba(139, 38, 53, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.voice-toggle-pill:hover:not(.voice-active) .voice-pill-text {
  font-size: 0;
}

.voice-toggle-pill:hover:not(.voice-active) .voice-pill-text::after {
  font-size: 12px;
  content: 'enable voice';
}

/* Active/Listening state - Bright green */
.voice-toggle-pill.voice-active {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 50%, #28a745 100%) !important;
  box-shadow: 0 2px 12px rgba(40, 167, 69, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.voice-toggle-pill.voice-active .voice-pill-shine {
  animation: metallic-shine-fast 1.5s ease-in-out infinite;
}

@keyframes metallic-shine-fast {
  0% {
    left: -100%;
  }
  50%,
  100% {
    left: 100%;
  }
}

/* Active hover - Show red "Voice Off" */
.voice-toggle-pill.voice-active:hover {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 50%, #dc3545 100%) !important;
  box-shadow: 0 2px 12px rgba(220, 53, 69, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.voice-toggle-pill.voice-active:hover .voice-pill-text {
  font-size: 0;
}

.voice-toggle-pill.voice-active:hover .voice-pill-text::after {
  font-size: 12px;
  content: 'Voice Off';
}

/* Listening pulse animation */
.voice-toggle-pill.voice-listening {
  animation: voice-pill-pulse 1.5s ease-in-out infinite;
}

@keyframes voice-pill-pulse {
  0%,
  100% {
    box-shadow: 0 2px 12px rgba(40, 167, 69, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2),
      inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  }
  50% {
    box-shadow: 0 2px 20px rgba(40, 167, 69, 0.6), 0 0 30px rgba(40, 167, 69, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  }
}

/* Processing state */
.voice-toggle-pill.voice-processing {
  background: linear-gradient(135deg, #ffc107 0%, #e0a800 50%, #ffc107 100%) !important;
  color: #212529 !important;
}

/* Speaking state */
.voice-toggle-pill.voice-speaking {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 50%, #17a2b8 100%) !important;
}

/* Error state */
.voice-toggle-pill.voice-error {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 50%, #dc3545 100%) !important;
  animation: voice-pill-error-shake 0.5s ease-in-out;
}

@keyframes voice-pill-error-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

/* -------------------------------------------------------------------------- */
/* Input Wrapper with Listening Indicator                                     */
/* -------------------------------------------------------------------------- */

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.voice-listening-indicator {
  position: absolute;
  left: 12px;
  font-size: 12px;
  font-weight: 500;
  color: #28a745;
  opacity: 0;
  transform: translateY(2px);
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-listening-indicator.active {
  opacity: 1;
  transform: translateY(0);
}

.voice-listening-indicator.active::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #28a745;
  border-radius: 50%;
  animation: listening-dot-pulse 1s ease-in-out infinite;
}

@keyframes listening-dot-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* Adjust input padding when listening indicator is active */
.input-wrapper .fluent-input {
  width: 100%;
  transition: padding-left 0.2s ease;
}

.input-wrapper:has(.voice-listening-indicator.active) .fluent-input {
  padding-left: 100px !important;
}

/* Fallback for browsers without :has() support */
.voice-listening-indicator.active + .fluent-input {
  padding-left: 100px !important;
}

/* -------------------------------------------------------------------------- */
/* Message Deduplication Fix - Prevent user messages from jumping             */
/* -------------------------------------------------------------------------- */

/* Ensure optimistic messages maintain position until confirmed */
.message.optimistic {
  opacity: 0.85;
}

/* Prevent layout shift during message updates */
.fluent-messages .message {
  will-change: auto; /* Remove will-change to prevent layout thrashing */
}

/* Ensure user messages stay consistently right-aligned */
.fluent-messages .message:not(.bot) {
  flex-direction: row-reverse !important;
  justify-content: flex-start !important;
}

/* Fix for message content wrapper alignment stability */
.fluent-messages .message:not(.bot) .message-content-wrapper {
  align-items: flex-end !important;
  text-align: right;
}

/* -------------------------------------------------------------------------- */
/* Result Tables - LLM-generated HTML tables for structured data              */
/* -------------------------------------------------------------------------- */

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  background: var(--colorNeutralBackground1, #ffffff);
  border-radius: var(--border-radius-medium, 8px);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.result-table thead {
  background: var(--colorNeutralBackground3, #f5f5f5);
}

.result-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--colorNeutralForeground1, #242424);
  border-bottom: 2px solid var(--colorNeutralStroke1, #d1d1d1);
  white-space: nowrap;
}

.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0);
  color: var(--colorNeutralForeground1, #242424);
  vertical-align: middle;
}

.result-table tbody tr:last-child td {
  border-bottom: none;
}

.result-table tbody tr:hover {
  background: var(--colorNeutralBackground1Hover, #f0f0f0);
}

/* Status badges in tables */
.result-table .status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: capitalize;
}

.result-table .status-badge.new-lead,
.result-table .status-badge.new {
  background: var(--colorPaletteGreenBackground2, #dff6dd);
  color: var(--colorPaletteGreenForeground2, #0e700e);
}

.result-table .status-badge.placed,
.result-table .status-badge.hired {
  background: var(--colorPaletteBlueBerryBackground2, #e0e8ff);
  color: var(--colorPaletteBlueBerryForeground2, #3b49df);
}

.result-table .status-badge.shortlisted,
.result-table .status-badge.qualified {
  background: var(--colorPaletteYellowBackground2, #fff4ce);
  color: var(--colorPaletteYellowForeground2, #835c00);
}

/* -------------------------------------------------------------------------- */
/* Interactive Record Links - Clickable elements that prefill chat input      */
/* -------------------------------------------------------------------------- */

.record-link {
  color: var(--color-brand-primary, #6264a7);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px dotted transparent;
}

.record-link:hover {
  color: var(--color-brand-primary-hover, #4b4d8c);
  border-bottom-color: var(--color-brand-primary, #6264a7);
  text-decoration: none;
}

.record-link:active {
  transform: scale(0.98);
}

/* Visual feedback when link is clicked */
.record-link.clicked {
  background: var(--colorPaletteBlueBerryBackground2, #e0e8ff);
  border-radius: 3px;
  padding: 0 2px;
}

/* Tooltip hint on hover */
.record-link::after {
  content: ' →';
  opacity: 0;
  transition: opacity 0.15s ease;
  font-size: 10px;
}

.record-link:hover::after {
  opacity: 0.6;
}

/* Mobile-friendly tap targets */
@media (max-width: 768px) {
  .result-table {
    font-size: 12px;
  }

  .result-table th,
  .result-table td {
    padding: 8px 10px;
  }

  .record-link {
    padding: 4px 2px;
  }
}

/* Dark mode support for tables */
@media (prefers-color-scheme: dark) {
  .result-table {
    background: var(--colorNeutralBackground1, #1f1f1f);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  .result-table thead {
    background: var(--colorNeutralBackground3, #2d2d2d);
  }

  .result-table th {
    color: var(--colorNeutralForeground1, #e0e0e0);
    border-bottom-color: var(--colorNeutralStroke1, #404040);
  }

  .result-table td {
    color: var(--colorNeutralForeground1, #e0e0e0);
    border-bottom-color: var(--colorNeutralStroke2, #333333);
  }

  .result-table tbody tr:hover {
    background: var(--colorNeutralBackground1Hover, #2a2a2a);
  }

  .record-link {
    color: var(--color-brand-primary, #8b8dd9);
  }

  .record-link:hover {
    color: var(--color-brand-primary-hover, #a5a7e8);
  }
}
