.sourcing-assistant-button-container {
    position: fixed;
    z-index: 1051;
    transition: opacity 0.3s ease;
}

@media (min-width: 62.1rem) {
    .sourcing-assistant-button-container {
        top: calc(7.5rem + 1.5rem);
        right: 1.5rem;
    }
}

@media (max-width: 62rem) {
    .sourcing-assistant-button-container {
        bottom: 12.5rem;
        right: 0.5rem;
        top: auto;
    }
}

.sourcing-assistant-button-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.assistant-toggle-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    background: var(--background-ai-button);
    box-shadow: 0 0.5rem 1.5rem 0 rgba(36, 21, 80, 0.16);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 48rem) {
    .assistant-toggle-btn {
        width: 3rem;
        height: 3rem;
    }

        .assistant-toggle-btn .s4d-icon {
            font-size: 1.25rem;
        }
}

.assistant-toggle-btn .s4d-icon {
    font-size: 1.5rem;
    color: var(--color-white);
}

.assistant-toggle-btn:hover {
    transform: translateY(-0.125rem);
    box-shadow: 0 0.625rem 1.75rem 0 rgba(36, 21, 80, 0.22);
}

.sourcing-assistant-modal .modal-dialog {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    bottom: 1.5rem;
    margin: 0;
    max-width: 29.5rem;
    width: 29.5rem;
    height: calc(100vh - 3rem);
    transform: translateX(0);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.sourcing-assistant-modal .modal-content {
    height: 100%;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sourcing-assistant-modal.show .modal-dialog {
    transform: translateX(0);
    opacity: 1;
}

.sourcing-assistant-modal:not(.show) .modal-dialog {
    transform: translateX(calc(100% + 2rem));
    opacity: 0;
}

.sourcing-assistant-modal .modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.assistant-header {
    display: flex;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    align-items: flex-start;
    gap: 1rem;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.header-title {
    color: var(--grey-90);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5rem;
    margin: 0;
}

.header-subtitle {
    color: var(--grey-60);
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.25rem;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-header {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--grey-90);
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-header:hover {
        opacity: 0.7;
    }

    .btn-header .s4d-icon {
        font-size: 1.25rem;
    }

.assistant-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

    .assistant-messages::-webkit-scrollbar {
        width: 0.375rem;
    }

    .assistant-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .assistant-messages::-webkit-scrollbar-thumb {
        background: var(--grey-30);
        border-radius: 4rem;
    }

.suggestions-section {
    padding: 1.5rem 2rem 1.5rem 2rem
}

.suggestions-title {
    overflow: hidden;
    color: var(--grey-60);
    text-overflow: ellipsis;
    font-size: 0.875rem;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    margin-bottom: 0.75rem;
}

.suggestions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-chip {
    padding: 0.5rem 0.75rem;
    background: var(--grey-10);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--grey-90);
    transition: all 0.2s;
    line-height: 1.25rem;
}

    .suggestion-chip:hover {
        background: var(--grey-20);
    }

.date-separator {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0.75rem 0;
    gap: 0.75rem;
}

.date-line {
    flex: 1;
    height: 0.0625rem;
    background: var(--grey-20);
}

.date-label {
    padding: 0.25rem 0.75rem;
    background: var(--card-total-bg);
    border-radius: 2.5rem;
    color: var(--grey-90);
    font-size: 0.75rem;
    font-weight: 400;
    white-space: nowrap;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

    .message-wrapper.user {
        align-items: flex-end;
    }

.message-row {
    display: flex;
    gap: 0.625rem;
    max-width: 85%;
    align-items: flex-start;
}

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

.message-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--action);
}

    .message-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .message-avatar .s4d-icon {
        font-size: 1.125rem;
        color: var(--color-white);
    }

.message-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    position: relative;
    padding-bottom: 0;
    margin-bottom: 2.25rem;
}

.message-bubble {
    padding: 0.5rem 1rem;
    background: var(--card-total-bg);
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
}

.message-wrapper:not(.user) .message-bubble {
    border-radius: 0 0.75rem 0.75rem 0.75rem;
}

.message-wrapper.user .message-bubble {
    background: var(--action);
    color: var(--color-white);
    border-radius: 0.75rem 0.75rem 0 0.75rem;
}

.message-text {
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.25rem;
    color: var(--grey-90);
    margin: 0;
    flex: 1;
    min-width: 0;
}

.message-wrapper.user .message-text {
    color: var(--color-white);
}

.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0.5rem 0 0.375rem 0;
    color: var(--grey-90);
    line-height: 1.375rem;
}

.message-text h1 {
    font-size: 1rem;
}

.message-text h2 {
    font-size: 0.9375rem;
}

.message-text h3 {
    font-size: 0.875rem;
}

.message-text h4 {
    font-size: 0.8125rem;
}

.message-text strong,
.message-text b {
    font-weight: 600;
    color: var(--grey-90);
}

.message-text ul,
.message-text ol {
    margin: 0.375rem 0;
    padding-left: 1.25rem;
}

.message-text li {
    margin: 0.1875rem 0;
    line-height: 1.375rem;
}

.message-text p {
    margin: 0.375rem 0;
}

.message-text br {
    display: block;
    content: "";
    margin: 0.1875rem 0;
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0;
}

.typing-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--action);
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-0.5rem);
    }
}

.message-time {
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--grey-60);
    flex-shrink: 0;
    white-space: nowrap;
}

.message-wrapper.user .message-time {
    color: var(--color-white);
    opacity: 0.8;
}

.message-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    background: var(--color-white);
    border-radius: 0.625rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
    align-items: center;
    transform: translateY(1.5rem);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    background: none;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--grey-60);
}

    .action-btn:hover {
        background: var(--grey-10);
    }

    .action-btn .s4d-icon {
        font-size: 0.9375rem;
        transition: color 0.2s;
    }

    .action-btn:hover .s4d-icon,
    .action-btn:hover .action-text {
        color: var(--grey-90);
    }

.action-text {
    font-size: 0.75rem;
    font-weight: 400;
    transition: color 0.2s;
}

.thumb-btn .s4d-icon {
    font-size: 1rem;
    color: var(--grey-60);
    transition: color 0.2s;
}

.thumb-btn:hover .s4d-icon {
    color: var(--grey-90);
}

.thumb-btn.thumb-down .s4d-icon {
    display: inline-block;
    transform: rotate(180deg);
}

.action-divider {
    width: 0.0625rem;
    height: 1rem;
    background: var(--grey-20);
}

.message-documents {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: var(--grey-10);
    border: 0.0625rem solid var(--grey-20);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

    .document-item:hover {
        background: var(--grey-10-hover);
        border-color: var(--action);
    }

.document-icon {
    font-size: 1.125rem;
    color: var(--grey-60);
}

.document-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.document-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--grey-90);
}

.document-type {
    font-size: 0.6875rem;
    color: var(--grey-60);
}

.assistant-input {
    border-top: 0.0625rem solid var(--grey-20);
    padding: 1.5rem 2rem 1.5rem 2rem;
    background: var(--color-white);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.file-preview {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: var(--grey-10);
    border: 0.0625rem solid var(--grey-20);
    border-radius: 0.5rem;
}

.file-icon {
    font-size: 1.125rem;
    color: var(--grey-60);
    flex-shrink: 0;
}

.file-name {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--grey-90);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-remove-file {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--grey-60);
    transition: color 0.2s;
    flex-shrink: 0;
}

    .btn-remove-file:hover {
        color: var(--red-fill);
    }

    .btn-remove-file .s4d-icon {
        font-size: 0.875rem;
    }

.input-container {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0 0.875rem;
    height: 3rem;
    background: var(--card-total-bg);
    border: 0.0625rem solid var(--grey-20);
    border-radius: 0.5rem;
    transition: border-color 0.2s;
    position: relative;
    overflow: visible;
}

    .input-container.has-multiline {
        height: auto;
        min-height: 3rem;
        max-height: 6.9375rem;
        padding: 0.75rem 0.875rem;
        align-items: flex-end;
    }

    .input-container:hover {
        border: 0.0625rem solid var(--grey-40);
    }

    .input-container:focus-within {
        border-color: var(--grey-30);
    }

    .input-container.recording {
        border-color: var(--red-fill);
        background: rgba(255, 64, 0, 0.02);
    }

.btn-attach,
.btn-microphone {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--grey-60);
    transition: color 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
}

    .btn-attach:hover,
    .btn-microphone:hover:not(:disabled) {
        color: var(--action);
    }

    .btn-microphone.recording {
        position: relative;
        background: none;
    }

.recording-icon-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .recording-icon-wrapper::before {
        content: "";
        position: absolute;
        width: 5rem;
        height: 5rem;
        background-image: url("/Plugins/Theme.Ship4wd/Content/images/ai-chat/microphone-wave.svg");
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        animation: recordrotate 2s linear infinite;
        z-index: 3;
    }

    .recording-icon-wrapper::after {
        content: "";
        position: absolute;
        width: 2.75rem;
        height: 2.75rem;
        background-color: var(--action);
        border-radius: 50%;
        z-index: 2;
    }

.btn-microphone.recording .s4d-icon {
    color: var(--color-white);
    position: relative;
    z-index: 4;
}

@keyframes recordrotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.btn-attach .s4d-icon,
.btn-microphone .s4d-icon {
    font-size: 1.125rem;
}

.btn-delete-recording {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .btn-delete-recording .s4d-icon {
        font-size: 1.125rem;
        color: var(--red);
    }

    .btn-delete-recording:hover .s4d-icon {
        opacity: 0.8;
    }

.input-textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.25rem;
    height: 1.25rem;
    max-height: 5.4375rem;
    background: transparent;
    color: var(--grey-90);
    padding: 0;
}

.input-container.has-multiline .input-textarea {
    height: auto;
    min-height: 1.25rem;
}

.input-textarea::placeholder {
    color: var(--grey-60);
}

.input-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.limits-info {
    text-align: center;
    font-size: 0.6875rem;
    color: var(--grey-60);
    line-height: 1rem;
}

.limits-count {
    font-weight: 600;
    color: var(--action);
}

.live-assistance {
    text-align: center;
    font-size: 0.6875rem;
    color: var(--grey-60);
    line-height: 1rem;
}

.live-assistance-link {
    color: var(--action);
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

    .live-assistance-link:hover {
        text-decoration: underline;
    }

.sourcing-assistant-modal .s4d-notification {
    position: absolute;
    top: 1rem;
    right: 1rem;
    left: auto;
    bottom: auto;
    height: auto;
    max-width: 20rem;
    z-index: 9999;
    background: var(--green-success);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateX(calc(100% + 1rem));
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

    .sourcing-assistant-modal .s4d-notification.show {
        transform: translateX(0);
        opacity: 1;
    }

.sourcing-assistant-modal .s4d-notification-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sourcing-assistant-modal .s4d-notification-icon {
    width: auto;
    height: auto;
}

    .sourcing-assistant-modal .s4d-notification-icon .s4d-icon {
        color: var(--color-white);
        font-size: 1rem;
    }

.sourcing-assistant-modal .s4d-notification-text {
    flex: none;
}

.sourcing-assistant-modal .s4d-notification-title {
    color: var(--color-white);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0;
}

@media (max-width: 48rem) {
    .sourcing-assistant-modal .modal-dialog {
        top: 1.5rem;
        right: 1.5rem;
        bottom: 1.5rem;
        left: 1.5rem;
        width: auto;
        max-width: none;
        height: calc(100vh - 3rem);
    }

    .header-actions {
        gap: 0.5rem;
    }

    .suggestion-chip {
        font-size: 0.75rem;
        padding: 0.4375rem 0.625rem;
    }

    .assistant-header {
        padding: 1rem;
    }

    .assistant-messages {
        padding: 0.75rem 1rem;
    }

    .assistant-input {
        padding: 0.75rem 1rem 1rem 1rem;
    }

    .message-actions {
        transform: translateY(1.5rem);
        padding: 0.25rem 0.5rem;
    }
}

.input-container:focus-within {
    border-color: var(--action);
}

.input-container.has-text {
    border-color: var(--action);
}

.btn-send {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--grey-60);
    transition: color 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}


    .btn-send:hover:not(:disabled) {
        color: var(--action);
    }

    .btn-send:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        background: none !important;
    }

        .btn-send:disabled .s4d-message-arrow {
            color: inherit;
            background: none;
            border: none;
        }

    .btn-send.active {
        color: var(--action);
    }

    .btn-send .s4d-icon {
        font-size: 1.125rem;
    }

    .btn-send .s4d-message-arrow {
        color: var(--action);
        font-size: 1.125rem;
        background: none;
        border: none;
    }
