* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: #fff;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Adicionado para responsividade */
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem; /* Adicionado para espaçamento em telas menores */
}

.search-box {
    display: flex;
    gap: 10px;
    flex-wrap: wrap; /* Adicionado para responsividade */
}

.search-box input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex-grow: 1; /* Para ocupar espaço disponível */
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
}

.limpar-btn {
    background-color: #dc3545;
}

.container {
    display: flex;
    flex: 1;
    height: calc(100vh - 70px); /* Ajustar altura se o header crescer */
    flex-direction: row; /* Padrão para telas maiores */
}

.sidebar {
    width: 0;
    background-color: #f8f9fa;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.sidebar.has-results {
    width: 40%;
    padding: 1rem;
    opacity: 1;
    visibility: visible;
}

#map {
    flex: 1;
    height: 100%;
    width: 100%; /* Padrão quando a sidebar não tem resultados */
    transition: width 0.3s ease;
}

.sidebar.has-results + #map {
    width: 60%;
}

#places-list {
    flex: 1;
}

.place-item {
    background: white;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-container {
    flex: 0 0 40px;
    display: flex;
    align-items: center;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.content-container {
    flex: 1;
    min-width: 0; /* Importante para permitir que o conteúdo se ajuste */
}

.contact-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    flex-wrap: wrap; /* Para quebrar em telas menores */
}

.contact-info .phone,
.contact-info .coordinates {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.2rem 0; /* Ajuste para espaçamento quando quebrar linha */
    color: #666;
}

.contact-info .phone {
    text-decoration: none;
    color: #666;
}

.contact-info .coordinates {
    font-family: monospace;
    font-size: 0.85rem;
}

#map {
    flex: 1;
    height: 100%;
    width: 60%;
}

#exportBtn {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #317a33;
    padding: 1rem;
    margin: 0;
    border-radius: 8px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);

}

.place-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.place-item.active {
    border: 2px solid #4CAF50;
}

/* Removendo os estilos do empty-state que não são mais necessários */
.empty-state {
    display: none;
}

.empty-state h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #333;
    font-weight: 500;
}

.empty-state p {
    font-size: 1.2rem;
    line-height: 1.6;
    max-width: 80%;
    margin: 0 auto;
}

#places-list .place-item ~ .empty-state {
    display: none;
}

/* Media Queries para Responsividade */

/* Telas médias (tablets) */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box {
        width: 100%;
        margin-top: 10px;
    }

    .search-box input, .search-box button {
        width: 100%;
        margin-bottom: 10px;
    }

    .search-box button:last-child {
        margin-bottom: 0;
    }
    
    .container {
        flex-direction: column;
        height: auto; /* Altura automática para acomodar conteúdo */
    }

    .sidebar.has-results {
        width: 100%;
        height: 50vh; /* Ou um valor que faça sentido para o seu conteúdo */
        max-height: 50vh; /* Para garantir que não ocupe a tela toda */
        padding: 1rem;
    }

    .sidebar.has-results + #map {
        width: 100%;
        height: 50vh; /* Ocupa o restante da altura da viewport */
    }
    
    #map {
        width: 100%;
        height: 100vh; /* Mapa ocupa toda a altura quando a sidebar está oculta */
    }

    .sidebar.has-results.sidebar-closed + #map {
        height: 100vh; /* Mapa ocupa toda a altura se a sidebar for fechada dinamicamente */
    }
}

/* Telas pequenas (smartphones) */
@media (max-width: 480px) {
    .logo {
        font-size: 1.2rem;
    }

    .sidebar.has-results {
        height: 60vh; /* Mais espaço para a lista em telas muito pequenas */
    }

    .sidebar.has-results + #map {
        height: 40vh;
    }

    .place-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .avatar-container {
        margin-bottom: 0.5rem;
    }

    .contact-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .contact-info .phone,
    .contact-info .coordinates {
        margin-bottom: 0.3rem;
    }

    #exportBtn {
        font-size: 0.9rem;
        padding: 0.8rem;
    }
}
#loginForm h2 {
    margin-bottom: 1.5rem;
}
.login-input {
    padding: 10px;
    border: 2px solid #4CAF50;
    border-radius: 6px;
    margin-bottom: 1rem;
    width: 100%;
    font-size: 1rem;
    transition: border-color 0.3s;
    outline: none;
    background: #f8f9fa;
}
.login-input:focus {
    border-color: #317a33;
    background: #fff;
}
#loginForm button {
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}
#loginForm button:hover {
    background: #317a33;
}
.btn-sair {
    position: fixed;
    bottom: 2%;
    right: 2%;
    z-index: 9999;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}
.btn-sair:hover {
    background: #b52a37;
    transform: scale(1.05);
}