/* CSS variables - :host for Shadow DOM, :root for fallback */
/* :root, :host {
    --primary-color: rgb(194, 110, 41);
} */

.vs-chat-empty-container .dxbl-wait-indicator {
    width: 30px !important;
    height: 30px !important;
}

.dx-license {
    display: none !important;
}

/* Note: #vs-widget-host styles are injected into the outer document head via JavaScript
   because Shadow DOM CSS cannot style the outer host element. See widget-core.js */

#vs-chat-container {
    position: absolute;
    z-index: 2147483001;
    /* above launcher */
    overflow: hidden;
    /* Smooth, slow transition with exponential ease-out (no overshoot) */
    transition: width 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                height 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.65s cubic-bezier(0.16, 1, 0.3, 1),
                top 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                left 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                right 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                bottom 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                border-radius 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.4s ease;
    border-radius: 16px;
    /* default placement and size (desktop) */
    bottom: 80px;
    right: 20px;
    top: auto;
    left: auto;
    width: var(--valuespace-chatwidget-width, 600px);
    height: var(--valuespace-chatwidget-height, 800px);
    max-height: calc(100vh - 160px); /* Leave space for button + margins */
    display: flex;
    transform-origin: bottom right;
}

/* Hidden state for container and launcher */
#vs-chat-container.is-hidden {
    display: none !important;
}

/* Button can be hidden with display none when truly not needed */
#vs-chat-button.is-completely-hidden {
    display: none !important;
}

/* When open on desktop, lift the container above the launcher */
    #vs-chat-container.is-open {
        bottom: 90px;
        background-color: white; /*    background-color: var(--dxds-color-surface-neutral-subdued-rest);*/
        box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    }

/* Expanded state - larger size with enhanced shadow for depth */
#vs-chat-container.is-expanded {
    width: var(--valuespace-chatwidget-expanded-width, 800px);
    height: var(--valuespace-chatwidget-expanded-height, 900px);
    max-height: calc(100vh - 160px); /* Leave space for button + margins */
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.20);
    /* Keep rounded corners in expanded mode (container mode) */
    border-radius: 16px;
}

#vs-chat-container button {
    color: var(--valuespace-text-color);
    /*color: var(--bs-emphasis-color); */
}

#vs-chat-button {
    /* VIEWPORT-BASED POSITIONING: Fixed to viewport, not parent container */
    position: fixed;
    /* Use safe-area-inset for notched devices (iPhone X+, etc.) */
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
    width: 56px;
    height: 56px;
    padding: 0 16px;
    border-radius: 9999px;
    /* pill */
    background-color: var(--bs-primary);
    color: white; /* White icons for contrast on accent background, matches expand icon behavior */
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 2147483000;
    /* below container */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    /* label size */
    /* Default state - visible and in final position */
    opacity: 1;
    transform: translateY(0);
    /* Animation will trigger when classes change */
    transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    /* Sticky positioning - may move slightly during URL bar transitions, but stays visible */
}

/* Connecting state - invisible and below final position */
#vs-chat-button.is-connecting {
    opacity: 0;
    transform: translateY(15px);
}


/* Launcher icon states - controlled by CSS classes */
#vs-chat-button .vs-close-icon {
    display: none;
}

#vs-chat-button.is-close-mode .vs-open-icon {
    display: none;
}

#vs-chat-button.is-close-mode .vs-close-icon {
    display: inline-block;
}

/* Open icon - now uses inline SVG like expand icon */
.vs-open-icon {
    display: block;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.vs-open-icon svg {
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    display: block;
    box-sizing: border-box;
}

/* Close icon - now uses inline SVG like expand icon */
.vs-close-icon {
    display: block;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.vs-close-icon svg {
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    display: block;
    box-sizing: border-box;
}

/* Status dot - positioned at bottom left of button, default connecting state */
.vs-status-dot {
    position: absolute;
    left: 0px;
    bottom: 0px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    transition: background-color 0.3s ease;
    animation: pulse 2s infinite; /* pulse animation by default */
}

/* Status dot when connected */
.vs-status-dot.vs-init {
    background-color: #6b7280; /* grey-500 */
    animation: none; /* stop pulse when connected */
}

/* Status dot when connected */
.vs-status-dot.vs-connected {
    background-color: #10b981; /* green-500 */
    animation: none; /* stop pulse when connected */
}

/* Status dot when connecting */
.vs-status-dot.vs-connecting {
    background-color: #f59e0b; /* amber-500 */
    /*animation: pulse 2s infinite;*/
}

/* Status dot when reconnecting (same as connecting) */
.vs-status-dot.vs-reconnecting {
    background-color: #f59e0b; /* amber-500 - same as connecting */
    animation: pulse 2s infinite;
}

/* Status dot when error (connection lost or failed) */
.vs-status-dot.vs-error {
    background-color: #6b7280; /* grey-500 */
    animation: none; /* stop pulse when error */
}

/* Unread message badge */
.vs-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    height: 20px;
    background: #dc2626; /* red-600 */
    color: white;
    display: none; /* Hidden by default, shown via class */
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    line-height: 1;
    /* Default: perfect circle for 1 digit */
    width: 20px;
    border-radius: 50%;
    padding: 0;
}

/* Show badge when visible */
.vs-unread-badge.vs-unread-badge-visible {
    display: flex;
}

/* Rounded rectangle for 2+ digits */
.vs-unread-badge.vs-unread-badge-multi {
    min-width: 20px;
    width: auto;
    border-radius: 10px;
    padding: 0px;
}

.vs-unread-count {
    line-height: 1;
}

/* Pulse animation for connecting/reconnecting states */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Hover/active effects for launcher button */
#vs-chat-button:hover {
    transform: scale(1.05);
}

#vs-chat-button:active {
    transform: scale(0.95);
}

/* Remove focus ring entirely for the toggle button (no keyboard usage needed) */
#vs-chat-button:focus,
#vs-chat-button:focus-visible {
    outline: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#vs-widget-iframe {
    border: none;
    width: 100%;
    height: 100%;
    /*  border-radius: 16px;*/
    position: relative;
    z-index: 1;
    /* keep below in-container controls */
}



/* In-container close button (full-screen mode only) */
#vs-chat-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border: none;
    font-size: 16px;
    display: none;
    /* hidden by default, shown in full-screen mode */
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transform-origin: center;
    transition: transform 0.2s ease, background 0.2s ease, border-radius 0.2s ease;
    background: transparent;
}

#vs-chat-close:hover {
    background: rgba(9, 14, 21, 0.1);
    border-radius: 6px;
    transform: scale(1.05);
}

#vs-chat-close:active {
    transform: scale(0.95);

}

/* Expand/Collapse button (container mode only) */
#vs-chat-expand {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform-origin: center;
    transition: transform 0.2s ease, background 0.2s ease, border-radius 0.2s ease;
    background: transparent;
    box-sizing: border-box;
}

#vs-chat-expand:hover {
    background: rgba(9, 14, 21, 0.1);
    border-radius: 6px;
    transform: scale(1.05);
}

#vs-chat-expand:active {
    transform: scale(0.95);
}

/* Expand/Collapse icon container */
.vs-chat-icon {
    display: block;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
}

.vs-chat-icon svg {
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    display: block;
    box-sizing: border-box;
}


/* Position variants */
.vs-position-bottom-right #vs-chat-container {
    bottom: 20px;
    right: 20px;
}

.vs-position-bottom-left #vs-chat-container {
    bottom: 20px;
    left: 20px;
}

.vs-position-top-right #vs-chat-container {
    top: 20px;
    right: 20px;
}

.vs-position-top-left #vs-chat-container {
    top: 20px;
    left: 20px;
}

/* ============================================
   SCROLL BEHAVIOR - Mobile & Desktop
   ============================================ */

/* Container scroll behavior:
   - Full-screen mode (mobile): Container scrolls to show/hide URL bar
   - Container mode (tablet/desktop): Natural scroll passthrough */
#vs-chat-container.is-open {
    /* Allow vertical scroll, prevent horizontal scroll */
    overflow-x: hidden;
    overflow-y: auto;
    /* Smooth scrolling on iOS */
    -webkit-overflow-scrolling: touch;
}

/* Full-screen mode: Widget becomes the scrollable "page" in small screens or landscape mode */
@media (max-width: 700px) or ((max-height: 700px) and (max-width: 1000px)) {
    #vs-chat-container.is-open {
        /* Prevent scroll chaining - we're the page now */
        overscroll-behavior: contain;
    }
}

/* Small screens OR landscape mode: full-screen when width ≤ 700px or (height ≤ 700px and width ≤ 1000px) */
@media (max-width: 700px) or ((max-height: 700px) and (max-width: 1000px)) {
    /* Force full-screen for ANY state - use dynamic viewport to account for mobile browser UI */
    #vs-chat-container,
    #vs-chat-container.is-expanded {
        position: fixed;
        width: 100vw;
        height: 100vh; /* Fallback for older browsers */
        height: 100dvh; /* Dynamic viewport height - accounts for mobile browser UI */
        max-height: none; /* Remove the desktop max-height constraint */
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        border-radius: 0;
        transition: none;
    }
    
    /* Ensure iframe uses full height on mobile without overflow */
    #vs-widget-iframe {
        height: 100% !important;
        max-height: 100vh !important; /* Fallback */
        max-height: 100dvh !important; /* Dynamic viewport height */
    }
    
    /* Button visibility: full-screen mode */
    /* Show: close button (X) in header */
    /* Hide: expand button */
    #vs-chat-expand {
        display: none !important;
    }

    #vs-chat-close {
        display: flex !important;
    }
    
    /* Hide launcher on small screens when widget is open (close button is inside header) */
    /* Using opacity/transform instead of display: none so animation works when reopening */
    #vs-chat-container.is-open ~ #vs-chat-button:not(.is-completely-hidden) {
        opacity: 0;
        transform: translateY(15px);
        pointer-events: none;
    }
    
    /* Remove all width constraints and border-radius */
    .agent-chat-widget,
    .user-chat-widget,
    .user-chat,
    .agentic-chat,
    .card-header:first-child {
        min-width: 0;
        border-radius: 0;
    }
    
    /* Override header border-radius - match working standard size approach */
    .chat-header, .card-header:first-child {
        border-radius: 0 !important;
        border-top-left-radius: 0px !important;
        border-top-right-radius: 0px !important;
        border-bottom-right-radius: 0px !important;
        border-bottom-left-radius: 0px !important;
    }
}

/* Medium screens: can fit normal but NOT expanded (width constraint) */
/* Edge case: Screen is 701-920px wide, expanded widget needs 800px+ → go full-screen */
@media (min-width: 701px) and (max-width: 920px) {
    /* When user clicks expand, go full-screen instead */
    #vs-chat-container.is-expanded {
        position: fixed;
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport for consistency */
        max-height: none; /* Remove the desktop max-height constraint */
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        border-radius: 0;
    }

    /* Remove border-radius from children */
    #vs-chat-container.is-expanded .agent-chat-widget,
    #vs-chat-container.is-expanded .user-chat-widget,
    #vs-chat-container.is-expanded #vs-widget-iframe,
    #vs-chat-container.is-expanded .card-header:first-child {
        border-radius: 0 !important;
    }
    
    /* Button visibility when expanded goes full-screen */
    #vs-chat-container.is-expanded #vs-chat-expand {
        display: none !important;
    }
    
    #vs-chat-container.is-expanded #vs-chat-close {
        display: flex !important;
    }
    
    /* Hide launcher when expanded (close button is inside header) */
    /* Using opacity/transform instead of display: none so animation works when reopening */
    #vs-chat-container.is-expanded ~ #vs-chat-button:not(.is-completely-hidden) {
        opacity: 0;
        transform: translateY(15px);
        pointer-events: none;
    }
}

/* Default: on large screens, show expand button when open */
@media (min-width: 701px) {
    #vs-chat-container.is-open #vs-chat-expand {
        display: flex;
    }
}

/* When proactive notification is visible, adjust main chat position */
#vs-chat-container.proactive-active {
    bottom: 100px;
    /* Move chat above the proactive notification */
}

/* Position variants for proactive notifications */
.vs-position-bottom-right #vs-proactive-container {
    bottom: 20px;
    right: 20px;
}

.vs-position-bottom-left #vs-proactive-container {
    bottom: 20px;
    left: 20px;
}

.vs-position-top-right #vs-proactive-container {
    top: 20px;
    right: 20px;
}

.vs-position-top-left #vs-proactive-container {
    top: 20px;
    left: 20px;
}

mark {
    background-color: #ffeb3b;
    /* bright yellow */
    color: inherit;
    /* keep normal text color */
    font-family: inherit;
    padding: 0 0.2em;
    border-radius: 2px;
    /* hand-drawn effect */
    background-image: linear-gradient(120deg, #ffeb3b 0%, #fff176 100%);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    /* uneven highlight edges */
    box-shadow: 2px 0 0 #ffeb3b, -2px 0 0 #ffeb3b;
}

/* violet #E2D9F3*/

/**
 * ValueSpace Widget CSS
 */

.agent-chat-widget .dxbl-wait-indicator {
    --dxbl-wait-indicator-color: var(--dxds-color-surface-primary-default-rest, var(--bs-primary));
}

html[data-bs-theme="dark"] .dxbl-chatui .dxbl-chatui-messages {
    background-color: var(--bs-tertiary-bg);
}


html[data-bs-theme="dark"] .dxbl-chatui-root .dxbl-chatui .dxbl-chatui-messages .dxbl-chatui-message.dxbl-chatui-message-user {
    background-color: var(--bs-light-border-subtle);
    color: var(--bs-body-color, var(--dxbl-body-color, inherit));
}


html[data-bs-theme="dark"] .dxbl-chatui-root .dxbl-chatui .dxbl-chatui-messages .dxbl-chatui-message.dxbl-chatui-message-assistant {
    background-color: var(--bs-secondary-bg);
}

/* Rounded corners for submit area container */
.dxbl-chatui-root .dxbl-chatui .dxbl-chatui-submitarea .dxbl-chatui-submitarea-container {
    --dxbl-chatui-submitarea-container-border-radius: 16px;
    border-radius: 16px !important;
}

/* Basic styling for content generated by Markdown */
.markdown-content {
    line-height: 1.6; /* Improve readability */
    font-family: Arial, sans-serif; /* Example font */
    /*color: var(--bs-body-color); */ /* Default text color */
    /*padding: 15px; */ /* Some internal padding */
}

    .markdown-content h1,
    .markdown-content h2,
    .markdown-content h3 {
        font-weight: 400; /* Slightly bolder */
    }

.markdown-content h1 {
    font-size: 1.4em;
}

.markdown-content h2 {
    font-size: 1.3em;
}

.markdown-content h3 {
    font-size: 1.2em;
}

.markdown-content p {
    margin-bottom: 1em; /* Space between paragraphs */
}

/*
    .markdown-content ul,
    .markdown-content ol {
        margin-left: 20px;
        margin-bottom: 1em;
    }
*/

/*
.markdown-content li {
    margin-bottom: 0.5em; 
}
*/

.markdown-content a {
    color: var(--bs-link-color, var(--dxbl-accent-color)); /* Use theme link color */
    text-decoration: none; /* No underline by default */
}

    .markdown-content a:hover {
        text-decoration: underline; /* Underline on hover */
    }

.markdown-content strong {
    font-weight: bold; /* Ensure strong text is truly bold */
}

.markdown-content em {
    font-style: italic; /* Ensure emphasized text is italic */
}

/* Example for code blocks if you have them */
.markdown-content pre {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-left: 3px solid var(--dxbl-accent-color, var(--bs-primary));
    color: #666;
    page-break-inside: avoid;
    font-family: monospace;
    font-size: 0.9em;
    line-height: 1.6;
    margin-bottom: 1.6em;
    max-width: 100%;
    overflow: auto;
    padding: 1em 1.5em;
    display: block;
    word-wrap: break-word;
}

.markdown-content code {
    font-family: monospace;
    background-color: #eee;
    padding: 2px 4px;
    border-radius: 3px;
}

.markdown-content ul li input[type="checkbox"] {
    /* 1. Hide the browser's default checkbox appearance */
    -webkit-appearance: none; /* For Webkit browsers (Chrome, Safari) */
    -moz-appearance: none; /* For Mozilla Firefox */
    appearance: none; /* Standard property */
    /* 2. Define the size and base styling for our custom box */
    width: 16px;
    height: 16px;
    /* NEW: Custom border and background for the UNCHECKED state */
    border: 1px solid #99d9c8; /* A light, subtle green-blue border */
    background-color: transparent; /* Makes the unchecked box transparent inside */

    border-radius: 4px; /* Slightly rounded corners, similar to ChatGPT */
    display: inline-block; /* Allows us to control width/height */
    vertical-align: middle; /* Aligns the checkbox nicely with the text */
    margin-right: 8px; /* Adds space between the box and the task text */
    flex-shrink: 0; /* Prevents the checkbox from shrinking in flex containers */
    cursor: default; /* Indicates it's not interactive (due to disabled="disabled") */
    position: relative; /* Essential for positioning the checkmark inside */
    /* 3. Smooth transition for visual changes (e.g., when it becomes checked) */
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Style for the CHECKED state (uses theme accent color) */
.markdown-content ul li input[type="checkbox"]:checked {
    background-color: var(--dxbl-accent-color, var(--bs-primary)); /* Theme accent color */
    border-color: var(--dxbl-accent-color, var(--bs-primary)); /* Theme accent color */
}

/* Create the white checkmark symbol inside the CHECKED checkbox */
.markdown-content ul li input[type="checkbox"]:checked::before {
    content: '\2713'; /* Unicode checkmark character */
    display: block; /* Allows us to control its layout */
    color: white; /* White color for the checkmark */
    font-size: 12px; /* Adjust the size to fit within the 16x16px box */
    line-height: 1; /* Helps with vertical alignment */
    text-align: center; /* Centers the checkmark horizontally */
    position: absolute; /* Positions it relative to the checkbox box */
    top: 50%; /* Moves to the vertical center */
    left: 50%; /* Moves to the horizontal center */
    transform: translate(-50%, -50%); /* Precisely centers the checkmark */
    font-weight: bold; /* Makes the checkmark bolder, similar to ChatGPT */
}


/* PDF viewer sizing - but not on very small screens where full-screen mode is active */
.agent-chat-widget .pdf-viewer {
    min-height: 300px !important;
    min-width: 0 !important; /* No min-width on small screens */
}

/* Only apply PDF viewer min-width when device is large enough for container mode */
@media (min-width: 701px) {
    .agent-chat-widget .pdf-viewer {
        min-width: 300px !important;
    }
}


.agent-chat-widget .print-btn {
    -webkit-mask-image: url("../images//printer.svg") !important;
    mask-image: url("../images/printer.svg");
    mask-repeat: no-repeat;
    mask-size: 100%;
    background-color: currentColor;
    color: black;
    --toolbar-icon-size: 32px;
}

.agent-chat-widget .download-btn {
    -webkit-mask-image: url("../images/download.svg") !important;
    mask-image: url("../images/download.svg");
    mask-repeat: no-repeat;
    mask-size: 100%;
    color: black;
    background-color: currentColor;
    --toolbar-icon-size: 32px;
}

.w-100 {
    width: 100% !important;
}



.loading-panel-chat {
    height: 250px; 
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000; /* sit above chat content */
}

.product-actions img {
    opacity: 0.3;
}

/* Image zoom transition effect removed from global - now applied only to ImageGrid and ProductCardThumbnail components */

/* Mobile keyboard handling in full-screen mode - ensure content scrolls properly when keyboard appears */
@media (max-width: 700px) or ((max-height: 700px) and (max-width: 1000px)) {
    /* Smooth scroll behavior for keyboard appearance */
    html, body {
        scroll-behavior: smooth;
    }
    
    /* Ensure focused inputs are visible above keyboard */
    ::deep textarea:focus,
    ::deep input:focus {
        scroll-margin-bottom: env(safe-area-inset-bottom, 20px);
    }
}

/* ===== IMAGE CONTENT STYLES ===== */

/* Chat images container */
.chat-images {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

/* Individual image item */
.image-item {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--vs-surface-secondary, #f5f5f5);
}

/* Clickable image item */
.image-item.clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-item.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Image link wrapper */
.image-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Image itself */
.chat-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

/* Single image - optimal sizing */
.chat-images.one .chat-image {
    max-height: 400px;
    object-fit: contain;
    background-color: var(--vs-surface-secondary, #f5f5f5);
}

/* Image caption/alt text */
.image-caption {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--valuespace-text-color, #333);
    background-color: var(--vs-surface-primary, #ffffff);
    border-top: 1px solid var(--vs-border, #e0e0e0);
    text-align: left;
    word-wrap: break-word;
}

/* Image grid (multiple images) */
.image-grid {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

/* Two images: side by side */
.chat-images.two .image-grid,
.image-grid.two-images {
    grid-template-columns: 1fr 1fr;
}

/* Three images: 2 on top, 1 below */
.chat-images.three .image-grid,
.image-grid.three-images {
    grid-template-columns: 1fr 1fr;
}

.chat-images.three .image-grid .image-item:last-child,
.image-grid.three-images .image-item:last-child {
    grid-column: 1 / -1;
}

/* Four or more images: 2x2 grid */
.chat-images.four .image-grid,
.chat-images.many .image-grid,
.image-grid.many-images {
    grid-template-columns: 1fr 1fr;
}

/* Grid image sizing */
.image-grid .chat-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
}

.image-grid .image-item {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-grid .image-item:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Clickable image links in grid */
.image-grid a.image-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.image-grid a.image-item.clickable:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* More images indicator overlay */
.more-images {
    position: relative;
}

.more-images::after {
    content: attr(data-count);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 24px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 8px;
}

/* Hidden images for gallery */
.hidden-images {
    display: none;
}

/* Gallery view */
.gallery-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gallery-controls {
    display: flex;
    justify-content: flex-start;
    padding: 8px 0;
}

.gallery-content {
    width: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-images.one .chat-image {
        max-height: 300px;
    }
    
    .image-grid .chat-image {
        height: 120px;
    }
    
    .image-caption {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* ===== VIDEO CONTENT STYLES ===== */

/* Video container */
.chat-video {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

/* Video player */
.video-player {
    width: 100%;
    max-height: 400px;
    border-radius: 12px;
    background-color: #000;
}

/* Video iframes (YouTube, Vimeo) */
.chat-video iframe {
    width: 100%;
    max-width: 560px;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    border: none;
}

/* Video caption */
.video-caption {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--valuespace-text-color, #333);
    background-color: var(--vs-surface-primary, #ffffff);
    border-top: 1px solid var(--vs-border, #e0e0e0);
    border-radius: 0 0 12px 12px;
    text-align: left;
    word-wrap: break-word;
}

/* Video link fallback */
.video-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-link-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--bs-primary);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.video-link-button:hover {
    background-color: var(--bs-primary-dark, #0056b3);
    color: white;
}

/* Audio controls */
.chat-audio {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.chat-audio audio {
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
}

/* Responsive video adjustments */
@media (max-width: 768px) {
    .video-player {
        max-height: 300px;
    }
    
    .video-caption {
        padding: 10px 12px;
        font-size: 13px;
    }
}
