/* ===================================================
   Pixi AI Chatbot Widget — PixiGreens
   =================================================== */

/* --- Animations --- */
@keyframes pixiFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25%       { transform: translateY(-8px) rotate(-2deg); }
    75%       { transform: translateY(-4px) rotate(2deg); }
}

@keyframes pixiWave {
    0%   { transform: rotate(0deg) scale(1.08); }
    15%  { transform: rotate(16deg) scale(1.08); }
    35%  { transform: rotate(-12deg) scale(1.08); }
    55%  { transform: rotate(10deg) scale(1.08); }
    75%  { transform: rotate(-8deg) scale(1.08); }
    90%  { transform: rotate(4deg) scale(1.05); }
    100% { transform: rotate(0deg) scale(1); }
}

@keyframes pixiPulseRing {
    0%   { box-shadow: 0 0 0 0 rgba(61, 153, 112, 0.55); }
    70%  { box-shadow: 0 0 0 20px rgba(61, 153, 112, 0); }
    100% { box-shadow: 0 0 0 0 rgba(61, 153, 112, 0); }
}

@keyframes pixiBounceIn {
    0%   { transform: scale(0.5) translateY(20px); opacity: 0; }
    60%  { transform: scale(1.1) translateY(-4px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes pixiSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

@keyframes pixiTypingDot {
    0%, 60%, 100% { transform: translateY(0);   opacity: 0.35; }
    30%            { transform: translateY(-6px); opacity: 1;    }
}

/* --- Floating trigger button --- */
.pixi-chat-btn {
    position: fixed;
    bottom: 112px;
    right: 32px;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    z-index: 998;
    animation: pixiFloat 3.5s ease-in-out infinite,
               pixiPulseRing 3s ease-out infinite;
    transform-origin: center bottom;
}

.pixi-chat-btn img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 60%;
    display: block;
    border: 3px solid #fff;
    box-shadow: 0 6px 22px rgba(13, 40, 24, 0.28);
    transition: box-shadow 0.2s;
}

.pixi-chat-btn:hover {
    animation: pixiWave 0.75s ease-in-out forwards;
}

.pixi-chat-btn.pixi-waving {
    animation: pixiWave 0.75s ease-in-out forwards !important;
}

.pixi-chat-btn.pixi-open {
    animation: none;
    transform: scale(1.08);
}

/* Tooltip label */
.pixi-chat-label {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1F5F3E;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 3px 12px rgba(13, 40, 24, 0.22);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateY(-50%) translateX(6px);
}

.pixi-chat-label::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #1F5F3E;
}

.pixi-chat-btn:hover .pixi-chat-label,
.pixi-chat-btn.pixi-waving .pixi-chat-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* --- Chat window --- */
.pixi-chatbox {
    position: fixed;
    bottom: 196px;
    right: 24px;
    width: 340px;
    max-height: min(480px, 75vh);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(13, 40, 24, 0.16), 0 4px 16px rgba(13, 40, 24, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 997;
    overflow: hidden;
    border: 1px solid rgba(13, 40, 24, 0.07);
    visibility: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.pixi-chatbox.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: pixiSlideUp 0.28s ease forwards;
}

/* --- Header --- */
.pixi-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #1F5F3E, #0D2818);
    color: #fff;
    flex-shrink: 0;
}

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

.pixi-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 60%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    animation: pixiFloat 3.5s ease-in-out infinite;
}

.pixi-chat-header-info strong {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.pixi-chat-header-info span {
    font-size: 0.75rem;
    opacity: 0.8;
}

.pixi-online-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.pixi-close-btn {
    background: rgba(255, 255, 255, 0.14);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.pixi-close-btn:hover {
    background: rgba(255, 255, 255, 0.26);
}

/* --- Messages area --- */
.pixi-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #F7FAF8;
    scrollbar-width: thin;
    scrollbar-color: #3D9970 transparent;
}

.pixi-messages::-webkit-scrollbar       { width: 4px; }
.pixi-messages::-webkit-scrollbar-thumb { background: #3D9970; border-radius: 4px; }

/* --- Message bubbles --- */
.pixi-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
    animation: pixiSlideUp 0.2s ease forwards;
}

.pixi-message.pixi-bot  { align-self: flex-start; }
.pixi-message.pixi-user { align-self: flex-end; flex-direction: row-reverse; }

.pixi-msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 60%;
    flex-shrink: 0;
}

.pixi-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.55;
    font-family: 'Inter', sans-serif;
}

.pixi-bot  .pixi-bubble {
    background: #fff;
    color: #1A2821;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(13, 40, 24, 0.07);
    border: 1px solid rgba(13, 40, 24, 0.06);
}

.pixi-user .pixi-bubble {
    background: #1F5F3E;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* --- Typing indicator --- */
.pixi-typing .pixi-bubble {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 13px 16px;
}

.pixi-typing .pixi-bubble span {
    width: 6px;
    height: 6px;
    background: #94a3a8;
    border-radius: 50%;
    display: inline-block;
    animation: pixiTypingDot 1.3s ease-in-out infinite;
}
.pixi-typing .pixi-bubble span:nth-child(2) { animation-delay: 0.2s; }
.pixi-typing .pixi-bubble span:nth-child(3) { animation-delay: 0.4s; }

/* --- Input area --- */
.pixi-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(13, 40, 24, 0.07);
    background: #fff;
    flex-shrink: 0;
}

.pixi-input-area input {
    flex: 1;
    border: 1.5px solid rgba(13, 40, 24, 0.12);
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    background: #F7FAF8;
    color: #1A2821;
    transition: border-color 0.2s, background 0.2s;
}

.pixi-input-area input:focus {
    border-color: #1F5F3E;
    background: #fff;
}

.pixi-input-area input::placeholder { color: #8a9e93; }

.pixi-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1F5F3E;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.pixi-send-btn:hover   { background: #0D2818; transform: scale(1.08); }
.pixi-send-btn:disabled { background: #c0cec7; cursor: not-allowed; transform: none; }

/* --- Mobile --- */
@media (max-width: 480px) {
    .pixi-chatbox {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 180px;
    }
    .pixi-chat-btn {
        right: 20px;
        bottom: 108px;
        width: 60px;
        height: 60px;
    }
    .pixi-chat-label { display: none; }
}
