#wpreplai-widget * {
    /* -webkit-font-smoothing: antialiased; */
}

#wpreplai-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    /* background: #2563eb; */
    background: #ff7304;
    color: #fff;
    border: none;
    cursor: pointer;
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: background 0.2s;
    padding: 0;
}

#wpreplai-launcher:hover {
    background: #ff7304;
}

#wpreplai-launcher svg {
    width: 24px;
    min-width: 24px;
    height: auto;
    fill: #fff;
}

#wpreplai-greeting {
    position: fixed;
    bottom: 95px;
    right: 24px;
    max-width: 240px;
    background: #fff;
    color: #1e293b;
    border-radius: 12px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 12px 32px 12px 14px;
    font-size: 13px;
    line-height: 1.5;
    z-index: 99999;
    display: flex;
    align-items: center;
    cursor: pointer;
}

#wpreplai-greeting.wpreplai-hidden,
#wpreplai-greeting.wpreplai-widget-open {
    display: none;
}

#wpreplai-greeting-close {
    position: absolute;
    top: 10px;
    right: 6px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
}

#wpreplai-greeting-close:hover {
    color: #64748b;
}

#wpreplai-widget {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 400px;
    max-width: 100%;
    height: 100%;
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    visibility: visible;
    flex-direction: column;
    z-index: 99998;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

#wpreplai-widget.wpreplai-hidden {
    opacity: 0;
    visibility: hidden;
    display: none;
    pointer-events: none;
    transform: translateY(8px);
}

.wpreplai-header {
    background: #0D0630;
    color: #fff;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpreplai-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.wpreplai-header-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.wpreplai-header-info {
    flex: 1;
}

.wpreplai-header-name {
    font-size: 14px;
    font-weight: 600;
}

.wpreplai-header-status {
    font-size: 11px;
    opacity: 0.85;
    font-weight: 400;
}

.wpreplai-messages {
    flex: 2;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* min-height: 280px; */
    /* max-height: 360px; */
    /* max-height: 50vh; */
}

.wpreplai-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    animation: wpreplai_msg_fadeup 0.3s cubic-bezier(0.0, 0.0, 0.2, 1);
}

.wpreplai-msg.agent {
    /* background: #f1f5f9; */
    background: #fff;
    color: #0D0630;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    padding-left: 5px;
    max-width: 100%;
}

.wpreplai-msg.agent code {
    background: #f2efef;
    padding: 4px 5px;
    border-radius: 6px;
    font-size: 13px;
}

.wpreplai-msg.user {
    background: #0D0630 !important;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.wpreplai-msg.agent ol, .wpreplai-msg.agent ul {
    padding-left: 20px;
    margin-left: 10px;
}

.wpreplai-msg.agent h3 {
    font-size: 15px;
}

.wpreplai-msg.agent h2 {
    font-size: 18px;
}

.wpreplai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}

.wpreplai-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: wpreplai-bounce 1.2s infinite ease-in-out;
}

.wpreplai-typing span:nth-child(2) { animation-delay: 0.2s; }
.wpreplai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wpreplai-bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40%            { transform: scale(1.1); opacity: 1; }
}

.wpreplai-footer {
    border-top: 1px solid #e2e8f0;
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#wpreplai-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 100px;
    line-height: 1.5;
    font-family: inherit;
    color: #1e293b;
}

#wpreplai-input:disabled {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

#wpreplai-input:focus {
    border-color: #ff7304;
}

#wpreplai-send {
    width: 40px;
    height: 100%;
    border-radius: 8px;
    background: #ff7304;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    padding: 0;
}

#wpreplai-send:hover {
    background: #ff7304;
}

#wpreplai-send svg {
    width: 16px;
    min-width: 16px;
    max-width: 16px;
    height: 16px;
    fill: #fff;
}

#wpreplai-send:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.wpreplai-watermark {
    text-align: center;
    padding: 0px 0 10px;
    font-size: 11px;
}

.wpreplai-watermark a {
    color: #94a3b8 !important;
    text-decoration: none;
}

.wpreplai-watermark a:hover {
    color: #64748b !important;
    text-decoration: underline;
}

#wpreplai-new-chat {
    background: #382e70;
    border: none;
    cursor: pointer;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.2s;
    flex-shrink: 0;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    gap: 3px;
}

#wpreplai-new-chat:hover {
    opacity: 1;
}

#wpreplai-new-chat svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

#wpreplai-new-chat.wpreplai-hidden {
    display: none;
}

.wpreplai-widget-inner {
    position: relative;
    flex: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.wpreplai-consent-overlay {
    flex: 1;
    background: #fff;
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
}

.wpreplai-consent-overlay.wpreplai-hidden {
    display: none;
}

.wpreplai-consent-text {
    font-size: 13px;
    line-height: 1.5;
    color: #1e293b;
    margin: 0;
}

.wpreplai-consent-text a {
    color: #ff7304;
    text-decoration: underline;
}

.wpreplai-consent-agree {
    background: #ff7304;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 20px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.wpreplai-consent-agree:hover {
    opacity: 0.9;
}

.wpreplai-rating-overlay {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    align-self: stretch;
}

.wpreplai-rating-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.wpreplai-stars {
    display: flex;
    gap: 6px;
}

.wpreplai-star {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #cbd5e1;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s, transform 0.1s;
}

.wpreplai-star:hover,
.wpreplai-star-active {
    color: #ff7304;
    transform: scale(1.15);
}

.wpreplai-rating-skip {
    background: none;
    border: none;
    font-size: 12px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.wpreplai-rating-skip:hover {
    color: #64748b;
}

@keyframes wpreplai_msg_fadeup {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0px);
    }
}

@media (max-width: 480px) {
    #wpreplai-widget {
        right: 16px;
        left: 16px;
        width: calc(100% - 32px);
        max-height: 80vh;
    }

    #wpreplai-launcher {
        bottom: 16px;
        right: 16px;
    }

    .wpreplai-msg {
        font-size: 15px;
    }

    #wpreplai-input {
        font-size: 16px;
    }
}
