:root {
    --primary-color: #00ff88;
    --primary-dark: #00cc6a;
    --dark-color: #121212;
    --darker-color: #0a0a0a;
    --light-color: #f5f5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    background-color: var(--darker-color);
    color: var(--light-color);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--dark-color);
    padding: 1.5rem;
    border-right: 2px solid var(--primary-color);
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    right: 0;
    left: auto;
    border-right: none;
    border-left: 2px solid var(--primary-color);
}

.sidebar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
}

.sidebar-header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.sidebar-header p {
    color: var(--light-color);
    opacity: 0.8;
    font-size: 0.9rem;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.trail-selection-container h2,
.map-options h2 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

#trail-selection {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.trail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trail-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.trail-item label {
    cursor: pointer;
}

#basemap-selector {
    width: 100%;
    padding: 0.5rem;
    background-color: #1e1e1e;
    border: 1px solid #333;
    color: var(--light-color);
    border-radius: 4px;
    margin-bottom: 1rem;
}

#basemap-selector:focus {
    outline: none;
    border-color: var(--primary-color);
}

#locate-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: var(--darker-color);
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#locate-btn:hover {
    background-color: var(--primary-dark);
}

/* Mapa */
#map {
    flex: 1;
    height: 100%;
    background-color: var(--dark-color);
}

/* Menu Mobile */
#mobile-menu-btn {
    display: none;
}

/* Modal de Boas-Vindas */
.welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.welcome-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--dark-color);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--light-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--primary-color);
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-features {
    text-align: left;
    margin: 1.5rem 0;
}

.modal-features li {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: flex-start;
}

.feature-icon {
    color: var(--primary-color);
    margin-right: 10px;
    font-size: 1.2rem;
}

#dont-show-again {
    margin-right: 8px;
    accent-color: var(--primary-color);
}

.dont-show-label {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.start-button {
    background-color: var(--primary-color);
    color: var(--darker-color);
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.2s;
}

.start-button:hover {
    background-color: var(--primary-dark);
}

/* Responsivo */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        right: auto;
        left: 0;
        height: 100%;
        width: 100%;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-content,
    .trail-selection-container,
    .map-options,
    .sidebar-header,
    .sidebar-header h1,
    .sidebar-header p,
    .trail-selection-container h2,
    .map-options h2,
    #basemap-selector,
    #locate-btn,
    .trail-item label,
    .weather-widget,
    .centered-trail-name,
    .load-status,
    .warning,
    .error,
    .error-detail {
        text-align: right;
    }

    .sidebar-header h1 {
        margin-top: 50px;
    }

    .centered-trail-name {
        display: none !important;
    }

    #mobile-menu-btn {
        display: block;
        text-align: right;
    }

    .sidebar-header h1 {
        margin-top: 50px;
    }

    .centered-trail-name {
        display: none !important;
    }

    #mobile-menu-btn {
        display: block;
        position: absolute;
        top: 15px;
        left: 60px; /* Posicionado à direita do controle de zoom (que fica na esquerda) */
        right: auto;
        z-index: 1500;
        background: var(--primary-color);
        color: var(--darker-color);
        border: none;
        border-radius: 8px;
        padding: 8px 16px;
        font-size: 1.5rem;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    /* Ajustes para o modal em mobile */
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }
}

/* Botão de fechar sidebar */
#close-sidebar-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-color);
    color: var(--darker-color);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2000;
}

.leaflet-control-zoom {
    z-index: 100;
}

/* Estilo para os popups */
.leaflet-popup-content {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    max-height: 400px;
    max-width: 500px;
    overflow-y: auto;
    overflow-x: hidden;
}

.leaflet-popup-content-wrapper {
    max-width: 520px;
}

.leaflet-popup-content h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.leaflet-popup-content p {
    margin-bottom: 0.3rem;
}

.loading {
    color: var(--primary-color);
    text-align: center;
    padding: 1rem;
    font-style: italic;
}

.warning {
    color: orange;
    text-align: center;
    padding: 1rem;
}

.error {
    color: #ff4444;
}

.trail-item.error {
    background-color: rgba(255, 0, 0, 0.1);
    padding: 8px;
    border-left: 3px solid #ff4444;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-icon {
    font-size: 1.2em;
}

.error-detail {
    font-size: 0.8em;
    opacity: 0.8;
}

.load-status {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
    text-align: center;
    font-size: 0.9em;
    color: #aaa;
}

.weather-widget {
    background: var(--dark-color);
    color: var(--light-color);
    padding: 12px;
    margin: 12px 0;
    border-radius: 8px;
    font-size: 1rem;
    text-align: left;
}

.centered-trail-name {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    /* centraliza */
    right: auto;
    /* garante que não “puxe” p/ a direita */
    z-index: 1200;
    background: rgba(18, 18, 18, 0.85);
    color: var(--primary-color);
    padding: 8px 24px;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 600;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    max-width: 80vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.3s;
}


.share-trail-btn {
    background: var(--primary-color);
    color: var(--darker-color);
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.95rem;
    cursor: pointer;
}

.share-trail-btn:hover {
    background: var(--primary-dark);
}

/* Destaca a opção selecionada no dropdown de trilhas */
#trail-dropdown option:checked {
    background: var(--primary-color);
    color: var(--darker-color);
    font-weight: bold;
}


/* Estilos para as imagens na sidebar */
.sidebar-images {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    align-items: center;
    /* centraliza horizontalmente */
}

.sidebar-img {
    width: 100%;
    /* ocupa toda a largura disponível */
    max-width: 200px;
    /* limite opcional para não ficar gigante em telas grandes */
    height: auto;
    /* mantém a proporção da imagem */
    border-radius: 6px;
    display: block;
    border: 5px solid #fff;
    /* borda branca */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    /* sombra opcional p/ destacar */
}


/* Ajustes para telas menores */
@media (max-width: 768px) {
    .sidebar-images {
        gap: 0.6rem;
    }
}











/* Modal de Colaboração */
.collaboration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.collaboration-modal.active {
    opacity: 1;
    visibility: visible;
}

.collaboration-content {
    background-color: var(--dark-color);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.collaboration-step {
    display: none;
}

.collaboration-step.active {
    display: block;
}

.category-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.category-btn {
    padding: 1rem;
    background-color: #1e1e1e;
    border: 2px solid #333;
    border-radius: 8px;
    color: var(--light-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.category-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.category-btn.selected {
    border-color: var(--primary-color);
    background-color: rgba(0, 255, 136, 0.1);
}






.map-selection-container {
    height: 300px;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #333;
}


/* Estilos específicos para o mapa de colaboração */
.map-selection-container {
    height: 300px;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #333;
    position: relative;
}

#collaboration-map {
    width: 100%;
    height: 100%;
}

.collaboration-marker {
    background: transparent !important;
    border: none !important;
    font-size: 24px;
    text-align: center;
}

/* Loading para o mapa */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--primary-color);
    font-weight: 600;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* Garantir que o Leaflet tenha z-index adequado */
.leaflet-container {
    z-index: 1;
}

.confirmation-step {
    text-align: center;
}

.confirmation-details {
    background-color: #1e1e1e;
    padding: 1rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.thank-you-step {
    text-align: center;
}

.thank-you-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.navigation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.nav-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-btn.primary {
    background-color: var(--primary-color);
    color: var(--darker-color);
}

.nav-btn.primary:hover {
    background-color: var(--primary-dark);
}

.nav-btn.secondary {
    background-color: #333;
    color: var(--light-color);
}

.nav-btn.secondary:hover {
    background-color: #444;
}

/* Botão de colaborar na sidebar */
#collaborate-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: var(--darker-color);
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

#collaborate-btn:hover {
    background-color: var(--primary-dark);
}


/* Estilos específicos para o mapa de colaboração */
#collaboration-map {
    width: 100%;
    height: 300px;
    border-radius: 8px;
}

.collaboration-marker {
    background: transparent !important;
    border: none !important;
    font-size: 24px;
    text-align: center;
}

/* Garantir que o mapa fique visível quando o modal abrir */
.collaboration-modal.active #collaboration-map {
    visibility: visible;
}

/* Loading para o mapa */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--primary-color);
    font-weight: 600;
}


/* No seu CSS, adicione estas regras */
#collaboration-map {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
}

#collaboration-map .leaflet-container {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Garantir que o modal tenha z-index adequado */
.collaboration-modal {
    z-index: 3000;
}

/* Quando o modal estiver ativo, garantir que o mapa seja visível */
.collaboration-modal.active #collaboration-map {
    visibility: visible;
}


/* Controle do Heatmap (lado direito, alto z-index) */
.leaflet-control.heat-tools {
    background: rgba(18, 18, 18, 0.9);
    color: #fff;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    min-width: 230px;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    line-height: 1.2;
    position: relative;
    z-index: 1500;
    /* acima do zoom e de outros overlays */
}

.heat-tools .heat-tools-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--primary-color);
}

.heat-tools label {
    display: block;
    cursor: pointer;
    margin: 4px 0;
}

.heat-tools input[type="radio"] {
    margin-right: 6px;
    accent-color: var(--primary-color);
}

/* margem do canto superior direito */
.leaflet-top.leaflet-right .leaflet-control.heat-tools {
    margin-top: 12px;
    margin-right: 12px;
}

/* Estilo para o controle do heatmap */
.heatmap-control {
    background: rgba(18, 18, 18, 0.9) !important;
    border: 2px solid var(--primary-color) !important;
    border-radius: 8px !important;
    display: flex;
    flex-direction: column-reverse;
    /* Faz expandir para cima */
    gap: 8px;
    margin-bottom: 20px !important;
    /* Afasta um pouco da borda inferior */
    margin-left: 10px !important;
}

@media (max-width: 768px) {
    .heatmap-control {
        max-height: 50vh;
        overflow-y: auto;
        margin-bottom: 60px !important; /* Espaço extra para não colar no fundo */
    }

    .heatmap-cat-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

#heatmap-toggle-btn {
    background-color: var(--primary-color);
    color: var(--darker-color);
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    transition: all 0.3s ease;
}

#heatmap-toggle-btn:hover {
    background-color: var(--primary-dark);
    transform: scale(1.05);
}

#heatmap-toggle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#heatmap-categories {
    margin-top: 0;
    /* Remove margem antiga */
    margin-bottom: 8px;
    /* Adiciona espaço entre categorias e botão */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.heatmap-cat-btn {
    background-color: #1e1e1e;
    color: var(--light-color);
    border: 2px solid #333;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    width: 100%;
    text-align: left;
}

.heatmap-cat-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background-color: rgba(0, 255, 136, 0.1);
    transform: translateX(-2px);
}

.heatmap-cat-btn.active {
    background-color: var(--primary-color);
    color: var(--darker-color);
    border-color: var(--primary-color);
}

.heatmap-cat-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.heatmap-cat-btn.no-selection {
    background-color: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
    font-weight: 700;
}

.heatmap-cat-btn.no-selection:hover:not(:disabled) {
    background-color: #ff5252;
    border-color: #ff5252;
}

.heatmap-cat-btn.active {
    background-color: var(--primary-color);
    color: var(--darker-color);
    border-color: var(--primary-color);
}

.heatmap-cat-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.heatmap-cat-btn.no-selection {
    background-color: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
    font-weight: 700;
}

.heatmap-cat-btn.no-selection:hover:not(:disabled) {
    background-color: #ff5252;
    border-color: #ff5252;
}