/* frontend/css/risks.css */
.risks-container {
    animation: fadeIn 0.3s ease;
    padding: 0;
}

/* Вкладки */
.risks-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 0 20px;
}

.risks-tabs .tab-btn {
    padding: 14px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-gray);
    transition: all 0.3s;
}

.risks-tabs .tab-btn:hover {
    color: var(--primary-color);
}

.risks-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Статистика рисков */
.risk-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card-mini {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-left: 4px solid;
}

.stat-card-mini.critical {
    border-left-color: #F44336;
}

.stat-card-mini.high {
    border-left-color: #FF9800;
}

.stat-card-mini.medium {
    border-left-color: #FFC107;
}

.stat-card-mini.low {
    border-left-color: #4CAF50;
}

.stat-card-mini .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-card-mini.critical .stat-icon {
    background: #fee2e2;
    color: #F44336;
}

.stat-card-mini.high .stat-icon {
    background: #fff3e0;
    color: #FF9800;
}

.stat-card-mini.medium .stat-icon {
    background: #fff8e1;
    color: #FFC107;
}

.stat-card-mini.low .stat-icon {
    background: #e8f5e9;
    color: #4CAF50;
}

.stat-card-mini .stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.stat-card-mini .stat-info p {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
}

/* Таблица рисков */
.risks-table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.risks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.risks-table thead th {
    text-align: left;
    padding: 14px 16px;
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

.risks-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.risks-table tbody tr:hover {
    background: var(--bg-light);
}

/* Бейджи уровня риска */
.risk-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.risk-badge.critical {
    background: #fee2e2;
    color: #c62828;
}

.risk-badge.high {
    background: #fff3e0;
    color: #e65100;
}

.risk-badge.medium {
    background: #fff8e1;
    color: #f57f17;
}

.risk-badge.low {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Бейджи статуса */
.status-badge-risk {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge-risk.active {
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge-risk.in_progress {
    background: #fff3e0;
    color: #e65100;
}

.status-badge-risk.closed {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Кнопки действий */
.action-buttons-risk {
    display: flex;
    gap: 8px;
}

/* Матрица рисков */
.matrix-container {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    overflow-x: auto;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.matrix-table th,
.matrix-table td {
    border: 1px solid var(--border-color);
    padding: 12px;
    vertical-align: top;
}

.matrix-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
}

.matrix-cell {
    min-width: 140px;
    transition: all 0.2s;
}

.matrix-cell.critical {
    background: #fee2e2;
}

.matrix-cell.high {
    background: #fff3e0;
}

.matrix-cell.medium {
    background: #fff8e1;
}

.matrix-cell.low {
    background: #e8f5e9;
}

.cell-score {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 8px;
}

.cell-risks {
    text-align: left;
    font-size: 11px;
}

.risk-item {
    display: block;
    padding: 4px 8px;
    margin: 2px 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-dark);
}

.risk-item:hover {
    background: white;
    transform: translateX(2px);
}

.risk-item.critical {
    border-left: 3px solid #F44336;
}

.risk-item.high {
    border-left: 3px solid #FF9800;
}

.risk-item.medium {
    border-left: 3px solid #FFC107;
}

.risk-item.low {
    border-left: 3px solid #4CAF50;
}

/* Шкала оценки */
.risk-assessment-row {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.assessment-item {
    flex: 1;
    min-width: 250px;
}

.assessment-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.rating-scale {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rating-option {
    flex: 1;
    text-align: center;
    cursor: pointer;
    padding: 8px 4px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.rating-option:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.rating-option input {
    display: none;
}

.rating-option input:checked+span {
    color: var(--primary-color);
    font-weight: bold;
}

.rating-option span {
    display: block;
    font-size: 13px;
}

.rating-option small {
    font-size: 9px;
    color: var(--text-light);
}

.risk-level-preview {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-label {
    font-weight: 600;
    color: var(--text-gray);
}

.preview-value {
    font-weight: 700;
    font-size: 16px;
}

/* Карточка просмотра риска */
.risk-view-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.risk-view-code {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 12px;
    font-family: monospace;
    margin-bottom: 12px;
}

.risk-view-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.risk-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 13px;
    color: var(--text-gray);
}

.risk-view-meta i {
    width: 16px;
    margin-right: 6px;
    color: var(--primary-color);
}

.risk-view-section {
    margin-bottom: 24px;
}

.risk-view-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.risk-view-section h4 i {
    margin-right: 8px;
    color: var(--primary-color);
}

.risk-view-section p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dark);
    margin: 0;
}

.risk-assessment-view {
    display: flex;
    gap: 24px;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 16px;
}

.assessment-view-item {
    flex: 1;
    text-align: center;
}

.assessment-view-item .label {
    font-size: 12px;
    color: var(--text-gray);
    margin-bottom: 4px;
}

.assessment-view-item .value {
    font-size: 24px;
    font-weight: 700;
}

.assessment-view-item .level {
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
}

.actions-list {
    margin-top: 8px;
}

.action-item-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
}

.action-name {
    font-size: 13px;
    color: var(--text-dark);
}

.action-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
}

/* Добавьте в конец файла frontend/css/risks.css */

/* Заголовок страницы */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header-left h1 {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

.page-header-left h1 i {
    color: #2e8bd5;
    margin-right: 12px;
}

.page-description {
    color: #7f8c8d;
    font-size: 14px;
    margin: 0;
}

/* Кнопки */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #2e8bd5;
    color: white;
}

.btn-primary:hover {
    background: #2577b8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #bdc3c7;
}

/* Фильтры */
.filters-bar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #ecf0f1;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #7f8c8d;
    margin-bottom: 6px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #2e8bd5;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

/* Кнопки действий */
.action-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #7f8c8d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-icon:hover {
    background: #e8f4f8;
    color: #2e8bd5;
}

/* Матрица */
.matrix-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

.matrix-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.matrix-stat.critical {
    color: #e74c3c;
}

.matrix-stat.high {
    color: #e67e22;
}

.matrix-stat.medium {
    color: #f1c40f;
}

.matrix-stat.low {
    color: #27ae60;
}

.matrix-legend {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.legend {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.probability-label {
    background: #f8f9fa;
    font-weight: 500;
    text-align: left !important;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    width: 700px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #ecf0f1;
    background: #f8f9fa;
    border-radius: 20px 20px 0 0;
    position: sticky;
    top: 0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #2c3e50;
}

.modal-header h2 i {
    color: #2e8bd5;
    margin-right: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #95a5a6;
    transition: all 0.2s;
}

.modal-close:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Пустые состояния */
.empty-state-small {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

.empty-state-small i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #ecf0f1;
    border-top-color: #2e8bd5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-row td {
    text-align: center !important;
    padding: 40px !important;
}

.action-status.assigned {
    background: #e3f2fd;
    color: #1565c0;
}

.action-status.in_progress {
    background: #fff3e0;
    color: #e65100;
}

.action-status.completed {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Добавьте в конец файла risks.css */

/* Форма */
.form-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.form-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section h4 i {
    color: #2e8bd5;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 6px;
}

.form-group .required {
    color: #e74c3c;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #2e8bd5;
    box-shadow: 0 0 0 3px rgba(46, 139, 213, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #ecf0f1;
}

.modal-lg {
    width: 700px;
    max-width: 90%;
}

/* Чекбоксы и радио */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Форма карты риска */
.form-header {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #ecf0f1;
}

.monitoring-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.monitoring-table th,
.monitoring-table td {
    border: 1px solid #ecf0f1;
    padding: 10px;
    text-align: left;
}

.monitoring-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.monitoring-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ecf0f1;
    border-radius: 6px;
}

/* План мероприятий */
.plan-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ecf0f1;
}

.plan-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.plan-header h3 i {
    color: #2e8bd5;
    margin-right: 8px;
}

.plan-table {
    width: 100%;
    border-collapse: collapse;
}

.plan-table th,
.plan-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.plan-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.plan-table tr:hover {
    background: #f8f9fa;
}

.btn-outline {
    background: transparent;
    border: 1px solid #2e8bd5;
    color: #2e8bd5;
}

.btn-outline:hover {
    background: #2e8bd5;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Печатная версия */
@media print {

    .sidebar,
    .main-header,
    .risks-tabs,
    .page-header-right,
    .filters-bar,
    .pagination,
    .modal-footer {
        display: none !important;
    }

    .content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .modal-content {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Статусы для плана мероприятий */
.status-badge-risk.status-planned {
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge-risk.status-in-progress {
    background: #fff3e0;
    color: #e65100;
}

.status-badge-risk.status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge-risk.status-overdue {
    background: #ffebee;
    color: #c62828;
}

.overdue-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    background: #ffebee;
    color: #c62828;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.action-icon.start-plan-item:hover,
.action-icon.complete-plan-item:hover {
    transform: scale(1.1);
}

/* Адаптивность */
@media (max-width: 1024px) {
    .risk-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .risk-assessment-row {
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .risk-stats-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .risks-table-container {
        overflow-x: auto;
    }

    .risks-table {
        min-width: 900px;
    }

    .rating-scale {
        justify-content: space-between;
    }

    .rating-option {
        flex: none;
        width: 50px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}