/* Основные стили */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* Контейнер */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Адаптивность для больших экранов */
@media (min-width: 1600px) {
    .container {
        max-width: 90%;
    }
}

@media (min-width: 2000px) {
    .container {
        max-width: 85%;
    }
}

@media (min-width: 2560px) {
    /* 2K мониторы */
    .container {
        max-width: 2400px;
        padding: 30px;
    }
    
    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .filter-block {
        padding: 25px;
    }
    
    .filter-group label {
        font-size: 15px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 15px;
    }
}

@media (min-width: 3840px) {
    /* 4K мониторы */
    .container {
        max-width: 3600px;
        padding: 40px;
    }
    
    h1 {
        font-size: 32px;
    }
    
    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 20px 25px;
        font-size: 18px;
    }
    
    .filter-block {
        padding: 30px;
    }
    
    .filter-group label {
        font-size: 17px;
        margin-bottom: 10px;
    }
    
    .btn {
        padding: 14px 28px;
        font-size: 16px;
    }
    
    .select2-container--default .select2-selection--single {
        height: 50px;
        padding: 8px 15px;
        font-size: 16px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 32px;
    }
}

/* Заголовок */
h1 {
    font-size: 24px;
    font-weight: 500;
    margin: 0;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 20px 0;
    margin-bottom: 30px;
}

/* Блок фильтров */
.filter-block {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 250px;
}

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

/* Кнопки */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

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

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

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

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

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

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

/* Select2 кастомизация */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    height: 42px;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
    color: #333;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 8px;
    color: #999;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: #e74c3c;
}

/* Select2 dropdown */
.select2-dropdown {
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.select2-results__option {
    padding: 10px 12px;
    font-size: 14px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #3498db;
    color: white;
}

.select2-container--default .select2-results__option--selected {
    background-color: #e8f4fc;
}

.select2-results__message {
    color: #999;
    font-style: italic;
}

/* Таблица DataTables */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
}

table.dataTable thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
    padding: 14px 15px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

table.dataTable tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #e ee;
    vertical-align: middle;
}

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

table.dataTable tbody tr.odd {
    background-color: #fcfcfc;
}

table.dataTable tbody tr.even {
    background-color: white;
}

#permissions-table_wrapper {
    margin: 15px 0;
}

/* DataTables элементы управления */
.dataTables_wrapper {
    padding: 0;
}

.dt-length {
    margin: 15px;
}

.dt-info {
    margin: 15px;
}

.dt-paging-button {
    font-size: 18px;
}

.dt-input {
    font-size: 15px;
}

.dataTables_wrapper .dataTables_length {
    float: left;
    margin: 20px 25px;
    font-size: 15px;
    color: #555;
}

.dataTables_wrapper .dataTables_length select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 8px;
    font-size: 15px;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_filter {
    float: right;
    margin: 20px 25px;
    font-size: 15px;
    color: #555;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 12px;
    width: 220px;
    font-size: 15px;
}

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

.dataTables_wrapper .dataTables_info {
    clear: both;
    float: left;
    margin: 20px 25px;
    color: #555;
    font-size: 15px;
}

.dataTables_wrapper .dataTables_paginate {
    float: right;
    margin: 20px 25px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 8px 14px;
    margin-left: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    color: #333;
    font-size: 15px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 20px;
    font-size: 16px;
    color: #666;
}

/* Пустая таблица */
table.dataTable tbody tr td.dataTables_empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* Адаптивность */
@media (max-width: 992px) {
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .btn {
        width: 100%;
    }
    
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin: 15px 10px;
        font-size: 14px;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .dataTables_wrapper .dataTables_length select {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 6px 10px;
        margin-left: 4px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 18px;
    }
    
    .filter-block {
        padding: 15px;
    }
    
    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 10px 8px;
        font-size: 13px;
    }
}

/* Скролл таблицы на мобильных */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Статусы */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-suspended {
    background-color: #fff3cd;
    color: #856404;
}

.status-revoked {
    background-color: #f8d7da;
    color: #721c24;
}

/* Анимация загрузки */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* Утилиты */
.text-center {
    text-align: center;
}

.text-muted {
    color: #999;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}