#core-ai-assistant-wrapper {
    --core-ai-assistant-width: 700px;
    --core-ai-assistant-history-width: 300px;
    margin: 0;
    flex: 0 0 calc(var(--core-ai-assistant-width) + var(--core-ai-assistant-history-width));
    width: calc(var(--core-ai-assistant-width) + var(--core-ai-assistant-history-width));
}

body #core-ai-assistant-wrapper ~ .columns .sp-main-actions-fixed,
body #core-ai-assistant-wrapper ~ .columns #core-ai-assistant-history,
body #core-ai-assistant-wrapper ~ .columns footer {
    right: calc(var(--core-ai-assistant-width) + var(--core-ai-assistant-history-width));
}

#core-ai-assistant-history-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: fixed;
    top: 0;
    right: var(--core-ai-assistant-width);
    bottom: 0;
    width: var(--core-ai-assistant-history-width);
    z-index: 9999;
    padding: 14px 12px;
    border-left: 1px solid #1f2937;
    border-right: 1px solid #d6dbe1;
    background: #111827;
    color: #f8fafc;
}

.core-ai-assistant-history-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.core-ai-assistant-history-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.core-ai-assistant-history-subtitle {
    margin-top: 2px;
    color: #9ca3af;
    font-size: 11px;
    line-height: 1.35;
}

#core-ai-assistant-new-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

#core-ai-assistant-new-chat:hover {
    background: rgba(255, 255, 255, 0.14);
}

.core-ai-assistant-history-search .form-control {
    height: 34px;
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    box-shadow: none;
}

.core-ai-assistant-history-search .form-control::placeholder {
    color: #9ca3af;
}

#core-ai-assistant-history-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 3px;
}

.core-ai-assistant-history-group {
    margin: 13px 0 7px;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.core-ai-assistant-history-item {
    display: block;
    width: 100%;
    margin: 0 0 4px;
    padding: 8px 34px 8px 9px;
    position: relative;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #f8fafc;
    text-align: left;
}

.core-ai-assistant-history-item:hover,
.core-ai-assistant-history-item.is-active {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.09);
}

.core-ai-assistant-history-item.is-pending .core-ai-assistant-history-item-title:before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #f59e0b;
}

.core-ai-assistant-history-item-title {
    display: block;
    overflow: hidden;
    color: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.core-ai-assistant-history-item-meta {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    color: #9ca3af;
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.core-ai-assistant-history-delete {
    display: none;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0 none;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}

.core-ai-assistant-history-item:hover .core-ai-assistant-history-delete,
.core-ai-assistant-history-item.is-active .core-ai-assistant-history-delete {
    display: inline-flex;
}

.core-ai-assistant-history-delete:hover {
    background: rgba(239, 68, 68, 0.24);
    color: #fff;
}

.core-ai-assistant-history-state,
.core-ai-assistant-history-more {
    padding: 12px 8px;
    color: #9ca3af;
    font-size: 12px;
    line-height: 1.45;
}

.core-ai-assistant-history-more {
    width: 100%;
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    text-align: center;
}

#core-ai-assistant {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: var(--core-ai-assistant-width);
    position: fixed;
    top: 0;
    padding-bottom: 55px;
    right: 0;
    z-index: 9999;
    border-left: 1px solid #999;
}

#core-ai-assistant .panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: auto;
}

.core-ai-assistant-worker-state {
    margin-bottom: 0;
}

#core-ai-assistant-worker-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #dfe4ea;
    border-radius: 10px;
    background: #f8fafc;
}

#core-ai-assistant-worker-toolbar.hidden {
    display: none;
}

.core-ai-assistant-worker-current {
    min-width: 0;
}

.core-ai-assistant-worker-kicker {
    display: block;
    margin-bottom: 2px;
    color: #88929c;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
}

.core-ai-assistant-worker-current-name {
    display: block;
    overflow: hidden;
    color: #1f2933;
    font-size: 13px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.core-ai-assistant-worker-current-description {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    color: #6f7a85;
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#core-ai-assistant-change-worker {
    flex: 0 0 auto;
}

.core-ai-assistant-worker-selector {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid #dfe4ea;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(31, 41, 51, 0.08);
}

.core-ai-assistant-worker-selector.hidden {
    display: none;
}

.core-ai-assistant-worker-selector-title {
    margin-bottom: 6px;
    color: #1f2933;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.core-ai-assistant-worker-selector-copy {
    margin: 0;
    color: #5f6b77;
    font-size: 12px;
    line-height: 1.45;
}

.core-ai-assistant-worker-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.core-ai-assistant-worker-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #dfe4ea;
    border-radius: 12px;
    background: #f8fafc;
    color: #1f2933;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.core-ai-assistant-worker-option:hover,
.core-ai-assistant-worker-option.is-active {
    border-color: var(--chatColor, #009a44);
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(0, 154, 68, 0.12);
}

.core-ai-assistant-worker-option strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.core-ai-assistant-worker-option span {
    display: -webkit-box;
    overflow: hidden;
    color: #667085;
    font-size: 11px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.core-ai-assistant-worker-selector-status {
    min-height: 18px;
    margin-top: 9px;
    color: var(--chatColor, #009a44);
    font-size: 12px;
    font-weight: 600;
}

#core-ai-assistant.is-worker-required #core-ai-assistant-input {
    opacity: 0.55;
}

#core-ai-assistant.is-worker-required #core-ai-assistant-message {
    cursor: not-allowed;
}

#core-ai-assistant #core-ai-assistant-input-options ul > li.disabled {
    cursor: not-allowed;
    opacity: 0.45;
    pointer-events: none;
}

#core-ai-assistant #core-ai-assistant-converstions {
    flex: 1;
    overflow: auto;
    cursor: default;
    padding-bottom: 10px;
}

#core-ai-assistant #core-ai-assistant-converstions > div {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    width: 80%;
    margin-bottom: 16px;
    cursor: text;
}

#core-ai-assistant #core-ai-assistant-converstions > div.role-user {
    margin-left: auto;
    background: var(--chatColor);
}

#core-ai-assistant #core-ai-assistant-converstions > div.chat-placeholder {
    width: 100%;
    background: transparent;
    color: #ccc;
    margin: 0;
}

#core-ai-assistant #core-ai-assistant-converstions > div a {
    /*margin-top: 30px;*/
    border: 0 none;
}

#core-ai-assistant-loading {
    padding-bottom: 10px;
    display: none;
    transition: all 0.2s;
}

#core-ai-assistant-loading > span {
    content: '';
    animation: typing-animation 1.5s infinite;
    animation-fill-mode: both;
    height: 10px;
    width: 10px;
    background: var(--chatColor);
    position: relative;
    display: inline-block;
    border-radius: 50%;
}

#core-ai-assistant-loading > span:nth-child(2) {
    animation-delay: .2s;
}

#core-ai-assistant-loading > span:nth-child(3) {
    animation-delay: .4s;
}

#core-ai-assistant #core-ai-assistant-input-options ul {
    display: flex;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

#core-ai-assistant #core-ai-assistant-input-options ul > li {
    cursor: pointer;
}

#core-ai-assistant #core-ai-assistant-input-options ul > li.record:not(.recording) .sp-icon-stop {
    display: none;
}

#core-ai-assistant #core-ai-assistant-input-options ul > li.record.recording .sp-icon-record {
    display: none;
}

#core-ai-assistant #core-ai-assistant-input-options ul > li.play:not(.playing) .sp-icon-stop {
    display: none;
}

#core-ai-assistant #core-ai-assistant-input-options ul > li.play.playing .sp-icon-play {
    display: none;
}

#core-ai-assistant #core-ai-assistant-input-options ul > li.record.recording {
    color: red; /* Red for recording */
    animation: pulse 1s infinite; /* Add pulsating animation */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 10px 2px rgba(255, 0, 0, 0.3);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

#core-ai-assistant #core-ai-assistant-input {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

#core-ai-assistant #core-ai-assistant-input-wrapper {
    flex: 1;
}

#core-ai-assistant #core-ai-assistant-input-wrapper textarea {
    max-width: 100%;
}

#core-ai-assistant #core-ai-assistant-send-message {
    display: inline-flex;
    width: 36px;
    height: 36px;
    justify-content: center;
    align-items: center;
    padding: 0;
}

#core-ai-assistant-history {
    overflow-x: auto;
    white-space: nowrap;
    position: fixed;
    bottom: 39px;
    right: 0;
    left: 250px;
    z-index: 9;
}

.has-menu.minified #core-ai-assistant-history {
    left: 50px;
}

#core-ai-assistant-history button {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 1px;
    margin-left: 0;
}

#core-ai-assistant-history button.active,
#core-ai-assistant-history button:hover {
    background-color: #f0f0f0;
    color: #FFB025;
}

@media (max-width: 1180px) {
    #core-ai-assistant-wrapper {
        --core-ai-assistant-width: calc(100vw - 280px);
        --core-ai-assistant-history-width: 280px;
    }

    body #core-ai-assistant-wrapper ~ .columns .sp-main-actions-fixed,
    body #core-ai-assistant-wrapper ~ .columns #core-ai-assistant-history,
    body #core-ai-assistant-wrapper ~ .columns footer {
        right: 0;
    }
}

#core-ai-assistant-converstions .ai-assistant-knowledge-sources {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 12px;
    line-height: 1.45;
    color: #5f6b77;
}

#core-ai-assistant-converstions .ai-assistant-knowledge-sources-label {
    margin-bottom: 4px;
    font-weight: 600;
    color: #33414e;
}

#core-ai-assistant-converstions .ai-assistant-knowledge-sources ul {
    margin: 0;
    padding-left: 18px;
}

#core-ai-assistant-converstions .ai-assistant-knowledge-sources li + li {
    margin-top: 6px;
}

#core-ai-assistant-converstions .ai-assistant-knowledge-source-name {
    color: #33414e;
    font-weight: 600;
}

#core-ai-assistant-converstions .ai-assistant-knowledge-source-link {
    color: #2c6fb7;
    font-weight: 600;
    text-decoration: none;
}

#core-ai-assistant-converstions .ai-assistant-knowledge-source-link:hover {
    text-decoration: underline;
}

#core-ai-assistant-converstions .ai-assistant-knowledge-source-domain,
#core-ai-assistant-converstions .ai-assistant-knowledge-source-id {
    display: inline-block;
    margin-left: 6px;
    color: #88929c;
}

#core-ai-assistant-converstions .ai-assistant-knowledge-source-quote {
    margin-top: 2px;
    color: #6f7a85;
}

#core-ai-assistant-selected-file {
    margin: 0 0 8px;
    padding: 7px 10px;
    border-radius: 4px;
    background: rgba(44, 111, 183, 0.08);
    color: #33414e;
    font-size: 12px;
    line-height: 1.4;
}

#core-ai-assistant-selected-file.hidden {
    display: none;
}

#core-ai-assistant-selected-file .ai-assistant-selected-file-label {
    font-weight: 600;
}

#core-ai-assistant-selected-file .ai-assistant-selected-file-name {
    font-weight: 700;
}

#core-ai-assistant-background-status {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 15px 12px;
    padding: 10px 12px;
    border: 1px solid rgba(44, 111, 183, 0.18);
    border-radius: 6px;
    background: rgba(44, 111, 183, 0.07);
    color: #33414e;
}

#core-ai-assistant-background-status.hidden {
    display: none;
}

#core-ai-assistant-background-status .ai-assistant-background-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: #2c6fb7;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 22px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#core-ai-assistant-background-status .ai-assistant-background-status-message {
    font-size: 12px;
    line-height: 1.45;
}

#core-ai-assistant-converstions .shapebot-table-wrap {
    margin: 8px 0 12px;
    overflow-x: auto;
    border: 1px solid #dfe4ea;
    border-radius: 6px;
    background: #fff;
}

#core-ai-assistant-converstions .shapebot-table-wrap table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
}

#core-ai-assistant-converstions .shapebot-table-wrap th,
#core-ai-assistant-converstions .shapebot-table-wrap td {
    padding: 8px 10px;
    border-bottom: 1px solid #dfe4ea;
    text-align: left;
    vertical-align: top;
    font-size: 12px;
    line-height: 1.45;
}

#core-ai-assistant-converstions .shapebot-table-wrap th {
    background: #f6f8fa;
    font-weight: 700;
    white-space: nowrap;
}

#core-ai-assistant-converstions .shapebot-table-wrap tbody tr:last-child td {
    border-bottom: 0 none;
}

#core-ai-assistant-converstions pre {
    margin: 8px 0 12px;
    padding: 10px 12px;
    overflow-x: auto;
    border-radius: 6px;
    background: #1f2933;
    color: #f7fafc;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre;
}

#core-ai-assistant-converstions code {
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(31, 41, 51, 0.08);
    color: #1f2933;
    font-size: 12px;
}

#core-ai-assistant-converstions pre code {
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
}

.core-ai-assistant-history-bulk {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 30px;
    padding: 6px 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    font-size: 11px;
}

.core-ai-assistant-history-bulk.hidden {
    display: none;
}

.core-ai-assistant-history-bulk button,
.core-ai-assistant-history-group-delete {
    border: 0 none;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
    font-size: 10px;
    line-height: 1.2;
}

.core-ai-assistant-history-bulk button {
    padding: 5px 7px;
}

.core-ai-assistant-history-bulk button:hover,
.core-ai-assistant-history-group-delete:hover {
    background: rgba(239, 68, 68, 0.28);
    color: #fff;
}

.core-ai-assistant-history-bulk-clear {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #e5e7eb !important;
}

.core-ai-assistant-history-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.core-ai-assistant-history-group-delete {
    padding: 4px 6px;
    opacity: 0.72;
    text-transform: none;
    letter-spacing: 0;
}

.core-ai-assistant-history-group:hover .core-ai-assistant-history-group-delete {
    opacity: 1;
}

.core-ai-assistant-history-item {
    padding-left: 32px;
}

.core-ai-assistant-history-select-wrap {
    position: absolute;
    top: 9px;
    left: 8px;
    line-height: 1;
}

.core-ai-assistant-history-select {
    margin: 0;
}

.core-ai-assistant-history-item.is-selected {
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(59, 130, 246, 0.16);
}

.ai-assistant-send-icon {
    transform: scale(1.2) scaleX(1);
}

.ai-assistant-send-icon-path {
    fill: none;
    fill-rule: nonzero;
    stroke: #fff;
    stroke-width: 17.38px;
}
