/* Custom styles to ensure modal appears above map */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

/* Tree info panel with position relative to be positioned properly */
#tree-info {
    position: relative;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 1000;
}

/* Ensure Leaflet controls appear below the modal */
.leaflet-control-container {
    z-index: 1000;
}

/* Add to your CSS file or inline style */
#view-details-button {
    display: inline-block;
    text-align: center;
    transition: transform 0.2s ease-in-out;
}

#view-details-button:hover {
    transform: scale(1.05);
}


/* Additional styling for the legend */
.legend-title {
    font-weight: bold;
    margin-bottom: 8px;
}

.legend {
    background: white;
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
}

.legend-item img, .legend-item div {
    margin-right: 8px;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .flex.h-\[calc\(100vh-8rem\)\] {
        flex-direction: column;
    }

    #map {
        height: 80vh !important; /* Give map more space on mobile */
        width: 100% !important;
    }

    /* Make sidebar slide in from bottom */
    #tree-info {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
        max-height: 60vh;
        width: 100% !important;
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: 1000;
    }

    #tree-info.active {
        transform: translateY(0);
    }

    /* Style adjustments for small screens */
    .leaflet-control-zoom {
        margin-bottom: 60px !important; /* Make room for the add button */
    }

    /* Add button visibility */
    #toggle-form-btn {
        z-index: 999;
    }

    /* Tree info close button */
    #tree-info-close-btn {
        display: block;
        position: absolute;
        top: 10px;
        right: 10px;
        background: none;
        border: none;
        cursor: pointer;
    }

    /* Legend adjustments */
    .leaflet-control.info.legend {
        max-width: 200px;
        font-size: 0.9em;
    }

    /* Better mobile form styling */
    .modal-overlay .bg-white {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
}