/* Основные стили */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

.container-fluid {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Шапка - ИСПРАВЛЕНО: иконка сдвинута вправо */
.header {
    background: white;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* Добавлено для позиционирования индикатора */
}

.logo {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-left: 40px; /* ДОБАВЛЕНО: отступ слева для сдвига вправо */
}

.logo i {
    font-size: 2.8rem;
    color: var(--secondary-color);
    background: linear-gradient(45deg, var(--secondary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
}

.version {
    background: var(--secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Информация о пользователе */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-details {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--light-color);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
}

.user-avatar i {
    font-size: 2.2rem;
    color: var(--secondary-color);
}

.user-text {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

.account-name {
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.user-meta {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    gap: 10px;
    margin-top: 2px;
}

.timezone {
    background: #e9ecef;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Секция входа */
.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    border: none;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 30px;
    text-align: center;
}

.login-logo i {
    font-size: 3.5rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.login-header h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.login-subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
}

.login-body {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label i {
    color: var(--secondary-color);
}

.form-control {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 15px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}

/* Основной интерфейс */
.main-interface {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.sidebar .card {
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    padding: 15px 20px;
    border: none;
}

.card-header h5 {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 20px;
}


/* ИНФОРМАЦИЯ О ТРК - СКРЫВАЕМ ПАРАМЕТРЫ */
#trkInfo {
    font-size: 0.85rem;
    color: #6c757d;
    background-color: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 3px solid var(--secondary-color);
    margin-top: 5px;
    display: none; /* Скрываем параметры */
}

/* Таблица */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    background-color: var(--primary-color) !important;
    color: white;
    border: none;
    padding: 12px 15px;
}

.table td {
    padding: 12px 15px;
    vertical-align: middle;
    border-color: #e9ecef;
}

.table-hover tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

/* Бейджи */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

.bg-secondary {
    background-color: #6c757d !important;
}

/* Статус бар */
.status-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    min-width: 300px;
    max-width: 400px;
    z-index: 1000;
    border-left: 4px solid var(--info-color);
}

.status-bar.success {
    border-left-color: var(--success-color);
}

.status-bar.error {
    border-left-color: var(--danger-color);
}

.status-bar.warning {
    border-left-color: var(--warning-color);
}

.status-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.status-content i {
    font-size: 1.2rem;
}

.status-bar.success i {
    color: var(--success-color);
}

.status-bar.error i {
    color: var(--danger-color);
}

.status-close {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.status-close:hover {
    background: #f8f9fa;
    color: #666;
}

/* Подвал */
.footer {
    background: var(--primary-color);
    color: white;
    padding: 20px 0;
    margin-top: 50px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
}

.footer .small {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Прогресс бар */
.progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Вспомогательные классы */
.hidden {
    display: none !important;
}

.text-muted {
    color: #6c757d !important;
}

.text-center {
    text-align: center;
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

/* Адаптивность */
@media (max-width: 992px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .logo {
        flex-direction: column;
        gap: 10px;
        padding-left: 0; /* На мобильных убираем отступ */
    }
    
    .user-details {
        flex-direction: column;
        text-align: center;
    }
    
    .main-interface .row {
        flex-direction: column;
    }
    
    .sidebar {
        margin-bottom: 20px;
    }
    
    .status-bar {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding: 0 10px;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 8px 10px;
    }
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.3s ease;
}

.spinner-border {
    vertical-align: middle;
}

/* Специфичные стили для отчета */
.report-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    padding: 20px;
    border-left: 4px solid var(--secondary-color);
}

.stats-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    border: 1px solid #dee2e6;
}

/* Исправление для выпадающего списка DataTables */
.dataTables_length {
    margin-bottom: 15px;
}

.dataTables_length label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 0 !important;
    font-weight: 500;
    color: var(--primary-color);
}

.dataTables_length select {
    width: 100px !important;
    padding: 6px 35px 6px 12px !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px 12px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

/* Убираем старую стрелку в IE */
.dataTables_length select::-ms-expand {
    display: none;
}

/* Стили для hover и focus */
.dataTables_length select:hover {
    border-color: #adb5bd;
}

.dataTables_length select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
    outline: 0;
}

/* Кастомные стили для DataTables */
.dataTables_wrapper {
    padding: 0 !important;
}

.dataTables_length,
.dataTables_filter {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.dataTables_info,
.dataTables_paginate {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Кнопки */
.btn-outline-info {
  border-color: var(--info-color);
  color: var(--info-color);
}

.btn-outline-info:hover {
  background-color: var(--info-color);
  color: white;
}

/* Стили для select с опциями */
select option[value=""] {
  color: #6c757d;
  font-style: italic;
}

select option {
  padding: 8px;
  border-bottom: 1px solid #eee;
}

select option:last-child {
  border-bottom: none;
}

/* Предупреждение о периоде */
#periodWarning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

#periodWarning i {
    color: #f39c12;
}

/* ИСПРАВЛЕНО: Скрываем параметры в выборе ТРК */
#trkSelect option {
    /* Убираем отображение параметров в скобках */
}

#trkSelect option:after {
    content: none !important;
}

/* Стиль для карточки рекомендаций */
.alert-light {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

/* Улучшения для DataTables */
#reportTable_wrapper {
    margin-top: 20px;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    margin-left: 10px;
}

.dataTables_wrapper .dataTables_info {
    padding-top: 15px;
    color: #6c757d;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 10px;
}

/* Улучшения для таблицы с большим количеством данных */
.table-responsive {
    max-height: 600px;
    overflow-y: auto;
}

/* Стили для сообщения об отсутствии данных */
#emptyReport {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 40px;
}

/* Улучшения для кнопки обновления ТРК */
#reloadTRKBtn {
    padding: 5px 10px;
    font-size: 0.875rem;
}

/* Улучшения для статус-бара */
.status-bar {
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Улучшения для анализа данных */
#analysisData {
    font-size: 0.9rem;
}

#analysisData strong {
    color: var(--primary-color);
}

/* Индикатор фоновых задач */
.background-job-indicator {
    position: absolute;
    top: 10px;
    right: 20px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(52, 152, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

.indicator-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.indicator-content i {
    font-size: 1rem;
}

.indicator-content span {
    font-size: 0.85rem;
    font-weight: 500;
}

#hideBackgroundIndicator {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 2px 8px;
    font-size: 0.7rem;
}

#hideBackgroundIndicator:hover {
    background: rgba(255,255,255,0.3);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
    
    #reportSummary {
        font-size: 0.85rem;
    }
    
    .dataTables_length select {
        width: 90px !important;
        padding: 5px 30px 5px 10px !important;
        background-position: right 8px center !important;
    }
    
    .background-job-indicator {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px auto;
        width: 90%;
    }
}

/* Административная панель */
.admin-panel {
    animation: fadeIn 0.5s ease;
}

.metric-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.realtime-monitor {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.log-entry {
    transition: background-color 0.2s ease;
}

.log-entry:hover {
    background-color: #f8f9fa;
}

.job-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
}

.progress-sm {
    height: 6px;
    margin-top: 5px;
}

.system-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    font-size: 0.9rem;
}

.system-info p {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.system-info strong {
    color: #2c3e50;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-actions .btn {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    text-align: left;
}

.admin-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border-radius: 0 0 8px 8px;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-logo i {
    font-size: 2.5rem;
    color: #3498db;
    background: linear-gradient(45deg, #3498db, #2980b9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.admin-logo h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
}

.admin-status {
    background: rgba(255,255,255,0.1);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-status.online:before {
    content: '';
    width: 10px;
    height: 10px;
    background: #27ae60;
    border-radius: 50%;
    display: inline-block;
}

.refresh-indicator {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

/* Адаптивность для админ панели */
@media (max-width: 768px) {
    .metric-card {
        margin-bottom: 10px;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .admin-panel .card {
        margin-bottom: 15px;
    }
    
    .quick-actions .btn {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .admin-logo {
        flex-direction: column;
        gap: 10px;
    }
    
    .admin-status {
        justify-content: center;
    }
}

/* Стили для кнопки отмены */
#cancelReportBtn {
  margin-left: 10px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Вместо рекомендаций показываем только базовую информацию */
.sidebar .alert-light {
  padding: 15px;
  margin-bottom: 20px;
}

.sidebar .alert-light p {
  margin-bottom: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Скрываем информацию о ТРК с иконками */
.sidebar .alert-light ul {
  display: none;
}

/* Убираем отступы для пустого списка */
.sidebar .alert-light ul:empty {
  display: none;
}

/* Для мобильных */
@media (max-width: 768px) {
  .sidebar .alert-light {
    padding: 10px;
    font-size: 0.8rem;
  }
  
  .sidebar .alert-light p {
    font-size: 0.8rem;
    margin-bottom: 6px;
  }
}