.st-ai-html-widget {
    border: 1px solid #d8dee9;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    padding: 14px;
}

.st-ai-html-placeholder {
    border: 1px dashed #b6c3d1;
    border-radius: 8px;
    background: #eef3f8;
    color: #1f2a37;
    padding: 18px;
    text-align: center;
    font-size: 13px;
}

.st-ai-html-output {
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #d2dbe6;
    background: #ffffff;
}

.st-ai-html-output iframe {
    width: 100%;
    border: 0;
    min-height: 280px;
    display: block;
}

.st-ai-html-meta {
    margin-top: 10px;
    font-size: 12px;
    color: #4f5f73;
}

.st-ai-generation-status-wrap {
    margin-top: 8px;
}

.st-ai-generation-status-message {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.4;
}

.st-ai-generation-status-message.st-ai-loading {
    background: #e6f4ff;
    color: #0b5aa2;
}

.st-ai-generation-status-message.st-ai-success {
    background: #e8f8ee;
    color: #0a6a39;
}

.st-ai-generation-status-message.st-ai-error {
    background: #fdecec;
    color: #a11a1a;
}

.st-ai-inline-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(17, 94, 162, 0.25);
    border-top-color: #0b5aa2;
    border-radius: 50%;
    animation: st-ai-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.elementor-control .st-ai-btn-loading {
    opacity: 0.85;
    cursor: wait;
}

@keyframes st-ai-spin {
    to {
        transform: rotate(360deg);
    }
}

.st-ai-settings-summary-wrap {
    margin-top: 6px;
}

.st-ai-settings-summary {
    background: #f4f7fb;
    border: 1px solid #d3dbe7;
    color: #243447;
    font-size: 11px;
    line-height: 1.4;
    border-radius: 6px;
    padding: 8px;
}

.st-ai-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
}

.st-ai-popup.is-open {
    display: block;
}

.st-ai-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 31, 44, 0.5);
}

.st-ai-popup-dialog {
    position: relative;
    width: min(520px, calc(100vw - 30px));
    margin: 70px auto;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.st-ai-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e3e9f2;
    padding: 14px 16px;
}

.st-ai-popup-header h3 {
    margin: 0;
    font-size: 16px;
    color: #182536;
}

.st-ai-popup-close {
    border: 0;
    background: transparent;
    color: #506178;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.st-ai-popup-body {
    padding: 16px;
}

.st-ai-popup-label {
    display: block;
    margin: 0 0 6px;
    color: #223246;
    font-size: 12px;
    font-weight: 600;
}

.st-ai-popup-input {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    border: 1px solid #c5d2e2;
    border-radius: 6px;
    padding: 9px 10px;
    font-size: 13px;
    background: #fff;
}

.st-ai-popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #e3e9f2;
    padding: 12px 16px;
}

.st-ai-popup-btn {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}

.st-ai-popup-btn-secondary {
    background: #f4f7fb;
    border-color: #ced8e5;
    color: #27405c;
}

.st-ai-popup-btn-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: #ffffff;
}

.st-ai-chat {
    border: 1px solid #d5dfea;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.st-ai-chat-messages {
    max-height: 270px;
    overflow-y: auto;
    padding: 10px;
    background: #f7f9fc;
    border-bottom: 1px solid #dfe7f2;
}

.st-ai-chat-empty {
    font-size: 12px;
    color: #5a6c83;
    padding: 8px;
    text-align: center;
}

.st-ai-chat-message {
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #d6e0ec;
    background: #ffffff;
}

.st-ai-chat-message.user {
    border-color: #bfd2ea;
    background: #edf5ff;
}

.st-ai-chat-message.assistant {
    border-color: #d9e5d2;
    background: #f4fbef;
}

.st-ai-chat-message-role {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #2a3c52;
}

.st-ai-chat-message-text {
    font-size: 12px;
    color: #1f2f43;
    white-space: pre-wrap;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-ai-chat-message-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.st-ai-chat-composer {
    padding: 10px;
    background: #ffffff;
}

.st-ai-chat-input {
    width: 100%;
    border: 1px solid #c8d6e8;
    border-radius: 7px;
    padding: 8px;
    font-size: 12px;
    resize: vertical;
    min-height: 70px;
}

.st-ai-chat-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

.st-ai-chat-btn {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.st-ai-chat-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    margin-right: auto;
    background: #f5f7fa;
    border: 1px solid #ced8e4;
    border-radius: 6px;
    color: #4a6078;
    cursor: pointer;
    transition: background 0.15s;
}

.st-ai-chat-btn-icon:hover {
    background: #e8edf3;
}

.st-ai-chat-image-zone {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
    border: 1px solid #d0daea;
    border-radius: 6px;
    overflow: hidden;
    max-width: 120px;
}

.st-ai-chat-image-zone img {
    display: block;
    max-width: 120px;
    max-height: 80px;
    object-fit: cover;
}

.st-ai-chat-image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.st-ai-chat-image-tag {
    font-size: 10px;
    color: #5a7a9a;
    margin-bottom: 3px;
}

.st-ai-chat-btn-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.st-ai-chat-btn-secondary {
    background: #f5f7fa;
    border-color: #ced8e4;
    color: #2b3f57;
}

.st-ai-preview-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000000;
}

.st-ai-preview-modal.is-open {
    display: block;
}

.st-ai-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.st-ai-preview-dialog {
    position: relative;
    width: min(980px, calc(100vw - 24px));
    margin: 40px auto;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.st-ai-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #e3e9f2;
}

.st-ai-preview-header h3 {
    margin: 0;
    font-size: 15px;
    color: #122338;
}

.st-ai-preview-body {
    max-height: 75vh;
    overflow: auto;
    background: #fff;
}

.st-ai-preview-frame {
    width: 100%;
    min-height: 72vh;
    border: 0;
    display: block;
}

.st-ai-preview-fragment {
    padding: 18px;
}
