/* ============================================
   Общие стили для страниц приложения
   ============================================ */

/* Page Header */
.page-title {
  font-size: 2rem;
  font-weight: 300;
  color: #212529;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: #6c757d;
  margin-bottom: 0;
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Section Titles */
.section-title {
  font-size: 1.5rem;
  font-weight: 400;
  color: #212529;
  margin-bottom: 1.5rem;
}

/* Status Badges */
.status-badge {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-weight: 500;
}

.status-published {
  background: #e8f5e8;
  color: #388e3c;
}

.status-draft {
  background: #f5f5f5;
  color: #616161;
}

.status-completed {
  background: #e8f5e8;
  color: #388e3c;
}

.status-progress,
.status-in-progress {
  background: #fff3e0;
  color: #f57c00;
}

.status-pending {
  background: #e3f2fd;
  color: #1976d2;
}

.status-active {
  background: #e8f5e8;
  color: #388e3c;
}

.status-inactive {
  background: #f5f5f5;
  color: #757575;
}

/* Common Sections */
.stats-section,
.info-section,
.actions-section,
.items-section,
.filters-section,
.form-section,
.error-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 60px;
  height: 60px;
  background: #e9ecef;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon i {
  font-size: 1.5rem;
  color: #495057;
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 2rem;
  font-weight: 600;
  color: #212529;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.125rem;
}

.stat-description {
  font-size: 0.875rem;
  color: #6c757d;
}

/* Form Styles */
.form-container {
  background: white;
  border-radius: 12px;
  padding: 2rem;
}

.form-row {
  margin-bottom: 1.5rem;
}

.form-group {
  width: 100%;
}

.form-label {
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.5rem;
  display: block;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.15s ease;
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control[type="textarea"] {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.form-text {
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Error Section */
.error-block {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.error-header {
  color: #721c24;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.error-list {
  margin: 0;
  padding-left: 1.25rem;
  color: #721c24;
}

/* Filters */
.filters-form {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-label {
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.filter-actions .btn {
  flex: 1;
}

.filter-results {
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
  color: #6c757d;
  font-size: 0.875rem;
}

.filter-results strong {
  color: #495057;
}

/* Lists */
.users-list,
.departments-list,
.assignments-list,
.items-list {
  background: #f8f9fa;
  border-radius: 12px;
  overflow: hidden;
}

.user-row,
.department-row,
.assignment-item {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background: white;
  border-bottom: 1px solid #e9ecef;
}

.user-row:last-child,
.department-row:last-child {
  border-bottom: none;
}

.user-row.inactive,
.department-row.inactive {
  opacity: 0.6;
}

/* User/Department Info */
.user-info,
.department-info {
  flex: 1;
  min-width: 0;
}

.user-header,
.department-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 1rem;
}

.user-name-block {
  flex: 1;
  min-width: 0;
}

.user-name,
.department-name {
  font-size: 1.25rem;
  font-weight: 500;
  color: #212529;
  margin: 0 0 0.25rem 0;
  line-height: 1.3;
}

.user-email,
.department-description {
  color: #6c757d;
  font-size: 0.875rem;
}

.user-badges,
.department-status {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-weight: 500;
}

.role-admin {
  background: #fff3e0;
  color: #e65100;
}

.role-supervisor {
  background: #e3f2fd;
  color: #1565c0;
}

.role-user {
  background: #f3e5f5;
  color: #6a1b9a;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.empty-state i {
  font-size: 3rem;
  color: #adb5bd;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 400;
  color: #495057;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: #6c757d;
  margin: 0;
}

.user-actions,
.department-actions {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
}

.user-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: #6c757d;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meta-item i {
  font-size: 0.875rem;
}

/* ============================================================================
   Flat Dashboard Styles (Yandex-style minimalism)
   ============================================================================ */

/* Dashboard Stat Cards - Flat */
.dashboard-stat-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color 0.2s ease;
}

.dashboard-stat-card:hover {
  border-color: #b0b0b0;
}

.dashboard-stat-value {
  font-size: 2rem;
  font-weight: 500;
  color: #000000;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.dashboard-stat-label {
  font-size: 0.875rem;
  color: #666666;
  line-height: 1.3;
}

/* Flat Card */
.flat-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.flat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  user-select: none;
}

.flat-card-header:hover {
  background: #FAFAFA;
}

.flat-card-title {
  font-size: 1rem;
  font-weight: 500;
  color: #000000;
  margin: 0;
  flex: 1;
}

.flat-card-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flat-link {
  font-size: 0.875rem;
  color: #0066cc;
  text-decoration: none;
  transition: color 0.2s ease;
}

.flat-link:hover {
  color: #0052a3;
  text-decoration: underline;
}

.flat-card-body {
  padding: 1rem 1.25rem;
  flex: 1;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease 0.1s, padding 0.3s ease;
  max-height: 5000px;
  opacity: 1;
}

.flat-card-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 1.25rem;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

.btn-card-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #757575;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.btn-card-toggle:hover {
  background: #F5F5F5;
  color: #212121;
}

.btn-card-toggle i {
  font-size: 18px;
  transition: transform 0.2s;
}

.btn-card-toggle.active i {
  transform: rotate(180deg);
}

/* Task List - Flat */
.task-list-flat {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.task-item-flat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 1rem;
}

.task-item-flat:last-child {
  border-bottom: none;
}

.task-item-flat:hover {
  background: #fafafa;
  margin: 0 -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.task-item-content {
  flex: 1;
  min-width: 0;
}

.task-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.task-item-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #000000;
  margin: 0;
  line-height: 1.3;
  flex: 1;
}

.task-item-desc {
  font-size: 0.8125rem;
  color: #666666;
  line-height: 1.4;
  margin: 0 0 0.5rem 0;
}

.task-item-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.75rem;
  color: #999999;
  flex-wrap: wrap;
}

.task-item-date {
  color: #999999;
}

.task-item-action {
  flex-shrink: 0;
}

.flat-btn {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  color: #0066cc;
  text-decoration: none;
  border: 1px solid #0066cc;
  border-radius: 6px;
  background: transparent;
  transition: all 0.2s ease;
}

.flat-btn:hover {
  background: #0066cc;
  color: #ffffff;
  text-decoration: none;
}

.flat-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  color: #666666;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Flat List */
.flat-list {
  display: flex;
  flex-direction: column;
}

.flat-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.flat-list-item:last-child {
  border-bottom: none;
}

.flat-list-content {
  flex: 1;
  min-width: 0;
  margin-right: 1rem;
}

.flat-list-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #000000;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.flat-list-meta {
  font-size: 0.75rem;
  color: #999999;
  line-height: 1.3;
}

.flat-list-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.flat-link-icon {
  color: #0066cc;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.2s ease;
}

.flat-link-icon:hover {
  color: #0052a3;
  text-decoration: none;
}

/* Flat Status Badges */
.flat-status {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 400;
  border: 1px solid;
  border-radius: 4px;
}

.flat-status-success {
  color: #2e7d32;
  background: #e8f5e9;
  border-color: #c8e6c9;
}

.flat-status-draft {
  color: #616161;
  background: #f5f5f5;
  border-color: #e0e0e0;
}

.flat-status-progress {
  color: #f57c00;
  background: #fff3e0;
  border-color: #ffe0b2;
}

/* Empty State - Flat */
.empty-state-flat {
  text-align: center;
  padding: 2rem 1rem;
}

.empty-text {
  font-size: 0.9375rem;
  color: #666666;
  margin-bottom: 0.5rem;
}

.empty-hint {
  font-size: 0.8125rem;
  color: #999999;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-stat-value {
    font-size: 1.5rem;
  }
  
  .dashboard-stat-label {
    font-size: 0.8125rem;
  }
  
  .flat-card-header,
  .flat-card-body {
    padding: 0.875rem 1rem;
  }
  
  .task-item-flat {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 0;
  }
  
  .task-item-flat:hover {
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .task-item-action {
    width: 100%;
  }
  
  .task-item-action .btn {
    width: 100%;
  }
  
  .flat-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .flat-list-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* Completion Stats */
.completion-stats {
  font-size: 0.875rem;
  color: #6c757d;
  background: #f8f9fa;
  padding: 0.5rem 1rem;
  border-radius: 20px;
}

/* Description Block */
.description-block {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  color: #495057;
  line-height: 1.6;
}

/* Table Improvements */
.table th {
  font-weight: 600;
  font-size: 0.875rem;
  border-bottom: 2px solid #dee2e6;
}

.table td {
  vertical-align: middle;
}

/* Multiple Select */
select[multiple] {
  min-height: 100px;
}

select[multiple] option:checked {
  background: #0d6efd linear-gradient(0deg, #0d6efd 0%, #0d6efd 100%);
  color: white;
}

/* Card Header Icons */
.card-header i.bi {
  opacity: 0.9;
}

.badge.text-bg-light.border {
  background-color: #f8f9fa !important;
}

/* Color Indicators */
.text-bg-success {
  --bs-bg-opacity: 0.8;
}

.text-bg-warning {
  --bs-bg-opacity: 0.8;
}

.text-bg-danger {
  --bs-bg-opacity: 0.8;
}

/* Print Styles */
@media print {
  .shadow-sm,
  .shadow,
  .shadow-lg {
    box-shadow: none !important;
  }
  .btn,
  .card-header {
    display: none !important;
  }
  .card {
    border: 1px solid #ddd !important;
  }
  .badge {
    border: 1px solid #000 !important;
  }
  #filtersBody {
    display: none !important;
  }
}

/* Chart Canvas */
#activityChart {
  position: relative;
  z-index: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .page-header .d-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .user-header,
  .department-header {
    flex-direction: column;
    gap: 1rem;
  }

  .stats-grid,
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

