/* WordPress Custom Chatbot Widget styles */
#cwpcb-widget-outer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
    color: #333333;
    line-height: 1.4;
    font-size: 14px;
    box-sizing: border-box;
}

#cwpcb-widget-outer * {
    box-sizing: border-box;
}

/* Launcher styles */
#cwpcb-launcher {
    background-color: var(--cwpcb-accent, #2563eb);
    color: #ffffff;
    border: none;
    outline: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.25s ease, background-color 0.2s ease;
}

#cwpcb-launcher:hover {
    transform: scale(1.05);
}

#cwpcb-launcher .cwpcb-close-icon {
    display: none;
}

#cwpcb-launcher.active .cwpcb-launcher-icon {
    display: none;
}

#cwpcb-launcher.active .cwpcb-btn-custom-img {
    display: none;
}

#cwpcb-launcher.active .cwpcb-close-icon {
    display: block;
}

#cwpcb-launcher .cwpcb-btn-custom-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#cwpcb-launcher .cwpcb-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #ffffff;
}

/* Chatbox window */
#cwpcb-chatbox {
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 370px;
    height: 500px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

#cwpcb-chatbox.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
#cwpcb-header {
    background-color: var(--cwpcb-accent, #2563eb);
    color: #ffffff;
    padding: 16px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

#cwpcb-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cwpcb-header-avatar-wrap {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.cwpcb-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cwpcb-default-avatar {
    font-size: 22px;
}

#cwpcb-bot-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

#cwpcb-bot-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    display: block;
    margin-top: 3px;
}

/* Messages body */
#cwpcb-messages-body {
    flex: 1;
    padding: 16px;
    background-color: #f8fafc;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cwpcb-msg-row {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.cwpcb-row-bot {
    align-self: flex-start;
}

.cwpcb-row-usr {
    align-self: flex-end;
}

.cwpcb-msg-text {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    word-break: break-word;
}

.cwpcb-row-bot .cwpcb-msg-text {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 2px;
    color: #1e293b;
}

.cwpcb-row-usr .cwpcb-msg-text {
    background-color: var(--cwpcb-accent, #2563eb);
    color: #ffffff;
    border-top-right-radius: 2px;
}

.cwpcb-msg-meta {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}

.cwpcb-row-usr .cwpcb-msg-meta {
    text-align: right;
}

/* Footer Composer Input */
#cwpcb-chat-form {
    display: flex;
    border-top: 1px solid #e2e8f0;
    padding: 10px 12px;
    background: #ffffff;
    align-items: center;
    gap: 10px;
}

#cwpcb-input-box {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 8px 16px;
    outline: none;
    font-size: 13.5px;
    transition: border-color 0.15s ease-in-out;
}

#cwpcb-input-box:focus {
    border-color: var(--cwpcb-accent, #2563eb);
}

#cwpcb-send-btn {
    background-color: var(--cwpcb-accent, #2563eb);
    color: #ffffff;
    border: none;
    outline: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

#cwpcb-send-btn:hover {
    filter: brightness(0.9);
}

/* Loading animations */
.cwpcb-loading-text {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px !important;
}

.cwpcb-loading-text span {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    display: inline-block;
    animation: cwpcb-loading-anim 1.4s ease-in-out infinite both;
}

.cwpcb-loading-text span:nth-child(1) {
    animation-delay: -0.32s;
}

.cwpcb-loading-text span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes cwpcb-loading-anim {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive mobile scaling */
@media (max-width: 480px) {
    #cwpcb-chatbox {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    #cwpcb-header {
        border-radius: 0;
    }
    #cwpcb-launcher {
        bottom: 12px;
        right: 12px;
    }
}
