#ask-ai-widget-root {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ask-ai-widget__panel {
    width: min(360px, calc(100vw - 32px));
    height: 520px;
    margin-top: 12px;
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ask-ai-widget__panel[hidden] {
    display: none;
}

.ask-ai-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #0f172a;
    border-bottom: 1px solid rgba(191, 219, 254, 0.9);
}

.ask-ai-widget__header h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    color: #0f172a;
}

.ask-ai-widget__close {
    border: 0;
    background: transparent;
    color: #334155;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.18s ease, transform 0.18s ease;
}

.ask-ai-widget__close:hover {
    color: #0f172a;
    transform: scale(1.05);
}

.ask-ai-widget__messages {
    flex: 1;
    overflow-y: auto;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f5f9 100%);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ask-ai-widget__message {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.ask-ai-widget__message--assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    border: 1px solid rgba(203, 213, 225, 0.85);
    box-shadow: 0 10px 22px rgba(148, 163, 184, 0.12);
}

.ask-ai-widget__message--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.2);
}

.ask-ai-widget__message--error {
    border-color: rgba(248, 113, 113, 0.35);
    color: #b91c1c;
}

.ask-ai-widget__message--pending {
    opacity: 0.75;
}

.ask-ai-widget__form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid rgba(203, 213, 225, 0.75);
    background: rgba(255, 255, 255, 0.96);
}

.ask-ai-widget__input {
    width: 100%;
    resize: none;
    border: 1px solid rgba(191, 219, 254, 0.95);
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    color: #0f172a;
    background: #ffffff;
    outline: none;
    box-sizing: border-box;
}

.ask-ai-widget__input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.ask-ai-widget__submit {
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 16px;
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ask-ai-widget__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.24);
}

.ask-ai-widget__submit:disabled,
.ask-ai-widget__input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    #ask-ai-widget-root {
        right: 16px;
        bottom: 16px;
    }

    .ask-ai-widget__panel {
        width: min(100vw - 24px, 360px);
        height: min(70vh, 520px);
    }
}
