.filesfm-ai.chat-container * {
    font-family: AlbertaSans, Roboto, sans-serif;
    box-sizing: border-box;
}

.filesfm-ai.chat-container {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filesfm-ai .chat-header {
    background: linear-gradient(to right, #F23047, #FE7007);
    color: white;
    padding: 20px;
    border-bottom-left-radius: 23px;
    display: flex;
    gap: 16px;
}

.filesfm-ai .ai-header-icon {
    background-image: url(/images/UI_icons/white/file_sparkle.svg);
    width: 18px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    display: inline-block;
    margin-right: 10px;
}

.filesfm-ai .chat-header h1 {
    font-size: 16px;
    font-weight: bold;
    line-height: 20px;
    display: inline-block;
    vertical-align: middle;
}

.filesfm-ai .chat-header p {
    opacity: 0.9;
    font-size: 14px;
}

.filesfm-ai .ai-header-title {
    margin-right: auto;
}

.filesfm-ai .ai-close-icon, .filesfm-ai .ai-refresh-icon {
    width: 16px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.filesfm-ai .ai-close-icon {
    background-image: url(/images/UI_icons/white/close.svg);
}

.filesfm-ai .ai-refresh-icon {
    background-image: url(/images/UI_icons/white/reload.svg);
}

.filesfm-ai .ai-close-icon:hover, .filesfm-ai .ai-refresh-icon:hover {
    opacity: 1;
}

.filesfm-ai .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    font-size: 16px;

    background-image: url(/images/UI_icons/light_grey/file_sparkle.svg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100px;
}

.filesfm-ai.chat-container.chat-started .chat-messages {
    background-image: none;
}

.filesfm-ai .message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

.filesfm-ai .message.user {
    flex-direction: row-reverse;
}

.filesfm-ai .message-content {
    background: white;
    padding: 15px 20px;
    border-radius: 18px;
    max-width: 70%;
    position: relative;
}

.filesfm-ai .message.user .message-content {
    background: linear-gradient(to right, #F7F2F3, #F5E4E7);
    color: black;
}

.filesfm-ai .message.assistant .message-content {
    background: transparent;
    box-shadow: none;
}

.filesfm-ai .copy-button {
    border: 1px solid #D9D9D9;
    border-radius: 8px;
    display: inline-block;
    width: 30px;
    height: 30px;
    cursor: pointer;
    background: url( '/images/UI_icons/copy.svg' ) center/contain no-repeat;
    background-origin: content-box;
    padding: 8px;
    transition: background-color 0.2s ease;
}

.filesfm-ai .copy-button:hover {
    background-image: url( '/images/UI_icons/white/copy.svg' );
    background-color: #000;
}

.filesfm-ai .copy-button.copied {
    background-image: url( '/images/UI_icons/white/check.svg' );
    background-color: #28CC90;
}

@media (hover: hover) and (pointer: fine) {
    .filesfm-ai .message .copy-button {
        opacity: 0;
        pointer-events: none;
    }

    .filesfm-ai .message:hover .copy-button,
    .filesfm-ai .message:focus-within .copy-button {
        opacity: 1;
        pointer-events: auto;
    }
}

.filesfm-ai .message-text {
    line-height: 1.5;
}

.filesfm-ai .message.assistant .message-text {
    margin-bottom: 5px;
}

.filesfm-ai .message-text p {
    margin: 0 0 10px 0;
}

.filesfm-ai .message-text p:last-child {
    margin-bottom: 0;
}

.filesfm-ai .message-text strong, .filesfm-ai .message-text b {
    font-weight: bold;
}

.filesfm-ai .message-text em, .filesfm-ai .message-text i {
    font-style: italic;
}

.filesfm-ai .message-text ul, .filesfm-ai .message-text ol {
    margin: 10px 0;
    padding-left: 20px;
}

.filesfm-ai .message-text li {
    margin: 5px 0;
}

.filesfm-ai .message-text a {
    color: #667eea;
    text-decoration: none;
}

.filesfm-ai .message-text a:hover {
    text-decoration: underline;
}

.filesfm-ai .chat-input-container {
    padding: 0 30px 30px 30px;
    position: relative;
}

.filesfm-ai .common-borders-button-like-container > * {
    cursor: pointer;
    border: 1px solid #D8D8D8;
    border-radius: 10px;
    height: 40px;
    transition: border-color 0.2s ease;
}

.filesfm-ai .common-borders-button-like-container > *:hover {
    border-color: #242424;
}

.filesfm-ai .fade-overlay {
    position: absolute;
    width: 100%;
    height: 60px;
    left: 0;
    top: -60px;
    background: linear-gradient(to top, white, transparent);
}

/* Document Indicator Styles */
.filesfm-ai .document-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.filesfm-ai .document-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filesfm-ai .toggle-switch {
    position: relative;
    display: inline-block;
    flex: 0 0 44px;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.filesfm-ai .toggle-switch input {
    display: block !important;
    position: absolute !important;
    inset: 0;
    opacity: 0 !important;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.filesfm-ai .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.filesfm-ai .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.filesfm-ai .toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(to right, #F23047, #FE7007);
}

.filesfm-ai .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.filesfm-ai .toggle-label {
    color: #333;
    font-weight: 500;
}

.filesfm-ai .document-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    max-width: 60%;
}

.filesfm-ai .document-icon {
    width: 16px;
    height: 16px;
    background-image: url(/images/UI_icons/file.svg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    flex-shrink: 0;
}

.filesfm-ai .document-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.filesfm-ai .suggested-prompts {
    position: absolute;
    top: -55px;
    left: 0;
    right: 0;
    padding: 0 30px;
    display: flex;
    gap: 10px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease, margin-bottom 0.3s ease;
}

.filesfm-ai .suggested-prompts > * {
    line-height: 40px;
}

.filesfm-ai .suggested-prompts:not(.show) {
    opacity: 0;
    transform: translateY(10px);
    margin-bottom: 0;
}

.filesfm-ai.chat-container.chat-started .suggested-prompts {
    display: none !important;
}

.filesfm-ai .prompt-btn {
    font-size: 14px;
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: auto 16px;
    padding-left: 35px;
    padding-right: 20px;
    white-space: nowrap;
}

.filesfm-ai .prompt-btn.summarize {
    background-image: url(/images/UI_icons/file.svg);
}

.filesfm-ai .prompt-btn.insights {
    background-image: url(/images/UI_icons/key-insights.svg);
}

.filesfm-ai .prompt-btn.translate {
    background-image: url(/images/UI_icons/translate.svg);
}

.filesfm-ai .chat-input-form {
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 20px;
    box-shadow: 0px 0px 40px rgba(4, 30, 77, 0.16);
    background: white;
}

.filesfm-ai .chat-input-form::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 20px;
    height: 60px;
    background: white;
    border-bottom-left-radius: 20px;
    z-index: 1;
    pointer-events: none;
}

.filesfm-ai .chat-input {
    width: 100%;
    flex: 0 0 auto;
    border: none;
    border-radius: 20px;
    padding: 20px;
    padding-bottom: 70px;
    padding-top: 15px;
    font-size: 16px;
    outline: none;
    resize: none;
    min-height: 125px;
    max-height: 250px;
    line-height: 20px;
    background: white;
    scroll-padding-bottom: 80px;
}

.filesfm-ai /* When document indicator is present, .filesfm-ai adjust textarea border radius */
.chat-input-form.has-document .chat-input {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    padding-top: 15px;
}

.filesfm-ai .send-btn {
    position: absolute;
    right: 15px;
    bottom: 15px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background:
        url(/images/UI_icons/white/arrow_up.svg) center no-repeat,
        linear-gradient(to right, #F23047, #FE7007);
    z-index: 10;
}

.filesfm-ai .send-btn:disabled {
    background:
        url(/images/UI_icons/white/arrow_up.svg) center no-repeat,
        linear-gradient(#B5B5B5, #B5B5B5);
}

.filesfm-ai .send-btn.stop {
    background:
        url(/images/UI_icons/white/close.svg) center / 16px 16px no-repeat,
        linear-gradient(to right, #F23047, #FE7007);
}

.filesfm-ai .send-btn:focus-visible {
    outline: 3px solid rgba(242, 48, 71, 0.3);
    outline-offset: 2px;
}

.filesfm-ai .typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding-left: 20px;
    margin-bottom: 20px;
}

.filesfm-ai .typing-dots {
    display: flex;
    gap: 4px;
}

.filesfm-ai .typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #242424;
    animation: filesfm-ai-typing 1.4s infinite ease-in-out;
}

.filesfm-ai .typing-dot:nth-child(1) { animation-delay: -0.32s; }
.filesfm-ai .typing-dot:nth-child(2) { animation-delay: -0.16s; }

.filesfm-ai .typing-status-text {
    color: #5F6368;
    font-size: 14px;
    line-height: 20px;
}

.filesfm-ai .retry-button {
    display: block;
    margin-top: 12px;
    padding: 7px 14px;
    border: 1px solid #D6D9DE;
    border-radius: 18px;
    color: #242424;
    background: #FFFFFF;
    cursor: pointer;
    font: inherit;
}

.filesfm-ai .retry-button:hover,
.filesfm-ai .retry-button:focus-visible {
    border-color: #F23047;
    outline: none;
}

.filesfm-ai .prompt-btn[aria-disabled="true"],
.filesfm-ai .custom-select.disabled {
    cursor: default;
    opacity: 0.6;
    pointer-events: none;
}

@keyframes filesfm-ai-typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .filesfm-ai .typing-dot {
        animation: none;
        opacity: 0.75;
    }

    .filesfm-ai .typing-dot:nth-child(2) {
        opacity: 0.55;
    }

    .filesfm-ai .typing-dot:nth-child(3) {
        opacity: 0.35;
    }
}

.filesfm-ai .model-selector {
    position: absolute;
    left: 45px;
    bottom: 45px;
    z-index: 5;
}

/* Custom Select Dropdown Styles */
.filesfm-ai .custom-select {
    position: relative;
    width: 100%;
}

.filesfm-ai .select-trigger {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
}

.filesfm-ai .selected-value {
    font-size: 14px;
    color: #333;
}

.filesfm-ai .select-arrow {
    transition: transform 0.2s ease;
}

.filesfm-ai .custom-select.open .select-arrow {
    transform: rotate(180deg);
}

.filesfm-ai .select-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    margin-bottom: 8px;
    min-width: max-content;
}

.filesfm-ai .custom-select.open .select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filesfm-ai .select-group {
    margin: 8px 0;
}

.filesfm-ai .group-label {
    padding: 8px 16px 4px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.filesfm-ai .select-option {
    padding: 12px 16px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    white-space: nowrap;
}

.filesfm-ai .select-option:last-child {
    border-bottom: none;
}

.filesfm-ai .select-option:hover {
    background: #F7F7F7;
}

.filesfm-ai .select-option.selected {
    background: #e3f2fd;
    color: #007bff;
    font-weight: 500;
}

.filesfm-ai .select-option.selected::before {
    content: "";
    position: absolute;
    right: 16px;
    width: 14px;
    height: 14px;
    background-image: url(/images/UI_icons/blue/check.svg);
    background-size: contain;
    background-repeat: no-repeat;
}

/* Focus states for accessibility */
.filesfm-ai .select-option:focus {
    outline: none;
    background: #e3f2fd;
    color: #007bff;
}

/* Animation for option selection */
.filesfm-ai .select-option {
    transform: translateX(0);
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.filesfm-ai .select-option:active {
    transform: translateX(4px);
}

@media (max-width: 768px) {
    .filesfm-ai.chat-container {
        height: 100vh;
        border-radius: 0;
        overflow: visible;
    }

    .filesfm-ai .chat-header {
        padding: 14px 16px;
        gap: 12px;
    }

    .filesfm-ai .chat-messages {
        padding: 12px;
        font-size: 15px;
    }

    .filesfm-ai .message {
        margin-bottom: 12px;
    }

    .filesfm-ai .message-content {
        max-width: 90%;
        padding: 10px 12px;
    }

    .filesfm-ai .chat-input-container {
        padding: 0;
    }

    .filesfm-ai .chat-input-form {
        border-radius: 14px 14px 0 0;
    }

    .filesfm-ai .chat-input-form::after {
        right: 0;
        height: 50px;
        border-bottom-left-radius: 0;
    }

    .filesfm-ai .chat-input {
        min-height: 104px;
        max-height: 200px;
        padding: 12px 12px 56px;
        border-radius: 14px 14px 0 0;
        font-size: 15px;
    }

    .filesfm-ai .send-btn {
        right: 10px;
        bottom: 10px;
        width: 36px;
        height: 36px;
    }

    .filesfm-ai .model-selector {
        left: 10px;
        bottom: 10px;
    }

    .filesfm-ai .common-borders-button-like-container > * {
        height: 36px;
    }

    .filesfm-ai .select-trigger {
        padding: 0 10px;
        gap: 10px;
    }

    .filesfm-ai .selected-value {
        font-size: 13px;
    }

    .filesfm-ai .suggested-prompts {
        top: -44px;
        padding: 0 8px;
        gap: 6px;
        overflow-y: hidden;
    }

    .filesfm-ai .suggested-prompts > * {
        line-height: 36px;
    }

    .filesfm-ai .prompt-btn {
        padding-right: 12px;
        padding-left: 32px;
        background-position: left 9px center;
        font-size: 13px;
    }

    .filesfm-ai .fade-overlay {
        top: -48px;
        height: 48px;
    }
}

@media (max-width: 650px) {
    .filesfm-ai .document-indicator {
        gap: 8px;
        padding: 8px 10px;
        font-size: 13px;
        border-top-left-radius: 14px;
        border-top-right-radius: 14px;
    }

    .filesfm-ai .document-toggle {
        gap: 6px;
    }

    .filesfm-ai .document-info {
        max-width: 48%;
    }

    .filesfm-ai .document-name {
        font-size: 12px;
    }
}

.filesfm-ai .markdownit,
.filesfm-ai .markdownit *:not(table):not(table *) {
    all: revert !important;
}

.filesfm-ai table th,
.filesfm-ai table td {
    padding: 10px;
}

.filesfm-ai table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.filesfm-ai table tbody tr:nth-of-type(odd) {
    background-color: #f2f2f2;
}

.filesfm-ai table tbody tr:hover {
    background-color: #e6e6e6;
}
