/**
 * AI Chat Component Styles
 * 
 * This file contains styles for the AI chat interface component.
 * Uses BEM methodology for maintainable CSS architecture.
 * 
 * @author LoanFlow Development Team
 * @version 2.1.0 - Updated footer button styling
 * @since 2024-01-01
 * @updated 2024-01-15 - Fixed suggestion button appearance
 */

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
  /* Color Palette */
  --color-primary: #1B424C;
  --color-primary-light: #39C260;
  --color-primary-dark: #0f2a32;
  --color-secondary: #6c757d;
  --color-success: #39C260;
  --color-white: #ffffff;
  --color-gray-100: #f8f9fa;
  --color-gray-200: #e9ecef;
  --color-gray-300: #6c757d;
  --color-gray-900: #212529;
  
  /* Typography */
  --font-family-primary: 'Poppins', 'NotoSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  
  /* Font Sizes */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  
  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Spacing Scale */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 0.75rem;   /* 12px */
  --spacing-lg: 1rem;      /* 16px */
  --spacing-xl: 1.25rem;   /* 20px */
  --spacing-2xl: 1.5rem;   /* 24px */
  --spacing-3xl: 2rem;     /* 32px */
  --spacing-4xl: 2.5rem;   /* 40px */
  
  /* Border Radius */
  --border-radius-sm: 0.375rem;   /* 6px */
  --border-radius-md: 0.5rem;     /* 8px */
  --border-radius-lg: 1rem;       /* 16px */
  --border-radius-xl: 1.25rem;    /* 20px */
  --border-radius-full: 50%;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.2s ease-in-out;
  --transition-slow: 0.3s ease-in-out;
  
  /* Z-Index Scale */
  --z-index-dropdown: 1000;
  --z-index-sticky: 1020;
  --z-index-fixed: 1030;
  --z-index-modal-backdrop: 1040;
  --z-index-modal: 1050;
  --z-index-popover: 1060;
  --z-index-tooltip: 1070;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

/**
 * Reset and base styles for the chat component
 */
.ai-chat {
  /* CSS Reset for component isolation */
  box-sizing: border-box;
  font-family: var(--font-family-primary);
  line-height: 1.5;
  color: var(--color-gray-900);
  
  /* Ensure proper text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   Chat Container (Block) - Universal Support
   ========================================================================== */

/**
 * Main chat container component - supports both old and new class names
 * 
 * @component .ai-chat, .ai-chat-container
 */
.ai-chat,
.ai-chat-container {
  position: fixed !important;
  top: 2rem !important;         /* 32px - closer to top like AskCodi */
  right: 1.5rem !important;     /* 24px - slightly more margin from right */
  width: 21.375rem !important;  /* 342px - 10% reduction from 380px */
  height: 33.75rem !important;  /* 540px - 10% reduction from 600px */
  background: #ffffff !important;
  border-radius: 1rem !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
  display: none !important;
  flex-direction: column !important;
  z-index: 9998 !important;     /* Lower than header to ensure header stays on top */
  border: 2px solid #1B424C !important;
  overflow: hidden !important;
  
  /* AskCodi-style positioning - independent of page scroll */
  transform: translateZ(0) !important;  /* Hardware acceleration */
  will-change: transform !important;    /* Optimize for animations */
  
  /* Animation */
  animation: ai-chat__slide-in-up 0.3s ease-out;
}

/**
 * Chat container when visible - supports both old and new class names
 * 
 * @modifier .ai-chat--visible, .show
 */
.ai-chat--visible,
.ai-chat.show,
.ai-chat-container.show {
  display: flex !important;
  /* Ensure chat overlays headers and other fixed elements when visible */
  z-index: 20000 !important;
}

/* ==========================================================================
   Chat Header (Block)
   ========================================================================== */

/**
 * Chat header section - supports both old and new class names
 * 
 * @component .ai-chat__header, .chat-header
 */
.ai-chat__header,
.chat-header {
  background: #1B424C !important;
  color: #ffffff !important;
  padding: 1.25rem 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;  /* Changed to column to stack controls above main content */
  flex-shrink: 0 !important;
  min-height: 4rem !important;
  position: relative !important;  /* For absolute positioning of controls */
}

/**
 * Header info section containing avatar and title
 * 
 * @component .ai-chat__header-info
 */
.ai-chat__header-info {
    display: flex;
    align-items: center;
  gap: 1.5rem;  /* Increased from var(--spacing-lg) to 1.5rem for wider spacing */
  flex: 1;
}

/**
 * Chat avatar
 * 
 * @component .ai-chat__avatar
 */
.ai-chat__avatar {
  width: 3.3125rem;             /* 53px - 32.5% increase from 40px */
  height: 3.3125rem;            /* 53px - 32.5% increase from 40px */
  border-radius: var(--border-radius-full);
  background: transparent !important;  /* Let the SVG logo handle the background */
  border: none !important;  /* Remove CSS border - let SVG handle it */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  overflow: hidden !important;
  color: inherit !important;  /* Let the SVG handle text colors */
  font-weight: inherit !important;
  font-size: inherit !important;
}

/**
 * Chat title
 * 
 * @component .ai-chat__title
 */
.ai-chat__title {
    margin: 0;
  font-size: 0.984375rem;  /* Reduced by 50% ≈ 15.75px */
  font-weight: normal;
  line-height: 1.2;
  color: #ffffff;
  display: flex;
  flex-direction: row;  /* Changed from column to row for horizontal layout */
  align-items: center;  /* Center align items vertically */
  gap: 0.5rem;  /* Increased gap for better spacing between title and status */
  flex: 1;  /* Allow title section to take available space */
}

/* Ensure the actual H4 title shrinks despite global/Bootstrap heading styles */
.ai-chat__title h4 {
  font-size: 0.984375rem !important; /* ~15.75px */
  line-height: 1 !important;
  margin: 0 !important;
  font-weight: normal !important;
}

/**
 * Online status indicator
 * 
 * @component .ai-chat__status
 */
.ai-chat__status {
  background: #39C260;
  color: #ffffff;
  padding: 0.125rem 0.375rem;  /* Reduced horizontal padding for better fit */
  border-radius: 0.75rem;
  font-size: 0.625rem;  /* Reduced from 0.75rem to 0.625rem for better fit */
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  align-self: center;  /* Changed from flex-start to center for proper alignment */
  white-space: nowrap;  /* Prevent text wrapping */
}

/**
 * Header control buttons container
 * 
 * @component .ai-chat__controls
 */
.ai-chat__controls {
    display: flex;
  gap: 0.25rem;  /* Reduced gap between buttons */
  position: absolute !important;  /* Position absolutely in top right */
  top: 0.5rem !important;  /* Small margin from top */
  right: 0.5rem !important;  /* Small margin from right */
  z-index: 10 !important;  /* Ensure buttons are above other content */
}

/**
 * Control button base styles
 * 
 * @component .ai-chat__control-btn
 */
.ai-chat__control-btn {
    background: transparent;  /* Removed background box */
    border: none;
  color: var(--color-white);
  width: auto;                 /* Auto width for text-only buttons */
  height: auto;                /* Auto height for text-only buttons */
  border-radius: 0;            /* Removed border radius */
  padding: 0.25rem 0.5rem;     /* Added padding for clickable area */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  font-size: 0.875rem;         /* Smaller font size */
  font-weight: var(--font-weight-bold);
  font-family: var(--font-family-primary);
  transition: all var(--transition-normal);
  
  /* Focus styles for accessibility */
  outline: none;
}

.ai-chat__control-btn:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
}

.ai-chat__control-btn:hover {
    background: rgba(255, 255, 255, 0.1);  /* Subtle hover background */
    transform: scale(1.05);
}

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

/* ==========================================================================
   Chat Messages (Block)
   ========================================================================== */

/**
 * Messages container
 * 
 * @component .ai-chat__messages
 */
.ai-chat__messages {
    flex: 1 !important;
  padding: var(--spacing-xl) !important;
    overflow-y: auto !important;
  background: var(--color-gray-100) !important;
    display: flex !important;
    flex-direction: column !important;
  gap: var(--spacing-lg) !important;
  visibility: visible !important;
  opacity: 1 !important;
  
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--color-gray-300) transparent;
}

.ai-chat__messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat__messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat__messages::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
    border-radius: 3px;
}

.ai-chat__messages::-webkit-scrollbar-thumb:hover {
  background: var(--color-secondary);
}

/**
 * Individual message
 * 
 * @component .ai-chat__message
 */
.ai-chat__message {
    display: flex !important;
  gap: var(--spacing-md) !important;
  align-items: flex-start !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/**
 * Bot message variant
 * 
 * @modifier .ai-chat__message--bot
 */
.ai-chat__message--bot {
  justify-content: flex-start;
}

/**
 * User message variant
 * 
 * @modifier .ai-chat__message--user
 */
.ai-chat__message--user {
  justify-content: flex-end;
    flex-direction: row-reverse;
}

/**
 * Message avatar
 * 
 * @component .ai-chat__message-avatar
 */
.ai-chat__message-avatar {
  width: 2.3rem;                /* 36.8px - 15% increase from 32px */
  height: 2.3rem;               /* 36.8px - 15% increase from 32px */
  border-radius: var(--border-radius-full);
  background: transparent !important;  /* Let the SVG logo handle the background */
  border: none !important;  /* Remove CSS border - let SVG handle it */
  color: inherit !important;  /* Let the SVG handle text colors */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  overflow: hidden !important;
}

/**
 * User message avatar variant
 * 
 * @modifier .ai-chat__message-avatar--user
 */
.ai-chat__message-avatar--user {
  background: transparent !important;  /* Let the SVG logo handle the background */
  border: none !important;  /* Remove CSS border - let SVG handle it */
  color: inherit !important;  /* Let the SVG handle text colors */
}

/**
 * Message content container
 * 
 * @component .ai-chat__message-content
 */
.ai-chat__message-content {
    max-width: 75% !important;
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/**
 * Message text
 * 
 * @component .ai-chat__message-text
 */
.ai-chat__message-text {
  background: #ffffff !important;
  padding: 0.75rem 1rem !important;
  border-radius: 1.125rem !important;
  margin: 0 !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  line-height: 1.5 !important;
  word-wrap: break-word !important;
  color: #1B424C !important;
  font-size: 0.8125rem !important; /* 13px - reduced by 1px from 14px */
  font-weight: 400 !important;
  border: 1px solid #e9ecef !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/**
 * User message text variant
 * 
 * @modifier .ai-chat__message-text--user
 */
.ai-chat__message-text--user {
  background: #1B424C !important;
  color: #ffffff !important;
  border-color: #1B424C !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/**
 * Message timestamp
 * 
 * @component .ai-chat__message-time
 */
.ai-chat__message-time {
  font-size: var(--font-size-xs);
  color: var(--color-gray-300);
  margin-top: var(--spacing-xs);
  padding: 0 var(--spacing-xs);
}

/**
 * User message timestamp variant
 * 
 * @modifier .ai-chat__message-time--user
 */
.ai-chat__message-time--user {
    text-align: right;
}

/* ==========================================================================
   Typing Indicator (Block)
   ========================================================================== */

/**
 * Typing indicator container
 * 
 * @component .ai-chat__typing
 */
.ai-chat__typing {
    display: flex;
    align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-white);
  border-radius: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  margin: 0 3.25rem 0 0;        /* 52px */
}

/**
 * Typing dots animation
 * 
 * @component .ai-chat__typing-dots
 */
.ai-chat__typing-dots {
    display: flex;
  gap: var(--spacing-xs);
}

/**
 * Individual typing dot
 * 
 * @component .ai-chat__typing-dot
 */
.ai-chat__typing-dot {
  width: 0.375rem;              /* 6px */
  height: 0.375rem;             /* 6px */
  background: var(--color-primary);
  border-radius: var(--border-radius-full);
  animation: ai-chat__typing-pulse 1.4s infinite ease-in-out;
}

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

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

/* ==========================================================================
   Chat Input (Block)
   ========================================================================== */

/**
 * Input container
 * 
 * @component .ai-chat__input-container
 */
.ai-chat__input-container {
  padding: 1rem 1.25rem;
  background: #ffffff;
  flex-shrink: 0;
  border-top: 1px solid #e9ecef;
}

/**
 * Input wrapper
 * 
 * @component .ai-chat__input-wrapper
 */
.ai-chat__input-wrapper {
    display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

/**
 * Text input field
 * 
 * @component .ai-chat__input
 */
.ai-chat__input {
    flex: 1;
  max-width: calc(100% - 3rem);
  padding: 0.75rem 1rem;
  border: 1px solid #e9ecef;
  border-radius: 1.5rem;
  font-size: 0.875rem;
  font-family: 'Poppins', sans-serif;
    outline: none;
  transition: border-color 0.2s ease;
  background: #ffffff;
  color: #212529;
  margin-right: 0.5rem;
}

.ai-chat__input:focus {
  border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(27, 66, 76, 0.1);
}

.ai-chat__input::placeholder {
  color: var(--color-gray-300);
}

/**
 * Send button
 * 
 * @component .ai-chat__send-btn
 */
.ai-chat__send-btn {
  background: #1B424C !important;
  border: none !important;
  color: #FFFFFF !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.6875rem !important;
  font-weight: bold !important;
  font-family: 'Poppins', sans-serif !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  outline: none !important;
  text-transform: uppercase !important;
}

.ai-chat__send-btn:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
}

.ai-chat__send-btn:hover {
  background: var(--color-primary-dark);
    transform: scale(1.05);
}

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

.ai-chat__send-btn:disabled {
  background: var(--color-secondary);
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Chat Suggestions (Block)
   ========================================================================== */

/**
 * Suggestions container
 * 
 * @component .ai-chat__suggestions
 */
.ai-chat__suggestions {
    display: flex !important;
  gap: 0.5rem !important;
  margin-top: 0.75rem !important;
  flex-wrap: nowrap !important;
  overflow-x: hidden !important;
  padding-bottom: 0.25rem !important;
  justify-content: space-between !important;
}

.ai-chat__suggestions::-webkit-scrollbar {
  height: 4px;
}

.ai-chat__suggestions::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat__suggestions::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 2px;
}

/**
 * Suggestion button
 * 
 * @component .ai-chat__suggestion
 */
.ai-chat__suggestion,
.ai-chat__suggestions .ai-chat__suggestion,
button.ai-chat__suggestion {
  background: #ffffff !important;
  border: 1px solid #1B424C !important;
  color: #1B424C !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 1.5rem !important;
  font-size: 0.6875rem !important;
  font-weight: 400 !important;
  font-family: 'Poppins', sans-serif !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  min-height: 2rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  flex: 1 !important;
  outline: none !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

.ai-chat__suggestion:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.ai-chat__suggestion:hover {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
    transform: translateY(-1px);
}

.ai-chat__suggestion:active {
  transform: translateY(0);
}

/* ==========================================================================
   Chat Toggle (Block)
   ========================================================================== */

/**
 * Chat toggle button
 * 
 * @component .ai-chat__toggle
 */
.ai-chat__toggle {
    position: fixed;
  bottom: 1.5rem;               /* 24px from bottom - like AskCodi */
  right: 1.5rem;                /* 24px from right - like AskCodi */
  width: 3.75rem;               /* 60px */
  height: 3.75rem;              /* 60px */
  background: var(--color-primary);
  color: var(--color-white);
  border: 2px solid var(--color-white);
  border-radius: var(--border-radius-full);
  cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  font-size: var(--font-size-2xl);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-slow);
  z-index: 9998;                /* High z-index but below chatbox */
  outline: none;
}

.ai-chat__toggle:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
}

.ai-chat__toggle:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

.ai-chat__toggle:active {
  transform: scale(0.95);
  background: var(--color-primary) !important;  /* Keep original color on active */
}

/**
 * Notification badge
 * 
 * @component .ai-chat__notification
 */
.ai-chat__notification {
    position: absolute;
  top: -0.3125rem;              /* -5px */
  right: -0.3125rem;            /* -5px */
  background: var(--color-success);
  color: var(--color-white);
  border-radius: var(--border-radius-full);
  width: 1.25rem;               /* 20px */
  height: 1.25rem;              /* 20px */
    display: flex;
    align-items: center;
    justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  animation: ai-chat__notification-pulse 2s infinite;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes ai-chat__slide-in-up {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ai-chat__typing-pulse {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-0.625rem);
    opacity: 1;
  }
}

@keyframes ai-chat__notification-pulse {
  0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/**
 * Tablet and below
 */
@media (max-width: 768px) {
  .ai-chat {
    top: 3.75rem;               /* 60px */
    right: 0.625rem;            /* 10px */
    left: 0.625rem;             /* 10px */
    width: auto;
    height: 28.125rem;          /* 450px - 10% reduction from 500px */
  }
  
  .ai-chat__toggle {
    bottom: 0.625rem;           /* 10px from bottom */
    right: 0.625rem;            /* 10px from right */
    width: 3.125rem;            /* 50px */
    height: 3.125rem;           /* 50px */
    font-size: var(--font-size-xl);
  }
  
  .ai-chat__suggestions {
    flex-wrap: nowrap !important;  /* Keep buttons in a row */
    gap: 0.125rem !important;  /* Even smaller gap for mobile */
    justify-content: space-between !important;
  }
  
  .ai-chat__suggestion {
    flex: 1 !important;  /* Equal width for all buttons */
    min-width: 0 !important;  /* Allow buttons to shrink */
    font-size: 10px !important;  /* Smaller font for mobile */
    padding: 6px 8px !important;  /* Smaller padding for mobile */
    min-height: 32px !important;  /* Smaller height for mobile */
  }
}

/**
 * Mobile devices
 */
@media (max-width: 480px) {
  .ai-chat {
    height: 25.3125rem;         /* 405px - 10% reduction from 450px */
  }
  
  .ai-chat__message-content {
    max-width: 85%;
  }
  
  .ai-chat__suggestion {
    flex: 1 !important;  /* Equal width for all buttons */
    min-width: 0 !important;  /* Allow buttons to shrink */
    font-size: 9px !important;  /* Even smaller font for very small screens */
    padding: 4px 6px !important;  /* Minimal padding for very small screens */
    min-height: 28px !important;  /* Smaller height for very small screens */
  }
  
  .ai-chat__toggle {
    bottom: 0.5rem;             /* 8px from bottom */
    right: 0.5rem;              /* 8px from right */
    width: 2.75rem;             /* 44px - minimum touch target */
    height: 2.75rem;            /* 44px - minimum touch target */
  }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
  .ai-chat {
    border-width: 3px;
  }
  
  .ai-chat__control-btn,
  .ai-chat__send-btn,
  .ai-chat__suggestion {
    border-width: 3px;
  }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .ai-chat,
  .ai-chat__control-btn,
  .ai-chat__send-btn,
  .ai-chat__suggestion,
  .ai-chat__toggle {
    animation: none;
    transition: none;
  }
  
  .ai-chat__typing-dot {
    animation: none;
  }
  
  .ai-chat__notification {
    animation: none;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .ai-chat,
  .ai-chat__toggle,
  .ai-chat-container,
  .chat-toggle {
    display: none !important;
  }
}

/* ==========================================================================
   LEGACY CLASS SUPPORT - Universal Compatibility
   ========================================================================== */

/**
 * Support for old class names to ensure compatibility across all pages
 * This section ensures the chatbox works regardless of which HTML structure is used
 */

/* Legacy container support */
.ai-chat-container {
  position: fixed !important;
  top: 2rem !important;         /* 32px - closer to top like AskCodi */
  right: 1.5rem !important;     /* 24px - slightly more margin from right */
  width: 21.375rem !important;  /* 342px - 10% reduction from 380px */
  height: 33.75rem !important;  /* 540px - 10% reduction from 600px */
  background: #ffffff !important;
  border-radius: 1rem !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
  display: none !important;
  flex-direction: column !important;
  z-index: 9998 !important;     /* Lower than header to ensure header stays on top */
  border: 2px solid #1B424C !important;
  overflow: hidden !important;
  
  /* AskCodi-style positioning - independent of page scroll */
  transform: translateZ(0) !important;  /* Hardware acceleration */
  will-change: transform !important;    /* Optimize for animations */
}

/* Legacy header support */
.chat-header {
  background: #1B424C !important;
  color: #ffffff !important;
  padding: 1rem 1.25rem !important;
  display: flex !important;
  flex-direction: column !important;  /* Changed to column to stack controls above main content */
  flex-shrink: 0 !important;
  position: relative !important;  /* For absolute positioning of controls */
}

.chat-header-info {
  display: flex !important;
  align-items: center !important;
  gap: 1.5rem !important;  /* Increased from 1rem to 1.5rem for wider spacing */
  flex: 1 !important;
}

.chat-avatar {
  width: 3.3125rem !important;  /* 53px - 32.5% increase from 40px */
  height: 3.3125rem !important; /* 53px - 32.5% increase from 40px */
  border-radius: 50% !important;
  background: transparent !important;  /* Let the SVG logo handle the background */
  border: none !important;  /* Remove CSS border - let SVG handle it */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  overflow: hidden !important;
  color: inherit !important;  /* Let the SVG handle text colors */
  font-weight: inherit !important;
  font-size: inherit !important;
}

.chat-title h4 {
  margin: 0 !important;
  font-size: 0.625rem !important;  /* Further reduced from 0.75rem to 0.625rem for smaller text */
  font-weight: bold !important;
  line-height: 1.2 !important;
  color: #ffffff !important;
  display: flex !important;
  flex-direction: row !important;  /* Changed from column to row for horizontal layout */
  align-items: center !important;  /* Center align items vertically */
  gap: 0.5rem !important;  /* Increased gap for better spacing */
  flex: 1 !important;  /* Allow title section to take available space */
}

.chat-status {
  background: #39C260 !important;
  color: #ffffff !important;
  padding: 0.125rem 0.375rem !important;  /* Reduced horizontal padding for better fit */
  border-radius: 0.75rem !important;
  font-size: 0.625rem !important;  /* Reduced from 0.75rem to 0.625rem for better fit */
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.025em !important;
  align-self: center !important;  /* Changed from flex-start to center for proper alignment */
  white-space: nowrap !important;  /* Prevent text wrapping */
}

.chat-controls {
  display: flex !important;
  gap: 0.25rem !important;  /* Reduced gap between buttons */
  position: absolute !important;  /* Position absolutely in top right */
  top: 0.25rem !important;  /* Small margin from top */
  right: 0.25rem !important;  /* Small margin from right */
  z-index: 10 !important;  /* Ensure buttons are above other content */
}

.chat-minimize,
.chat-close {
  background: transparent !important;  /* Removed background box */
  border: none !important;
  color: #ffffff !important;
  width: auto !important;  /* Auto width for text-only buttons */
  height: auto !important;  /* Auto height for text-only buttons */
  border-radius: 0 !important;  /* Removed border radius */
  padding: 0.25rem 0.5rem !important;  /* Added padding for clickable area */
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.875rem !important;  /* Smaller font size */
  font-weight: bold !important;
  font-family: 'Poppins', sans-serif !important;
  transition: all 0.2s ease !important;
  outline: none !important;
}

.chat-minimize:hover,
.chat-close:hover {
  background: rgba(255, 255, 255, 0.1) !important;  /* Subtle hover background */
  transform: scale(1.05) !important;
}

/* Legacy messages support */
.chat-messages {
  flex: 1 !important;
  padding: 1.25rem !important;
  overflow-y: auto !important;
  background: #f8f9fa !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
}

.message {
  display: flex !important;
  gap: 0.75rem !important;
  align-items: flex-start !important;
}

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

.user-message {
  justify-content: flex-end !important;
  flex-direction: row-reverse !important;
}

.message-avatar {
  width: 2.3rem !important;     /* 36.8px - 15% increase from 32px */
  height: 2.3rem !important;    /* 36.8px - 15% increase from 32px */
  border-radius: 50% !important;
  background: transparent !important;  /* Let the SVG logo handle the background */
  border: none !important;  /* Remove CSS border - let SVG handle it */
  color: inherit !important;  /* Let the SVG handle text colors */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  overflow: hidden !important;
}

.user-message .message-avatar {
  background: transparent !important;  /* Let the SVG logo handle the background */
  border: none !important;  /* Remove CSS border - let SVG handle it */
  color: inherit !important;  /* Let the SVG handle text colors */
}

.message-content {
  max-width: 75% !important;
  display: flex !important;
  flex-direction: column !important;
}

.message-content p {
  background: #ffffff !important;
  padding: 0.75rem 1rem !important;
  border-radius: 1.125rem !important;
  margin: 0 !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  line-height: 1.5 !important;
  word-wrap: break-word !important;
  color: #1B424C !important;
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  border: 1px solid #e9ecef !important;
}

.user-message .message-content p {
  background: #1B424C !important;
  color: #ffffff !important;
  border-color: #1B424C !important;
}

.message-time {
  font-size: 0.6875rem !important;
  color: #6c757d !important;
  margin-top: 0.25rem !important;
  padding: 0 0.25rem !important;
}

.user-message .message-time {
  text-align: right !important;
}

/* Legacy input support */
.chat-input-container {
  padding: 1rem 1.25rem !important;
  background: #ffffff !important;
  flex-shrink: 0 !important;
  border-top: 1px solid #e9ecef !important;
}

.chat-input-wrapper {
  display: flex !important;
  gap: 0.75rem !important;
  align-items: center !important;
}

.chat-input-wrapper input {
  flex: 1 !important;
  max-width: calc(100% - 3rem) !important;
  padding: 0.75rem 1rem !important;
  border: 1px solid #e9ecef !important;
  border-radius: 1.5rem !important;
  font-size: 0.875rem !important;
  font-family: 'Poppins', sans-serif !important;
  outline: none !important;
  transition: border-color 0.2s ease !important;
  background: #ffffff !important;
  color: #212529 !important;
  margin-right: 0.5rem !important;
}

.chat-input-wrapper input:focus {
  border-color: #1B424C !important;
  box-shadow: 0 0 0 3px rgba(27, 66, 76, 0.1) !important;
}

.chat-input-wrapper input::placeholder {
  color: #6c757d !important;
}

.chat-input-wrapper button {
  background: #1B424C !important;
  border: none !important;
  color: #ffffff !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.6875rem !important;
  font-weight: bold !important;
  font-family: 'Poppins', sans-serif !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  outline: none !important;
  text-transform: uppercase !important;
}

.chat-input-wrapper button:hover {
  background: #0f2a32 !important;
  transform: scale(1.05) !important;
}

.chat-input-wrapper button:disabled {
  background: #6c757d !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* Legacy suggestions support */
.chat-suggestions {
  display: flex !important;
  gap: 0.25rem !important;  /* Smaller gap to fit 3 buttons */
  margin-top: 0.75rem !important;
  flex-wrap: nowrap !important;
  overflow-x: hidden !important;  /* Remove horizontal scroll */
  padding-bottom: 0.25rem !important;
  justify-content: space-between !important;  /* Distribute buttons evenly */
}

.suggestion-btn,
.chat-suggestions .suggestion-btn,
button.suggestion-btn {
  background: #ffffff !important;
  border: 1px solid #1B424C !important;
  color: #1B424C !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 1.5rem !important;
  font-size: 0.6875rem !important;
  font-weight: 400 !important;
  font-family: 'Poppins', sans-serif !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  min-height: 2rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  flex: 1 !important;
  outline: none !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

.suggestion-btn:hover {
  background: #1B424C !important;
  color: #ffffff !important;
  border-color: #1B424C !important;
  transform: translateY(-1px) !important;
}

/* Legacy toggle support */
.chat-toggle {
  position: fixed !important;
  bottom: 1.5rem !important;    /* 24px from bottom - like AskCodi */
  right: 1.5rem !important;     /* 24px from right - like AskCodi */
  width: 3.75rem !important;
  height: 3.75rem !important;
  background: #1B424C !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.5rem !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.3s ease !important;
  z-index: 9998 !important;     /* High z-index but below chatbox */
  outline: none !important;
}

.chat-toggle:hover {
  background: #0f2a32 !important;
  transform: scale(1.05) !important;
}

.chat-toggle:active {
  transform: scale(0.95) !important;
  background: #1B424C !important;  /* Keep original color on active */
}

.chat-notification {
  position: absolute !important;
  top: -0.3125rem !important;
  right: -0.3125rem !important;
  background: #39C260 !important;
  color: #ffffff !important;
  border-radius: 50% !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.6875rem !important;
  font-weight: bold !important;
  animation: ai-chat__notification-pulse 2s infinite !important;
}

/* Legacy typing indicator support */
.typing-indicator {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 0.75rem 1rem !important;
  background: #ffffff !important;
  border-radius: 1.125rem !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  margin: 0 3.25rem 0 0 !important;
}

.typing-dots {
  display: flex !important;
  gap: 0.25rem !important;
}

.typing-dots span {
  width: 0.375rem !important;
  height: 0.375rem !important;
  background: #1B424C !important;
  border-radius: 50% !important;
  animation: ai-chat__typing-pulse 1.4s infinite ease-in-out !important;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s !important;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s !important;
}

/* ==========================================================================
   FORCE OVERRIDE - Suggestion Button Styling
   ========================================================================== */

/* Force override for all suggestion buttons */
.ai-chat__suggestion,
.ai-chat__suggestions .ai-chat__suggestion,
button.ai-chat__suggestion,
.suggestion-btn,
.chat-suggestions .suggestion-btn,
button.suggestion-btn {
  background: #ffffff !important;
  border: 1px solid #1B424C !important;
  color: #1B424C !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 1.5rem !important;
  font-size: 0.6875rem !important;
  font-weight: 400 !important;
  font-family: 'Poppins', sans-serif !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  min-height: 2rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  flex: 1 !important;
  outline: none !important;
  text-align: center !important;
  box-sizing: border-box !important;
  width: auto !important;
  height: auto !important;
}

/* Force override for suggestions container */
.ai-chat__suggestions,
.chat-suggestions {
  display: flex !important;
  gap: 0.5rem !important;
  margin-top: 0.75rem !important;
  flex-wrap: nowrap !important;
  overflow-x: hidden !important;
  padding-bottom: 0.25rem !important;
  justify-content: space-between !important;
  width: 100% !important;
}

/* CLEAN MINIMAL STYLE - Fixed visibility */
#aiChatBox .chat-suggestions .suggestion-btn,
#aiChatBox .ai-chat__suggestions .ai-chat__suggestion,
div#aiChatBox .chat-suggestions button.suggestion-btn,
div#aiChatBox .ai-chat__suggestions button.ai-chat__suggestion {
  background: #ffffff !important;
  border: 1px solid #1B424C !important;
  color: #1B424C !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 1.5rem !important;
  font-size: 0.6875rem !important;
  font-weight: 400 !important;
  font-family: 'Poppins', sans-serif !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  min-height: 2rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  flex: 1 !important;
  outline: none !important;
  text-align: center !important;
  box-sizing: border-box !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  line-height: 1.4 !important;
  vertical-align: middle !important;
}

/* Hover effect - consistent with main style */
#aiChatBox .chat-suggestions .suggestion-btn:hover,
#aiChatBox .ai-chat__suggestions .ai-chat__suggestion:hover,
div#aiChatBox .chat-suggestions button.suggestion-btn:hover,
div#aiChatBox .ai-chat__suggestions button.ai-chat__suggestion:hover {
  background: #1B424C !important;
  color: #ffffff !important;
  border-color: #1B424C !important;
  transform: translateY(-1px) !important;
}

/* ==========================================================================
   Minimalistic Text Links for Suggestions
   ========================================================================== */

/**
 * Suggestion links - minimalistic text style
 * 
 * @component .ai-chat__suggestion-link
 */
.ai-chat__suggestion-link {
  color: #1B424C !important;
  text-decoration: none !important;
  font-size: 0.625rem !important;
  font-weight: 400 !important;
  font-family: 'Poppins', sans-serif !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  display: inline-block !important;
  padding: 0.125rem 0.25rem !important;
  border-radius: 0.25rem !important;
  margin: 0 0.0625rem !important;
  line-height: 1.4 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  text-align: center !important;
  box-sizing: border-box !important;
  flex: 1 !important;
}

.ai-chat__suggestion-link:focus-visible {
  outline: 2px solid #1B424C !important;
  outline-offset: 2px !important;
}

.ai-chat__suggestion-link:hover {
  color: #39C260 !important;
  text-decoration: underline !important;
  transform: translateY(-1px) !important;
}

.ai-chat__suggestion-link:active {
  transform: translateY(0) !important;
}

/* Force override for suggestion links in all contexts */
#aiChatBox .ai-chat__suggestions .ai-chat__suggestion-link,
div#aiChatBox .ai-chat__suggestions a.ai-chat__suggestion-link {
  color: #1B424C !important;
  text-decoration: none !important;
  font-size: 0.625rem !important;
  font-weight: 400 !important;
  font-family: 'Poppins', sans-serif !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  display: inline-block !important;
  padding: 0.125rem 0.25rem !important;
  border-radius: 0.25rem !important;
  margin: 0 0.0625rem !important;
  line-height: 1.4 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  text-align: center !important;
  box-sizing: border-box !important;
  flex: 1 !important;
}

#aiChatBox .ai-chat__suggestions .ai-chat__suggestion-link:hover,
div#aiChatBox .ai-chat__suggestions a.ai-chat__suggestion-link:hover {
  color: #39C260 !important;
  text-decoration: underline !important;
  transform: translateY(-1px) !important;
}