/* ==========================================================================
   WP CookieChat - Chatbot Widget
   ========================================================================== */

.wpcc-chatbot {
    position: fixed;
    z-index: 999998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    --wpcc-primary: #3a7d8c;
    --wpcc-header-grad: linear-gradient(135deg, var(--wpcc-primary), color-mix(in srgb, var(--wpcc-primary) 60%, #21384a));
}

.wpcc-chatbot--bottom-right { bottom: 24px; right: 24px; }
.wpcc-chatbot--bottom-left  { bottom: 24px; left: 24px; }

/* Floating trigger (avatar bubble)
   ========================================================================== */

.wpcc-chatbot__trigger {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--wpcc-primary);
    color: #fff;
    border: none;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: absolute;
    bottom: 0;
}
.wpcc-chatbot--bottom-right .wpcc-chatbot__trigger { right: 0; }
.wpcc-chatbot--bottom-left  .wpcc-chatbot__trigger { left: 0; }

.wpcc-chatbot__trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.wpcc-chatbot__trigger-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.wpcc-chatbot__icon--close { display: none; }

/* Chat Panel
   ========================================================================== */

.wpcc-chatbot__panel {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}
.wpcc-chatbot--bottom-right .wpcc-chatbot__panel { right: 0; transform-origin: bottom right; }
.wpcc-chatbot--bottom-left  .wpcc-chatbot__panel { left: 0; transform-origin: bottom left; }

.wpcc-chatbot.is-open .wpcc-chatbot__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.wpcc-chatbot__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--wpcc-primary);
    background: var(--wpcc-header-grad);
    color: #fff;
}

.wpcc-chatbot__avatar {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wpcc-chatbot__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.wpcc-chatbot__avatar-initial {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
}

.wpcc-chatbot__heading {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.wpcc-chatbot__name {
    font-weight: 700;
    font-size: 17px;
    line-height: 1.2;
}
.wpcc-chatbot__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
    margin-top: 2px;
}
.wpcc-chatbot__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
}

.wpcc-chatbot__close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.85;
    display: flex;
    border-radius: 6px;
    transition: opacity 0.15s ease, background 0.15s ease;
}
.wpcc-chatbot__close:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }

/* Messages */
.wpcc-chatbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
}

.wpcc-chatbot__message {
    max-width: 82%;
    padding: 11px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    white-space: pre-wrap;
    animation: wpcc-msg-in 0.2s ease;
}
@keyframes wpcc-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wpcc-chatbot__message--assistant {
    align-self: flex-start;
    background: #f0f2f5;
    color: #1c1e21;
    border-bottom-left-radius: 6px;
}
.wpcc-chatbot__message--user {
    align-self: flex-end;
    background: var(--wpcc-primary);
    color: #fff;
    border-bottom-right-radius: 6px;
}
.wpcc-chatbot__message--error {
    align-self: flex-start;
    background: #fde8e8;
    color: #b32d2e;
    border-bottom-left-radius: 6px;
}

/* Typing indicator */
.wpcc-chatbot__typing {
    align-self: flex-start;
    background: #f0f2f5;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    padding: 14px 16px;
    display: inline-flex;
    gap: 4px;
}
.wpcc-chatbot__typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9aa0a6;
    animation: wpcc-typing 1.2s infinite ease-in-out;
}
.wpcc-chatbot__typing span:nth-child(2) { animation-delay: 0.2s; }
.wpcc-chatbot__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wpcc-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
.wpcc-chatbot__input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid #eaecef;
    background: #fff;
}
.wpcc-chatbot__input {
    flex: 1;
    resize: none;
    border: 1.5px solid var(--wpcc-primary);
    border-radius: 24px;
    padding: 11px 18px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    max-height: 110px;
    outline: none;
    color: #1c1e21;
    background: #fff;
    transition: box-shadow 0.15s ease;
}
.wpcc-chatbot__input::placeholder { color: #8a9099; }
.wpcc-chatbot__input:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wpcc-primary) 18%, transparent);
}

.wpcc-chatbot__send {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--wpcc-primary);
    background: var(--wpcc-header-grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.wpcc-chatbot__send:hover { transform: scale(1.06); }
.wpcc-chatbot__send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Mobile */
@media (max-width: 480px) {
    .wpcc-chatbot__panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 110px);
    }
}
