/* ============================================
   SIDEBAR PROFESSIONAL - МИРОВОЙ УРОВЕНЬ  
   Создано: 2025-10-31
   Вдохновлено: Notion, Linear, Figma
   ============================================ */

/* === ОСНОВА SIDEBAR === */
asideaside.sidebar {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
  padding: 88px 0 24px 0; /* 64px top-bar + 24px отступ */
  position: fixed;
  left: 0;
  top: 64px;
  bottom: 0;
  height: calc(100vh - 64px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 900;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

aside.sidebar::-webkit-scrollbar {
  width: 6px;
}

aside.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

aside.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

aside.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* === НАВИГАЦИЯ === */
aside.sidebar nav {
  width: 100%;
  padding: 0 16px;
  margin-bottom: 24px;
}

aside.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

aside.sidebar nav ul li {
  margin: 0;
}

aside.sidebar nav ul li a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  background: transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

aside.sidebar nav ul li a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 0 3px 3px 0;
}

aside.sidebar nav ul li a i {
  font-size: 20px;
  color: #6b7280;
  transition: all 0.3s;
  width: 24px;
  text-align: center;
}

/* Hover эффект */
aside.sidebar nav ul li a:hover:not(.active) {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #3b82f6;
  padding-left: 20px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}

aside.sidebar nav ul li a:hover:not(.active) i {
  color: #3b82f6;
  transform: scale(1.1);
}

/* Активное состояние */
aside.sidebar nav ul li a.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3),
              inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

aside.sidebar nav ul li a.active::before {
  opacity: 1;
}

aside.sidebar nav ul li a.active i {
  color: #ffffff !important;
  transform: scale(1.08);
}

aside.sidebar nav ul li a.active::after {
  content: '';
  position: absolute;
  right: 16px;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.5);
  animation: pulse 2s infinite;
}

/* === ВИДЖЕТЫ === */
.sidebar-widgets {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.sidebar-widget {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-widget:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-weight: 600 !important;
  font-size: 14px;
  color: #1f2937;
}

.widget-header i {
  font-size: 18px;
  color: #3b82f6;
}

.widget-content {
  padding: 16px;
}

/* === TIMELINE ВИДЖЕТ === */
.widget-timeline .widget-header {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.widget-timeline .widget-header i {
  color: #3b82f6;
  animation: rotate 3s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#current-time {
  font-weight: 700;
  color: #3b82f6;
  font-size: 16px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.timeline-loading {
  text-align: center;
  padding: 24px 12px;
  color: #6b7280;
  font-size: 14px;
}

.timeline-loading i {
  font-size: 24px;
  color: #3b82f6;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 40px;
  bottom: -12px;
  width: 2px;
  background: linear-gradient(180deg, #e5e7eb 0%, transparent 100%);
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.timeline-info {
  flex: 1;
  min-width: 0;
}

.timeline-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.timeline-patient {
  font-size: 14px;
  font-weight: 600 !important;
  color: #1f2937;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-meta {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Текущий приём - КРАСНЫЙ */
.timeline-current .timeline-dot {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4),
              0 0 0 4px rgba(239, 68, 68, 0.1);
  animation: pulse 2s infinite;
}

.timeline-current .timeline-dot::before {
  content: '⚡';
  font-size: 16px;
}

.timeline-current .timeline-label {
  color: #ef4444;
  font-weight: 800;
}

/* Следующий приём - ЖЁЛТЫЙ */
.timeline-next .timeline-dot {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3),
              0 0 0 4px rgba(245, 158, 11, 0.1);
}

.timeline-next .timeline-dot::before {
  content: '⏱️';
  font-size: 14px;
}

.timeline-next .timeline-label {
  color: #f59e0b;
}

/* Будущие приёмы - СИНИЙ */
.timeline-later .timeline-dot {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.timeline-later .timeline-dot::before {
  content: '📋';
  font-size: 14px;
}

.timeline-later .timeline-label {
  color: #3b82f6;
}

.timeline-empty {
  text-align: center;
  padding: 32px 16px;
  color: #6b7280;
  font-size: 14px;
}

.timeline-empty i {
  font-size: 32px;
  color: #10b981;
  display: block;
  margin-bottom: 12px;
}

/* === СТАТИСТИКА ВИДЖЕТ === */
.widget-stats .widget-header {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.widget-stats .widget-header i {
  color: #10b981;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-icon {
  font-size: 24px;
  width: 36px;
  text-align: center;
}

.stat-label {
  flex: 1;
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
}

.stat-money .stat-value {
  color: #10b981;
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  asideaside.sidebar {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
  }
}

@media (max-width: 900px) {
  asideaside.sidebar {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
  }
  
  aside.sidebar nav ul li a {
    justify-content: center;
    padding: 14px;
  }
  
  aside.sidebar nav ul li a span {
    display: none;
  }
  
  .sidebar-widgets {
    display: none;
  }
}

@media (max-width: 650px) {
  asideaside.sidebar {
    position: static;
    width: 100%;
    min-width: unset;
    max-width: unset;
    height: auto;
    top: unset;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }
  
  aside.sidebar nav {
    padding: 16px;
  }
  
  aside.sidebar nav ul {
    flex-direction: row;
    overflow-x: auto;
  }
  
  aside.sidebar nav ul li a span {
    display: inline;
  }
}

/* === DARK MODE === */
body.dark-theme asideaside.sidebar {
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  border-right-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme aside.sidebar nav ul li a {
  color: #d1d5db;
}

body.dark-theme aside.sidebar nav ul li a i {
  color: #9ca3af;
}

body.dark-theme aside.sidebar nav ul li a:hover:not(.active) {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

body.dark-theme aside.sidebar nav ul li a:hover:not(.active) i {
  color: #60a5fa;
}

body.dark-theme .sidebar-widget {
  background: #374151;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .widget-header {
  background: #4b5563;
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
}

body.dark-theme .timeline-patient,
body.dark-theme .stat-value {
  color: #f3f4f6;
}

body.dark-theme .timeline-meta,
body.dark-theme .stat-label {
  color: #9ca3af;
}

body.dark-theme .stat-row {
  border-bottom-color: #4b5563;
}

/* === АНИМАЦИИ === */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4),
                0 0 0 4px rgba(239, 68, 68, 0.1);
  }
  50% {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.6),
                0 0 0 8px rgba(239, 68, 68, 0.15);
  }
}

/* Плавное появление виджетов */
.sidebar-widget {
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar-widget:nth-child(1) {
  animation-delay: 0.1s;
}

.sidebar-widget:nth-child(2) {
  animation-delay: 0.2s;
}

/* === ФИКС ДЛЯ MAIN AREA === */
.main-area {
  margin-left: 280px !important;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1200px) {
  .main-area {
    margin-left: 240px !important;
  }
}

@media (max-width: 900px) {
  .main-area {
    margin-left: 72px !important;
  }
}

@media (max-width: 650px) {
  .main-area {
    margin-left: 0 !important;
  }
}



