/* Banner lateral de intimações */
#banner-intimacoes {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 1050;
    max-width: 300px;
    display: none;
    animation: var(--banner-animation);
}

#banner-intimacoes .card {
    border-left: 4px solid var(--primary-bright) !important;
}

.juristia-banner-card {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-medium) 100%) !important;
}

#banner-intimacoes .btn-light {
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--primary-dark);
    font-weight: 500;
}

#banner-intimacoes .btn-light:hover {
    background-color: white;
    color: var(--primary-dark);
    transform: translateY(-1px);
}

#banner-intimacoes .text-white {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#banner-intimacoes .card-body {
    color: #ffffff !important;
}

#banner-intimacoes .card-body p,
#banner-intimacoes .card-body h6,
#banner-intimacoes .card-body strong,
#banner-intimacoes .fas {
    color: #ffffff !important;
}

/* Widget principal do hub de chats */
#juristia-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

#juristia-main-toggle {
    width: 56px;
    height: 56px;
    background: #0071CE;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
    padding: 8px;
    border: none;
}

#juristia-main-toggle:hover {
    background: #00416B;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

#juristia-main-toggle img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50%;
    object-fit: cover;
    border: none !important;
    outline: none !important;
}

.juristia-widget-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 16px rgba(0, 113, 206, 0.4);
    }

    50% {
        box-shadow: 0 4px 20px rgba(0, 113, 206, 0.6);
    }

    100% {
        box-shadow: 0 44px 16px rgba(0, 113, 206, 0.4);
    }
}

#juristia-options-menu {
    width: 280px;
    position: fixed;
    bottom: 90px;
    right: 24px;
    animation: fadeInUp 0.3s ease;
    display: none;
}

#juristia-options-menu .btn {
    text-align: left;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

#juristia-options-menu .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#juristia-chat-box,
#juristia-help-box {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 98vw;
    display: none;
    animation: fadeIn 0.25s;
    transition: all 0.3s;
    z-index: 99999;
}

#juristia-chat-box {
    width: 420px;
}

#juristia-help-box {
    width: 370px;
}

#juristia-chat-box.expanded,
#juristia-help-box.expanded {
    width: 90vw !important;
    max-width: 1100px !important;
    height: 80vh !important;
    max-height: 90vh !important;
    top: 50% !important;
    left: 50% !important;
    bottom: auto !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25) !important;
}

#juristia-chat-box.expanded .card-body,
#juristia-help-box.expanded .card-body {
    height: 65vh !important;
}

#juristia-chat-box.expanded #juristia-chat-messages,
#juristia-help-box.expanded #juristia-help-messages {
    height: 50vh !important;
    max-height: 60vh !important;
}

/* Estilos gerais do chat (fora do .expanded) */
.juristia-chat-body {
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    max-height: 400px;
}

.juristia-chat-stream {
    height: 280px;
    max-height: 45vh;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e3e6ea;
    flex: 1;
}

#juristia-chat-messages,
#juristia-help-messages {
    font-size: 1em;
    height: 280px;
    max-height: 45vh;
    overflow-y: auto;
}

.juristia-chat-bubble,
.chat-bubble {
    max-width: 85%;
    padding: 0.7em 1em;
    border-radius: 1.2em;
    margin-bottom: 0.2em;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    animation: fadeIn 0.3s;
    position: relative;
}

.juristia-chat-bubble.user,
.chat-message-wrapper.usuario .chat-bubble {
    background: #d1e7dd;
    color: #1b4332;
    border-bottom-right-radius: 0.3em;
    align-self: flex-end;
    margin-left: auto;
}

.juristia-chat-bubble.assistant,
.chat-message-wrapper.assistente .chat-bubble {
    background: #e7eaf6;
    color: #22223b;
    border-bottom-left-radius: 0.3em;
    align-self: flex-start;
    margin-right: auto;
}

.juristia-btn-copy {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    color: #495057;
    border: none;
    border-radius: 50%;
    padding: 0.3em 0.45em;
    font-size: 1em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    z-index: 2;
}

.juristia-chat-bubble.assistant:hover .juristia-btn-copy,
.juristia-chat-bubble.assistant:focus-within .juristia-btn-copy {
    display: block;
}

.juristia-btn-copy:active {
    background: #e7eaf6;
    color: #22223b;
}

#juristia-chat-box .btn-light {
    background: #fff !important;
    color: #0071CE !important;
    border: none !important;
    box-shadow: none !important;
}

#juristia-chat-box .btn-light:hover {
    background: #e3eafc !important;
    color: #00416B !important;
}

#juristia-chat-box .btn-light i {
    color: #0071CE !important;
}

@media (max-width: 600px) {

    #juristia-chat-box,
    #juristia-help-box {
        width: 98vw;
    }

    #juristia-options-menu {
        width: 95vw;
        right: 2.5vw;
    }

    #juristia-chat-messages,
    #juristia-help-messages {
        height: 200px !important;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Balões reutilizados em páginas específicas */
.chat-message-wrapper {
    display: flex;
    margin-bottom: 10px;
}

.chat-message-wrapper.usuario {
    justify-content: flex-end;
}

.chat-message-wrapper.assistente {
    justify-content: flex-start;
}

.chat-message-wrapper.sistema .chat-bubble {
    background-color: #f8f9fa;
    color: #0875d59e;
    font-style: italic;
    font-size: 0.9em;
    width: 100%;
    text-align: center;
    border-radius: 5px;
    box-shadow: none;
}

.message-sender-label {
    font-size: 0.8em;
    color: #6c757d;
    margin-bottom: 3px;
    display: block;
}

.chat-message-wrapper.usuario .message-sender-label {
    text-align: right;
}

.chat-message-wrapper.assistente .message-sender-label {
    text-align: left;
}

/* Modais tema dark */
.juristia-modal {
    background: #0A2240;
    color: #ffffff;
    border: 1px solid rgba(0, 113, 206, 0.3);
}

.juristia-modal .modal-header,
.juristia-modal .modal-footer {
    background: rgba(0, 65, 107, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

.juristia-modal .modal-title {
    color: #0071CE;
    font-weight: 600;
}

.juristia-modal .btn-close {
    filter: invert(1);
}

.juristia-modal .modal-body {
    color: rgba(255, 255, 255, 0.92);
}

.juristia-modal a {
    color: #4da3ff;
}

.juristia-modal a:hover {
    color: #ffffff;
}

.juristia-modal p,
.juristia-modal li,
.juristia-modal span,
.juristia-modal div,
.juristia-modal h1,
.juristia-modal h2,
.juristia-modal h3,
.juristia-modal h4,
.juristia-modal h5,
.juristia-modal h6,
.juristia-modal .text-muted,
#conteudo-politica,
#conteudo-termos,
#conteudo-politica h1,
#conteudo-politica h2,
#conteudo-politica h3,
#conteudo-termos h1,
#conteudo-termos h2,
#conteudo-termos h3,
#conteudo-politica p,
#conteudo-termos p,
#conteudo-politica li,
#conteudo-termos li {
    color: rgba(255, 255, 255, 0.92) !important;
}

/* Overlays genéricos */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0A2240;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-overlay-global {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-content-global {
    text-align: center;
    color: white;
    padding: 40px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    max-width: 400px;
}

.spinner-global {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #0071CE;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.spinner-global.success {
    border-top-color: #28a745;
}

.loading-content-global h4 {
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.loading-content-global p {
    margin-bottom: 0;
    opacity: 0.9;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Tour guiado */
.juristia-tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 100000;
    pointer-events: none;
}

.juristia-tour-highlight {
    position: relative !important;
    z-index: 100001 !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, .25) !important;
    transition: box-shadow .2s ease-in-out;
    border-radius: 8px !important;
    pointer-events: auto;
}

.juristia-tour-tooltip {
    position: absolute;
    max-width: 380px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .125);
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
    border-radius: .5rem;
    padding: 1rem 1rem .75rem 1rem;
    z-index: 100003;
    font-family: 'Poppins', sans-serif;
}

.juristia-tour-tooltip h6 {
    margin: 0 0 .5rem 0;
    font-weight: 600;
    color: var(--dark);
}

.juristia-tour-tooltip .tour-actions {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .75rem;
}

.juristia-tour-tooltip .text-muted {
    font-size: 0.95rem !important;
    line-height: 1.5;
}