﻿/* ======================================================= */
/* ===================== VARIÁVEIS ======================= */
/* ======================================================= */
:root {
    --bg: #0f172a;
    --panel: #0b1223;
    --muted: #94a3b8;
    --primary: #22d3ee;
    --accent: #a78bfa;
    --grid: #1e293b;
}

/* ======================================================= */
/* ===================== BASE GERAL ====================== */
/* ======================================================= */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden !important; /* sem rolagem global */
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, 'Helvetica Neue', Arial;
    background-size: auto;
    background-attachment: fixed;
    background-position: center top;
}


/* ======================================================= */
/* ====================== ORB AREA ======================= */
/* ======================================================= */
#orb-stage {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    z-index: 1;
}


#orb-canvas {
    width: min(70vmin, 900px);
    height: min(70vmin, 900px);
    display: block;
    filter: drop-shadow(0 0 40px rgba(56,189,248,.35));
}

/* viewport */
#viewport {
    position: relative;
    z-index: 2;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

/* stack */
#stack {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* ======================================================= */
/* ===================== RAIL CONFIG ===================== */
/* ======================================================= */
.rail {
    position: absolute;
    top: 0;
    height: 100vh;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    display: flex;
    align-items: center;
    will-change: transform, opacity, filter;
    transition: transform .55s cubic-bezier(.2, .7, .1, 1), opacity .45s ease, filter .45s ease;
    opacity: 0;
    filter: blur(10px);
    overflow: hidden;
    pointer-events: none; /* 🔧 evita interação com rails ocultas */
}

/* Cada rail-content ocupa área fixa e redimensiona internamente */
.rail-content {
    position: relative;
    width: clamp(260px, 30vw, 880px);
    max-width: 90vw;
    max-height: 90vh;
    height: auto;
    margin: auto;
    padding: 16px;
    border-radius: 12px;
    transform-origin: center center;
    transition: transform 0.4s ease;
}

/* títulos / textos */
.rail h2 {
    margin: 0 0 8px 0;
    font-size: 1.35rem;
}

.rail p {
    margin: 0;
    line-height: 1.55;
}

/* ======================================================= */
/* =================== ESTADOS / ÂNCORAS ================= */
/* ======================================================= */
.rail.off-left, .rail.enter-left {
    transform: translateX(-110%);
    opacity: 0;
}

.rail.off-right, .rail.enter-right {
    transform: translateX(110%);
    opacity: 0;
}

.rail.anchor-left {
    left: 0;
    width: 50vw !important;
    justify-content: flex-start;
}

.rail.anchor-right {
    right: 0;
    width: 50vw !important;
    justify-content: flex-end;
}

.rail.hidden {
    pointer-events: none !important;
    opacity: 0;
    z-index: 1;
}

.rail.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateX(0) !important;
    pointer-events: auto !important; /* ✅ permite clique apenas na rail visível */
    z-index: 2;
}

/* ======================================================= */
/* ======== AJUSTE DE ÂNCORAS LATERAIS (FINAL) =========== */
/* ======================================================= */

/* Rail esquerda: conteúdo encostado no lado esquerdo */
.rail.anchor-left {
    justify-content: flex-start !important;
    padding-left: 5vw !important; /* distância suave da borda */
    padding-right: 0 !important;
}

/* Rail direita: conteúdo encostado no lado direito */
.rail.anchor-right {
    justify-content: flex-end !important;
    padding-right: 5vw !important; /* distância suave da borda */
    padding-left: 0 !important;
}

/* Garante que o conteúdo dentro de cada rail respeite o alinhamento */
.rail.anchor-left .rail-content {
    margin-left: 0 !important;
    margin-right: auto !important;
}

.rail.anchor-right .rail-content {
    margin-right: 0 !important;
    margin-left: auto !important;
}

/* Mantém a escala sem quebrar o alinhamento */
.rail.anchor-left .rail-content,
.rail.anchor-right .rail-content {
    transform-origin: center center !important;
}

/* Evita qualquer centralização residual */
.rail.visible {
    align-items: center !important;
    justify-content: normal !important;
}

/* ======================================================= */
/* ======== DASHBOARD — AJUSTE DE DIMENSÃO NO RAIL ======= */
/* ======================================================= */

.rail-content .dashboard,
.rail-content .dashboard-row {
    width: 100% !important;
    height: auto !important;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 1rem;
    box-sizing: border-box;
}

/* Garante que o dashboard nunca ultrapasse a área útil */
.rail-content .dashboard {
    max-width: 90vw !important;
    max-height: 85vh !important;
    overflow: hidden !important;
    margin: auto;
}

/* Cards e gráficos se adaptam ao tamanho do rail */
.dashboard .card {
    background-color: #061929;
    border-radius: 8px;
    padding: 1rem;
    flex: 1 1 calc(50% - 1rem);
    min-width: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}
.card {
    opacity: 80%
}

/* Alturas automáticas dos gráficos */
.dashboard .chart-container {
    flex: 1;
    width: 100%;
    height: 100%;
    max-height: 280px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

    .dashboard .chart-container canvas {
        width: 100% !important;
        height: 100% !important;
        max-height: 260px !important;
        object-fit: contain !important;
    }

/* Linha de mapa */
#mapContainer {
    width: 100% !important;
    height: 40vh !important;
    min-height: 240px;
    max-height: 50vh;
    margin: auto;
    background-color: #0f172a;
    border-radius: 8px;
    overflow: hidden;
}

/* Título e legendas */
.dashboard h2,
.dashboard h3 {
    text-align: center;
    color: #00FFFF;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .foto-perfil {
        display: none;
    }
    .fluxo-content {
        justify-content: center;
        flex-direction: column;
    }
}

/* 
@media (max-width: 900px) {
    .dashboard .card {
        flex: 1 1 100%;
    }

    #mapContainer {
        height: 220px !important;
    }

    .dashboard .chart-container canvas {
        max-height: 180px !important;
    }
}*/

/* ======================================================= */
/* === AJUSTES FINAIS DE ALTURA DO DASHBOARD E MAPA ====== */
/* ======================================================= */

/* Gráficos de endpoints (REST / SOAP / MCP) */
#restChart,
#soapChart,
#mcpChart {
    height: 180px !important; /* antes 300px */
    max-height: 200px !important;
}

/* Gráfico geral (API) e LeoAI */
#apiChart,
#chatChart {
    height: 220px !important;
    max-height: 240px !important;
}

/* Containers dos gráficos — impede alongamento */
.chart-container {
    width: 100% !important;
    height: auto !important;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden !important;
}

    .chart-container canvas {
        height: 100% !important;
        max-height: inherit !important;
    }

/* Mapa — limita dentro da tela */
#mapContainer {
    width: 100% !important;
    height: 35vh !important; /* reduzido */
    max-height: 360px !important;
    margin: 0 auto !important;
    background-color: #0f172a;
    border-radius: 8px;
    overflow: hidden;
}

/* Layout geral da linha de gráficos */
.dashboard-row {
    gap: 0.8rem !important;
    margin-bottom: 1rem !important;
}

/* Cards */
.card {
    padding: 0.8rem !important;
    background-color: #061929;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 
@media (max-width: 900px) {
    #restChart,
    #soapChart,
    #mcpChart {
        height: 140px !important;
    }

    #apiChart,
    #chatChart {
        height: 180px !important;
    }

    #mapContainer {
        height: 220px !important;
    }
}*/


/* ======================================================= */
/* === AJUSTE FINO: GRÁFICOS SUPERIORES (API / LEOAI) ==== */
/* ======================================================= */

#apiChart,
#chatChart {
    height: 160px !important; /* antes 220px */
    max-height: 110px !important;
}

/* 
@media (max-width: 900px) {
    #apiChart,
    #chatChart {
        height: 140px !important;
        max-height: 110px !important;
    }
}*/

/* Card e container fixam a altura */
.card.half {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 180px !important; /* controla o espaço real */
    max-height: 180px !important;
    overflow: hidden;
}

    .card.half .chart-container {
        height: 100% !important;
        max-height: 110px !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }

#apiChart,
#chatChart {
    width: 100% !important;
    height: 110px !important;
    max-height: 110px !important;
    object-fit: contain !important;
}

/*
@media (max-width: 900px) {
    .card.half {
        height: 110px !important;
        max-height: 110px !important;
    }

    #apiChart,
    #chatChart {
        height: 110px !important;
        max-height: 110px !important;
    }
}*/



/* ======================================================= */
/* ====================== ANIMAÇÕES ====================== */
/* ======================================================= */
.fade-in {
    animation: fadeIn .8s forwards;
}

.fade-out {
    animation: fadeOut .8s forwards;
}

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

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }

    to {
        opacity: 0;
        transform: translateY(-40px);
        filter: blur(10px);
    }
}

/* ======================================================= */
/* ===================== AUTO SCALE ====================== */
/* ======================================================= */

/* grandes blocos são reescalados automaticamente */
.swagger-sim,
.dashboard-row,
.fluxograma-vertical-wrapper,
.ordem-fluxo-geral,
.app-Tec-section {
    transform: scale(0.85);
    transform-origin: top center;
}
.data-mind-scale {
    transform: scale(0.85);
    transform-origin: top center;
}
.app-scale {
    transform: scale(0.75);
    transform-origin: top center;
}
/*
    @media (max-height: 900px) {
        .rail-content {
        transform: scale(0.95);
    }
}

@media (max-height: 800px) {
    .rail-content {
        transform: scale(0.9);
    }
}

@media (max-height: 700px) {
    .rail-content {
        transform: scale(0.85);
    }
}*/


    /* ======================================================= */
    /* ====================== HUD AJUDA ====================== */
    /* ======================================================= */
    #hud {
        position: fixed;
        bottom: 18px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 8px;
        z-index: 3;
    }

    /* ======================================================= */
    /* ===================== RESPONSIVO ====================== */
    /* ======================================================= */
    /*@media (max-width: 900px) {
    #orb-canvas {
        width: 88vmin;
        height: 88vmin;
    }

    .rail-content {
        transform: scale(0.9);
        transform-origin: top center;
    }
}*/


    @keyframes pulseWave {
        0% {
            transform: scale(1);
            opacity: 1;
        }

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


    .dm-modal {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.75);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
    }

        .dm-modal.hidden {
            display: none;
        }

    /* Caixa do modal com tamanho travado em relação à tela */
    .dm-diagram-box {
        position: relative;
        background: #050816;
        border: 1px solid #22d3ee;
        border-radius: 16px;
        padding: 16px 20px 20px;
        width: min(900px, 90vw);
        height: min(600px, 80vh); /* << altura TRAVADA no viewport */
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
        display: flex;
        flex-direction: column;
        align-items: center;
        overflow: hidden; /* nada de scroll interno */
    }

    /* Título ocupa só um pedacinho fixo em cima */
    .dm-diagram-title {
        width: 100%;
        text-align: center;
        font-size: 1.1rem;
        font-weight: 600;
        color: #e2e8f0;
        margin-bottom: 8px;
        flex: 0 0 auto;
    }

    /* Imagem preenche o resto da caixa, sempre 100% visível */
    .dm-diagram-img {
        flex: 1 1 auto;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain; /* mantém proporção, sem cortar */
    }

    /* Botão X */
    .dm-modal-close {
        position: absolute;
        top: 8px;
        right: 10px;
        border: none;
        background: transparent;
        color: #e2e8f0;
        font-size: 22px;
        cursor: pointer;
        line-height: 1;
    }

        .dm-modal-close:hover {
            color: #22d3ee;
        }

@media (max-width: 768px) {
    .linguagens-selector {
        gap: 0px;
    }

    .fluxo-content {
        transform: scale(0.9);
        gap: 0px;
        align-items:center;
    }
    .intro-fluxograma {
        transform: scale(0.95);
    }
}
