/* ==========================================================================
   INFINITEL PROJETOS - ESTILO GERAL UNIFICADO (V200 - CLEAN & FIX)
   Tema: Dark Premium (Azul Profundo + Roxo/Rosa)
   ========================================================================== */

:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --border-color: #334155;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    /* Gradientes da Marca */
    --grad-main: linear-gradient(135deg, #58249e, #f50057);
    --grad-hover: linear-gradient(135deg, #7c3aed, #ff4081);
    
    /* Z-Index Layers (Hierarquia Visual) */
    --z-map: 1;
    --z-ui-base: 100;    /* Botões do mapa */
    --z-panels: 1000;    /* Sidebars */
    --z-modals: 5000;    /* Janelas Pop-up */
    --z-overlay: 999999; /* Editores flutuantes críticos */
}

html, body {
    height: 100%; margin: 0; padding: 0;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden; /* Impede scroll da página inteira */
}

/* ==========================================================================
   LAYOUT PRINCIPAL (MAPA E DIVISÃO)
   ========================================================================== */
.map-container {
    position: absolute; inset: 0; z-index: var(--z-map);
}

#map-sv-split {
    display: flex; width: 100%; height: 100%;
}

#map-pane { flex: 1; position: relative; }
#sv-pane { flex: 1; position: relative; border-left: 4px solid var(--border-color); }

#map, #street-view { width: 100%; height: 100%; }

/* ==========================================================================
   MENU DOCK (BOTÕES REDONDOS SUPERIORES)
   ========================================================================== */
#main-dock {
    position: fixed; top: 15px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 15px; z-index: var(--z-ui-base);
    pointer-events: none; /* Permite clicar no mapa entre os botões */
}

.dock-btn {
    pointer-events: auto;
    width: 54px; height: 54px; border-radius: 50%;
    background-image: var(--grad-main);
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    color: white; font-size: 24px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dock-btn:hover { transform: scale(1.1) translateY(-2px); filter: brightness(1.1); }
.dock-btn:active { transform: scale(0.95); }

/* Menus Suspensos dos Botões */
.dock-menu {
    pointer-events: auto;
    position: absolute; top: 75px; left: 50%; transform: translateX(-50%);
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 12px; padding: 8px;
    display: none; flex-direction: column; gap: 5px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    z-index: 2000 !important; /* Adicione esta linha! */
}

.dock-menu.show { display: flex; animation: slideDown 0.2s ease; }
@keyframes slideDown { from{opacity:0;transform:translate(-50%,-10px)} to{opacity:1;transform:translate(-50%,0)} }

.dock-title {
    font-size: 11px; text-transform: uppercase; color: var(--text-muted);
    padding: 8px 12px 4px; font-weight: 800; letter-spacing: 0.5px;
}

.dock-item {
    background: transparent; border: none; color: #e2e8f0;
    padding: 10px 14px; text-align: left; border-radius: 8px;
    font-size: 14px; font-weight: 500; cursor: pointer;
    display: flex; align-items: center; gap: 12px; transition: 0.2s;
}

.dock-item:hover { background: rgba(255,255,255,0.1); color: white; transform: translateX(2px); }
.dock-item span { width: 24px; text-align: center; font-size: 18px; }
.dock-sep { border-top: 1px solid var(--border-color); margin: 4px 0; }

/* ==========================================================================
   SIDEBARS (MEUS PROJETOS)
   ========================================================================== */
.sidebar {
    position: fixed; top: 0; bottom: 0; right: 0; width: 340px;
    background: var(--bg-panel); z-index: var(--z-panels);
    box-shadow: -5px 0 30px rgba(0,0,0,0.5);
    transform: translateX(100%); transition: transform 0.3s ease;
    border-left: 1px solid var(--border-color);
    display: flex; flex-direction: column;
}
.sidebar.show { transform: translateX(0); }

/* Sidebar Esquerda (Clientes) */
#clients-sidebar {
    left: 0; right: auto; border-right: 1px solid var(--border-color); border-left: none;
    transform: translateX(-100%);
}
#clients-sidebar.show { transform: translateX(0); }

.sidebar-header {
    background-image: var(--grad-main); padding: 20px;
    display: flex; justify-content: space-between; align-items: center;
    color: white; font-weight: bold;
}
.sidebar-content { flex: 1; overflow-y: auto; padding: 15px; }

/* Itens da Lista de Projetos */
.client-item { background: rgba(0,0,0,0.2); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.client-header { padding: 12px; cursor: pointer; display: flex; justify-content: space-between; font-weight: bold; }
.client-header:hover { background: rgba(255,255,255,0.05); }
.client-projects { display: none; padding: 5px; background: rgba(0,0,0,0.3); }
.client-item.open .client-projects { display: block; }

.project-entry {
    padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: #cbd5e1;
}
.project-entry:hover { background: rgba(255,255,255,0.05); color: white; }

/* ==========================================================================
   MODAIS E JANELAS FLUTUANTES
   ========================================================================== */
.mgmt-modal {
    display: none; position: fixed; inset: 0; z-index: var(--z-modals);
    background: rgba(0,0,0,0.85); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
}

.mgmt-box {
    background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: 12px; width: 90%; max-width: 1000px;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.mgmt-head {
    padding: 15px 20px; background-image: var(--grad-main);
    display: flex; justify-content: space-between; align-items: center;
    border-radius: 12px 12px 0 0;
}
.mgmt-title { font-weight: bold; font-size: 16px; color: white; text-transform: uppercase; }
.btn-close { background: none; border: none; color: white; font-size: 24px; cursor: pointer; }

.mgmt-body { padding: 20px; overflow-y: auto; flex: 1; }
.mgmt-foot { padding: 15px 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

/* Inputs e Botões Gerais */
.inp-field {
    width: 100%; background: #0f172a; border: 1px solid var(--border-color);
    color: white; padding: 10px; border-radius: 6px; box-sizing: border-box;
}
.inp-field:focus { outline: none; border-color: #f50057; }
.inp-label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; font-weight: bold; }

.btn { padding: 10px 16px; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; color: white; transition: 0.2s; }
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-g { background: #10b981; } /* Verde */
.btn-r { background: #ef4444; } /* Vermelho */
.btn-b { background: #3b82f6; } /* Azul */
.bg-purple { background: #8b5cf6; }

/* ==========================================================================
   EDITORES ESPECÍFICOS (POLÍGONO, ETC)
   ========================================================================== */
/* Força o Z-Index Máximo para não sumir atrás do mapa */
#poly-editor {
    z-index: var(--z-overlay) !important;
}

/* ==========================================================================
   INFO WINDOW DO GOOGLE MAPS (CUSTOMIZADA)
   ========================================================================== */
.gm-style .gm-style-iw-c {
    background-color: var(--bg-panel) !important;
    padding: 0 !important; border-radius: 8px !important;
    border: 1px solid var(--border-color);
}
.gm-style .gm-style-iw-t::after { display: none; }
.gm-ui-hover-effect { display: none !important; }

.info-window-content { width: 260px; padding-bottom: 10px; }
.iw-header {
    background-image: var(--grad-main); padding: 10px; color: white;
    font-weight: bold; font-size: 14px; display: flex; justify-content: space-between;
}
.iw-body { padding: 10px; }
.iw-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.iw-input { width: 100%; background: #0f172a; border: 1px solid #444; color: white; padding: 4px; border-radius: 4px; }

/* ==========================================================================
   BARRA DE BUSCA (LUPA)
   ========================================================================== */
#search-fab-container {
    position: fixed; left: 20px; bottom: 200px; z-index: var(--z-ui-base);
    width: 50px; height: 50px; border-radius: 25px;
    background-image: var(--grad-main);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: flex-end;
    transition: width 0.3s ease; overflow: hidden;
}
#search-fab-container.open { width: 300px; background: var(--bg-panel); border: 1px solid #f50057; }

#search-fab-input {
    flex: 1; height: 100%; background: transparent; border: none;
    color: white; padding-left: 15px; outline: none; opacity: 0;
}
#search-fab-container.open #search-fab-input { opacity: 1; }

#search-fab-btn {
    width: 50px; height: 50px; background: transparent; border: none;
    color: white; font-size: 20px; cursor: pointer;
}

/* ==========================================================================
   UTILITÁRIOS E SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #f50057; }

/* Ajuste para telas pequenas */
@media (max-width: 768px) {
    #main-dock { top: auto; bottom: 20px; width: 100%; justify-content: center; }
    .dock-menu { bottom: 80px; top: auto; }
    .sidebar { width: 100%; }
}

/* --- CORREÇÃO DO MENU DESENHO (GRADE 4 COLUNAS) --- */
    
    /* Quando o menu #menu-desenho estiver aberto (.show) */
    #menu-desenho.show {
        display: grid !important;          /* Ativa modo grade */
        grid-template-columns: repeat(4, 1fr); /* 4 Colunas iguais */
        width: 700px !important;           /* Força largura grande */
        max-height: 80vh;                  /* Altura máxima da tela */
        overflow-y: auto;                  /* Barra de rolagem se precisar */
        gap: 6px;                          /* Espaço entre botões */
        padding: 10px;
    }

    /* Faz os Títulos, Separadores e Divs internas ocuparem a largura total */
    #menu-desenho .dock-title,
    #menu-desenho .dock-sep,
    #menu-desenho > div {
        grid-column: 1 / -1; /* Ocupa de ponta a ponta */
        width: 100%;
    }

    /* Estilo dos botões para ficarem bonitos na grade */
    #menu-desenho .dock-item {
        display: flex;
        flex-direction: column; /* Ícone em cima, texto embaixo */
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: normal;    /* Permite quebrar o texto */
        height: 60px;           /* Altura fixa */
        padding: 5px;
        font-size: 11px;
        line-height: 1.2;
    }
    
    /* Pequeno ajuste para as divs internas que você já usava grid (Cordoalhas, etc) */
    #menu-desenho > div[style*="grid"] {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important; /* Mantém 4 colunas dentro */
        gap: 6px;
    }

    /* --- CORREÇÃO DO MENU GESTÃO (IGUAL AO DESENHAR) --- */
    
    #menu-gestao.show {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr); /* 4 Colunas */
        width: 600px !important;           /* Largura Grande */
        max-height: 80vh;
        overflow-y: auto;
        gap: 6px;
        padding: 10px;
    }

    /* Títulos e Separadores ocupam largura total */
    #menu-gestao .dock-title,
    #menu-gestao .dock-sep,
    #menu-gestao > div,
    #menu-gestao > button { /* Garante que botões soltos (como Medição) estiquem */
        grid-column: 1 / -1; 
        width: 100%;
    }

    /* Estilo dos botões */
    #menu-gestao .dock-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: normal;
        height: 60px;
        padding: 5px;
        font-size: 11px;
        line-height: 1.2;
    }

    /* Ajuste para as grades internas (Financeiro/Dados) */
    #menu-gestao > div[style*="grid"] {
        display: grid !important;
        /* Se tiver 3 botões, usa 3 colunas, se tiver 4, usa 4 */
        width: 100%; 
    }

    /* --- CORREÇÃO DO MENU REDE (GRADE) --- */
    #menu-rede.show {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr);
        width: 500px !important; /* Um pouco menor que os outros */
        max-height: 80vh;
        overflow-y: auto;
        gap: 6px;
        padding: 10px;
    }
    
    #menu-rede .dock-title, #menu-rede .dock-sep, #menu-rede > div, #menu-rede > button {
        grid-column: 1 / -1; width: 100%;
    }

    #menu-rede .dock-item {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        text-align: center; white-space: normal; height: 60px; padding: 5px; font-size: 11px; line-height: 1.2;
    }
    
    #menu-rede > div[style*="grid"] { display: grid !important; width: 100%; }

    /* --- HIERARQUIA DE CAMADAS (Z-INDEX) --- */

/* NO SEU style.css */

/* CAMADA BAIXA: Apenas acima do mapa */
#tool-indicator {
    display: none;
    position: fixed !important;
    bottom: 80px !important;   
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 5 !important; /* Agora sim, ele mergulha sob o menu! */
    
    /* RECOLOQUEI O VISUAL QUE FALTAVA PARA ELE NÃO FICAR INVISÍVEL */
    background-color: rgba(30, 41, 59, 0.95) !important; 
    color: #fff !important; 
    padding: 10px 20px !important;
    border-radius: 30px !important; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    border: 1px solid #3b82f6 !important; 
    align-items: center !important; 
    gap: 10px !important; 
    font-size: 14px !important;
    pointer-events: none !important; /* Evita que ele bloqueie cliques */
}

#tool-indicator span { font-weight: bold; pointer-events: auto; }
.spinner { border: 2px solid #f3f3f3; border-top: 2px solid #3b82f6; border-radius: 50%; width: 12px; height: 12px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* CAMADA MÉDIA: Menus e botões principais */
.dock, #main-dock {
    z-index: 1000 !important;
    position: fixed !important;
}

.dock-menu {
    z-index: 1100 !important;   /* Fica acima da barra dock */
}

/* CAMADA ALTA: Modais e painéis de consulta */
#rodovia-panel, .modal {
    z-index: 2000 !important;
}

/* ==========================================================================
   RESET E CONFIGURAÇÕES GERAIS
   ========================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; scroll-behavior: smooth; }
body { background: #0f172a; }

/* ==========================================================================
   LANDING PAGE (PÁGINA INICIAL)
   ========================================================================== */
#landing-page {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #0f172a; z-index: 999999; overflow-y: auto;
    color: #e2e8f0; transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}
.access-granted { transform: translateY(-100%); }

.lp-header {
    position: fixed; top: 0; left: 0; width: 100%; padding: 15px 50px;
    display: flex; justify-content: space-between; align-items: center;
    backdrop-filter: blur(12px); background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid #334155; z-index: 100;
}
.lp-logo img { height: 40px; width: auto; display: block; }
.lp-nav { display: flex; gap: 20px; align-items: center; }
.lp-nav a { color: #94a3b8; text-decoration: none; font-weight: 600; font-size: 14px; transition: 0.3s; cursor: pointer; }
.lp-nav a:hover { color: #3b82f6; }

.lp-btn-login {
    padding: 8px 20px; background: transparent; border: 2px solid #3b82f6;
    color: #3b82f6; font-weight: bold; border-radius: 50px; cursor: pointer;
    transition: 0.3s; font-size: 13px;
}
.lp-btn-login:hover { background: #3b82f6; color: white; box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); }

/* SEÇÕES DA LANDING PAGE */
.lp-section { padding: 80px 50px; border-bottom: 1px solid #1e293b; }
.lp-container { max-width: 1200px; margin: 0 auto; }
.lp-bg-alt { background: #1e293b; }
.lp-title { font-size: 36px; font-weight: 800; margin-bottom: 40px; text-align: center; color: white; }
.lp-title span { color: #3b82f6; }
p { line-height: 1.6; color: #cbd5e1; }

/* HERO SECTION */
.lp-hero {
    min-height: 100vh; display: flex; align-items: center; padding-top: 80px;
    background: linear-gradient(135deg, #0f172a 20%, #1e3a8a 100%);
    position: relative; overflow: hidden;
}
.lp-hero::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px);
    background-size: 40px 40px; z-index: 0; pointer-events: none;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}
.hero-content { position: relative; z-index: 1; max-width: 600px; }
.hero-title { font-size: 56px; line-height: 1.1; margin-bottom: 20px; font-weight: 800; color: white; }
.hero-title span { 
    background: linear-gradient(45deg, #3b82f6, #60a5fa);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.hero-text { font-size: 18px; margin-bottom: 30px; }
.hero-btns { display: flex; gap: 15px; }

/* GRID E CARDS */
.lp-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.lp-card {
    background: rgba(30, 41, 59, 0.5); padding: 30px; border-radius: 16px;
    border: 1px solid #334155; transition: 0.3s; cursor: default;
}
.lp-card:hover { border-color: #3b82f6; transform: translateY(-5px); box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.2); background: #1e293b; }
.card-icon { font-size: 32px; margin-bottom: 20px; color: #3b82f6; }
.card-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; color: white; }

.lp-footer { background: #0f172a; padding: 50px; text-align: center; border-top: 1px solid #334155; }
.footer-info { margin-bottom: 20px; font-size: 14px; }

/* ==========================================================================
   GATEKEEPER (MODAL DE ACESSO)
   ========================================================================== */
#gatekeeper-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); z-index: 1000000;
    display: none; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s;
}
.gate-box {
    background: #1e293b; padding: 40px; border-radius: 16px; text-align: center;
    border: 1px solid #334155; width: 350px; box-shadow: 0 0 50px rgba(59, 130, 246, 0.2);
}
.gate-input {
    width: 100%; padding: 12px; margin: 20px 0; background: #0f172a;
    border: 1px solid #475569; color: white; border-radius: 8px; outline: none; text-align: center; font-size: 16px;
}
.gate-input:focus { border-color: #3b82f6; }
.shake { animation: shake 0.5s; }
@keyframes shake { 0%{transform:translateX(0);} 25%{transform:translateX(5px);} 50%{transform:translateX(-5px);} 75%{transform:translateX(5px);} 100%{transform:translateX(0);} }