/* === PÕHIKONTEINER === */
#eesti-kaart-container {
    width: 100% !important;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    gap: 15px;
}

/* === KOMPAKTNE LEGEND VASAKUL === */
#kaart-legend {
    flex: 0 0 240px;
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: fit-content;
}

/* === KAART PAREMAL === */
#eesti-kaart {
    flex: 1;
    height: 75vh !important;
    min-height: 500px;
    max-height: 900px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #ffffff !important;
}

/* === MINIMALISTLIK LEGEND === */
#kaart-legend h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.filter-section {
    margin: 0;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.filter-option:hover {
    background-color: #f8f9fa;
}

.filter-radio {
    margin-right: 8px;
    cursor: pointer;
    transform: scale(0.9);
}

.filter-label {
    font-size: 13px;
    color: #444;
    flex: 1;
    line-height: 1.3;
}

.filter-count {
    margin-left: 6px;
    color: #666;
    font-size: 12px;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
    font-weight: 500;
}

/* === OMAVALITSUSE FILTER === */
.municipality-filter {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.municipality-filter label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.municipality-dropdown {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.municipality-dropdown:hover {
    border-color: #0073aa;
}

.municipality-dropdown:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.municipality-dropdown option {
    padding: 8px;
}

/* === KAARDI ELEMENDID === */
.leaflet-interactive {
    cursor: pointer;
}

.leaflet-interactive:hover {
    stroke-width: 3;
}

/* Eemalda Leaflet'i vaikimisi attribution */
.leaflet-control-attribution {
    display: none !important;
}

.leaflet-control-zoom {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* === TAGASIHOIDLIK POPUP STIIL === */
.municipality-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

.popup-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
    color: #2c3e50;
}

.popup-stats {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

.dialoog-item {
    margin-bottom: 8px;
}

.dialoog-header {
    margin-bottom: 4px;
}

.dialoog-name {
    font-weight: 500;
    color: #2c3e50;
}

.private-badge {
    background-color: #95a5a6;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: normal;
}

/* === VIRTUAALNE BADGE === */
.virtual-badge {
    background-color: #3498db;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: normal;
}

.dialoog-desc {
    font-size: 13px;
    color: #555;
    margin: 4px 0;
    line-height: 1.3;
}

.dialoog-contact {
    font-size: 13px;
    margin: 4px 0;
}

.dialoog-contact a {
    color: #3498db;
    text-decoration: none;
}

.dialoog-contact a:hover {
    text-decoration: underline;
}

.dialoog-time {
    font-size: 13px;
    color: #666;
    margin: 4px 0;
}

.dialoog-link {
    margin-top: 6px;
}

.dialoog-link a {
    color: #2980b9;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.dialoog-link a:hover {
    text-decoration: underline;
}

.dialoog-separator {
    height: 1px;
    background-color: #f0f0f0;
    margin: 10px 0;
}

.no-dialogs {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 10px 0;
}

/* === POPUP VÄLJAD (ÜHEREALINE TÜHIKUGA) === */
.dialoog-field {
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.5;
}

.field-label {
    font-weight: 600;
    color: #555;
    margin-right: 8px;
}

.field-value {
    color: #333;
}

.field-icon {
    margin-right: 6px;
    vertical-align: middle;
    width: 16px;
    display: inline-block;
}

.dialoog-field a {
    color: #3498db;
    text-decoration: none;
    word-break: break-word;
}

.dialoog-field a:hover {
    text-decoration: underline;
}

/* Tüübi stiilid */
.type-public {
    color: #27ae60;
    font-weight: bold;
}

.type-private {
    color: #e74c3c;
    font-weight: bold;
}

/* === POPUP KONTEINER === */
.leaflet-popup-content-wrapper {
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 350px !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 16px 10px 16px 18px;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    overflow-y: auto;
    max-height: 380px;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.leaflet-popup-content::-webkit-scrollbar {
    width: 5px;
}

.leaflet-popup-content::-webkit-scrollbar-track {
    background: transparent;
}

.leaflet-popup-content::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.leaflet-popup-close-button {
    color: #666 !important;
    font-size: 18px !important;
    padding: 4px 8px !important;
}

/* === EXCEL UPLOAD VORM === */
#excel-upload-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#excel-upload-container h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.upload-section {
    margin-bottom: 20px;
}

.upload-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.upload-section input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

.upload-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #17a2b8;
}

.upload-info h4 {
    margin-top: 0;
    color: #2c3e50;
}

.upload-info ul {
    margin: 10px 0;
    padding-left: 20px;
}

.upload-info li {
    margin-bottom: 5px;
}

#upload-btn {
    background: #28a745;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
}

#upload-btn:hover {
    background: #218838;
}

#upload-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #28a745;
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-animation 1.5s ease-in-out infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin-top: 15px;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin-top: 15px;
}

.download-template {
    background: #e9ecef;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    text-align: center;
}

.download-btn {
    background: #17a2b8;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    font-weight: 500;
}

.download-btn:hover {
    background: #138496;
    text-decoration: none;
    color: white;
}

/* === RESPONSIIVSUS === */
@media (max-width: 992px) {
    #eesti-kaart-container {
        flex-direction: column;
    }

    #kaart-legend {
        flex: none;
        width: 100%;
        order: 1;
    }

    .filter-options {
        flex-direction: row;
        justify-content: space-around;
    }

    #eesti-kaart {
        order: 2;
        height: 65vh !important;
        min-height: 400px;
    }

    .municipality-filter {
        margin-top: 10px;
        padding-top: 10px;
    }
}

@media (max-width: 768px) {
    #eesti-kaart-container {
        padding: 10px;
        gap: 10px;
    }

    #kaart-legend {
        padding: 12px;
    }

    .filter-options {
        flex-direction: column;
        gap: 6px;
    }

    #eesti-kaart {
        height: 55vh !important;
        min-height: 350px;
    }

    .leaflet-popup-content-wrapper {
        max-width: 280px !important;
    }

    #excel-upload-container {
        margin: 10px;
        padding: 15px;
    }

    .municipality-dropdown {
        font-size: 16px; /* iOS zoom prevention */
    }
}

@media (max-width: 480px) {
    #eesti-kaart-container {
        padding: 5px;
    }

    #eesti-kaart {
        height: 50vh !important;
        min-height: 300px;
    }

    .leaflet-popup-content-wrapper {
        max-width: 250px !important;
    }

    .popup-title {
        font-size: 14px;
    }

    .dialoog-name {
        font-size: 13px;
    }
}

/* === INFO VÄLJAD POPUPIS (TÜHIKUGA) === */
.info-row {
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.5;
}

.info-label {
    font-weight: 600;
    color: #555;
    margin-right: 6px;
}

.info-label::after {
    content: " ";
}

.info-value {
    color: #333;
}

/* === TÜÜBI LEGEND === */
.type-legend {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.type-legend-item {
    display: flex;
    align-items: flex-start;
    font-size: 11px;
    color: #777;
    line-height: 1.4;
}

.type-legend-dot {
    display: none;
}

.type-legend-text strong {
    color: #555;
}
