:root {
    --primary-color: #0066cc;
    --secondary-color: #004d99;
    --background-color: #f5f7fa;
    --text-color: #333;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    height: 100vh;
    overflow: hidden;
}

/* Map styles */
#map {
    width: 100%;
    height: 100vh;
    z-index: 1;
}

.map-container {
    position: relative;
    width: 100%;
    height: 100vh;
}

/* Legend styles */
.legend {
    padding: 12px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    min-width: 280px;
    max-width: 280px;
    position: absolute;
    bottom: 20px;
    right: 10px;
}

.leaflet-right {
    right: 0;
}

.leaflet-bottom {
    bottom: 0;
}

.legend .leaflet-control {
    margin: 0;
    padding: 0;
    width: 100%;
}

.legend select {
    width: 100%;
    padding: 8px;
    margin-bottom: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.legend select:hover {
    border-color: #999;
}

.legend select:focus {
    border-color: #0074d9;
    box-shadow: 0 0 0 2px rgba(0,116,217,0.2);
}

.legend .color-bar {
    height: 8px;
    background: linear-gradient(to right, rgba(0, 102, 204, 0), rgba(0, 102, 204, 0.5));
    border-radius: 4px;
    margin: 8px 0;
}

.legend .legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    margin-bottom: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.legend .attribution {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 11px;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

.legend .attribution a {
    color: #0074d9;
    text-decoration: none;
    transition: color 0.2s;
}

.legend .attribution a:hover {
    color: #0052cc;
    text-decoration: underline;
}

/* Loading indicator */
.loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 16px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.loading-indicator.active {
    display: block;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0074d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Zoom warning */
.zoom-warning {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1000;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-align: center;
    transition: opacity 0.3s;
    animation: fadeIn 0.3s ease-out;
}

.zoom-warning.active {
    display: block;
}

.zoom-warning p {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Share button styles */
.leaflet-control-share {
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.leaflet-control-share svg {
    width: 18px;
    height: 18px;
    fill: #333;
}

.leaflet-control-share:hover svg {
    fill: #0074d9;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 0 auto;
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.2s, opacity 0.2s;
}

.modal:not(.active) {
    display: none;
}

.modal.active {
    display: flex;
}

.modal.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-button {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.share-option {
    margin-bottom: 15px;
}

.share-option label {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.share-option input {
    width: 100%;
    padding: 8px;
    margin-bottom: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.copy-button {
    background-color: #0074d9;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.copy-button:hover {
    background-color: #0052cc;
}

/* Error message styles */
.error-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
    animation: fadeInOut 3s ease-in-out;
}

/* Animations */
@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -20px); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    90% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}
