html, body {
    width: 100%;
    height: 100%;
    border: 0;
    margin: 0;
    padding: 0;
    line-height: 1.15;
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%
}

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

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;

    font-family: "Roboto Light", "Helvetica Neue", Arial, Helvetica, sans-serif;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.filters-panel {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 25%;
    min-width: 300px;
    background-color: #f5f5f5;
    padding: 15px;
    overflow-y: auto;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(-100%);

    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 32px 1fr 56px;
}

.filters-panel.visible {
    transform: translateX(0);
}

.filters-container {
    overflow: auto;
}

select optgroup {
    font-weight: bold;
    font-style: normal;
    color: #2c3e50;
    background-color: #f8f9fa;
}

select option {
    padding-left: 20px;
}

.toggle-filters {
    position: absolute;
    top: 140px; /* Сдвинуто на 40px ниже */
    left: 25%;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    padding: 10px;
    cursor: pointer;
    z-index: 1001;
    transition: left 0.3s ease;
}

.toggle-filters.hidden {
    left: 0;
}

.map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: left 0.3s ease, width 0.3s ease;
}

.filters-panel.visible ~ .map-container {
    left: 25%;
    width: 75%;
}

#map {
    width: 100%;
    height: 100%;
}

.filter-group {
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.filter-input {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.filter-interval {
    display: flex;
    gap: 5px;
}

.filter-interval input {
    flex: 1;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-secondary {
    background-color: #e74c3c;
    color: white;
}

.btn-download {
    background-color: #2ecc71;
    color: white;
}

.error-message {
    color: #e74c3c;
    padding: 10px;
    margin: 10px 0;
    background: #ffeaea;
    border-radius: 4px;
    display: none;
    height: 60px;
    overflow: auto;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
}

.legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* Стили для валидации */
.filter-input.error {
    border-color: #e74c3c;
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
}

.filter-group .required-label::after {
    content: " *";
    color: #e74c3c;
}

/* Стили для кастомных маркеров */
.custom-marker {
    background: transparent;
    border: none;
}

.legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    margin-right: 5px;
}

.chosen-container .chosen-results li.loading {
    color: #999;
    font-style: italic;
}

.chosen-container .chosen-results li.no-results {
    color: #999;
    font-style: italic;
}

.dtp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.dtp-modal .modal-content {
    background: white;
    padding: 20px;
    border-radius: 5px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    width: 800px;
}

.dtp-details {
    max-height: 70vh;
    overflow: auto;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.details-table th {
    background-color: #f2f2f2;
    text-align: left;
    padding: 8px;
    border: 1px solid #ddd;
    width: 30%;
}

.details-table td {
    padding: 8px;
    border: 1px solid #ddd;
}

.nested-section {
    margin: 10px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.nested-section h4 {
    margin-top: 0;
    color: #2c3e50;
}

.close-btn {
    padding: 10px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 15px;
}

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

.array-item {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.array-item h5 {
    margin-top: 0;
    color: #2c3e50;
}

/* Стили для вкладок */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 10px 15px;
    background: #f2f2f2;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    cursor: pointer;
}

.tab-btn.active {
    background: white;
    border-bottom: 1px solid white;
    margin-bottom: -1px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Стили для подвкладок (для ТС) */
.sub-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.sub-tab-btn {
    padding: 8px 12px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    cursor: pointer;
    font-size: 14px;
}

.sub-tab-btn.active {
    background: white;
    border-bottom: 1px solid white;
    margin-bottom: -1px;
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
}

.legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 250px;
    max-height: 70vh;
    overflow-y: auto;
}

.legend-header {
    cursor: pointer;
    padding: 5px;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 5px;
}

.legend-body {
    margin-top: 10px;
}

.em-types-list {
    margin-top: 10px;
}

.em-type-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
}

.color-box {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.em-type-name {
    word-break: break-word;
}


@media (max-width: 768px) {
    .filters-panel {
        position: absolute;
        height: 100%;
        z-index: 1000;
    }

    .toggle-filters {
        display: block;
    }
}

.loader {
    left: 0;
    right: 0;
    top: 0;
    z-index: 1;
    position: fixed;
    height: 4px;
    background-image: repeating-linear-gradient(90deg, transparent, transparent 20px, #8d99a5 0, #8d99a5 25px);
    background-size: 200% 100%;
    -webkit-animation: change 12s linear infinite;
    animation: change 12s linear infinite;
    transition: opacity 1s;
    opacity: 1;
}
