/* ============================================================
   PowerSense Chat – CSS complet și optimizat
   ============================================================ */

/* ------------------------------------------------------------
   Bula plutitoare – ps-chat-bubble
   ------------------------------------------------------------ */
#ps-chat-bubble {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 62px;
    height: 62px;
    background: #0069ff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    cursor: pointer;
    z-index: 99999;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#ps-chat-bubble svg {
    width: 32px;
    height: 32px;
    fill: #fff;
}

#ps-chat-bubble:hover {
    transform: scale(1.08);
}

/* ------------------------------------------------------------
   CHAT BOX – container principal
   ------------------------------------------------------------ */
#ps-chatbox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 340px;
    height: 520px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
}

/* ------------------------------------------------------------
   FIX MOBIL – blocăm corpul ca să nu sară UI-ul
   ------------------------------------------------------------ */
body.ps-lock-scroll {
    overflow: hidden !important;
    position: fixed !important;
    width: 100%;
}

/* ------------------------------------------------------------
   Header Chat
   ------------------------------------------------------------ */
#ps-chat-header {
    background: #0069ff;
    color: #fff;
    padding: 14px;
    font-size: 17px;
    font-weight: 600;
    text-align: left;
    position: relative;
}

#ps-chat-close {
    position: absolute;
    right: 12px;
    top: 8px;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    font-weight: 300;
}

/* ------------------------------------------------------------
   Zona mesajelor
   ------------------------------------------------------------ */
#ps-chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ------------------------------------------------------------
   Mesaje: USER
   ------------------------------------------------------------ */
.ps-msg.ps-user {
    align-self: flex-end;
    background: #0069ff;
    color: #fff;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-right-radius: 4px;
    max-width: 78%;
    font-size: 14px;
    line-height: 1.35;
}

/* ------------------------------------------------------------
   Mesaje: AI
   ------------------------------------------------------------ */
.ps-msg.ps-ai {
    align-self: flex-start;
    background: #f1f1f1;
    color: #222;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    max-width: 78%;
    font-size: 14px;
    line-height: 1.35;
}

/* ------------------------------------------------------------
   Input Area
   ------------------------------------------------------------ */
#ps-chat-input-area {
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 8px;
}

#ps-chat-input {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
}

#ps-chat-send {
    background: #0069ff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

#ps-chat-send:hover {
    background: #0053d6;
}

/* ------------------------------------------------------------
   Typing Indicator (pentru când vom adăuga punctele animate)
   ------------------------------------------------------------ */
#ps-chat-typing {
    display: none;
    margin-bottom: 8px;
}

.ps-typing-bubble {
    background: #ececec;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.ps-typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #777;
    margin: 0 2px;
    border-radius: 50%;
    animation: psTyping 1.2s infinite;
    opacity: 0.3;
}

.ps-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.ps-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes psTyping {
    0% { transform: translateY(0); opacity: 0.3; }
    50% { transform: translateY(-3px); opacity: 1; }
    100% { transform: translateY(0); opacity: 0.3; }
}

/* ------------------------------------------------------------
   MEDIA QUERIES – Responsivitate totală
   ------------------------------------------------------------ */
@media(max-width: 600px) {

    #ps-chatbox {
        width: 100vw;
        height: 50vh;
        max-height: none;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    #ps-chat-bubble {
        bottom: 20px;
        right: 20px;
        width: 58px;
        height: 58px;
    }

    #ps-chat-input {
        font-size: 16px; /* pentru tastatura iPhone */
    }
}
