/* ══════════════════════════════════════════
   1. SEU DESKTOP ORIGINAL (MELHORADO & ADAPTADO)
   ══════════════════════════════════════════ */
body, html {
  margin: 0; padding: 0; height: 100%; width: 100%;
  font-family: Arial, sans-serif; overflow: hidden;
}

h1 {
  text-align: center; margin: 0 !important; padding: 18px 0;
  font-size: 36px; font-weight: 800; color: #2E7D32;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.15); background: white;
  position: relative; z-index: 10;
  letter-spacing: 0.5px;
}

.container {
    display: flex;
    width: 100%;
    height: calc(100vh - 77px - 40px); /* Compensando o h1 e rodapé maiores */
}

/* Ocupa todo o espaço restante ao lado da barra lateral */
.map-wrapper {
    flex: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* O mapa preenche completamente o wrapper de fundo */
.map {
    width: 100%;
    height: 100%;
    background-color: #e5e3df;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 320px !important; /* Ganhou mais espaço para evitar quebra de linhas desnecessárias */
    height: 100%;
    background-color: #fcfcfc; 
    padding: 20px;
    box-shadow: -3px 0 8px rgba(0,0,0,0.12);
    display: flex !important;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    border-left: 1px solid #bbb;
    box-sizing: border-box !important;
}

fieldset { 
    margin-bottom: 22px; 
    border: 2px solid #2E7D32; /* Linha mais espessa para delimitação clara */
    padding: 16px; 
    border-radius: 6px; 
    background: #ffffff;
}

legend { 
    font-weight: 800; 
    font-size: 16px; /* Fonte aumentada e bem destacada */
    color: #1b5e20; 
    padding: 0 8px;
}

/* 👉 LEGIBILIDADE MÁXIMA NA SIDEBAR */
.sidebar label {
    display: block;
    font-size: 16px; /* Aumentado */
    font-weight: 800;
    color: #111111; /* Preto de alto contraste */
    margin-bottom: 12px;
    line-height: 1.4;
    white-space: nowrap; /* Impede a quebra de linha de qualquer forma */
}

.sidebar select {
    width: 100%;
    padding: 12px;
    font-size: 16px; /* Aumentado */
    font-weight: 700; /* Texto em negrito dentro do seletor */
    color: #000000; 
    border: 2px solid #555;
    border-radius: 6px;
    background-color: #fff;
    margin-bottom: 12px;
    box-sizing: border-box;
    cursor: pointer;
}

/* Opções de dentro do menu cascata */
.sidebar select option {
    font-size: 15px; /* Garante que a lista suspensa ao abrir também fique grande */
    font-weight: 600;
    color: #000000;
}

/* Botão principal da Sidebar */
.sidebar button {
    display: block; 
    width: 100%; 
    margin: 10px 0;
    padding: 14px 10px; /* Aumentado o respiro do botão */
    font-size: 15px; /* Letras do botão maiores */
    font-weight: 800; 
    color: #fff; 
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    border: none; 
    border-radius: 6px; 
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: opacity 0.2s;
}

button:hover {
    opacity: 0.95;
}

#distance { 
    margin-top: 15px; 
    font-size: 18px; /* Destaque no resultado */
    font-weight: 800; 
    text-align: center; 
    color: #2E7D32; 
}

.instrucoes {
    cursor: pointer !important;
    padding: 14px;
    background: #dfdfdf; 
    margin-top: 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: 800;
    font-size: 15px; /* Aumentado */
    color: #1b5e20; 
    z-index: 10001 !important;
    border: 1px solid #bbb;
    margin-bottom: 65px !important; 
}

/* 👉 RODAPÉ COM MAIOR VISIBILIDADE */
footer {
  position: fixed !important; bottom: 0; left: 0;
  width: 100%; height: 40px; background: #000; /* Levemente mais alto */
  display: flex; justify-content: center; align-items: center;
  z-index: 999999 !important;
}
footer a { 
  color: #fff; 
  text-decoration: none; 
  font-size: 13px; /* Aumentado de 11px para 13px */
  margin: 0 20px; 
  font-weight: 700; 
  letter-spacing: 0.3px;
}
footer a:hover {
  text-decoration: underline;
}

/* ══════════════════════════════════════════
   2. ESTILO DOS MODAIS
   ══════════════════════════════════════════ */
.modal {
    display: none; position: fixed; z-index: 20000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fff; margin: 5% auto; padding: 25px;
    width: 85%; max-width: 500px; border-radius: 10px; position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
#streetviewContainer { width: 100%; height: 350px; background: #000; }

/* ══════════════════════════════════════════
   3. MENU SANDUÍCHE (FONTES CORRIGIDAS)
   ══════════════════════════════════════════ */    
.menu-sanduiche {
    position: absolute; 
    top: 18px; 
    left: 15px; 
    z-index: 10005;
}
#menu-check { display: none; }
.menu-icone {
    font-size: 24px; cursor: pointer; background: #fff;
    padding: 6px 14px; border-radius: 4px; border: 1px solid #999;
    color: #2E7D32; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.menu-conteudo {
    position: absolute; top: 48px; left: 0; background: white;
    width: 250px; border-radius: 8px; display: none;
    flex-direction: column; overflow: hidden; border: 1px solid #bbb;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
}
/* Alvo específico para aumentar e clarear os links internos */
.menu-conteudo a { 
    padding: 16px 18px; 
    text-decoration: none; 
    color: #000000; /* Preto puro */
    font-size: 15px; /* Aumentado consideravelmente */
    font-weight: 700; /* Mais encorpado */
    border-bottom: 1px solid #eee; 
    line-height: 1.2;
}
.menu-conteudo a:hover {
    background-color: #f5f5f5;
}
#menu-check:checked ~ .menu-conteudo { display: flex; }

/* ══════════════════════════════════════════
   4. MÁSCARA FOSCA E MOLDURA DE CAPTURA (PROPORÇÃO 4:3)
   ══════════════════════════════════════════ */
.map-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5;
    pointer-events: none; 
    display: flex;
    align-items: center;
    justify-content: center;
}

.capture-frame-43 {
    width: 85%;                 
    max-width: 900px;           
    aspect-ratio: 4 / 3;        
    border: 3.5px dashed #FFEB3B; 
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.45); 
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.frame-label {
    background: rgba(0, 0, 0, 0.85);
    color: #FFEB3B;
    font-size: 11px;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 0 0 6px 6px;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

button:disabled {
    background: #a5cca5 !important;
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
}

/* ══════════════════════════════════════════
   5. ADAPTAÇÃO MOBILE
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
    h1 { font-size: 20px; padding: 12px 0; text-align: center; }

    .menu-sanduiche { 
        top: 125px !important; 
        left: 10px !important; 
    }

    .container { 
        display: block; 
        position: relative;
        height: calc(100vh - 44px - 40px);
    }
    
    .sidebar {
        position: absolute; 
        right: 5px; 
        top: 10px; 
        width: 145px !important; 
        background: #fdfdfd;
        border: 1px solid #999; 
        border-radius: 8px; 
        padding: 10px 6px;
        z-index: 10000;
        display: flex !important; 
        flex-direction: column;
        max-height: calc(100vh - 120px); 
        overflow-y: auto !important; 
        -webkit-overflow-scrolling: touch;
    }

    .sidebar fieldset { padding: 6px 4px; margin-bottom: 8px; border-width: 1px; }
    .sidebar label { font-size: 12px; margin-bottom: 4px; }
    .sidebar select { padding: 6px 4px; font-size: 12px; margin-bottom: 6px; }
    
    .sidebar button { 
        padding: 8px 4px; 
        font-size: 11px; 
        line-height: 1.1;
        margin: 4px 0;
    }

    .capture-frame-43 {
        width: 90vw;
        max-width: none;
    }

    .modal-content {
        margin: 10px auto;
        width: 92%;
        padding: 15px;
    }

    @media (orientation: landscape) {
        h1 { display: none !important; }
        .container { height: calc(100vh - 40px); }
        
        .sidebar { 
            top: 5px !important; 
            max-height: calc(100vh - 45px); 
            width: 160px !important; 
        }

        .menu-sanduiche { 
            top: 15px !important; 
            left: 220px !important; 
        }
        
        .capture-frame-43 {
            width: 45vw; 
        }
    }
}

/* Correção para o Menu Sanduíche em telas deitadas (Modo Paisagem) */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .menu-sanduiche {
        position: absolute;
        top: 10px;
        left: 10px;
        z-index: 1010; /* Fica acima da moldura do mapa */
    }

    /* Ajusta o tamanho do ícone de três listras para não ocupar muito espaço */
    .menu-icone {
        font-size: 20px;
        padding: 5px 8px;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 4px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }
}

/* 📱 AJUSTE EXCLUSIVO PARA MOBILE (Telas de até 768px) */
@media screen and (max-width: 768px) {
    
    /* Clareia a opacidade da máscara ao redor da moldura amarela */
    .map-overlay {
        background-color: rgba(0, 0, 0, 0.25) !important; 
        /* Se o seu CSS original usava uma opacidade alta (como 0.6 ou 0.7), 
           mudar para 0.25 vai deixar o fundo bem mais visível e limpo */
    }

    /* Opcional: Se a própria moldura estiver muito grossa atrapalhando, 
       podemos suavizar a linha tracejada no celular */
    .capture-frame-43 {
        border: 2px dashed #ffeb3b !important; /* Linha um pouco mais fina */
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25) !important; /* Garante o clareamento da extensão */
    }
    
    /* Deixa o texto de aviso da moldura menor para não disputar espaço com os rios/ruas */
    .frame-label {
        font-size: 9px !important;
        padding: 2px 6px !important;
    }
}


/* ══════════════════════════════════════════
   6. AJUSTE DE POSIÇÃO DOS CONTROLES DO GOOGLE
   ══════════════════════════════════════════ */

/* Aplica o recuo apenas em Computadores/Desktops (onde a sidebar fica na direita) */
@media screen and (min-width: 1025px) {
    
    /* Afasta o seletor Mapa/Satélite para a esquerda da barra lateral */
    .gm-style-mtc {
        margin-right: 170px !important; /* Largura da sidebar (320px) + 20px de respiro */
        margin-bottom: 100px !important; /* Ajusta a altura acima do rodapé */
    }

    /* Remove a margem antiga dos botões individuais para eles colarem de volta */
    .gm-style-mtc {
        margin-right: 0px !important;
    }

    /* Afasta também os botões nativos de Zoom (+ e -) para não ficarem escondidos */
    .gm-bundled-control-on-bottom {
        margin-right: 170px !important;
        margin-bottom: 100px !important;
    }
}