/* frontend/css/users.css */

/* Контейнер */
.users-container {
    animation: fadeIn 0.3s ease;
}

/* Заголовок страницы */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header-left h1 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.page-header-left h1 i {
    color: #2e8bd5;
    margin-right: 12px;
}

.page-description {
    color: #7f8c8d;
    font-size: 14px;
}

.page-header-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Фильтры */
.filters-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #ecf0f1;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #7f8c8d;
    margin-bottom: 6px;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #2e8bd5;
    box-shadow: 0 0 0 2px rgba(46, 139, 213, 0.1);
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.btn-filter-reset {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filter-reset:hover {
    background: #e9ecef;
}

/* Таблица пользователей */
.users-table-container {
    background: white;
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #ecf0f1;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.users-table thead th {
    text-align: left;
    padding: 14px 16px;
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 1px solid #ecf0f1;
}

.users-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

.users-table tbody tr:hover {
    background: #fafbfc;
}

/* Ячейка имени */
.user-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-mini {
    width: 36px;
    height: 36px;
    background: #e8f4f8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2e8bd5;
    font-size: 18px;
}

.user-fullname {
    font-weight: 500;
    color: #2c3e50;
}

.user-login {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 4px;
}

.user-email {
    font-size: 12px;
    color: #7f8c8d;
}

/* Бейджи ролей */
.user-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.role-admin {
    background: #e74c3c;
    color: white;
}

.role-curator {
    background: #2e8bd5;
    color: white;
}

.role-group_leader {
    background: #3498db;
    color: white;
}

.role-auditor {
    background: #27ae60;
    color: white;
}

.role-department_head {
    background: #f39c12;
    color: white;
}

.role-head_nurse {
    background: #9b59b6;
    color: white;
}

.role-doctor {
    background: #95a5a6;
    color: white;
}

/* Бейджи статуса */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-active i {
    font-size: 8px;
    color: #4caf50;
}

.status-inactive {
    background: #fff3e0;
    color: #e65100;
}

.status-blocked {
    background: #ffebee;
    color: #c62828;
}

/* Кнопки действий */
.user-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #7f8c8d;
}

.action-btn:hover {
    background: #e9ecef;
    color: #2e8bd5;
}

/* Пагинация */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination {
    display: flex;
    gap: 6px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #e0e4e8;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.page-btn:hover {
    background: #f8f9fa;
    border-color: #2e8bd5;
}

.page-btn.active {
    background: #2e8bd5;
    border-color: #2e8bd5;
    color: white;
}

.page-dots {
    padding: 0 8px;
    line-height: 36px;
    color: #95a5a6;
}

.pagination-info {
    font-size: 13px;
    color: #7f8c8d;
}

/* Модальное окно */
.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: 16px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-sm {
    width: 500px;
}

.modal-md {
    width: 700px;
}

.modal-lg {
    width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #ecf0f1;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #95a5a6;
}

.modal-body {
    padding: 24px;
}

/* Форма */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 180px;
}

.form-group.full-width {
    width: 100%;
    flex: auto;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 6px;
}

.required {
    color: #e74c3c;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #2e8bd5;
    box-shadow: 0 0 0 2px rgba(46, 139, 213, 0.1);
}

.form-hint {
    display: block;
    font-size: 11px;
    color: #95a5a6;
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 8px;
}

.roles-checkboxes,
.department-access-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #ecf0f1;
}

/* Кнопки */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #2e8bd5;
    color: white;
}

.btn-primary:hover {
    background: #2577b8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f8f9fa;
    border: 1px solid #e0e4e8;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-outline {
    background: white;
    border: 1px solid #2e8bd5;
    color: #2e8bd5;
}

.btn-outline:hover {
    background: #2e8bd5;
    color: white;
}

/* Импорт */
.file-upload-area {
    border: 2px dashed #e0e4e8;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: #2e8bd5;
    background: #f0f7fc;
}

.file-upload-area i {
    font-size: 48px;
    color: #2e8bd5;
    margin-bottom: 12px;
}

.import-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-item.success {
    background: #e8f5e9;
}

.stat-item.warning {
    background: #fff3e0;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #7f8c8d;
}

.import-errors {
    max-height: 200px;
    overflow-y: auto;
}

.error-item {
    padding: 8px;
    background: #ffebee;
    color: #c62828;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 12px;
}

.template-link {
    color: #2e8bd5;
    text-decoration: none;
}

/* Toast уведомления */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid #27ae60;
}

.toast-success i {
    color: #27ae60;
}

.toast-error {
    border-left: 4px solid #e74c3c;
}

.toast-error i {
    color: #e74c3c;
}

/* Empty state */
.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
}

.empty-state i,
.error-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Адаптивность */
@media (max-width: 992px) {
    .page-header {
        flex-direction: column;
    }

    .filters-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .users-table {
        font-size: 12px;
    }

    .user-actions {
        flex-direction: column;
    }

    .modal-lg {
        width: 95%;
    }
}

/* Добавить в конец файла frontend/css/users.css */

/* Состояния загрузки и ошибок */
.loading-row td {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #7f8c8d;
}

.loading-spinner i {
    font-size: 20px;
}

.empty-row td {
    text-align: center;
    padding: 40px;
}

.error-row td {
    text-align: center;
    padding: 40px;
}

.access-denied {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
}

.access-denied i {
    font-size: 64px;
    color: #e74c3c;
    margin-bottom: 20px;
}

.access-denied h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.access-denied p {
    color: #7f8c8d;
    margin-bottom: 24px;
}

/* Модальные окна */
.text-warning {
    color: #e67e22;
    margin-top: 10px;
    font-size: 13px;
}

.import-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #e8f4f8;
    border-radius: 8px;
    margin-bottom: 20px;
}

.import-info i {
    color: #2e8bd5;
    font-size: 20px;
}

.import-info p {
    margin: 0;
    font-size: 13px;
    color: #2c3e50;
}

.template-link {
    color: #2e8bd5;
    text-decoration: none;
}

.template-link:hover {
    text-decoration: underline;
}

.import-preview {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.import-preview h4 {
    margin-bottom: 12px;
    font-size: 14px;
    color: #2c3e50;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.users-container {
    animation: fadeIn 0.3s ease;
}

/* Toast уведомления - добавить, если нет */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    font-size: 14px;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid #27ae60;
}

.toast-success i {
    color: #27ae60;
}

.toast-error {
    border-left: 4px solid #e74c3c;
}

.toast-error i {
    color: #e74c3c;
}

.toast-info {
    border-left: 4px solid #2e8bd5;
}

.toast-info i {
    color: #2e8bd5;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

/* Добавьте в конец файла frontend/css/users.css */

/* Карточка просмотра пользователя */
.user-info-card {
    display: flex;
    gap: 24px;
    padding: 20px;
}

.user-avatar-large {
    flex-shrink: 0;
    text-align: center;
}

.user-avatar-large i {
    font-size: 120px;
    color: #bdc3c7;
}

.user-details {
    flex: 1;
}

.info-row {
    display: flex;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
}

.info-label {
    width: 140px;
    font-weight: 600;
    color: #7f8c8d;
}

.info-value {
    flex: 1;
    color: #2c3e50;
}

.user-details .role-badge {
    display: inline-block;
    margin-right: 6px;
    margin-bottom: 4px;
}

@media (max-width: 768px) {
    .user-info-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .info-row {
        flex-direction: column;
    }

    .info-label {
        width: 100%;
        margin-bottom: 4px;
    }
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Права доступа к разделам */
.access-intro {
    font-size: 13px;
    color: #5a6c7e;
    margin: 0 0 10px;
}

.access-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 14px;
}

.access-table {
    width: 100%;
    border-collapse: collapse;
}

.access-table th {
    text-align: left;
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 600;
    padding: 8px 10px;
    border-bottom: 1px solid #ecf0f1;
}

.access-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f3f5f7;
    vertical-align: middle;
}

.access-table tr.is-override td {
    background: #fff8e6;
}

.access-section-title {
    font-size: 14px;
    color: #2c3e50;
}

.access-section-hint {
    font-size: 11.5px;
    color: #95a5a6;
    margin-top: 2px;
}

.access-select {
    min-width: 170px;
}

.access-badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.access-badge.level-none { background: #f0f2f5; color: #95a5a6; }
.access-badge.level-view { background: #e8f1fb; color: #2e8bd5; }
.access-badge.level-fill { background: #fff3e0; color: #e67e22; }
.access-badge.level-full { background: #e8f8f0; color: #27ae60; }

#accessModal .form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 600px) {
    .access-select {
        min-width: 0;
        width: 100%;
    }
}
