/* ==========================================================================
   FLOATING CHATBOT WIDGET
   ========================================================================== */
.psap-chat-widget {
    position: fixed;
    bottom: 0; /* Anchor to the very bottom of the screen */
    left: 20px;
    z-index: 9990;
    font-family: var(--font-body), sans-serif;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}


/* New Custom Mascot Toggle */
.psap-chat-toggle-container {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.psap-chat-toggle-container:hover {
    transform: translateY(-4px);
}

.psap-chat-mascot-btn {
    position: relative;
    height: 120px; /* Reduced from 240px to be much smaller */
    width: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: visible;
}

.psap-chat-mascot-btn img {
    height: 100%;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(4px 4px 10px rgba(0,0,0,0.25)); /* Softer shadow */
}

.psap-online-dot {
    position: absolute;
    bottom: 50px; /* Adjusted to sit near her laptop at new size */
    right: -5px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 2px solid #ffffff;
    border-radius: 50%;
    z-index: 2;
}

.psap-chat-pill-btn {
    margin-bottom: 20px; /* Align perfectly with her waist at new size */
    background: var(--primary);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-heading);
    box-shadow: 0 8px 24px rgba(123, 13, 46, 0.4);
    transition: background 0.2s, transform 0.2s;
}

.psap-chat-toggle-container:hover .psap-chat-pill-btn {
    background: var(--secondary);
    transform: scale(1.05);
}

.psap-chat-window {
    position: absolute;
    bottom: 20px;
    left: 160px; /* Pop up right next to her and the pill button */
    width: 360px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: chatSlideUpLeft 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom left;
}

@keyframes chatSlideUpLeft {
    0% { opacity: 0; transform: scale(0.8) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.psap-chat-header {
    background: linear-gradient(135deg, var(--primary), #5a0921);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #ffffff;
}

.psap-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f8fafc;
    border: 2px solid var(--secondary);
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.psap-chat-avatar img {
    width: 120%;
    height: auto;
    object-fit: cover;
}

.psap-chat-title h4 {
    margin: 0 0 2px 0;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #ffffff;
}

.psap-chat-title p {
    margin: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 4px;
}
.psap-chat-title p::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
}

.psap-chat-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}
.psap-chat-close:hover {
    color: #ffffff;
}

.psap-chat-body {
    height: 380px;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.psap-chat-msg {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

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

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

.psap-chat-msg .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.psap-chat-msg .msg-avatar img {
    width: 120%;
}

.psap-chat-msg.user .msg-avatar {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #ffffff;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
}

.psap-chat-msg .msg-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.psap-chat-msg.user .msg-bubble {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    border-top-left-radius: 16px;
    border-top-right-radius: 4px;
}

/* Typing Indicator */
.psap-typing {
    display: flex;
    gap: 4px;
    padding: 6px 4px;
}
.psap-typing span {
    width: 6px;
    height: 6px;
    background: #cbd5e1;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}
.psap-typing span:nth-child(1) { animation-delay: -0.32s; }
.psap-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.psap-chat-footer {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.psap-chat-footer input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.psap-chat-footer input:focus {
    border-color: var(--primary);
}

.psap-chat-footer button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--secondary);
    color: #ffffff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}
.psap-chat-footer button:hover {
    transform: scale(1.05);
    background: #c29115;
}

@media (max-width: 768px) {
    .psap-chat-widget {
        left: 12px;
        bottom: 0;
    }
    .psap-chat-toggle-container {
        gap: 8px;
    }
    .psap-chat-mascot-btn {
        height: 80px;
    }
    .psap-online-dot {
        bottom: 30px;
        width: 10px;
        height: 10px;
        right: -2px;
        border-width: 1.5px;
    }
    .psap-chat-pill-btn {
        margin-bottom: 14px;
        padding: 6px 14px;
        font-size: 12px;
        box-shadow: 0 4px 14px rgba(123, 13, 46, 0.35);
        white-space: nowrap;
    }
    .psap-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 10000;
    }
    .psap-chat-body {
        height: calc(100vh - 140px);
    }
}

@media (max-width: 480px) {
    .psap-chat-widget {
        left: 10px;
        bottom: 0;
    }
    .psap-chat-toggle-container {
        gap: 6px;
    }
    .psap-chat-mascot-btn {
        height: 70px;
    }
    .psap-online-dot {
        bottom: 26px;
        width: 9px;
        height: 9px;
        right: -2px;
    }
    .psap-chat-pill-btn {
        margin-bottom: 12px;
        padding: 5px 12px;
        font-size: 11px;
    }
    .psap-chat-body {
        height: calc(100vh - 135px);
    }
}

