/**
 * AI Search Widget & Overlay Styles
 * File: css/widget.css
 *
 * Styles for the embeddable widget and full-page overlay
 */

/* ==================== PRIMARY COLOR SYSTEM ==================== */
:root {
    --ai-primary-color: #01c3c3;
    --ai-text-color: #212121;
    --ai-text-light: #ffffff;
}

/* ==================== SCROLL LOCK WHEN OVERLAY OPEN ==================== */
body.ai-overlay-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
    -webkit-overflow-scrolling: none;
    overscroll-behavior: none;
}

/* ==================== WIDGET STYLES ==================== */

/* Main Widget Container - White box with shadow */
.ai-search-widget {
    background: #ffffff;
    border: 1px solid #f2f2f2;
    border-radius: 5px;
    padding: 18px 15px;
    margin: 16px 0;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: inherit !important;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    width: auto;
    box-sizing: border-box;
    box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Main Row: AI Icon + Input Box + Close Button */
.ai-widget-main-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

/* AI Icon (speech bubble with stars) */
.ai-widget-ai-icon {
    flex-shrink: 0;
    width: 33px;
    height: 30px;
    color: var(--ai-primary-color, #f17203);
}

.ai-widget-ai-icon svg {
    width: 100%;
    height: 100%;
}

/* Input Box - rectangular with gray border */
.ai-widget-input-box {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #dadada;
    border-radius: 5px;
    padding: 0 15px;
    height: 47px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.ai-widget-input-box:hover {
    border-color: #c0c0c0;
}

.ai-widget-input-box:focus {
    outline: none;
    border-color: var(--ai-primary-color, #f17203);
}

/* Placeholder text */
.ai-widget-placeholder {
    font-family: 'Open Sans', sans-serif;
    font-size: 14px !important;
    font-weight: 400;
    color: #212121;
    line-height: 16px;
}

/* Submit arrow (visual only, gray) */
.ai-widget-submit-arrow {
    flex-shrink: 0;
    width: 15px;
    height: 20px;
    color: #212121;
}

.ai-widget-submit-arrow svg {
    width: 100%;
    height: 100%;
}

/* Collapse/Close Button */
.ai-widget-collapse-btn {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #212121;
    transition: color 0.2s ease;
    padding: 0;
    margin: -8px -8px -8px 0;
}

.ai-widget-collapse-btn:hover {
    color: #212121;
}

.ai-widget-collapse-btn svg {
    width: 20px;
    height: 20px;
}

/* Prompt Buttons Container */
.ai-widget-prompts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    padding-left: 47px; /* Align with input box (icon width + gap) */
}

/* Individual Prompt Button */
.ai-widget-prompt-btn {
    background: transparent;
    border: 1px solid #dadada;
    border-radius: 20px;
    padding: 0 12px;
    font-family: 'Open Sans', sans-serif;
    font-size: 12px !important;
    font-weight: 300;
    color: #212121;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    max-width: 500px;
    height: 25px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* First prompt button gets primary color border */
.ai-widget-prompt-btn.ai-widget-prompt-primary {
    border-color: var(--ai-primary-color, #f17203);
}

.ai-widget-prompt-btn:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--ai-primary-color, #f17203);
}

.ai-widget-prompt-icon {
    width: 10px;
    height: 13px;
    flex-shrink: 0;
    color: var(--ai-primary-color, #f17203);
}

/* Legacy styles kept for backwards compatibility */
.ai-widget-clickable {
    cursor: pointer;
}

.ai-widget-search-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background-color: var(--ai-primary-color, #01c3c3);
    color: var(--ai-primary-text-color, #ffffff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: none;
    padding: 0;
}

.ai-widget-search-btn:hover {
    background-color: var(--ai-primary-color, #01c3c3);
    opacity: 0.9;
    transform: none;
    box-shadow: none;
}

.ai-widget-search-btn:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.ai-widget-search-btn .dashicons {
    font-size: 18px !important;
    color: var(--ai-text-light, white);
    width: 18px;
    height: 18px;
    line-height: 1;
}

.ai-widget-search-icon,
.ai-widget-loading {
    font-size: 16px !important;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.ai-widget-loading {
    animation: spin 1s linear infinite;
}

/* Ensure proper icon styling within button */
.ai-widget-search-btn .ai-widget-search-icon,
.ai-widget-search-btn .ai-widget-loading {
    color: var(--ai-primary-text-color, #ffffff);
}

/* Widget title icon uses primary color */
.ai-widget-title-icon {
    background-color: var(--ai-primary-color, #01c3c3);
}

/* Sample Questions */
.ai-widget-samples-container {
    margin-bottom: 32px;
}

.ai-widget-samples-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    padding: 8px 0;
}

.ai-widget-samples-spinner {
    animation: spin 1s linear infinite;
}

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

.ai-widget-samples-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.ai-widget-sample-question {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 0 8px;
    font-family: inherit;
    font-size: 12px !important;
    font-weight: inherit;
    color: inherit;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    max-width: 500px;
    height: 25px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Placeholder bubbles for sample questions loading state */
.ai-widget-sample-placeholder {
    background: #f1f3f6;
    border-radius: 20px;
    height: 25px;
    min-width: 120px;
    max-width: 220px;
    margin: 4px;
    display: inline-block;
    opacity: 0.7;
    box-sizing: border-box;
}

.ai-widget-sample-question .dashicons {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.ai-widget-sample-icon {
    width: 10px;
    height: 13px;
    flex-shrink: 0;
}

.ai-widget-sample-question:hover {
    background: #f8f9fa;
    border-color: #ccc;
    color: inherit;
    transform: none;
    box-shadow: none;
}

.ai-widget-generate-samples {
    background: transparent;
    border: 1px dashed #6c757d;
    color: #6c757d;
    padding: 8px 16px;
    font-size: 13px !important;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 8px;
    white-space: nowrap;
}

.ai-widget-generate-samples:hover {
    border-color: #0066cc;
    color: #0066cc;
}

/* Response Section */
.ai-widget-response-container {
    border-top: none;
    padding-top: 0px;
    padding-bottom: 32px;
    margin-top: 0;
}

.ai-widget-response-content {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    font-family: inherit;
    font-size: 16px !important;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    min-height: auto;
}

.ai-widget-response-content.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-style: normal;
    text-align: center;
    width: 100%;
    min-height: 60px;
    padding: 20px 0;
}

/* Pulsing Circle Loader for Widget */
.ai-widget-pulse-loader {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--ai-primary-color, #01c3c3);
    animation: ai-pulse 1.2s infinite ease-in-out;
    display: block;
}

@keyframes ai-pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}

.ai-widget-response-content p {
    margin: 0 0 8px 0;
}

.ai-widget-response-content p:last-child {
    margin-bottom: 0;
}

/* AI Response Text Wrapper */
.ai-widget-response-text {
    margin: 0;
}

/* Markdown Elements in Response Content */
.ai-widget-response-content strong {
    font-weight: 600;
}

.ai-widget-response-content em {
    font-style: italic;
}

.ai-widget-response-content code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    padding: 2px 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em !important;
    color: #d63384;
}

.ai-widget-response-content ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.ai-widget-response-content ol {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: decimal;
}

.ai-widget-response-content li {
    margin: 4px 0;
}

.ai-widget-response-content a {
    color: #0066cc;
    text-decoration: underline;
}

.ai-widget-response-content a:hover {
    color: #004499;
    text-decoration: none;
}

/* Citations */
.ai-widget-citations {
    margin-top: 12px;
}

.ai-widget-citations-header {
    font-size: 13px !important;
    font-weight: 600;
    color: #6c757d;
    margin: 0 0 6px 0;
}

.ai-widget-citations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ai-widget-citations-list li {
    margin-bottom: 4px;
}

.ai-widget-citations-list a {
    color: #0066cc;
    font-size: 12px !important;
}

.ai-widget-citations-list a:hover {
    border-bottom-color: #0066cc;
}

/* When citations are disabled, ensure proper spacing */
.ai-search-widget[data-show-citations="false"] .ai-widget-response-content {
    margin-bottom: 0;
}

/* Error Messages */
.ai-widget-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px !important;
    margin-top: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-search-widget {
        margin: 16px 0;
        padding: 14px 12px;
    }

    .ai-widget-main-row {
        gap: 10px;
    }

    .ai-widget-ai-icon {
        width: 28px;
        height: 25px;
    }

    .ai-widget-input-box {
        height: 44px;
        padding: 0 12px;
    }

    .ai-widget-placeholder {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    .ai-widget-collapse-btn {
        width: 44px;
        height: 44px;
        margin: -4px -4px -4px 0;
    }

    .ai-widget-prompts-container {
        gap: 8px;
        justify-content: flex-start;
        padding-left: 38px; /* Adjust for smaller icon */
    }

    .ai-widget-prompt-btn {
        padding: 0 14px;
        height: 32px;
        font-size: 13px !important;
        border-radius: 20px;
    }

    .ai-widget-prompt-icon {
        width: 10px;
        height: 13px;
    }
}

@media (max-width: 480px) {
    .ai-search-widget {
        padding: 12px 10px;
        margin: 12px 0;
    }

    .ai-widget-main-row {
        gap: 8px;
        margin-bottom: 10px;
    }

    .ai-widget-ai-icon {
        width: 26px;
        height: 24px;
    }

    .ai-widget-input-box {
        height: 40px;
        padding: 0 10px;
    }

    .ai-widget-placeholder {
        font-size: 14px !important;
    }

    .ai-widget-collapse-btn {
        width: 40px;
        height: 40px;
        margin: -2px -2px -2px 0;
    }

    .ai-widget-collapse-btn svg {
        width: 16px;
        height: 16px;
    }

    .ai-widget-prompts-container {
        gap: 6px;
        padding-left: 34px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .ai-widget-prompts-container::-webkit-scrollbar {
        display: none;
    }

    .ai-widget-prompt-btn {
        height: 28px;
        padding: 0 12px;
        font-size: 12px !important;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .ai-widget-prompt-icon {
        width: 9px;
        height: 12px;
    }
}

/* Theme Integration Helpers */

/* Light theme support */
.ai-search-widget.theme-light {
    background: #ffffff;
    border-color: #e1e5e9;
}

/* Dark theme support */
.ai-search-widget.theme-dark {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.ai-search-widget.theme-dark .ai-widget-title {
    color: #e2e8f0;
}

.ai-search-widget.theme-dark .ai-widget-subtitle {
    color: #a0aec0;
}

.ai-search-widget.theme-dark .ai-widget-input {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

.ai-search-widget.theme-dark .ai-widget-sample-question {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

.ai-search-widget.theme-dark .ai-widget-response-content {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

/* Dark theme markdown elements */
.ai-search-widget.theme-dark .ai-widget-response-content code {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #f093fb;
}

.ai-search-widget.theme-dark .ai-widget-response-content a {
    color: #63b3ed;
}

.ai-search-widget.theme-dark .ai-widget-response-content a:hover {
    color: #90cdf4;
}

/* ==================== AI SUMMARY WIDGET STYLES ==================== */

/* Main Summary Widget Container */
.ai-summary-widget {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 12px 0;
    margin: 16px 0;
    font-family: inherit;
    font-size: inherit !important;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    width: auto;
    box-sizing: border-box;
    box-shadow: none;
    position: relative;
}

/* Summary Button Container */
.ai-summary-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

/* Summary Button */
.ai-summary-btn {
    background: white;
    border: 1px solid #000000;
    border-radius: 25px;
    padding: 8px 20px;
    font-family: inherit;
    font-size: 14px !important;
    font-weight: 500;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    box-sizing: border-box;
    text-decoration: none;
    white-space: nowrap;
}

.ai-summary-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #000000;
    color: #000000;
    transform: none;
    box-shadow: none;
}

.ai-summary-btn:disabled,
.ai-summary-btn.disabled {
    background-color: #f5f5f5;
    border-color: #cccccc;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.ai-summary-btn .ai-summary-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-summary-btn .ai-summary-icon svg {
    width: 100%;
    height: 100%;
    color: #000000;
}

.ai-summary-btn:disabled .ai-summary-icon svg,
.ai-summary-btn.disabled .ai-summary-icon svg {
    color: #999;
}

.ai-summary-btn .ai-summary-loading {
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
    color: #000000;
}

/* Loading state with gray background */
.ai-summary-btn.loading {
    background-color: #f5f5f5;
    border-color: #cccccc;
    color: #000000;
}

.ai-summary-btn.loading .ai-summary-loading {
    color: #000000;
}

/* Summary Error Messages */
.ai-summary-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px !important;
    margin-top: 8px;
    text-align: center;
}

/* ==================== SUMMARY MODAL STYLES ==================== */

/* Modal Overlay */
.ai-summary-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 200px;
    box-sizing: border-box;
    --ai-summary-close-color: #01c3c3;
}

/* Modal Content */
.ai-summary-modal-content {
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    max-width: 1280px;
    width: 100%;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px 0 rgba(0, 0, 0, 0.3);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Modal Header */
.ai-summary-modal-header {
    padding: 70px 165px 0;
    border-bottom: none;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-shrink: 0;
}

.ai-summary-modal-header h3 {
    margin: 0;
    font-size: 24px !important;
    font-weight: 600;
    color: #000000;
    text-align: left;
    width: 100%;
}

.ai-summary-modal-close {
    background: none;
    border: none;
    font-size: 14px !important;
    font-weight: 600;
    line-height: 20px;
    color: var(--ai-summary-close-color);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: absolute;
    top: 27px;
    right: 52px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: underline;
}

.ai-summary-modal-close:hover {
    color: var(--ai-summary-close-color);
    opacity: 0.8;
}

/* Modal Subtitle */
.ai-summary-modal-subtitle {
    padding: 0 165px;
    margin-top: 20px;
    text-align: left;
    font-size: 14px !important;
    color: #666;
    line-height: 1.5;
}

/* Modal Body */
.ai-summary-modal-body {
    padding: 25px 165px 70px;
    flex: 1;
}

.ai-summary-content {
    font-family: inherit;
    font-size: 16px !important;
    line-height: 28px;
    color: #333;
}

/* Summary Response Text Styling */
.ai-summary-response-text {
    margin: 0;
    line-height: 0px;
}

/* Paragraph styling */
.ai-summary-paragraph {
    margin: 0 0 20px 0;
    line-height: 28px;
    text-align: left;
    font-size: 16px !important;
}

.ai-summary-paragraph:last-child {
    margin-bottom: 0;
}

/* Special styling for "Read the full article for more about:" */
.ai-summary-content p:has(+ ul),
.ai-summary-content p:has(+ ol) {
    font-weight: 700;
    margin-top: 24px;
    margin-bottom: 8px;
}

/* Headings in summary */
.ai-summary-response-text h1,
.ai-summary-response-text h2,
.ai-summary-response-text h3 {
    margin: 20px 0 12px 0;
    line-height: 1.3;
    color: #000000;
}

.ai-summary-response-text h1:first-child,
.ai-summary-response-text h2:first-child,
.ai-summary-response-text h3:first-child {
    margin-top: 0;
}

.ai-summary-response-text h1 {
    font-size: 1.25em !important;
    font-weight: 700;
}

.ai-summary-response-text h2 {
    font-size: 1.15em !important;
    font-weight: 600;
}

.ai-summary-response-text h3 {
    font-size: 1.1em !important;
    font-weight: 600;
}

/* Text formatting */
.ai-summary-response-text strong {
    font-weight: 600;
    color: #000000;
}

.ai-summary-response-text em {
    font-style: italic;
}

.ai-summary-response-text code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    padding: 2px 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em !important;
    color: #d63384;
}

/* Links */
.ai-summary-response-text a {
    color: #0066cc;
    text-decoration: underline;
}

.ai-summary-response-text a:hover {
    color: #004499;
    text-decoration: none;
}

/* Numbered Lists */
.ai-summary-numbered-list {
    margin: 16px 0;
    padding-left: 24px;
    list-style-type: decimal;
}

.ai-summary-numbered-list:first-child {
    margin-top: 0;
}

.ai-summary-numbered-list:last-child {
    margin-bottom: 0;
}

.ai-summary-numbered-list li {
    margin: 0;
    line-height: 1.6;
    padding-left: 4px;
}

.ai-summary-numbered-list li:first-child {
    margin-top: 0;
}

.ai-summary-numbered-list li:last-child {
    margin-bottom: 0;
}

/* Bullet Lists */
.ai-summary-bullet-list {
    margin: 12px 0 20px 0;
    padding-left: 28px;
    list-style-type: disc;
}

.ai-summary-bullet-list:first-child {
    margin-top: 0;
}

.ai-summary-bullet-list:last-child {
    margin-bottom: 0;
}

.ai-summary-bullet-list li {
    margin: 0;
    line-height: 1.6;
    padding-left: 8px;
    font-size: 16px !important;
}

.ai-summary-bullet-list li:first-child {
    margin-top: 0;
}

.ai-summary-bullet-list li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.ai-summary-numbered-list .ai-summary-numbered-list,
.ai-summary-bullet-list .ai-summary-bullet-list {
    margin: 4px 0;
    font-size: 0.95em !important;
}

/* List item content formatting */
.ai-summary-numbered-list li strong,
.ai-summary-bullet-list li strong {
    color: #000000;
}

.ai-summary-numbered-list li em,
.ai-summary-bullet-list li em {
    color: #555;
}

/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .ai-summary-modal {
        padding: 0 50px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-summary-modal {
        padding: 0;
        align-items: flex-end;
    }

    .ai-summary-modal-content {
        height: 60vh;
        max-height: none;
        max-width: 100%;
        width: 100%;
        border-radius: 20px 20px 0 0;
    }

    .ai-summary-modal-header {
        padding: 40px 30px 0;
    }

    .ai-summary-modal-header h3 {
        font-size: 20px !important;
    }

    .ai-summary-modal-close {
        top: 20px;
        right: 25px;
        font-size: 13px !important;
    }

    .ai-summary-modal-subtitle {
        padding: 0 30px;
        margin-top: 16px;
    }

    .ai-summary-modal-body {
        padding: 18px 30px 40px;
    }

    .ai-summary-content {
        font-size: 15px !important;
        line-height: 26px;
    }

    .ai-summary-btn {
        padding: 10px 24px;
        font-size: 16px !important;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .ai-summary-modal {
        padding: 0;
        align-items: flex-end;
    }

    .ai-summary-modal-content {
        height: 60vh;
        max-height: none;
        max-width: 100%;
        width: 100%;
        border-radius: 20px 20px 0 0;
    }

    .ai-summary-modal-header {
        padding: 35px 25px 0;
    }

    .ai-summary-modal-header h3 {
        font-size: 18px !important;
    }

    .ai-summary-modal-close {
        top: 18px;
        right: 20px;
        font-size: 12px !important;
    }

    .ai-summary-modal-subtitle {
        padding: 0 25px;
        margin-top: 16px;
        font-size: 13px !important;
    }

    .ai-summary-modal-body {
        padding: 18px 25px 35px;
    }

    .ai-summary-content {
        font-size: 15px !important;
        line-height: 26px;
    }

    /* Mobile paragraph adjustments */
    .ai-summary-paragraph {
        margin: 0 0 14px 0;
        line-height: 26px;
        text-align: left;
    }

    /* Mobile list adjustments */
    .ai-summary-numbered-list,
    .ai-summary-bullet-list {
        margin: 14px 0;
        padding-left: 20px;
    }

    .ai-summary-numbered-list li,
    .ai-summary-bullet-list li {
        margin: 0;
        font-size: 15px !important;
        line-height: 1.6;
    }

    /* Mobile heading adjustments */
    .ai-summary-response-text h1,
    .ai-summary-response-text h2,
    .ai-summary-response-text h3 {
        margin: 16px 0 10px 0;
    }
}

/* ==================== AI ASSISTANT OVERLAY STYLES ==================== */

/* Overlay Animations */
@keyframes overlayOpen {
    0% {
        transform: scale(0.3) translateY(100%);
        opacity: 0;
        transform-origin: bottom center;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes overlayClose {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(0.3) translateY(100%);
        opacity: 0;
        transform-origin: bottom center;
    }
}

/* Overlay Container - WHITE background */
.ai-assistant-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh; /* Fallback */
    height: 100dvh; /* Dynamic viewport height for mobile */
    height: calc(var(--app-height, 100vh)); /* JS fallback */
    background-color: #fff;
    z-index: 999999;
    display: none;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ai-assistant-overlay[data-state="opening"] {
    animation: overlayOpen 0.3s ease-out forwards;
}

.ai-assistant-overlay[data-state="closing"] {
    animation: overlayClose 0.25s ease-in forwards;
}

.ai-assistant-overlay[data-state="open"] {
    display: flex;
}

/* Top Bar Container - Logo and Close Button */
.ai-assistant-overlay .ai-overlay-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    flex-shrink: 0;
}

/* Logo link wrapper - In top bar */
.ai-assistant-overlay .ai-overlay-logo-link {
    display: none;
    line-height: 0;
}

.ai-assistant-overlay .ai-overlay-logo-link.has-logo {
    display: block;
}

/* Logo - In top bar */
.ai-assistant-overlay .ai-overlay-logo {
    width: auto;
    height: 35px;
    display: block;
    object-fit: contain;
}

/* Close Button - In top bar */
.ai-assistant-overlay .ai-overlay-close {
    background: transparent;
    border: none;
    color: var(--ai-primary-color, #01c3c3);
    font-size: 36px !important;
    font-weight: 300;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: opacity 0.2s ease;
}

.ai-assistant-overlay .ai-overlay-close:hover {
    opacity: 0.7;
}

/* Horizontal rule below logo/close */
.ai-assistant-overlay .ai-overlay-divider {
    height: 1px;
    background: #F2F2F2;
    flex-shrink: 0;
}

/* Content Container */
.ai-assistant-overlay .ai-overlay-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 40px 40px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* Header */
.ai-assistant-overlay .ai-overlay-header {
    text-align: center;
    margin-bottom: 24px;
    flex-shrink: 0;
}

.ai-assistant-overlay .ai-overlay-heading {
    font-size: 48px !important;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    color: #212121;
    margin: 0 0 12px 0;
}

.ai-assistant-overlay .ai-overlay-text {
    font-size: 18px !important;
    font-style: normal;
    font-weight: 300;
    line-height: normal;
    color: var(--ai-primary-color, #01c3c3);
    margin: 0;
}

/* Prompts Section - Above input */
.ai-assistant-overlay .ai-overlay-prompts-section {
    margin-bottom: 24px;
    text-align: center;
    flex-shrink: 0;
}

.ai-assistant-overlay .ai-overlay-prompts-heading {
    font-size: 12px !important;
    font-style: italic;
    font-weight: 300;
    line-height: normal;
    color: #212121;
    margin: 0 0 24px 0;
}

.ai-assistant-overlay .ai-overlay-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.ai-assistant-overlay .ai-overlay-prompt-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.20);
    border-radius: 20px;
    padding: 10px 18px;
    color: #212121;
    font-size: 12px !important;
    font-style: normal;
    font-weight: 300;
    line-height: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    max-height: 25px;
    box-sizing: border-box;
}

.ai-assistant-overlay .ai-overlay-prompt-btn span {
    font-size: 12px !important;
    color: #212121;
}

.ai-assistant-overlay .ai-overlay-prompt-btn svg {
    flex-shrink: 0;
    width: 10px;
    height: 13px;
}

.ai-assistant-overlay .ai-overlay-prompt-btn:hover {
    border-color: var(--ai-primary-color, #01c3c3);
    color: var(--ai-primary-color, #01c3c3);
}

/* Chat Container */
.ai-assistant-overlay .ai-overlay-chat {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Messages */
.ai-assistant-overlay .ai-overlay-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px !important;
    line-height: 1.5;
}

.ai-assistant-overlay .ai-overlay-message-user {
    background: var(--ai-primary-color, #01c3c3);
    color: var(--ai-primary-text-color, #ffffff);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    margin-right: 24px;
}

.ai-assistant-overlay .ai-overlay-message-user,
.ai-assistant-overlay .ai-overlay-message-user p,
.ai-assistant-overlay .ai-overlay-message-user span,
.ai-assistant-overlay .ai-overlay-message-user a {
    color: var(--ai-primary-text-color, #ffffff);
}

.ai-assistant-overlay .ai-overlay-message-assistant {
    background: transparent;
    color: #212121;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.ai-assistant-overlay .ai-overlay-message-content {
    word-wrap: break-word;
}

.ai-assistant-overlay .ai-overlay-message-content a {
    color: var(--ai-primary-color, #01c3c3);
    text-decoration: underline;
}

.ai-assistant-overlay .ai-overlay-message-assistant .ai-overlay-message-content a:hover {
    text-decoration: none;
}

.ai-assistant-overlay .ai-overlay-message-content strong {
    font-weight: 600;
}

.ai-assistant-overlay .ai-overlay-message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Monaco, Menlo, monospace;
    font-size: 0.9em !important;
}

/* Loading State */
.ai-assistant-overlay .ai-overlay-message-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ai-assistant-overlay .ai-overlay-pulse-loader {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--ai-primary-color, #01c3c3);
    animation: ai-pulse 1.2s infinite ease-in-out;
}

/* Streaming/Typing State */
.ai-assistant-overlay .ai-overlay-message-streaming .ai-overlay-message-content {
    min-height: 20px;
}

.ai-typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--ai-primary-color, #01c3c3);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: ai-cursor-blink 0.8s infinite;
}

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

/* Citations */
.ai-assistant-overlay .ai-overlay-citations {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 13px !important;
}

.ai-assistant-overlay .ai-overlay-citations-label {
    color: #212121;
    margin-right: 8px;
}

.ai-assistant-overlay .ai-overlay-citations a {
    color: var(--ai-primary-color, #01c3c3);
    text-decoration: none;
}

.ai-assistant-overlay .ai-overlay-citations a:hover {
    text-decoration: underline;
}

/* Input Section */
.ai-assistant-overlay .ai-overlay-input-section {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 20px;
}

.ai-assistant-overlay .ai-overlay-form {
    margin: 0;
}

/* Input Row - Icon left, input middle, arrow right */
.ai-assistant-overlay .ai-overlay-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-assistant-overlay .ai-overlay-input-icon {
    flex-shrink: 0;
    width: 34px;
    height: 30px;
}

.ai-assistant-overlay .ai-overlay-input-icon svg {
    width: 100%;
    height: 100%;
}

.ai-assistant-overlay .ai-overlay-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.20);
    border-radius: 8px;
    padding: 0 16px;
}

.ai-assistant-overlay .ai-overlay-input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px !important;
    color: #212121;
    padding: 24px 0;
    margin: 0;
    box-shadow: none;
}

.ai-assistant-overlay .ai-overlay-input-wrapper input:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.ai-assistant-overlay .ai-overlay-input-wrapper input::placeholder {
    color: rgba(33, 33, 33, 0.5);
}

/* Submit arrow - Outside input, grey color */
.ai-assistant-overlay .ai-overlay-submit {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #212121;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    padding: 0;
}

.ai-assistant-overlay .ai-overlay-submit:hover {
    opacity: 0.7;
}

.ai-assistant-overlay .ai-overlay-submit svg {
    width: 15px;
    height: 20px;
}

/* Footer */
.ai-assistant-overlay .ai-overlay-footer {
    text-align: center;
    margin-top: 30px;
    flex-shrink: 0;
}

.ai-assistant-overlay .ai-overlay-footer-text {
    font-size: 14px !important;
    line-height: 1.4;
    color: #212121;
    margin: 0 0 15px 0;
}

.ai-assistant-overlay .ai-overlay-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Mobile: horizontal scroll for prompts and buttons */
@media (max-width: 480px) {
    .ai-assistant-overlay .ai-overlay-prompts {
        flex-direction: column;
        flex-wrap: wrap;
        align-content: flex-start;
        justify-content: flex-start;
        height: 95px; /* 3 rows: 3×25px + 2×10px gap */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }

    .ai-assistant-overlay .ai-overlay-prompts::-webkit-scrollbar {
        display: none;
    }

    .ai-assistant-overlay .ai-overlay-prompt-btn {
        flex-shrink: 0;
    }

    .ai-assistant-overlay .ai-overlay-buttons {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }

    .ai-assistant-overlay .ai-overlay-buttons::-webkit-scrollbar {
        display: none;
    }

    .ai-assistant-overlay .ai-overlay-contact-btn {
        flex-shrink: 0;
    }
}

/* Contact buttons - Primary color with 10% opacity background */
.ai-assistant-overlay .ai-overlay-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ai-primary-color-rgba, rgba(1, 195, 195, 0.10));
    border: 1px solid var(--ai-primary-color, #01c3c3);
    color: var(--ai-primary-color, #01c3c3);
    padding: 12px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px !important;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ai-assistant-overlay .ai-overlay-contact-btn:hover {
    background: var(--ai-primary-color, #01c3c3);
    color: var(--ai-primary-text-color, #ffffff);
}

.ai-assistant-overlay .ai-overlay-contact-btn:hover .ai-overlay-contact-icon svg {
    color: var(--ai-primary-text-color, #ffffff);
}

.ai-assistant-overlay .ai-overlay-contact-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ai-assistant-overlay .ai-overlay-contact-icon svg {
    width: 100%;
    height: 100%;
    color: var(--ai-primary-color, #01c3c3);
    transition: color 0.2s ease;
}

/* Disclaimer - Bottom of overlay */
.ai-assistant-overlay .ai-overlay-disclaimer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.10);
    font-size: 12px !important;
    line-height: 1.5;
    color: #212121;
    text-align: center;
    flex-shrink: 0;
}

.ai-assistant-overlay .ai-overlay-disclaimer a {
    color: var(--ai-primary-color, #01c3c3);
    text-decoration: underline;
}

.ai-assistant-overlay .ai-overlay-disclaimer a:hover {
    text-decoration: none;
}

/* Hide title/subtitle when actively chatting (desktop + mobile) */
.ai-assistant-overlay.ai-overlay-chatting .ai-overlay-header {
    display: none;
}

/* Responsive Overlay */
@media (max-width: 768px) {
    .ai-assistant-overlay .ai-overlay-top-bar {
        padding: 12px 15px;
    }

    .ai-assistant-overlay .ai-overlay-content {
        padding: 30px 20px 30px;
        justify-content: flex-start;
    }

    .ai-assistant-overlay .ai-overlay-header {
        text-align: center;
    }

    .ai-assistant-overlay .ai-overlay-footer {
        margin-top: auto;
    }

    .ai-assistant-overlay .ai-overlay-logo {
        height: 30px;
    }

    .ai-assistant-overlay .ai-overlay-close {
        font-size: 32px !important;
        width: 40px;
        height: 40px;
    }

    .ai-assistant-overlay .ai-overlay-heading {
        font-size: 24px !important;
    }

    .ai-assistant-overlay .ai-overlay-text {
        font-size: 15px !important;
    }

    .ai-assistant-overlay .ai-overlay-message {
        max-width: 90%;
        padding: 12px 16px;
        font-size: 14px !important;
    }

    .ai-assistant-overlay .ai-overlay-input-row {
        gap: 10px;
    }

    .ai-assistant-overlay .ai-overlay-input-icon {
        width: 28px;
        height: 25px;
    }

    .ai-assistant-overlay .ai-overlay-input-wrapper {
        padding: 0 12px;
    }

    .ai-assistant-overlay .ai-overlay-input-wrapper input {
        font-size: 16px !important;
        padding: 12px 0;
    }

    .ai-assistant-overlay .ai-overlay-submit {
        width: 36px;
        height: 36px;
    }

    .ai-assistant-overlay .ai-overlay-prompt-btn {
        padding: 8px 14px;
        font-size: 13px !important;
    }

    .ai-assistant-overlay .ai-overlay-contact-btn {
        padding: 10px 16px;
        font-size: 13px !important;
    }

    .ai-assistant-overlay .ai-overlay-disclaimer {
        margin-top: 20px;
        padding-top: 15px;
        font-size: 11px !important;
    }

    /* When actively chatting on mobile, hide title/subtitle to maximize chat space */
    .ai-assistant-overlay.ai-overlay-chatting .ai-overlay-header {
        display: none;
    }

    /* Tighten padding and fix chat height so footer/disclaimer are below the fold */
    .ai-assistant-overlay.ai-overlay-chatting .ai-overlay-content {
        padding-top: 15px;
        padding-bottom: 10px;
    }

    .ai-assistant-overlay.ai-overlay-chatting .ai-overlay-chat {
        flex: 0 0 auto;
        /* viewport minus top-bar(~54) + divider(1) + padding(25) + input(~70) */
        height: calc(var(--app-height, 100vh) - 150px);
    }
}

@media (max-width: 480px) {
    .ai-assistant-overlay .ai-overlay-top-bar {
        padding: 10px 12px;
    }

    .ai-assistant-overlay .ai-overlay-content {
        padding: 25px 15px 25px;
    }

    .ai-assistant-overlay .ai-overlay-logo {
        height: 28px;
    }

    .ai-assistant-overlay .ai-overlay-close {
        font-size: 28px !important;
        width: 36px;
        height: 36px;
    }

    .ai-assistant-overlay .ai-overlay-header {
        margin-bottom: 16px;
    }

    .ai-assistant-overlay .ai-overlay-heading {
        font-size: 20px !important;
    }

    .ai-assistant-overlay .ai-overlay-prompts-section {
        margin-bottom: 16px;
    }

    .ai-assistant-overlay .ai-overlay-input-icon {
        width: 24px;
        height: 21px;
    }

    .ai-assistant-overlay .ai-overlay-footer {
        margin-top: 20px;
    }

    .ai-assistant-overlay .ai-overlay-contact-btn {
        flex: 1;
        justify-content: center;
    }

    .ai-assistant-overlay .ai-overlay-disclaimer {
        margin-top: 15px;
        padding-top: 12px;
        font-size: 10px !important;
    }
}