/* ================================================================
   QUOTEPLAN AI ASSISTANT - MODERN PROFESSIONAL UI
   ================================================================ */

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

body.chatbot-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  background: #f4f4f4;
  height: 100vh;
  overflow: hidden;
  color: #222;
  line-height: 1.6;
}

/* ================================================================
   FLOATING CHAT BUTTON
   ================================================================ */
.chat-toggle-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  cursor: grab;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  font-size: 24px;
  --chat-icon-zoom: 1;
  transform: scale(var(--chat-icon-zoom));
  transform-origin: center;
}

.chat-toggle-btn:hover {
  transform: scale(var(--chat-icon-zoom)) scale(1.1) translateY(-2px);
  box-shadow: 0 15px 40px rgba(59, 130, 246, 0.5);
}

.chat-toggle-btn:active {
  transform: scale(var(--chat-icon-zoom)) scale(0.95);
  cursor: grabbing;
}

/* Chat icon options popover (right-click: zoom & reset) */
.chat-icon-popover {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  font-size: 13px;
  color: #334155;
}

.chat-icon-popover-title {
  font-weight: 600;
  margin-bottom: 10px;
  color: #0f172a;
}

.chat-icon-popover-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-icon-popover-row label {
  flex-shrink: 0;
  font-weight: 500;
}

.chat-icon-zoom-slider {
  flex: 1;
  min-width: 80px;
  height: 6px;
  accent-color: #3b82f6;
}

.chat-icon-zoom-value {
  min-width: 36px;
  text-align: right;
  font-weight: 600;
  color: #1d4ed8;
}

.chat-icon-reset-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.chat-icon-reset-btn:hover {
  background: #dbeafe;
  color: #1e40af;
}

.unread-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* ================================================================
   CHAT WIDGET CONTAINER
   ================================================================ */
.chat-widget {
  position: fixed;
  left: auto;
  top: auto;
  right: 24px;
  bottom: 24px;
  cursor: grab;
  width: 380px;
  height: 650px;
  max-height: 85vh;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  z-index: 998;
  /* Closed = slide off to the right (not visible on screen) */
  transform: translateX(calc(100% + 48px));
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border: 1px solid #e2e8f0;
  visibility: visible;
  pointer-events: auto;
}

.chat-widget:not(.visible) {
  visibility: hidden;
  pointer-events: none;
}

.chat-widget.visible {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

/* ================================================================
   CHAT HEADER - ENHANCED BEAUTIFUL DESIGN
   ================================================================ */
.chat-header {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #0c4a6e 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: none;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

/* Animated background overlay */
.chat-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(255, 255, 255, 0.05) 50%, 
    transparent 100%);
  pointer-events: none;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
}

.chat-header-content {
  flex: 1;
  position: relative;
  z-index: 1;
}

.chat-header-content h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px 0 !important;
  letter-spacing: -0.02em;
  /* color/gradient from .chat-title-info h1 */
}

.chat-subtitle {
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Status indicator */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-icon-link {
  display: inline-block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.chat-icon {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.chat-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, 
    transparent 30%, 
    rgba(255, 255, 255, 0.2) 50%, 
    transparent 70%);
  animation: iconShine 3s ease-in-out infinite;
}

@keyframes iconShine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

.chat-icon-link:hover .chat-icon {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.chat-icon:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.chat-icon img {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.chat-title-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-title-info h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 50%, #bae6fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
  text-shadow: none;
  line-height: 1.2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.chat-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05) rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-close-btn:active {
  transform: scale(0.95) rotate(90deg);
}

/* Minimize button - same style as close, no rotate */
.chat-minimize-btn {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

.chat-minimize-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-minimize-btn:active {
  transform: scale(0.95);
}

/* ================================================================
   CHAT HEADER ACTIONS
   ================================================================ */
.chat-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.header-btn {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.header-btn:active {
  transform: scale(0.95);
}

.header-btn.disabled {
  opacity: 0.5;
}

/* ================================================================
   CHAT MESSAGES AREA
   ================================================================ */
.chat-messages-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px;
  background: #ffffff;
  scroll-behavior: smooth;
  position: relative;
}

.chat-messages-wrapper::-webkit-scrollbar {
  width: 6px;
}

.chat-messages-wrapper::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 3px;
}

.chat-messages-wrapper::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 3px;
}

.chat-messages-wrapper::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ================================================================
   AUTO-SCROLL BUTTON
   ================================================================ */
.auto-scroll-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  padding: 0;
  animation: slideUp 0.3s ease-out;
}

.auto-scroll-btn:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

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

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

.messages {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 8px;
}

/* ================================================================
   GREETING SECTION
   ================================================================ */
.message-greeting {
  text-align: center;
  padding: 20px 20px 24px;
  margin-bottom: 8px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.greeting-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  position: relative;
}

.greeting-gif {
  width: 250px;
  height: 310px;
  object-fit: contain;
  border-radius: 50%;
  animation: greetingBounce 2s ease-in-out infinite;
}

@keyframes greetingBounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.05);
  }
}

/* Animation for GIF moving to corner */
.message-greeting.animating .greeting-gif {
  position: absolute;
  z-index: 1001;
  animation: moveToCorner 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes moveToCorner {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    transform: translate(280px, -450px) scale(0.25);
    opacity: 0;
  }
}

.message-greeting h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.message-greeting p {
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 12px;
}

.message-greeting {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: #2563eb;
  text-decoration: none;
  margin-top: 4px;
  padding: 8px 14px;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}


/* ================================================================
   QUICK PROMPTS
   ================================================================ */
.quick-prompts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.quick-prompt-btn {
  background: white;
  border: 1.5px solid #e5e7eb;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-align: left;
}

.quick-prompt-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateX(4px);
}

.prompt-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ================================================================
   MESSAGE BUBBLES - ENHANCED
   ================================================================ */
.message {
  display: flex;
  gap: 10px;
  animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.message.bot-message {
  justify-content: flex-start;
}

.message.user-message {
  justify-content: flex-end;
}

/* Added avatar icons for bot and user messages */
.message::before, .message.bot-message::before, .message.user-message::before {
  display: none !important;
}

.message-body {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message.user-message .message-body {
  order: 1;
  max-width: 85%;
}

.message-content {
  background: white;
  border: 1px solid #e2e8f0;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.65;
  color: #334155;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
}

.message.bot-message .message-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  border-radius: 14px 14px 14px 4px;
}

/* Bot bubble containing enhanced-reply - hide only direct .message-content child, not content inside sections */
.message.bot-message .message-body:has(.enhanced-reply) > .message-content {
  display: none;
}

.message.bot-message .message-body:has(.enhanced-reply) {
  max-width: 100%;
}

.message.bot-message .message-body:has(.enhanced-reply) .enhanced-reply {
  margin: 0;
}

/* User question bubble - matches response section card UI */
.message.user-message .message-content {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e40af;
  border: 1px solid #93c5fd;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
  border-radius: 14px 14px 4px 14px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.65;
  background: #ffffff;
  border: 1px solid #86baff;
  border-left: 3px solid #ff5a24;
  padding: 12px 14px;
  border-radius: 10px;
}

/* Added timestamp styling */
.message-timestamp {
  font-size: 11px;
  color: #94a3b8;
  padding: 0 4px;
  margin-top: 4px;
}

.message.user-message .message-timestamp {
  text-align: right;
  color: #64748b;
}

/* Code blocks in messages */
.message-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 3px 7px;
  border-radius: 6px;
  font-family: "Monaco", "Courier New", monospace;
  font-size: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.message.user-message .message-content code {
  background: rgba(30, 64, 175, 0.2);
  border-color: rgba(30, 64, 175, 0.3);
  color: #1e3a8a;
}

/* Strong text (step numbers, key terms) */
.message-content strong {
  font-weight: 700;
  color: #1e3a5f;
}

.message.user-message .message-content strong {
  color: #1e40af;
}

/* Step list spacing - minimal gap after intro */
.message-content br + strong,
.answer-section br + strong {
  display: inline-block;
  margin-top: 4px;
}

/* Links - inside bot response */
.message-content a,
.answer-section a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 99, 235, 0.4);
  transition: color 0.2s, border-color 0.2s;
}

.message.user-message .message-content a {
  color: #1d4ed8;
  border-bottom-color: rgba(29, 78, 216, 0.5);
}

.message-content a:hover,
.answer-section a:hover {
  color: #1d4ed8;
  border-bottom-color: #2563eb;
}

/* Strong/bold in answers - menu paths, step numbers */
.answer-section strong {
  font-weight: 700;
  color: #1e293b;
}

/* ================================================================
   STRUCTURED ANSWER SECTIONS - ENHANCED UI FORMAT
   ================================================================ */
.enhanced-reply {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;  
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  animation: fadeIn 0.36s;
}

.answer-section {
  padding: 5px 5px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.65;
  color: #334155;
  transition: all 0.2s ease;
}

.answer-section:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.answer-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
  text-transform: none;
}

/* Section content - paragraphs and lists */
.answer-section .typing-content p,
.answer-section p {
  margin: 0 0 10px 0;
}
.answer-section .typing-content p:last-child,
.answer-section p:last-child {
  margin-bottom: 0;
}

.answer-section ol.steps-list {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}

.answer-section ol.steps-list li {
  position: relative;
  margin-bottom: 14px;
  padding: 12px 12px 12px 44px;
  padding-left: 44px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  counter-increment: step;
  min-height: 2.5em;
}

.answer-section ol.steps-list li:last-child {
  margin-bottom: 0;
}

.answer-section ol.steps-list li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.answer-section ol:not(.steps-list),
.answer-section ul {
  margin: 0 0 0 18px;
  padding: 0;
}

.answer-section li:not(.steps-list li) {
  margin-bottom: 8px;
  padding-left: 4px;
}

.answer-section li::marker {
  font-weight: 600;
  color: #64748b;
}

/* Intro line (## from backend) - bold heading, minimal space below */
.answer-section .answer-intro,
.message-content .answer-intro {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
  margin: 0 0 4px 0;
  padding: 0 0 2px 0;
  border-bottom: 1px solid #e2e8f0;
  letter-spacing: 0.01em;
}
.answer-section .answer-intro em,
.message-content .answer-intro em {
  font-style: italic;
  font-weight: 700;
  color: #475569;
}

/* Subheading (### from backend) - bold subheading, minimal space below */
.answer-section .answer-subhead,
.message-content .answer-subhead {
  font-size: 13px;
  font-weight: 700;
  color: #1e3a5f;
  line-height: 1.4;
  margin: 4px 0 2px 0;
  padding: 0;
}
.answer-section .answer-subhead em,
.message-content .answer-subhead em {
  font-style: italic;
  font-weight: 700;
  color: #475569;
}

.answer-section .answer-subhead:first-child,
.message-content .answer-subhead:first-child {
  margin-top: 0;
}

/* Section heading (e.g. "Steps to...:", "Result and Notes:") - bold, clear hierarchy */
.answer-section .answer-section-head,
.message-content .answer-section-head {
  font-size: 13px;
  font-weight: 700;
  color: #1e3a5f;
  line-height: 1.5;
  margin: 6px 0 4px 0;
  padding: 0;
}

/* Bullet & numbered lists inside message/answer - proper spacing */
.answer-section .answer-list,
.message-content .answer-list {
  margin: 8px 0 12px 0;
  padding-left: 20px;
  line-height: 1.6;
}

.answer-section .answer-list li,
.message-content .answer-list li {
  margin-bottom: 6px;
  padding-left: 4px;
}

.answer-section .answer-list-num {
  list-style: decimal;
  padding-left: 24px;
}

.answer-section .answer-list-num li {
  margin-bottom: 6px;
}

/* Indented sub-steps / sub-sub (from backend: 2 or 4 space indent; bullets rendered as hierarchy) */
.answer-section .answer-indent,
.message-content .answer-indent {
  margin: 2px 0 10px 0;
  padding-left: 0.75em;
  border-left: 2px solid #cbd5e1;
  font-size: 0.95em;
  line-height: 1.55;
  color: #334155;
}
.answer-section .answer-indent-line,
.message-content .answer-indent-line {
  margin: 2px 0;
  line-height: 1.5;
}
/* Sub-list under a step: bullets with proper hierarchy */
.answer-section .answer-sublist,
.message-content .answer-sublist {
  margin: 4px 0 6px 0;
  padding-left: 1.25em;
  list-style-type: disc;
}
.answer-section .answer-sublist li,
.message-content .answer-sublist li {
  margin: 0.2em 0 0.35em 0;
  padding-left: 2px;
  line-height: 1.5;
}
.answer-section .answer-sublist-nested,
.message-content .answer-sublist-nested {
  margin-left: 1em;
  padding-left: 0.5em;
  list-style-type: circle;
}
.message-content .answer-formatted .answer-sublist {
  margin: 0.25em 0 0.5em 0;
  padding-left: 1.25em;
}
.message-content .answer-formatted .answer-sublist li {
  margin: 0.2em 0;
}
.message-content .answer-formatted .answer-sublist-nested {
  margin-left: 1em;
  list-style-type: circle;
}

/* Inline code in responses */
.answer-section .answer-inline-code,
.message-content .answer-inline-code {
  background: rgba(30, 64, 175, 0.08);
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 12px;
  font-weight: 500;
}

/* Paragraph spacing in typed content - professional readability */
.answer-section .typing-content br + br,
.message-content br + br {
  display: block;
  content: "";
  margin-top: 6px;
}

.message-content strong,
.answer-section .typing-content strong {
  font-weight: 700;
  color: #1e3a5f;
}

.message-content em,
.answer-section .typing-content em {
  font-style: italic;
  color: #475569;
}

/* Bold + italic combined (e.g. ***word*** in headings) */
.message-content strong em,
.message-content em strong,
.answer-section .typing-content strong em,
.answer-section .typing-content em strong {
  font-weight: 700;
  font-style: italic;
  color: #334155;
}

/* ================================================================
   FORMATTED BOT ANSWER - steps, sub-steps, indentation (same as frontend)
   ================================================================ */
.message-content.answer-formatted {
  white-space: normal;
  line-height: 1.6;
  word-wrap: break-word;
}
.message-content.answer-formatted p.answer-plain {
  white-space: pre-wrap;
  margin: 0 0 0.75em;
}
.message-content.answer-formatted p {
  margin: 0 0 0.75em;
}
.message-content.answer-formatted p:last-child {
  margin-bottom: 0;
}
.message-content.answer-formatted p.answer-heading {
  font-weight: 700;
  margin-top: 1em;
  margin-bottom: 0.35em;
  font-size: 1em;
  color: #1e3a5f;
}
.message-content.answer-formatted p.answer-heading:first-child {
  margin-top: 0;
}
.message-content.answer-formatted .answer-indent {
  margin: 0.35em 0 0.75em;
  border-left: 2px solid #e2e8f0;
  font-size: 0.875em;
  font-weight: 400;
  line-height: 1.55;
  color: #334155;
  padding-left: 0.5em;
}
.message-content.answer-formatted .answer-indent-line {
  margin: 0.2em 0;
  padding-left: 0.25em;
}
.message-content.answer-formatted p.answer-step {
  margin: 0.4em 0 0.25em 0;
  padding-left: 0;
  line-height: 1.55;
  font-weight: 500;
  color: #1e3a5f;
}
.message-content.answer-formatted p.answer-step:first-of-type {
  margin-top: 0;
}
.message-content.answer-formatted .answer-indent {
  margin-top: 0.15em;
  margin-bottom: 0.6em;
}
.message-content.answer-formatted ol.list-top,
.message-content.answer-formatted ul.list-top {
  margin: 0.5em 0 0.75em;
  padding-left: 1.5em;
}
.message-content.answer-formatted ol.list-top {
  list-style-type: decimal;
}
.message-content.answer-formatted ul.list-top {
  list-style-type: disc;
}
.message-content.answer-formatted .list-top li {
  margin: 0.4em 0;
  padding-left: 0.35em;
}
.message-content.answer-formatted .list-top li.indent {
  list-style-type: circle;
  margin-left: 1.25em;
  padding-left: 0.25em;
}
.message-content.answer-formatted ol.list-nested,
.message-content.answer-formatted ul.list-nested {
  margin: 0.25em 0 0.5em 1em;
  padding-left: 1.25em;
}
.message-content.answer-formatted ol.list-nested {
  list-style-type: lower-alpha;
}
.message-content.answer-formatted ul.list-nested {
  list-style-type: circle;
}
.message-content.answer-formatted .list-nested li {
  margin: 0.2em 0;
}
.message-content.answer-formatted strong {
  font-weight: 700;
  color: #1e3a5f;
}
.message-content.answer-formatted strong em,
.message-content.answer-formatted em strong {
  font-weight: 700;
  font-style: italic;
  color: #0c4a6e;
}

/* Summary card */
.summary-box {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
  border: 1px solid #bae6fd;
  border-left: 4px solid #0284c7;
  padding: 14px 16px 14px 18px;
  border-radius: 12px;
}

.summary-box h3 {
  color: #0369a1;
  font-size: 13px;
  margin-bottom: 10px;
}

.summary-box .typing-content {
  font-size: 14px;
  font-weight: 500;
  color: #0c4a6e;
  line-height: 1.6;
}

/* Steps card - numbered steps with badges */
.steps-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  padding: 14px 16px;
  border-radius: 12px;
}

.steps-box .steps-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.steps-box h3 {
  color: #1e40af;
  font-size: 13px;
  margin: 0;
}

.steps-box .copy-btn {
  margin-left: auto;
}

/* Follow-up / Tip callout */
.followup-box {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 40%, #faf5ff 100%);
  border: 1px solid #c4b5fd;
  border-left: 4px solid #7c3aed;
  padding: 12px 16px;
  border-radius: 12px;
}

.followup-box h3 {
  color: #5b21b6;
  font-size: 13px;
  margin-bottom: 8px;
}

.followup-box .typing-content {
  font-size: 13px;
  color: #4c1d95;
  line-height: 1.55;
}

/* Video link at end of answer (no separate section; title as clickable link) */
.answer-video-at-end {
  margin-top: 0.75em;
  margin-bottom: 0;
}
.answer-video-at-end .answer-video-link {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
  cursor: pointer;
  text-decoration: underline;
}
.answer-video-at-end .answer-video-link:hover {
  text-decoration: underline;
  color: #1e40af;
}

/* Suggested follow-up questions (Related questions) */
.suggested-follow-ups {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #64748b;
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 8px;
}
.suggested-follow-ups-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
}
.suggested-follow-ups-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.suggested-follow-up-chip {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.suggested-follow-up-chip:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

/* Sources list */
.sources-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #64748b;
  padding: 10px 14px;
  border-radius: 10px;
}

.sources-box h3 {
  font-size: 12px;
  color: #475569;
  margin: 0 0 8px 0;
}

.sources-box .sources-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.sources-box .sources-list li {
  margin-bottom: 4px;
}

/* Full answer (no steps) */
.answer-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #64748b;
  padding: 7px 5px;
  border-radius: 12px;
}

.answer-box h3 {
  color: #475569;
  font-size: 13px;
}

.answer-box .typing-content {
  font-size: 13px;
  color: #334155;
  line-height: 1.65;
}

/* Copy button - clear CTA */
.copy-btn {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.copy-btn:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #60a5fa;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

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

.copy-btn::before {
  content: "ðŸ“‹";
  font-size: 12px;
}

/* ================================================================
   CREATE PO CTA + FORM (inline inside bot answer)
   ================================================================ */
.po-cta {
  background: #f8fafc;
  border-left-color: #0ea5e9;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.po-cta-text {
  font-size: 13px;
  color: #334155;
  margin: 0;
}

.po-cta-button {
  align-items: flex-start;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #0ea5e9;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  color: #0369a1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.po-cta-button:hover {
  background: linear-gradient(135deg, #bae6fd 0%, #7dd3fc 100%);
  border-color: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.po-cta-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.po-form-holder {
  margin-top: 4px;
}

.po-form {
  margin-top: 6px;
  background: #ffffff;
  border-left-color: #0ea5e9;
}

.po-form h3 {
  margin-bottom: 6px;
  font-size: 13px;
  color: #0f172a;
}

.po-form-intro {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 10px 0;
}

.po-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.po-row-inline {
  flex-direction: row;
  gap: 10px;
}

.po-row-inline .po-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.po-label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.po-label-helper {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #94a3b8;
}

.po-input {
  width: 100%;
  padding: 7px 9px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f9fafb;
  color: #0f172a;
  outline: none;
  transition: all 0.15s ease;
}

.po-input:focus {
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.po-input-date {
  min-height: 34px;
}

.po-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.po-submit-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
  transition: all 0.2s ease;
}

.po-submit-btn:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.45);
  transform: translateY(-1px);
}

.po-submit-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.po-cancel-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.po-cancel-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.po-error {
  margin-top: 6px;
  font-size: 12px;
  color: #b91c1c;
  background: #fef2f2;
  border-radius: 6px;
  padding: 6px 8px;
  border: 1px solid #fecaca;
  display: none;
}

.po-error div + div {
  margin-top: 2px;
}

.po-summary-holder {
  margin-top: 10px;
}

.po-summary {
  margin-top: 4px;
  background: #f8fafc;
  border-left-color: #0ea5e9;
}

.po-summary-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 4px 10px;
  margin-bottom: 8px;
}

.po-summary-header .po-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: #64748b;
}

.po-summary-header .po-value {
  display: inline-block;
  margin-left: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
}

.po-summary-table {
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  font-size: 12px;
}

.po-summary-row {
  display: grid;
  grid-template-columns: 2fr 0.7fr 1fr 1fr;
  gap: 6px;
  padding: 6px 8px;
  align-items: center;
}

.po-summary-row:nth-child(even):not(.po-summary-row-head):not(.po-summary-row-total) {
  background: #f9fafb;
}

.po-summary-row-head {
  background: #e5f3ff;
  font-weight: 600;
  color: #1e3a8a;
}

.po-summary-row-total {
  background: #f1f5f9;
  font-weight: 600;
  color: #111827;
}

.po-summary-row-total div:first-child {
  grid-column: 1 / 4;
  text-align: right;
  padding-right: 6px;
}

/* ================================================================
   CREATE PROJECT CTA + FORM (inline inside bot answer)
   ================================================================ */
.project-cta {
  background: #f8fafc;
  border-left-color: #4f46e5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.project-cta-text {
  font-size: 13px;
  color: #334155;
  margin: 0;
}

.project-cta-button {
  align-items: flex-start;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #4f46e5;
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-cta-button:hover {
  background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%);
  border-color: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.project-cta-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.project-form-holder {
  margin-top: 4px;
}

.project-form {
  margin-top: 6px;
  background: #ffffff;
  border-left-color: #4f46e5;
}

.project-form h3 {
  margin-bottom: 6px;
  font-size: 13px;
  color: #0f172a;
}

.project-form-intro {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 10px 0;
}

.project-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.project-label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.project-required {
  color: #dc2626;
  font-weight: 700;
}

.project-input {
  width: 100%;
  padding: 7px 9px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f9fafb;
  color: #0f172a;
  outline: none;
  transition: all 0.15s ease;
}

.project-input:focus {
  background: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.18);
}

.project-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.project-submit-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
  transition: all 0.2s ease;
}

.project-submit-btn:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.45);
  transform: translateY(-1px);
}

.project-submit-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.project-cancel-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-cancel-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.project-error {
  margin-top: 6px;
  font-size: 12px;
  color: #b91c1c;
  background: #fef2f2;
  border-radius: 6px;
  padding: 6px 8px;
  border: 1px solid #fecaca;
  display: none;
}

.project-result {
  margin-top: 6px;
  font-size: 12px;
  color: #166534;
  background: #ecfdf3;
  border-radius: 6px;
  padding: 6px 8px;
  border: 1px solid #bbf7d0;
  display: none;
}

/* ================================================================
   LOADING INDICATOR - ENHANCED
   ================================================================ */
.loading {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  align-items: center;
}

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  animation: dotPulse 1.4s ease-in-out infinite;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.loading-dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes dotPulse {
  0%,
  60%,
  100% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ================================================================
   INPUT AREA - ENHANCED
   ================================================================ */
.chat-input-area {
  padding: 16px 18px;
  background: #fbfbfb;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  box-shadow: none;
}

.chat-input-area form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chat-disclaimer {
  margin: 0;
  padding: 8px 18px 12px;
  font-size: 11px;
  line-height: 1.35;
  color: #64748b;
  text-align: center;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.chat-meta-fields {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.chat-meta-field {
  flex: 1;
  min-width: 120px;
}

.chat-meta-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chat-meta-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #f9fafb;
  color: #374151;
  box-sizing: border-box;
}

.chat-meta-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-with-count {
  flex: 1;
  position: relative;
}

.input-with-count .char-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 11px;
  color: #9ca3af;
  margin: 0;
  padding: 0;
  line-height: 1;
  pointer-events: none;
}
.input-with-count .char-count.near-limit {
  color: #dc2626;
}

#questionInput {
  width: 100%;
  padding: 13px 50px 13px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
  background: #f9fafb;
  line-height: 1.5;
  color: rgba(0, 0, 0, 1);
  box-sizing: border-box;
}

#questionInput:focus {
  background: white;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

#questionInput::placeholder {
  color: #9ca3af;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: #2676df;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(38, 118, 223, 0.09);
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.45);
}

.send-btn:active:not(:disabled) {
  transform: translateY(0);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Cancel mode: red ✕ button while request is in progress */
.send-btn.send-btn-cancel {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}
.send-btn.send-btn-cancel:hover {
  background: #b91c1c;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */
@media (max-width: 640px) {
  .chat-widget {
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-height: 100vh;
    transform: translateY(100%);
  }

  .chat-widget.visible {
    transform: translateY(0);
  }

  .message::before {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .message-body {
    max-width: 80%;
  }

  .chat-messages-wrapper {
    padding: 16px;
  }

  .quick-prompts {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .quick-prompt-btn {
    font-size: 12px;
    padding: 10px 12px;
  }

  .answer-section {
    padding: 12px 14px;
  }

  .enhanced-reply {
    padding: 12px 10px;
  }

  .answer-section ol.steps-list li {
    padding-left: 42px;
  }

  .answer-section ol.steps-list li::before {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .chat-toggle-btn {
    right: 16px;
    bottom: 16px;
    width: 50px;
    height: 50px;
  }

  .chat-header {
    padding: 14px 16px;
  }
  
  .chat-icon {
    width: 42px;
    height: 42px;
  }
  
  .chat-title-info h1 {
    font-size: 17px;
  }
  
  .chat-subtitle {
    font-size: 11px;
  }

  .chat-title-info h1 {
    font-size: 16px;
  }

  .message-content {
    font-size: 13px;
    padding: 12px 14px;
  }

  .message::before {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .message-greeting h2 {
    font-size: 18px;
  }

  .chat-input-area {
    padding: 12px 16px 16px;
  }

  #questionInput {
    padding: 11px 42px 11px 14px;
    font-size: 13px;
  }

  .send-btn {
    width: 40px;
    height: 40px;
  }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.hidden {
  display: none !important;
}

/* Added fade-in animation for smoother appearance */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

/* ================================================================
   TYPING ANIMATION CURSOR
   ================================================================ */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #3b82f6;
  margin-left: 2px;
  animation: blink 1s infinite;
  vertical-align: baseline;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

.typing-content {
  min-height: 1em;
}

/* ================================================================
   FEEDBACK SCREEN (before close)
   ================================================================ */
.feedback-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  animation: fadeIn 0.25s ease-out;
}

.feedback-screen[hidden] {
  display: none !important;
}

.feedback-screen-content {
  text-align: center;
  padding: 24px 20px;
  max-width: 320px;
}

.feedback-screen-message {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.5;
  color: #374151;
  font-weight: 500;
}

.feedback-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}

.feedback-star {
  padding: 4px;
  border: none;
  background: none;
  cursor: pointer;
  color: #d1d5db;
  transition: transform 0.15s ease, color 0.15s ease;
}

.feedback-star:hover {
  transform: scale(1.15);
}

.feedback-star .star-icon {
  font-size: 32px;
  line-height: 1;
  display: block;
}

.feedback-star.active,
.feedback-star.filled {
  color: #f59e0b;
}

.feedback-star:hover {
  color: #fbbf24;
}

.feedback-rating-text {
  margin: 0 0 20px;
  font-size: 13px;
  color: #6b7280;
}

.feedback-screen-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feedback-submit-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: all 0.2s ease;
}

.feedback-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.feedback-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.feedback-skip-btn {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #6b7280;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.feedback-skip-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}

/* ================================================================
   CLOSE CHAT MODAL
   ================================================================ */
.close-chat-modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  animation: fadeIn 0.2s ease-out;
}

.close-chat-modal.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.close-chat-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  width: calc(100% - 32px);
  max-width: min(320px, 100%);
  overflow: hidden;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.close-chat-modal-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.close-chat-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.close-chat-modal-body {
  padding: 16px 20px;
}

.close-chat-modal-body p {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.close-chat-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 20px 12px;
}

.close-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.close-chat-btn svg {
  flex-shrink: 0;
}

.close-chat-btn.clear-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(87, 67, 67, 0.3);
}

.close-chat-btn.clear-btn:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.close-chat-btn.clear-btn:active {
  transform: translateY(0);
}

.close-chat-btn.keep-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.close-chat-btn.keep-btn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.close-chat-btn.keep-btn:active {
  transform: translateY(0);
}

.close-chat-cancel-btn {
  display: block;
  width: calc(100% - 40px);
  margin: 0 20px 16px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.close-chat-cancel-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}

.close-chat-cancel-btn:active {
  transform: scale(0.98);
}

@media (max-width: 480px) {
  .close-chat-modal-content {
    width: calc(100% - 24px);
    max-width: none;
  }

  .close-chat-modal-header,
  .close-chat-modal-body,
  .close-chat-modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .close-chat-cancel-btn {
    width: calc(100% - 32px);
    margin-left: 16px;
    margin-right: 16px;
  }
}