/* Variáveis CSS para cores e sombras */
:root {
    --celeste-claro: #E0F2F7; /* Azul celeste muito claro */
    --celeste-medio: #A0DAEB; /* Azul celeste médio */
    --celeste-escuro: #2D8BBD; /* Azul celeste mais escuro, base principal */
    --celeste-muito-escuro: #1A5F8A; /* Azul bem escuro, quase marinho */
    --verde-sucesso: #28a745;
    --cinza-texto: #444;
    --sombra-suave: 0 4px 12px rgba(0, 0, 0, 0.1);
    --sombra-media: 0 6px 15px rgba(0, 0, 0, 0.2);
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    display: flex;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background-color: #f0f0f0;
}

/* Sidebar - Layout e Estilo Moderno */
#sidebar {
    width: 220px; /* Largura para desktop */
    background: linear-gradient(180deg, var(--celeste-escuro) 0%, var(--celeste-muito-escuro) 100%);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
    padding: 20px;
    box-sizing: border-box;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.sidebar-header {
    text-align: center;
    width: 100%; /* Garante que o header ocupe todo o espaço */
}

.app-logo {
    width: 60px;
    height: auto;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.app-title {
    font-size: 2em;
    font-weight: 800;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.app-subtitle {
    font-size: 1.1em;
    font-weight: 300;
    opacity: 0.9;
    margin-top: 5px;
}

/* Mapa */
#map {
    flex: 1;
    height: 100%;
    z-index: 1;
    border: none;
    background-color: var(--celeste-claro);
}

/* Contêiner de Detecção e Mensagem */
#detectionContainer {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px 0;
    box-sizing: border-box;
}

#detectionMessage {
    padding: 12px;
    background-color: var(--celeste-claro);
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    color: var(--celeste-muito-escuro);
    box-shadow: var(--sombra-suave);
    margin-bottom: 15px;
    display: block;
    width: 100%;
    line-height: 1.4;
}

/* Botões de Ação */
.action-button {
    width: 100%;
    padding: 12px 15px;
    font-size: 1em;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: var(--sombra-media);
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

#detectedButton {
    background-color: var(--verde-sucesso);
    color: #fff;
    display: none; /* Inicialmente oculto */
  
}

#detectedButton:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: var(--sombra-suave);
 
}

/* Novo estilo para o botão piscando */
.flash-button {
    animation: flash-animation 1s infinite alternate; /* Animação de piscar */
}

@keyframes flash-animation {
    0% { background-color: var(--verde-sucesso); } /* Começa verde */
    100% { background-color: #dc3545; /* Termina vermelho (cor para piscar) */ }
}

.market-button {
    background-color: #FFD700;
    color: var(--celeste-muito-escuro);
}

.market-button:hover {
    background-color: #e6c200;
    transform: translateY(-2px);
    box-shadow: var(--sombra-suave);
}

.refresh-button {
    background-color: var(--celeste-medio);
    color: #fff;
}

.refresh-button:hover {
    background-color: #60BBEB;
    transform: translateY(-2px);
    box-shadow: var(--sombra-suave);
}

.about-button {
    background-color: #fff;
    color: var(--celeste-escuro);
}

.about-button:hover {
    background-color: var(--celeste-claro);
    transform: translateY(-2px);
    box-shadow: var(--sombra-suave);
}

/* Container dos botões na sidebar */
.sidebar-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* Estilo para o botão VER ENIGMA */
.view-enigma-button {
    background-color: #8A2BE2; /* Um tom de violeta, por exemplo */
    color: #fff;
}

.view-enigma-button:hover {
    background-color: #6A1BAA;
    transform: translateY(-2px);
    box-shadow: var(--sombra-suave);
}

/* Responsividade: para telas menores que 768px */
@media (max-width: 768px) {
    body {
        flex-direction: column; /* Altera a direção principal para vertical */
    }
    #sidebar {
        width: 100%; /* Ocupa a largura total */
        height: auto;
        padding: 15px;
        flex-direction: column; /* Alinha o conteúdo em coluna */
        justify-content: center;
        align-items: center;
        order: 2; /* Coloca a sidebar na parte inferior, após o mapa */
    }
    .sidebar-header {
        display: flex;
        align-items: center;
        text-align: left;
        margin-bottom: 15px;
        width: 100%;
        justify-content: center;
    }
    .app-logo {
        margin-right: 15px;
        margin-bottom: 0;
    }
    .app-title, .app-subtitle {
        margin: 0;
        text-align: left;
    }
    #detectionContainer {
        width: 100%;
        padding: 0;
        flex-grow: 0;
        margin-bottom: 15px;
    }
    #detectionMessage {
        width: 90%;
        margin: 0 auto;
    }
    .sidebar-buttons {
        flex-direction: column;
        align-items: center;
        width: 90%;
    }
    .action-button {
        width: 100%;
        margin: 5px 0;
    }
    #map {
        order: 1; /* Coloca o mapa na parte superior */
        height: calc(100vh - 200px); /* Ajusta a altura do mapa para acomodar a sidebar */
    }
} /* Fechamento correto da media query */

/* --- Pop-up de Instalação (PWA) --- */
#installPrompt {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.prompt-content {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    width: 90%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--cinza-texto);
}

.prompt-content p {
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: 600;
}

.prompt-buttons {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

#installButton {
    background-color: var(--celeste-escuro);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    flex-grow: 1;
    transition: background-color 0.2s ease;
}

#installButton:hover {
    background-color: var(--celeste-muito-escuro);
}

#cancelInstallButton {
    background-color: #f0f0f0;
    color: var(--cinza-texto);
    border: 1px solid #ccc;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    flex-grow: 1;
    transition: background-color 0.2s ease;
}

#cancelInstallButton:hover {
    background-color: #e0e0e0;
}