/* Kaardi konteiner */
.rahvaalgatus-map-container {
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.rahvaalgatus-map {
    width: 100%;
    z-index: 1;
}

/* Loading animation */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 0 auto 10px;
}

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

/* Popup stiilid */
.leaflet-popup-content {
    margin: 15px 15px 10px 15px;
    min-width: 250px;
}

.municipality-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.municipality-popup h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 18px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.stat-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    border-left: 4px solid;
}

.stat-item.edit { border-left-color: #e67e22; }
.stat-item.sign { border-left-color: #3498db; }
.stat-item.government { border-left-color: #27ae60; }
.stat-item.archive { border-left-color: #95a5a6; }

.stat-number {
    font-size: 24px;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.initiatives-list {
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.initiative-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.initiative-item:last-child {
    border-bottom: none;
}

.initiative-title {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 4px;
}

.initiative-meta {
    font-size: 12px;
    color: #666;
}

.phase-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 500;
    margin-right: 5px;
}

.phase-badge.edit { background: #f39c12; color: white; }
.phase-badge.sign { background: #3498db; color: white; }
.phase-badge.government { background: #27ae60; color: white; }
.phase-badge.archive { background: #95a5a6; color: white; }

/* Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.legend-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}

.legend-color {
    width: 20px;
    height: 15px;
    border-radius: 3px;
    margin-right: 8px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Map controls */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.refresh-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.refresh-btn:hover {
    background: #2980b9;
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Update info */
.update-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255,255,255,0.9);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    z-index: 1000;
}

/* Responsive design */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .map-legend {
        position: relative;
        bottom: auto;
        right: auto;
        margin-top: 10px;
    }

    .update-info {
        position: relative;
        bottom: auto;
        left: auto;
        margin-top: 10px;
        display: block;
        text-align: center;
    }

    .map-controls {
        position: relative;
        top: auto;
        right: auto;
        text-align: center;
        margin-bottom: 10px;
    }

    .leaflet-popup-content {
        min-width: 200px;
    }
}

/* Tooltip styles */
.leaflet-tooltip {
    background: rgba(0,0,0,0.8);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.leaflet-tooltip-top:before {
    border-top-color: rgba(0,0,0,0.8);
}

.leaflet-tooltip-bottom:before {
    border-bottom-color: rgba(0,0,0,0.8);
}

.leaflet-tooltip-left:before {
    border-left-color: rgba(0,0,0,0.8);
}

.leaflet-tooltip-right:before {
    border-right-color: rgba(0,0,0,0.8);
}

/* Error states */
.map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #e74c3c;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    text-align: center;
    z-index: 1000;
}

.map-no-data {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}
