/* ================================================================
   Justiça Multiportas • Assistente AI
   CSS de estilo principal - Versão 2.0.0
   Autor: Charles Vasconcelos & Azimov IA
=================================================================== */

#jmrjai-floating-btn,
#jmrjai-container,
#jmrjai-messages,
#jmrjai-input-area {
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------------------------------------------------------------
   BOTÃO FLUTUANTE
---------------------------------------------------------------- */
#jmrjai-floating-btn {
    position: fixed;
    right: 20px;
    bottom: 22px;
    width: 70px;
    height: 70px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2147483000;
    transition: transform 0.2s ease;
}
#jmrjai-floating-btn:hover {
    transform: scale(1.08);
}
#jmrjai-floating-btn img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    user-select: none;
}

/* ---------------------------------------------------------------
   CONTAINER DO CHAT
---------------------------------------------------------------- */
#jmrjai-container {
    position: fixed;
    right: 20px;
    bottom: 110px;
    width: 360px;
    height: 520px;
    background: #ffffff;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #d0e8ff;
    box-shadow: 0 6px 22px rgba(0,0,0,0.25);
    z-index: 2147482999;
    transition: all .25s ease;
}

/* EXPANDIDO — modo fullscreen */
#jmrjai-container.expanded {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 2147483500;
}

/* ---------------------------------------------------------------
   CABEÇALHO
---------------------------------------------------------------- */
#jmrjai-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(90deg, #dff4ff, #e8f8ff);
    border-bottom: 1px solid #bfe4ff;
    z-index: 10;
}

#jmrjai-header img.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 6px rgba(0, 150, 255, 0.35);
}

#jmrjai-title {
    font-weight: 600;
    color: #003d66;
    font-size: 16px;
}

#jmrjai-controls {
    margin-left: auto;
    display: flex;
    gap: 14px;
    font-size: 22px;
}

#jmrjai-controls span {
    cursor: pointer;
    transition: transform 0.15s ease;
}
#jmrjai-controls span:hover {
    transform: scale(1.2);
}

/* ---------------------------------------------------------------
   ÁREA DE MENSAGENS
---------------------------------------------------------------- */
#jmrjai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    background: #ffffff;
}

/* Scrollbar moderno */
#jmrjai-messages::-webkit-scrollbar {
    width: 8px;
}
#jmrjai-messages::-webkit-scrollbar-thumb {
    background: #b6dcff;
    border-radius: 8px;
}
#jmrjai-messages::-webkit-scrollbar-thumb:hover {
    background: #8acaff;
}

/* ---------------------------------------------------------------
   BALÕES DE MENSAGEM
---------------------------------------------------------------- */
.jm-msg {
    max-width: 80%;
    border-radius: 12px;
    padding: 10px 14px;
    position: relative;
    animation: fadeIn 0.25s ease;
}

.jm-user {
    align-self: flex-end;
    background: #ececec;
    color: #222;
}

.jm-ai {
    align-self: flex-start;
    background: #e7f5ff;
    color: #003d66;
    padding-left: 60px;
    padding-bottom: 40px;
}

/* Avatar da IA */
.jm-ai::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 10px;
    width: 38px;
    height: 38px;
    background-image: url("../img/avatar-default.png");
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0,150,255,0.4);
}

/* ---------------------------------------------------------------
   TEXTO INTERNO
---------------------------------------------------------------- */
.jm-msg-inner {
    font-size: 15px;
    line-height: 1.55;
    word-break: break-word;
}

.jm-msg-inner strong { color: #003d66; }
.jm-msg-inner em { color: #004f80; }
.jm-msg-inner a {
    color: #0077cc;
    text-decoration: none;
}
.jm-msg-inner a:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------------
   BOTÕES INTERNOS (ler e ver mais)
---------------------------------------------------------------- */
.jm-tts-btn {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    background: none;
    border: none;
    color: #005c9d;
    transition: transform 0.2s ease;
}
.jm-tts-btn:hover {
    transform: scale(1.15);
}

.jm-readmore {
    margin-top: 4px;
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
    color: #0077cc;
    font-weight: 500;
}
.jm-readmore:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------------
   ÁREA DE INPUT
---------------------------------------------------------------- */
#jmrjai-input-area {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #f3f9ff;
    border-top: 1px solid #cfeaff;
}

#jmrjai-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #a5d9ff;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
}
#jmrjai-input:focus {
    border-color: #3399ff;
}

#jmrjai-send {
    background: #3399ff;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}
#jmrjai-send:hover {
    background: #1e82e6;
}

/* ---------------------------------------------------------------
   RESPONSIVIDADE
---------------------------------------------------------------- */
@media (max-width: 480px) {
    #jmrjai-container {
        right: 10px;
        bottom: 80px;
        width: 92%;
        height: 75%;
    }

    #jmrjai-floating-btn {
        right: 14px;
        bottom: 14px;
        width: 64px;
        height: 64px;
    }

    #jmrjai-floating-btn img {
        width: 60px;
        height: 60px;
    }

    #jmrjai-title {
        font-size: 14px;
    }
}

/* ---------------------------------------------------------------
   ANIMAÇÕES
---------------------------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* ================================================================
   TYPING SPINNER — Animação "Digitando..." estilo WhatsApp
================================================================ */
.typing-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 16px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background-color: #0077cc;
    border-radius: 50%;
    opacity: 0.4;
    animation: typingBlink 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBlink {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.9); }
    40% { opacity: 1; transform: scale(1.2); }
}
