/*
 * chat-widget.css
 *
 * Extracted from landing.css for reuse on the Knowledge Hub (public blog).
 * The blog must NOT load the full landing.css; load this file instead to style
 * the floating chat widget and its message-rendering elements.
 *
 * Source: service_ui/mirror_app/static/css/landing.css
 * Extracted ranges (verbatim, no modifications):
 *   Base widget rules:  6910–7786 (main contiguous chat block)
 *   Top-level message:  8787–9002 (chat-message / .message-content re-declarations)
 *   Typing / loading:   7948–7980, 9013–9057
 *   Keyframes:          6969–6978, 6990–6993, 7077–7081, 7148–7151, 7458–7467,
 *                       7971–7980, 9032–9041, 9048–9057
 *   focus-visible:      10892–10915 (chat-send + chat-bubble only)
 *   prefers-reduced-motion: 10857–10861 (starter-button/chat-bubble/chat-send only)
 *   Responsive fragments extracted from mixed @media blocks:
 *     @media (max-width: 968px): 6024–6053, 6369–6397, 7788–7852
 *     @media (max-width: 480px): 6496–6516, 6599–6618, 7855–7942, 8376–8481
 *     @media (max-width: 767px): 8184–8268, 9088–9109
 *
 * DO NOT add non-chat rules here. Landing page hero/nav/footer styles stay in landing.css.
 */


/* ========================================
   1. CHAT WIDGET — BASE (POSITION + FIXED)
   ======================================== */

.chat-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
    z-index: var(--z-chat, 1050) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
}


/* ========================================
   2. CHAT BUBBLE — PREMIUM UPGRADE
   ======================================== */

.chat-bubble {
    position: relative !important;
    width: 72px !important;
    height: 72px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;

    /* Gradient background */
    background: linear-gradient(135deg, #764ba2 0%, #00f2fe 100%) !important;

    /* Premium border */
    border: 3px solid rgba(0, 242, 254, 0.4) !important;

    /* Complex shadow */
    box-shadow:
        0 10px 40px rgba(0, 242, 254, 0.4),
        0 0 80px rgba(118, 75, 162, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.2),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2) !important;

    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: visible !important;
}

/* Animated pulse ring */
.chat-bubble::before {
    content: '';
    position: absolute;
    inset: -8px;
    border: 2px solid rgba(0, 242, 254, 0.3);
    border-radius: 50%;
    animation: chatBubblePulseRing 3s ease-in-out infinite;
}

/* Secondary pulse ring */
.chat-bubble::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px dashed rgba(118, 75, 162, 0.4);
    border-radius: 50%;
    animation: chatBubbleRotate 20s linear infinite;
}

.chat-bubble:hover {
    transform: scale(1.12) !important;
    box-shadow:
        0 15px 50px rgba(0, 242, 254, 0.5),
        0 0 100px rgba(118, 75, 162, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.3) !important;
}

.chat-bubble:hover::before {
    animation: none;
    opacity: 0;
}

.chat-bubble i {
    color: white !important;
    font-size: 28px !important;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3)) !important;
    transition: all 0.3s ease !important;
    position: relative;
    z-index: 2;
}

.chat-bubble:hover i {
    transform: scale(1.1) rotate(-5deg);
}


/* ========================================
   3. CHAT WINDOW — PREMIUM GLASSMORPHISM
   ======================================== */

.chat-window {
    position: fixed !important;
    bottom: 110px !important;
    right: 24px !important;
    width: 420px;
    height: 580px;
    border-radius: 28px;
    overflow: hidden;

    /* Deep glassmorphism */
    background: linear-gradient(135deg,
        rgba(15, 20, 45, 0.95) 0%,
        rgba(26, 31, 58, 0.95) 50%,
        rgba(15, 20, 45, 0.95) 100%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);

    /* Animated border setup */
    border: 2px solid transparent;
    background-clip: padding-box;

    /* Premium shadow */
    box-shadow:
        0 40px 100px rgba(0, 0, 0, 0.7),
        0 0 100px rgba(0, 242, 254, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);

    opacity: 0;
    visibility: hidden;
    display: none;
    transform: translateY(30px) scale(0.9);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    z-index: calc(var(--z-chat, 1050) + 1) !important;
}

/* Animated gradient border */
.chat-window::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg,
        rgba(0, 242, 254, 0) 0%,
        rgba(0, 242, 254, 0.6) 25%,
        rgba(118, 75, 162, 0.6) 50%,
        rgba(240, 147, 251, 0.4) 75%,
        rgba(0, 242, 254, 0) 100%);
    background-size: 400% 400%;
    border-radius: 30px;
    z-index: -1;
    animation: chatWindowBorderRotate 8s linear infinite;
    opacity: 0.7;
}

/* Inner background cover */
.chat-window::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: linear-gradient(135deg,
        rgba(15, 20, 45, 0.98) 0%,
        rgba(20, 25, 50, 0.99) 100%);
    border-radius: 26px;
    z-index: -1;
}

.chat-window.open {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    transform: translateY(0) scale(1) !important;
}

.chat-window.open::before {
    opacity: 1;
}

/* Premium Header z-index anchoring */
.chat-window .chat-header,
.chat-window .chat-intro {
    position: relative;
    z-index: 10;
}


/* ========================================
   4. DEMO BADGE
   ======================================== */

.demo-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg,
        rgba(243, 156, 18, 0.2) 0%,
        rgba(230, 126, 34, 0.2) 100%);
    border: 1px solid rgba(243, 156, 18, 0.4);
    color: #f39c12;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.demo-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(243, 156, 18, 0.3),
        transparent);
    animation: demoBadgeShine 3s ease-in-out infinite;
}


/* ========================================
   5. CHAT INTRO
   ======================================== */

.chat-intro {
    margin-bottom: 20px;
}

.chat-intro h3 {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-intro p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 24px 0;
}


/* ========================================
   6. CONVERSATION STARTERS
   ======================================== */

.conversation-starters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.starter-button {
    background: linear-gradient(135deg,
        rgba(26, 31, 58, 0.8) 0%,
        rgba(16, 21, 46, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.5;
    position: relative;
    overflow: hidden;
}

/* Animated L-shaped accent */
.starter-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    border-top: 2px solid rgba(0, 242, 254, 0.4);
    border-left: 2px solid rgba(0, 242, 254, 0.4);
    border-radius: 16px 0 0 0;
    transition: all 0.4s ease;
    opacity: 0;
}

/* Shine effect */
.starter-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(0, 242, 254, 0.08),
        transparent);
    transition: left 0.6s ease;
}

.starter-button:hover {
    background: linear-gradient(135deg,
        rgba(0, 242, 254, 0.1) 0%,
        rgba(118, 75, 162, 0.1) 100%);
    border-color: rgba(0, 242, 254, 0.3);
    transform: translateX(8px);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(0, 242, 254, 0.1);
}

.starter-button:hover::before {
    opacity: 1;
    width: 40px;
    height: 40px;
}

.starter-button:hover::after {
    left: 100%;
}


/* ========================================
   7. CLOSE BUTTON
   ======================================== */

.chat-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
}

.chat-close:hover {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.1) 100%);
    border-color: rgba(0, 242, 254, 0.4);
    transform: rotate(90deg) scale(1.1);
    color: #00f2fe;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}


/* ========================================
   8. CHAT BODY + SCROLLBAR
   ======================================== */

.chat-body {
    flex: 1;
    padding: 70px 24px 24px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: 10;
}

/* Custom scrollbar */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 242, 254, 0.3), rgba(118, 75, 162, 0.3));
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(0, 242, 254, 0.5), rgba(118, 75, 162, 0.5));
}


/* ========================================
   9. INPUT AREA
   ======================================== */

.chat-input-area {
    padding: 20px 24px 24px;
    border-top: 1px solid rgba(0, 242, 254, 0.1);
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.4) 100%);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.chat-input-container {
    display: flex;
    gap: 14px;
    align-items: flex-end;
}

/* Premium Text Input */
.chat-input {
    flex: 1;
    background: linear-gradient(135deg,
        rgba(10, 15, 35, 0.8) 0%,
        rgba(15, 20, 40, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 16px 20px;
    color: white;
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    min-height: 52px;
    font-family: inherit;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.5;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.chat-input:focus {
    outline: none;
    border-color: rgba(0, 242, 254, 0.5);
    box-shadow:
        0 0 0 4px rgba(0, 242, 254, 0.1),
        0 0 30px rgba(0, 242, 254, 0.15),
        inset 0 0 20px rgba(0, 242, 254, 0.03);
    background: linear-gradient(135deg,
        rgba(10, 15, 35, 0.9) 0%,
        rgba(15, 20, 40, 0.95) 100%);
}


/* ========================================
   10. SEND BUTTON
   ======================================== */

.chat-send {
    background: linear-gradient(135deg, #00f2fe 0%, #764ba2 100%);
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 8px 24px rgba(0, 242, 254, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

/* Shine effect on button */
.chat-send::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 40%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(45deg) translateY(-100%);
    transition: transform 0.6s ease;
}

.chat-send:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow:
        0 12px 32px rgba(0, 242, 254, 0.45),
        0 0 40px rgba(0, 242, 254, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-send:hover::before {
    transform: rotate(45deg) translateY(100%);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chat-send i {
    font-size: 1.1rem;
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

.chat-send:hover i {
    transform: translateX(2px);
}


/* ========================================
   11. CHAT MESSAGES
   ======================================== */

.chat-message {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-message .message-avatar,
.user-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.bot-message .message-avatar,
.bot-avatar {
    background: linear-gradient(135deg, #764ba2 0%, #00f2fe 100%);
    color: white;
}

.message-content {
    flex: 1;
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    max-width: 100%;
}

.user-message .message-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

.bot-message .message-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}


/* ========================================
   12. MARKDOWN CLASSES (bot-message)
   ======================================== */

.bot-message .markdown-wrapper {
    font-size: 14px;
    line-height: 1.6;
}

.bot-message .markdown-h2 {
    color: #00f2fe;
    margin: 16px 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(0, 242, 254, 0.2);
    padding-bottom: 8px;
}

.bot-message .markdown-h3 {
    color: #00f2fe;
    margin: 14px 0 6px 0;
    font-size: 1rem;
    font-weight: 600;
}

.bot-message .markdown-h4 {
    color: #00f2fe;
    margin: 12px 0 6px 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.bot-message .markdown-p {
    margin: 8px 0;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.bot-message .markdown-ul,
.bot-message .markdown-ol {
    margin: 8px 0;
    padding-left: 20px;
}

.bot-message .markdown-li {
    margin: 4px 0;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

.bot-message .markdown-strong {
    color: #ffffff;
    font-weight: 600;
}

.bot-message .markdown-em {
    opacity: 0.9;
    font-style: italic;
}

.bot-message .markdown-pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    overflow-x: auto;
    border: 1px solid rgba(0, 242, 254, 0.2);
}

.bot-message .markdown-code {
    color: #00f2fe;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

.bot-message .markdown-inline-code {
    background: rgba(0, 242, 254, 0.15);
    color: #00f2fe;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9em;
}


/* ========================================
   13. MESSAGE-CONTENT RICH TEXT FORMATTING
   ======================================== */

.message-content p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    margin: 16px 0 8px 0;
    line-height: 1.3;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child,
.message-content h4:first-child {
    margin-top: 0;
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.2em; }
.message-content h4 { font-size: 1.1em; }

.message-content strong,
.message-content b {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.message-content em,
.message-content i {
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9em;
    color: #00f2fe;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
    line-height: 1.5;
}

.message-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
}

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 24px;
    line-height: 1.6;
}

.message-content ul {
    list-style-type: disc;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content li {
    margin: 4px 0;
    color: rgba(255, 255, 255, 0.9);
}

.message-content li::marker {
    color: rgba(0, 242, 254, 0.7);
}

.message-content blockquote {
    border-left: 3px solid rgba(0, 242, 254, 0.5);
    margin: 12px 0;
    padding: 8px 0 8px 16px;
    background: rgba(0, 242, 254, 0.05);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
}

.message-content a {
    color: #00f2fe;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 242, 254, 0.3);
    transition: all 0.2s ease;
}

.message-content a:hover {
    color: #64d9ff;
    border-bottom-color: #64d9ff;
}

.message-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 16px 0;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.95em;
}

.message-content table th,
.message-content table td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    text-align: left;
}

.message-content table th {
    background: rgba(0, 242, 254, 0.1);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.message-content table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Numbered list emphasis */
.message-content ol > li {
    padding-left: 8px;
}

.message-content ol > li > strong:first-child {
    display: block;
    margin-bottom: 4px;
    color: #00f2fe;
}

/* Code syntax highlighting hints */
.message-content .keyword { color: #f92672; }
.message-content .string  { color: #a6e22e; }
.message-content .comment { color: #75715e; font-style: italic; }
.message-content .number  { color: #ae81ff; }


/* ========================================
   14. CHAT-MESSAGE DIRECT DESCENDANTS
       (top-level re-declarations from lines 8787–9002)
   ======================================== */

/* Chat Widget Message Formatting — Enhanced */
.message-content {
    flex: 1;
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.8;
    word-break: break-word;
    max-width: 100%;
    white-space: pre-wrap;
}

/* Bot Message Enhanced Formatting */
.bot-message .message-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Structured content in chat messages */
.chat-message .formatted-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.8;
}

.chat-message h2 {
    color: #00f2fe;
    font-size: 1.1rem;
    margin: 16px 0 10px 0;
    font-weight: 700;
    line-height: 1.3;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 242, 254, 0.2);
}

.chat-message h3 {
    color: #00f2fe;
    font-size: 1rem;
    margin: 14px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.chat-message h2:first-child,
.chat-message h3:first-child {
    margin-top: 0;
}

.chat-message p {
    margin: 12px 0;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.chat-message p:first-child {
    margin-top: 0;
}

.chat-message p:last-child {
    margin-bottom: 0;
}

.chat-message strong,
.chat-message b {
    color: #ffffff;
    font-weight: 600;
}

.chat-message em,
.chat-message i {
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
}

.chat-message ul,
.chat-message ol {
    margin: 12px 0;
    padding-left: 24px;
    line-height: 1.6;
}

.chat-message ul {
    list-style-type: disc;
}

.chat-message ol {
    list-style-type: decimal;
}

.chat-message li {
    margin: 8px 0;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
}

.chat-message li::marker {
    color: rgba(0, 242, 254, 0.7);
}

/* Definition lists for key-value pairs */
.chat-message dl {
    margin: 16px 0;
}

.chat-message dt {
    color: var(--accent-cyan);
    font-weight: 600;
    margin: 12px 0 4px 0;
}

.chat-message dd {
    margin: 4px 0 12px 20px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
}

/* Code formatting in chat messages */
.chat-message code {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9em;
    color: #00f2fe;
}

.chat-message pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-message pre code {
    background: none;
    border: none;
    padding: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
}

/* Blockquote for emphasis */
.chat-message blockquote {
    border-left: 3px solid rgba(0, 242, 254, 0.5);
    margin: 16px 0;
    padding: 8px 0 8px 16px;
    background: rgba(0, 242, 254, 0.05);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
}

/* Links in chat messages */
.chat-message a {
    color: #00f2fe;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 242, 254, 0.3);
    transition: all 0.2s ease;
}

.chat-message a:hover {
    color: #64d9ff;
    border-bottom-color: #64d9ff;
}

/* Horizontal rule */
.chat-message hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

/* Tables in chat messages */
.chat-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.9em;
}

.chat-message table th,
.chat-message table td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    text-align: left;
}

.chat-message table th {
    background: rgba(0, 242, 254, 0.1);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.chat-message table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}


/* ========================================
   15. TYPING INDICATOR + LOADING STATE
   ======================================== */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: rgba(0, 242, 254, 0.6);
    border-radius: 50%;
    animation: typingDots 1.5s ease-in-out infinite;
}

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

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

/* Alternative typing indicator (top-level declarations) */
.typing-dot:nth-child(1) { animation-delay: -0.32s; }

/* Loading state for formatted content */
.formatting-content {
    animation: fadeIn 0.3s ease-in;
}


/* ========================================
   16. FOCUS-VISIBLE RINGS (chat elements only)
   ======================================== */

.chat-send,
.chat-bubble {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.chat-send:focus-visible,
.chat-bubble:focus-visible {
    outline-color: var(--accent-cyan, #00f2fe);
}


/* ========================================
   17. KEYFRAMES
   ======================================== */

/* Bubble outer pulse ring */
@keyframes chatBubblePulseRing {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.15);
        opacity: 0;
    }
}

/* Bubble dashed ring rotation */
@keyframes chatBubbleRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Window animated gradient border */
@keyframes chatWindowBorderRotate {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Demo badge shine sweep */
@keyframes demoBadgeShine {
    0%       { left: -100%; }
    50%, 100% { left: 100%; }
}

/* Message slide-in on render */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing dots bounce (small variant) */
@keyframes typingDots {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Typing dots bounce (larger variant used at top level) */
@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Fade-in for dynamically rendered content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ========================================
   18. RESPONSIVE — @media (max-width: 968px)
       Chat rules extracted from mixed landing blocks
       (source lines 6024–6053, 6369–6397, 7788–7852)
   ======================================== */

@media (max-width: 968px) {
    /* Mobile-specific chat widget positioning */
    .chat-widget {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        left: auto !important;
        top: auto !important;
        z-index: var(--z-chat, 1050) !important;
        width: auto !important;
        height: auto !important;
    }

    .chat-bubble {
        width: 56px !important;
        height: 56px !important;
    }

    .chat-bubble i {
        font-size: 24px !important;
    }

    .chat-window {
        position: fixed !important;
        bottom: 90px !important;
        right: 20px !important;
        left: 20px !important;
        width: auto !important;
        max-width: calc(100vw - 40px) !important;
        height: 60vh !important;
        max-height: 500px !important;
    }

    /* Chat Window Sizing (footer section overrides) */
    .chat-window {
        width: calc(100vw - 32px);
        height: 70vh;
        bottom: 90px;
        right: 16px;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-body {
        padding: 15px;
    }

    .chat-input-container {
        padding: 15px;
    }

    .chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 15px;
    }

    .chat-send {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* Mobile Chat Window Improvements */
    .chat-window {
        border-radius: 16px !important;
        max-width: none !important;
    }

    .chat-close {
        width: 30px !important;
        height: 30px !important;
        top: 12px !important;
        right: 12px !important;
    }

    .chat-body {
        padding: 50px 16px 16px 16px !important;
    }

    .chat-intro h3 {
        font-size: 16px !important;
    }

    .chat-intro p {
        font-size: 13px !important;
    }

    .demo-badge {
        font-size: 10px !important;
        padding: 3px 10px !important;
    }

    .starter-button {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

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

    .chat-input {
        padding: 10px 14px !important;
        font-size: 13px !important;
        min-height: 36px !important;
    }

    .chat-send {
        width: 36px !important;
        height: 36px !important;
    }

    .chat-message {
        margin-bottom: 12px !important;
    }

    .message-avatar {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }

    .message-content {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }
}


/* ========================================
   19. RESPONSIVE — @media (max-width: 767px)
       Chat rules extracted from mixed landing blocks
       (source lines 8184–8268, 9088–9109)
   ======================================== */

@media (max-width: 767px) {
    /* Chat Widget */
    .chat-widget {
        bottom: 16px !important;
        right: 16px !important;
    }

    .chat-bubble {
        width: 60px !important;
        height: 60px !important;
    }

    .chat-bubble i {
        font-size: 24px !important;
    }

    .chat-window {
        bottom: 85px !important;
        right: 16px !important;
        left: 16px !important;
        width: auto !important;
        max-width: calc(100vw - 32px) !important;
        height: 65vh !important;
        max-height: 520px !important;
        border-radius: 20px;
    }

    .chat-close {
        width: 36px;
        height: 36px;
        top: 16px;
        right: 16px;
    }

    .chat-body {
        padding: 60px 18px 18px 18px;
    }

    .chat-intro h3 {
        font-size: 1.2rem;
    }

    .chat-intro p {
        font-size: 0.9rem;
    }

    .demo-badge {
        font-size: 0.7rem;
        padding: 5px 12px;
    }

    .starter-button {
        padding: 14px 16px;
        font-size: 0.9rem;
        border-radius: 14px;
    }

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

    .chat-input {
        padding: 14px 16px;
        font-size: 0.9rem;
        min-height: 46px;
        border-radius: 14px;
    }

    .chat-send {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 12px;
    }

    .message-content {
        padding: 12px 14px;
        font-size: 0.9rem;
        border-radius: 14px;
    }

    /* Chat message content (mobile responsive) */
    .chat-message .message-content {
        font-size: 13px;
        padding: 10px 14px;
    }

    .chat-message h2 {
        font-size: 1rem;
    }

    .chat-message h3 {
        font-size: 0.95rem;
    }

    .chat-message p {
        font-size: 0.9rem;
    }

    .chat-message li {
        font-size: 0.9rem;
    }
}


/* ========================================
   20. RESPONSIVE — @media (max-width: 480px)
       Chat rules extracted from mixed landing blocks
       (source lines 6496–6516, 6599–6618, 7855–7942, 8376–8481)
   ======================================== */

@media (max-width: 480px) {
    /* Extra small devices — nav-section block (with !important) */
    .chat-widget {
        bottom: 15px !important;
        right: 15px !important;
    }

    .chat-bubble {
        width: 50px !important;
        height: 50px !important;
    }

    .chat-bubble i {
        font-size: 22px !important;
    }

    .chat-window {
        bottom: 75px !important;
        right: 15px !important;
        left: 15px !important;
        width: auto !important;
        height: 65vh !important;
    }

    /* Extra Small Devices — Chat Window (dedicated block) */
    .chat-window {
        border-radius: 12px !important;
    }

    .chat-close {
        width: 28px !important;
        height: 28px !important;
        top: 10px !important;
        right: 10px !important;
    }

    .chat-body {
        padding: 50px 14px 14px 14px !important;
    }

    .chat-intro {
        margin-bottom: 16px !important;
    }

    .chat-intro h3 {
        font-size: 15px !important;
        margin-bottom: 6px !important;
    }

    .chat-intro p {
        font-size: 12px !important;
        margin-bottom: 16px !important;
    }

    .demo-badge {
        font-size: 9px !important;
        padding: 2px 8px !important;
        margin-bottom: 12px !important;
    }

    .conversation-starters {
        gap: 6px !important;
    }

    .starter-button {
        padding: 9px 12px !important;
        font-size: 12px !important;
        border-radius: 10px !important;
    }

    .chat-input-area {
        padding: 10px 14px !important;
    }

    .chat-input-container {
        gap: 6px !important;
    }

    .chat-input {
        padding: 9px 12px !important;
        font-size: 12px !important;
        min-height: 34px !important;
        border-radius: 10px !important;
    }

    .chat-send {
        width: 34px !important;
        height: 34px !important;
        border-radius: 10px !important;
    }

    .chat-send i {
        font-size: 14px !important;
    }

    .chat-message {
        margin-bottom: 10px !important;
        gap: 6px !important;
    }

    .message-avatar {
        width: 26px !important;
        height: 26px !important;
        font-size: 11px !important;
    }

    .message-content {
        padding: 9px 12px !important;
        font-size: 12px !important;
        border-radius: 12px !important;
    }

    /* Small Mobile — about section chat overrides */
    .chat-widget {
        bottom: 12px !important;
        right: 12px !important;
    }

    .chat-bubble {
        width: 54px !important;
        height: 54px !important;
    }

    .chat-bubble i {
        font-size: 22px !important;
    }

    .chat-window {
        bottom: 75px !important;
        right: 12px !important;
        left: 12px !important;
        height: 70vh !important;
        max-height: 480px !important;
        border-radius: 18px;
    }

    .chat-close {
        width: 32px;
        height: 32px;
        top: 14px;
        right: 14px;
    }

    .chat-body {
        padding: 55px 14px 14px 14px;
    }

    .chat-intro {
        margin-bottom: 16px;
    }

    .chat-intro h3 {
        font-size: 1.1rem;
    }

    .chat-intro p {
        font-size: 0.85rem;
        margin-bottom: 16px;
    }

    .demo-badge {
        font-size: 0.65rem;
        padding: 4px 10px;
        margin-bottom: 14px;
    }

    .conversation-starters {
        gap: 8px;
    }

    .starter-button {
        padding: 12px 14px;
        font-size: 0.85rem;
        border-radius: 12px;
    }

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

    .chat-input-container {
        gap: 10px;
    }

    .chat-input {
        padding: 12px 14px;
        font-size: 0.85rem;
        min-height: 42px;
        border-radius: 12px;
    }

    .chat-send {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .chat-send i {
        font-size: 1rem;
    }

    .chat-message {
        margin-bottom: 14px;
        gap: 10px;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        font-size: 11px;
    }

    .message-content {
        padding: 10px 12px;
        font-size: 0.85rem;
        border-radius: 12px;
    }
}


/* ========================================
   21. PREFERS-REDUCED-MOTION
       (chat-specific entries only from the global block)
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .starter-button:hover,
    .chat-bubble:hover,
    .chat-send:hover {
        transform: none !important;
    }
}
