.ai-chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
    font-family: inherit;
}

.chat-launcher {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin-left: auto;
    border: none;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 24px rgb(37 99 235 / 30%);
}

.chat-window {
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 48px));
    height: min(520px, calc(100dvh - 120px));
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: white;
    box-shadow: 0 12px 48px rgb(15 23 42 / 18%);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 16px;
    background: #2563eb;
    color: white;
}

.chat-header strong,
.chat-header small {
    display: block;
}

.chat-header small {
    margin-top: 4px;
    opacity: 0.9;
}

.close-button {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.close-button:hover {
    background: rgb(255 255 255 / 15%);
}

.chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
}

.message {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.user-message {
    align-self: flex-end;
    background: #2563eb;
    color: white;
}

.assistant-message {
    align-self: flex-start;
    border: 1px solid #e2e8f0;
    background: white;
    color: #0f172a;
}

.chat-input-area {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
}

.chat-input-area input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
}

.chat-input-area button {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    cursor: pointer;
}

.chat-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

@media (max-width: 480px) {
    .ai-chat-widget {
        right: 12px;
        bottom: 12px;
    }

    .chat-window {
        width: calc(100vw - 24px);
    }
}