/* CALENDAR STYLES - ОБНОВЛЕННЫЙ ДЛЯ НОВОЙ ВЕРСИИ */
.calendar-view-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  font-family: var(--font-primary);
  font-weight: 500 !important;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ЗАГОЛОВОК И НАВИГАЦИЯ */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #dee2e6;
  font-family: var(--font-primary);
}

.calendar-nav-btn {
  padding: 10px 20px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  font-family: var(--font-primary);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 14px;
}

.calendar-nav-btn:hover {
  background: #5a6268;
  color: white;
}

#current-month {
  margin: 0;
  font-family: var(--font-primary);
  font-weight: 700 !important;
  font-size: 20px;
  color: #333;
}

/* СЕТКА КАЛЕНДАРЯ */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 110px);
  gap: 1px;
  padding: 1px;
  justify-content: center;
  width: fit-content;
  margin: 0 auto 24px auto;
  box-sizing: border-box;
}

/* ЗАГОЛОВКИ ДНЕЙ НЕДЕЛИ */
.calendar-day-header {
  min-height: 40px;
  height: 40px;
  min-width: 110px;
  max-width: 110px;
  padding: 8px 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-sizing: border-box;
  margin: 0;
  font-family: var(--font-primary);
}

/* ЯЧЕЙКИ С ДАТАМИ */
.calendar-day {
  min-height: 80px;
  height: 80px;
  min-width: 110px;
  max-width: 110px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-sizing: border-box;
  margin: 0;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.calendar-day.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.calendar-day.empty:hover {
  background: transparent;
  border: none;
}

/* СОДЕРЖИМОЕ ЯЧЕЕК */
.day-number {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  line-height: 1;
  margin: 0;
  font-family: var(--font-primary);
}

.day-payout {
  font-size: 13px;
  line-height: 1.2;
  margin: 1px 0;
  text-align: center;
  font-weight: 500;
  color: #1976d2;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 700;
}

.day-count {
  font-size: 12px;
  line-height: 1.2;
  margin: 1px 0;
  text-align: center;
  color: #6c757d;
  font-family: var(--font-primary);
  font-weight: 500;
}

/* СОСТОЯНИЯ ЯЧЕЕК */
.calendar-day.has-payout {
  background: #e3f2fd;
  border-color: #2196f3;
}

.calendar-day.has-payout .day-number {
  color: #1565c0;
}

.calendar-day.has-payout .day-payout {
  color: #1565c0;
  font-weight: 700;
}

.calendar-day.has-payout .day-count {
  color: #495057;
  font-weight: 500;
}

.calendar-day.selected {
  background: #d1ecf1;
  border-color: #17a2b8;
  box-shadow: 0 0 0 2px rgba(23, 162, 184, 0.3);
}

.calendar-day.selected .day-number {
  color: #000000;
  font-weight: 700;
}

.calendar-day.selected .day-payout,
.calendar-day.selected .day-count {
  color: #0c5460;
  font-weight: 600;
}

.calendar-day:hover:not(.empty) {
  background: #e9ecef;
  border-color: #adb5bd;
}

.calendar-day.has-payout:hover:not(.empty) {
  background: #bbdefb;
  border-color: #1976d2;
}

/* СТАТИСТИКА КАЛЕНДАРЯ */
.calendar-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.stat-item {
  text-align: center;
  font-family: var(--font-primary);
}

.stat-item strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.stat-item span {
  font-size: 0.875rem;
  color: #6c7280;
  font-weight: 500;
}

/* ФИЛЬТРЫ И УПРАВЛЕНИЕ */
.calendar-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.date-filter-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-primary);
}

.date-filter-control label {
  font-weight: 600;
  color: #495057;
}

#date-filter {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-family: var(--font-primary);
  font-size: 14px;
}

#reset-date {
  padding: 8px 16px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  transition: background-color 0.2s;
}

#reset-date:hover {
  background: #5a6268;
}

/* АДАПТИВНОСТЬ */
@media (max-width: 1200px) {
  .calendar-grid {
    grid-template-columns: repeat(7, 100px);
  }
  
  .calendar-day-header,
  .calendar-day {
    min-width: 100px;
    max-width: 100px;
  }
}

@media (max-width: 768px) {
  .calendar-view-container {
    padding: 15px;
  }
  
  .calendar-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
  }
  
  .calendar-day-header,
  .calendar-day {
    min-width: auto;
    max-width: none;
    min-height: 60px;
    height: auto;
  }
  
  .calendar-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .calendar-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .day-number {
    font-size: 16px;
  }
  
  .day-payout,
  .day-count {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .calendar-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
  }
  
  .calendar-day {
    min-height: 50px;
    padding: 4px 2px;
  }
  
  .day-number {
    font-size: 14px;
  }
  
  .day-payout,
  .day-count {
    font-size: 10px;
  }
}

/* ДОПОЛНИТЕЛЬНЫЕ УТИЛИТЫ */
.calendar-financial-data {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
}

.debug-panel {
  background: #ffeb3b;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ffc107;
  font-family: var(--font-primary);
}

/* АНИМАЦИИ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.calendar-view-container {
  animation: fadeIn 0.3s ease-out;
}

.calendar-day {
  animation: fadeIn 0.2s ease-out;
}

/* Улучшаем отображение статистики */
.calendar-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    transition: all 0.3s ease;
}

.stat-item strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.stat-item span {
    font-size: 0.875rem;
    color: #6c7280;
    font-weight: 500;
    line-height: 1.3;
}

/* 🆕 Подсветка при выборе дня */
.calendar-day.selected + .calendar-stats .stat-item:first-child,
.calendar-day.selected + .calendar-stats .stat-item:nth-child(2) {
    background: #e3f2fd;
    border-radius: 6px;
    padding: 10px;
}

/* 🆕 Анимация изменения статистики */
.stat-item strong {
    transition: color 0.3s ease;
}

.stat-item strong.updated {
    color: #1976d2;
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}