/* ==========================================================
   CHATBOT - MAUSOLÉU DAS ALMAS
   ========================================================== */

@font-face {
  font-family: 'Cinzel';
  src: url('../fonts/cinzel/CinzelDecorative-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

#ma-chatbot {
    --chat-gold: #c9a23f;
    --chat-gold-light: #a18232;
    --chat-bg: #090909;
    --chat-bg-2: #111111;
    --chat-border: rgba(197, 145, 33, 0.808);
    --chat-text: #eeeeee;
    --chat-muted: #aaa;

    position: fixed;
    right: 25px;
    bottom: 0px;
    z-index: 999999;
    font-family: Arial, Helvetica, sans-serif;
}

/* ==========================================================
   BOTÃO DO AVATAR
   ========================================================== */

#ma-chatbot-button {
    width: 160px;
    height: 160px;

    border: 0;
    padding: 0;
    margin: 0;

    background: transparent;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.8));

    transition:
        transform 0.3s ease,
        filter 0.3s ease;
}

#ma-chatbot-button:hover {
    transform: scale(1.08);
    filter:
        drop-shadow(0 4px 12px rgba(0, 0, 0, 0.9))
        drop-shadow(0 0 8px rgba(201, 162, 77, 0.35));
}

#ma-chatbot-button .whatsapp-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* ==========================================================
   JANELA
   ========================================================== */

#ma-chat-window {
    position: absolute;

    right: 0;
    bottom: 105px;

    width: 360px;
    max-width: calc(100vw - 30px);
    height: 570px;
    max-height: calc(100vh - 140px);

    display: none;
    flex-direction: column;

    overflow: hidden;

    background:
        radial-gradient(
            circle at top right,
            rgba(201, 162, 77, 0.08),
            transparent 35%
        ),
        var(--chat-bg);

    border: 1px solid var(--chat-border);
    border-radius: 14px;

    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.75),
        0 0 30px rgba(0, 0, 0, 0.5);
}

#ma-chat-window.ma-chat-open {
    display: flex;
    animation: maChatOpen 0.25s ease;
}

@keyframes maChatOpen {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.97);
    }

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

/* ==========================================================
   CABEÇALHO
   ========================================================== */

.ma-chat-header {
    min-height: 70px;

    padding: 12px 15px;

    display: flex;
    align-items: center;

    background:
        linear-gradient(
            135deg,
            rgba(148, 106, 15, 0.795),
            rgba(0, 0, 0, 0.212)
        );

    border-bottom: 1px solid var(--chat-border);
}

.ma-chat-avatar {
    width: 45px;
    height: 45px;

    margin-right: 10px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #050505;
    border: 1px solid var(--chat-border);

    overflow: hidden;
}

.ma-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ma-chat-header-info {
    flex: 1;
}

.ma-chat-title {
    color: var(--chat-gold);
    font-family: 'Cinzel', serif;
    font-size: 15px;
    font-weight: bold;
}

.ma-chat-status {
    margin-top: 4px;

    color: #8bcf75;
    font-size: 11px;
}

.ma-chat-close {
    width: 32px;
    height: 32px;

    border: 0;
    background: transparent;

    color: #aaa;

    font-size: 25px;
    line-height: 1;

    cursor: pointer;
}

.ma-chat-close:hover {
    color: var(--chat-gold-light);
}

/* ==========================================================
   MENSAGENS
   ========================================================== */

#ma-chat-messages {
    flex: 1;

    overflow-y: auto;

    padding: 15px;

    display: flex;
    flex-direction: column;
    gap: 10px;

    scrollbar-width: thin;
    scrollbar-color: var(--chat-gold) #080808;
}

.ma-chat-message {
    max-width: 84%;

    padding: 10px 12px;

    border-radius: 12px;

    font-size: 13px;
    line-height: 1.5;

    word-wrap: break-word;
}

.ma-chat-bot {
    align-self: flex-start;

    color: var(--chat-text);

    background: #151515;

    border: 1px solid rgba(255, 255, 255, 0.07);

    border-bottom-left-radius: 3px;
}

.ma-chat-user {
    align-self: flex-end;

    color: #111;

    background:
        linear-gradient(
            135deg,
            var(--chat-gold-light),
            var(--chat-gold)
        );

    border-bottom-right-radius: 3px;
}

.ma-chat-time {
    display: block;

    margin-top: 5px;

    font-size: 9px;
    opacity: 0.55;

    text-align: right;
}

/* ==========================================================
   BOTÃO WHATSAPP
   ========================================================== */

.ma-chat-whatsapp {
    display: block;

    margin-top: 10px;

    padding: 10px 13px;

    border-radius: 7px;

    background: #25d366;

    color: #fff;

    text-decoration: none;
    text-align: center;

    font-size: 13px;
    font-weight: bold;

    transition: 0.2s ease;
}

.ma-chat-whatsapp:hover {
    background: #1ebe5d;
    transform: translateY(-1px);
}

/* ==========================================================
   ÁREA DE ENTRADA
   ========================================================== */

.ma-chat-input-area {
    padding: 10px;

    background: #0d0d0d;

    border-top: 1px solid var(--chat-border);

    display: flex;
    gap: 7px;
}

#ma-chat-input {
    flex: 1;

    min-width: 0;

    height: 42px;

    padding: 0 12px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;

    outline: none;

    background: #171717;
    color: #fff;

    font-size: 13px;
}

#ma-chat-input:focus {
    border-color: var(--chat-gold);
}

#ma-chat-input::placeholder {
    color: #777;
}

#ma-chat-send {
    width: 45px;
    height: 42px;

    border: 0;
    border-radius: 8px;

    background: var(--chat-gold);

    color: #111;

    font-size: 18px;
    font-weight: bold;

    cursor: pointer;

    transition: 0.2s ease;
}

#ma-chat-send:hover {
    background: var(--chat-gold-light);
}

/* ==========================================================
   DIGITANDO
   ========================================================== */

.ma-chat-typing {
    display: flex;
    gap: 4px;

    padding: 5px 2px;
}

.ma-chat-typing span {
    width: 6px;
    height: 6px;

    background: #aaa;

    border-radius: 50%;

    animation: maTyping 1.2s infinite;
}

.ma-chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.ma-chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes maTyping {
    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* ==========================================================
   FORMULÁRIO DE DADOS
   ========================================================== */

.ma-chat-lead {
    padding: 12px;

    margin-top: 8px;

    background: rgba(201, 162, 77, 0.06);

    border: 1px solid rgba(201, 162, 77, 0.25);

    border-radius: 9px;
}

.ma-chat-lead-title {
    color: var(--chat-gold-light);

    font-size: 13px;
    font-weight: bold;

    margin-bottom: 10px;
}

.ma-chat-lead input {
    width: 100%;
    box-sizing: border-box;

    height: 38px;

    margin-bottom: 7px;
    padding: 0 10px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;

    background: #111;
    color: #fff;

    outline: none;
}

.ma-chat-lead input:focus {
    border-color: var(--chat-gold);
}

.ma-chat-lead button {
    width: 100%;

    height: 38px;

    border: 0;
    border-radius: 6px;

    background: var(--chat-gold);

    color: #111;

    font-weight: bold;

    cursor: pointer;
}

/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 600px) {

    #ma-chatbot {
        right: 12px;
        bottom: 12px;
    }

    #ma-chatbot-button {
        width: 130px;
        height: 130px;
    }

    #ma-chat-window {
        right: -3px;
        bottom: 88px;

        width: calc(100vw - 24px);

        height: min(570px, calc(100vh - 110px));

        max-width: none;
    }
}

/* ==========================================================
   INTEGRAÇÃO COM O AVATAR
   ========================================================== */

#ma-chatbot .whatsapp-float {
    position: static;
    right: auto;
    bottom: auto;
    z-index: auto;
}

#ma-chatbot .whatsapp-avatar {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#ma-chatbot-button {
    appearance: none;
    -webkit-appearance: none;
}

/* ==========================================================
   NOVO: OPÇÕES CLICÁVEIS DO MENU DO CHATBOT
   Acrescentado ao CSS original. Nenhuma regra existente foi alterada.
   ========================================================== */

.ma-chat-options {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 8px 0 4px 0;
}

.ma-chat-option {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(201, 162, 77, 0.28);
    border-radius: 8px;
    background: rgba(201, 162, 77, 0.06);
    color: inherit;
    font: inherit;
    font-size: 12px;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.ma-chat-option:hover {
    background: rgba(201, 162, 77, 0.14);
    border-color: rgba(201, 162, 77, 0.55);
    transform: translateY(-1px);
}

.ma-chat-option:active {
    transform: translateY(0);
}

.ma-chat-option-number {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(201, 162, 77, 0.9);
    color: #111;
    font-size: 11px;
    font-weight: 700;
}

@media (max-width: 600px) {
    .ma-chat-option {
        min-height: 40px;
        padding: 8px 9px;
        font-size: 12px;
    }
}

/* ======================================================
   FASE DA LUA
   ====================================================== */

.moon-phase {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.moon-phase-name {
    display: inline-block;
    opacity: 0;
    transform: translateX(-6px);
    animation: moonPhaseName 4s ease forwards;
    font-size: 1em;
    font-weight: normal;
    white-space: nowrap;
}


/* ======================================================
   ANIMAÇÃO DO NOME DA LUA
   ====================================================== */

@keyframes moonPhaseName {

    0% {
        opacity: 0;
        transform: translateX(-6px);
    }

    15% {
        opacity: 1;
        transform: translateX(0);
    }

    70% {
        opacity: 1;
        transform: translateX(0);
    }

    100% {
        opacity: 0;
        transform: translateX(6px);
    }
}

/* ======================================================
   BALÃO DE FALA - MESTRE NOCTUS
   ====================================================== */

#ma-noctus-speech {
    position: absolute;

    /*
     * Fica à esquerda do personagem
     */
    right: 150px;
    bottom: 45px;

    width: 300px;
    max-width: 300px;

    box-sizing: border-box;

    padding: 15px 18px;

    background:
        radial-gradient(
            circle at 30% 20%,
            rgba(201, 162, 77, 0.14),
            transparent 55%
        ),
        rgba(8, 8, 8, 0.96);

    border: 1px solid rgba(201, 162, 77, 0.65);
    border-radius: 16px;

    color: #eeeeee;

    font-family: 'Cinzel', serif;
    font-size: 13px;
    line-height: 1.55;

    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.75),
        0 0 18px rgba(201, 162, 77, 0.18);

    opacity: 0;
    visibility: hidden;

    transform:
        translateX(25px)
        scale(0.92);

    transform-origin: right bottom;

    pointer-events: none;

    z-index: 20;
}


/*
 * Pequena "cauda" apontando para o personagem
 */

#ma-noctus-speech::after {
    content: "";

    position: absolute;

    right: -10px;
    bottom: 28px;

    width: 18px;
    height: 18px;

    background: #080808;

    border-top: 1px solid rgba(201, 162, 77, 0.65);
    border-right: 1px solid rgba(201, 162, 77, 0.65);

    transform: rotate(45deg);
}


/* ======================================================
   BALÃO VISÍVEL
   ====================================================== */

#ma-noctus-speech.ma-noctus-visible {

    visibility: visible;

    animation:
        noctusSpeechIn 0.55s cubic-bezier(.18,.89,.32,1.28)
        forwards;
}


/* ======================================================
   EFEITO ENQUANTO NOCTUS "FALA"
   ====================================================== */

#ma-noctus-speech.ma-noctus-speaking {

    animation:
        noctusSpeechIn 0.55s cubic-bezier(.18,.89,.32,1.28) forwards,
        noctusSpeechGlow 1.4s ease-in-out 0.55s infinite;
}


/* ======================================================
   ENTRADA DO BALÃO
   ====================================================== */

@keyframes noctusSpeechIn {

    0% {
        opacity: 0;
        transform:
            translateX(25px)
            scale(0.92);
    }

    60% {
        opacity: 1;
        transform:
            translateX(-4px)
            scale(1.02);
    }

    100% {
        opacity: 1;
        transform:
            translateX(0)
            scale(1);
    }
}


/* ======================================================
   BRILHO DE "VOZ"
   ====================================================== */

@keyframes noctusSpeechGlow {

    0% {
        box-shadow:
            0 8px 30px rgba(0, 0, 0, 0.75),
            0 0 12px rgba(201, 162, 77, 0.12);
    }

    50% {
        box-shadow:
            0 8px 30px rgba(0, 0, 0, 0.75),
            0 0 25px rgba(201, 162, 77, 0.32);
    }

    100% {
        box-shadow:
            0 8px 30px rgba(0, 0, 0, 0.75),
            0 0 12px rgba(201, 162, 77, 0.12);
    }
}


/* ======================================================
   TEXTO - EFEITO DE VOZ
   ====================================================== */

#ma-noctus-speech-text {
    display: block;
    max-width: 100%;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

/*
 * Cada palavra é indivisível para o navegador.
 * A quebra de linha acontece somente entre palavras,
 * nunca no meio de uma palavra como "assistente".
 */
.ma-noctus-word {
    display: inline-block;
    white-space: nowrap;
}


/*
 * Cada letra aparece como se estivesse sendo pronunciada
 */

.ma-noctus-letter {
    display: inline-block;

    opacity: 0;

    transform:
        translateY(4px)
        scale(0.96);

    animation: noctusLetter 0.12s ease forwards;
}


/* ======================================================
   ANIMAÇÃO DAS LETRAS
   ====================================================== */

@keyframes noctusLetter {

    0% {
        opacity: 0;
        transform:
            translateY(5px)
            scale(0.94);
        filter: blur(3px);
    }

    60% {
        opacity: 1;
        transform:
            translateY(-1px)
            scale(1.03);
        filter: blur(0);
    }

    100% {
        opacity: 1;
        transform:
            translateY(0)
            scale(1);
        filter: blur(0);
    }
}


/* ======================================================
   MOBILE
   ====================================================== */

@media (max-width: 600px) {

    #ma-noctus-speech {

        right: 125px;
        bottom: 40px;

        width: min(270px, calc(100vw - 145px));
        max-width: none;

        padding: 12px 14px;

        font-size: 11px;
        line-height: 1.45;

        border-radius: 14px;
    }

    #ma-noctus-speech::after {

        right: -8px;
        bottom: 20px;

        width: 14px;
        height: 14px;
    }
}

/* ==========================================================
   EASTER EGG — FLASH DO MESTRE NOCTUS
   Sobrepõe todo o site, mas nunca bloqueia cliques ou toque.
   ========================================================== */

#ma-noctus-easter-egg {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

#ma-noctus-easter-egg img {
    display: block;
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

#ma-noctus-easter-egg.ma-noctus-easter-egg-active {
    display: flex;
    animation: maNoctusEasterEggFlash 2.8s ease-in-out forwards;
}

@keyframes maNoctusEasterEggFlash {
    0% {
        opacity: 0;
    }

    18% {
        opacity: 1;
    }

    62% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    #ma-noctus-easter-egg.ma-noctus-easter-egg-active {
        animation-duration: 0.35s;
    }
}
