/**
 * COEPLUS Chatbot — Styles v1.0.0
 * Brand colours: Primary Green #00C853 | Dark Navy #1a1a2e | White #FFFFFF
 */

/* ─────────────────────────────────────────────
   WIDGET CONTAINER
───────────────────────────────────────────── */
.cpchat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ─────────────────────────────────────────────
   BUBBLE BUTTON
───────────────────────────────────────────── */
.cpchat-bubble {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00C853, #00a846);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(0, 200, 83, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    outline: none;
}

.cpchat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0, 200, 83, 0.55);
}

.cpchat-bubble-icon {
    line-height: 1;
    color: #fff;
    font-style: normal;
}

.cpchat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #ff3d00;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

@keyframes cpchat-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.6); }
    70%  { box-shadow: 0 0 0 14px rgba(0, 200, 83, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 200, 83, 0); }
}

.cpchat-bubble-pulse {
    animation: cpchat-pulse 1.8s infinite;
}

/* ─────────────────────────────────────────────
   CHAT WINDOW
───────────────────────────────────────────── */
.cpchat-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 340px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: cpchat-slide-up 0.25s ease;
}

@keyframes cpchat-slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────
   HEADER
───────────────────────────────────────────── */
.cpchat-header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cpchat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cpchat-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.cpchat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #00C853;
}

.cpchat-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #00C853;
    border-radius: 50%;
    border: 2px solid #1a1a2e;
}

.cpchat-agent-name {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.cpchat-agent-status {
    color: #a0aec0;
    font-size: 11px;
    margin-top: 1px;
}

.cpchat-close-btn {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s;
}

.cpchat-close-btn:hover {
    color: #fff;
}

/* ─────────────────────────────────────────────
   MESSAGES AREA
───────────────────────────────────────────── */
.cpchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.cpchat-messages::-webkit-scrollbar {
    width: 4px;
}
.cpchat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.cpchat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

/* ─────────────────────────────────────────────
   MESSAGE BUBBLES
───────────────────────────────────────────── */
.cpchat-msg {
    display: flex;
    max-width: 88%;
}

.cpchat-msg-bot {
    align-self: flex-start;
}

.cpchat-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.cpchat-bubble-msg {
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
}

.cpchat-msg-bot .cpchat-bubble-msg {
    background: #f0f4f8;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
}

.cpchat-msg-user .cpchat-bubble-msg {
    background: linear-gradient(135deg, #00C853, #00a846);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cpchat-bubble-msg a {
    color: #00C853;
    text-decoration: underline;
}

.cpchat-msg-user .cpchat-bubble-msg a {
    color: #fff;
}

/* Typing indicator */
.cpchat-typing .cpchat-bubble-msg {
    padding: 12px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.cpchat-typing .cpchat-bubble-msg span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #00C853;
    border-radius: 50%;
    animation: cpchat-bounce 1.2s infinite;
}

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

@keyframes cpchat-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

/* ─────────────────────────────────────────────
   QUICK REPLIES
───────────────────────────────────────────── */
.cpchat-quick-replies {
    padding: 6px 14px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
    border-top: 1px solid #f0f0f0;
}

.cpchat-qr-btn {
    background: #fff;
    border: 1.5px solid #00C853;
    color: #00a846;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cpchat-qr-btn:hover {
    background: #00C853;
    color: #fff;
}

/* ─────────────────────────────────────────────
   INPUT AREA
───────────────────────────────────────────── */
.cpchat-input-area {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    gap: 8px;
    flex-shrink: 0;
}

.cpchat-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 22px;
    padding: 8px 14px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.15s;
    background: #f8fafc;
    color: #1a1a2e;
}

.cpchat-input:focus {
    border-color: #00C853;
    background: #fff;
}

.cpchat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00C853, #00a846);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.cpchat-send-btn:hover {
    transform: scale(1.08);
}

/* ─────────────────────────────────────────────
   FOOTER BRAND
───────────────────────────────────────────── */
.cpchat-footer-brand {
    text-align: center;
    font-size: 10.5px;
    color: #a0aec0;
    padding: 5px 0 8px;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   RESPONSIVE — MOBILE
───────────────────────────────────────────── */
@media (max-width: 480px) {
    .cpchat-widget {
        bottom: 16px;
        right: 16px;
    }

    .cpchat-window {
        width: calc(100vw - 32px);
        max-height: 70vh;
        bottom: 70px;
        right: 0;
    }
}
