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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.filters-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #555;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-group select:hover {
    border-color: #3498db;
}

.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.searchable-select-wrapper {
    position: relative;
}

#filter-strategy-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.2s;
}

#filter-strategy-search:hover {
    border-color: #3498db;
}

#filter-strategy-search:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#filter-strategy {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 2px;
}

#filter-strategy option {
    padding: 8px 12px;
    cursor: pointer;
}

#filter-strategy option:hover {
    background-color: #f0f0f0;
}

.filter-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background-color: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

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

.legend-section {
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #2c3e50;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.legend-orange {
    background-color: #fff3cd;
}

.legend-red {
    background-color: #f8d7da;
}

.legend-green {
    background-color: #d4edda;
}

.table-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.table-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.table-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.table-info span {
    font-size: 14px;
    color: #666;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background-color: #f8f9fa;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px;
}

th.sortable:hover {
    background-color: #e9ecef;
}

.sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #999;
}

th.sortable[data-sort-order="asc"] .sort-indicator::after {
    content: "▲";
    color: #3498db;
}

th.sortable[data-sort-order="desc"] .sort-indicator::after {
    content: "▼";
    color: #3498db;
}

td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Цветовая индикация строк */
tbody tr.no-tv-signal {
    background-color: #fff3cd;
}

tbody tr.no-tv-signal:hover {
    background-color: #ffeaa7;
}

tbody tr.no-iint-signal {
    background-color: #f8d7da;
}

tbody tr.no-iint-signal:hover {
    background-color: #f5c6cb;
}

.source-group {
    border-left: 2px solid #dee2e6;
    border-right: 2px solid #dee2e6;
}

.source-group:first-of-type {
    border-left: none;
}

.source-group:last-of-type {
    border-right: none;
}

.source-cell {
    position: relative;
    transition: background-color 0.2s;
}

.source-cell.faster {
    background-color: #d4edda !important;
}

.source-cell.faster:hover {
    background-color: #c3e6cb !important;
}

/* Визуальное разделение между TV и IINT группами */
.source-group-tv {
    border-right: 3px solid #e9ecef;
}

.source-group-iint {
    border-left: 3px solid #e9ecef;
}

.source-delay {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

/* Стили для двухуровневых заголовков */
thead tr:first-child th {
    border-bottom: 1px solid #dee2e6;
}

thead tr:last-child th {
    border-top: none;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    padding: 8px 12px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-tv {
    background-color: #34495e;
    color: #fff;
}

.badge-iint {
    background-color: #27ae60;
    color: #fff;
}

.badge-open {
    background-color: #3498db;
    color: #fff;
}

.badge-tp {
    background-color: #27ae60;
    color: #fff;
}

.badge-sl {
    background-color: #e74c3c;
    color: #fff;
}

.badge-equal {
    background-color: #95a5a6;
    color: #fff;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }

    .table-wrapper {
        overflow-x: scroll;
    }

    table {
        min-width: 800px;
    }
}
