.dp-ai-chat-root,
.dp-ai-chat-root * {
    box-sizing: border-box;
}

.dp-ai-chat-hidden {
    display: none !important;
}

.dp-ai-chat-button {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #a20401;
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    cursor: pointer;
    z-index: 999999;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease;
}
.dp-ai-chat-button:hover {
    transform: scale(1.06);
}

.dp-ai-chat-bubble {
    position: fixed;
    right: 20px;
    bottom: 92px;
    max-width: 260px;
    background: #fff;
    color: #242424;
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    padding: 14px 34px 14px 16px;
    font-size: 14px;
    line-height: 1.4;
    z-index: 999998;
    cursor: pointer;
    font-family: inherit;
}
.dp-ai-chat-bubble-close {
    position: absolute;
    top: 4px;
    right: 6px;
    border: none;
    background: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 4px;
}

.dp-ai-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 92px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: inherit;
}

.dp-ai-chat-header {
    background: #a20401;
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.dp-ai-chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.dp-ai-chat-header-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #fff;
}
.dp-ai-chat-header-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dp-ai-chat-header-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: .85;
    padding: 0;
}
.dp-ai-chat-header-close:hover {
    opacity: 1;
}

.dp-ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f7f5f5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dp-ai-chat-msg {
    display: flex;
}
.dp-ai-chat-msg-user {
    justify-content: flex-end;
}
.dp-ai-chat-msg-assistant {
    justify-content: flex-start;
}

.dp-ai-chat-msg-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.dp-ai-chat-msg-user .dp-ai-chat-msg-bubble {
    background: #a20401;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.dp-ai-chat-msg-assistant .dp-ai-chat-msg-bubble a {
    color: #a20401;
    text-decoration: underline;
}
.dp-ai-chat-msg-assistant .dp-ai-chat-msg-bubble {
    background: #fff;
    color: #242424;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 4px;
}

.dp-ai-chat-typing .dp-ai-chat-msg-bubble span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 3px;
    border-radius: 50%;
    background: #bbb;
    animation: dp-ai-chat-blink 1.2s infinite ease-in-out;
}
.dp-ai-chat-typing .dp-ai-chat-msg-bubble span:nth-child(2) {
    animation-delay: .2s;
}
.dp-ai-chat-typing .dp-ai-chat-msg-bubble span:nth-child(3) {
    animation-delay: .4s;
}
@keyframes dp-ai-chat-blink {
    0%, 80%, 100% { opacity: .3; }
    40% { opacity: 1; }
}

.dp-ai-chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}
.dp-ai-chat-input {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    max-height: 90px;
}
.dp-ai-chat-input:focus {
    outline: none;
    border-color: #a20401;
}
.dp-ai-chat-send {
    background: #a20401;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.dp-ai-chat-send:hover {
    opacity: .9;
}

@media (max-width: 480px) {
    .dp-ai-chat-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 84px;
    }
    .dp-ai-chat-bubble {
        right: 10px;
        max-width: calc(100vw - 100px);
    }
}
