/* Ant Design System */
:root {
  --primary-color: #1890ff;
  --primary-hover: #40a9ff;
  --primary-active: #096dd9;
  --success-color: #52c41a;
  --warning-color: #faad14;
  --error-color: #f5222d;
  --info-color: #13c2c2;
  
  --text-primary: rgba(0, 0, 0, 0.85);
  --text-secondary: rgba(0, 0, 0, 0.65);
  --text-disabled: rgba(0, 0, 0, 0.25);
  
  --border-color: #d9d9d9;
  --border-color-split: #f0f0f0;
  --background-color: #fafafa;
  --component-background: #ffffff;
  
  --box-shadow-base: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  --box-shadow-card: 0 1px 2px -2px rgba(0, 0, 0, 0.16), 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09);
  
  --border-radius-base: 6px;
  --border-radius-sm: 4px;
  --border-radius-lg: 8px;
  
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-base: 14px;
  --font-size-lg: 16px;
  --font-size-sm: 12px;
  
  --height-base: 32px;
  --height-lg: 40px;
  --height-sm: 24px;
  
  --padding-md: 16px;
  --padding-sm: 12px;
  --padding-xs: 8px;
  --padding-lg: 24px;
}

/* ДОБАВИТЬ в начало frontend/css/style.css после :root */

/* Темная тема */
[data-theme="dark"] {
  /* Основные цвета */
--primary-color: #0ea5e9;
--primary-hover: #38bdf8;
--primary-active: #0369a1;
  
  /* Цвета фона */
  --body-background: #0f0f0f;
  --component-background: #1f1f1f;
  --background-color: #141414;
  --background-color-light: #262626;
  
  /* Цвета текста */
  --text-primary: rgba(255, 255, 255, 0.88);
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-disabled: rgba(255, 255, 255, 0.25);
  
  /* Границы */
  --border-color: #424242;
  --border-color-split: #303030;
  
  /* Состояния */
  --error-color: #ff4d4f;
  --warning-color: #faad14;
  --success-color: #52c41a;
  --info-color: #1677ff;
  
  /* Тени */
  --box-shadow-base: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  
  /* Дополнительные цвета для темной темы */
  --hover-bg: rgba(255, 255, 255, 0.06);
  --active-bg: rgba(255, 255, 255, 0.1);
  --menu-hover-bg: rgba(22, 104, 220, 0.15);
  --menu-active-bg: var(--primary-color);
  --menu-active-text: var(--component-background);
}

/* Theme Toggle - Simplified */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
}

.theme-checkbox {
  display: none;
}

.theme-slider {
  width: 60px;
  height: 30px;
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  border-radius: 30px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  transition: all 0.3s ease;
}

.theme-slider:hover {
  border-color: var(--primary-color);
}

.theme-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: var(--primary-color);
  border-radius: 50%;
  left: 4px;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-checkbox:checked ~ .theme-slider::before {
  transform: translateX(30px);
}

.theme-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: opacity 0.3s ease;
}

.theme-icon.sun {
  color: #FDB813;
}

.theme-icon.moon {
  color: #94A3B8;
}

.theme-checkbox:checked ~ .theme-slider .theme-icon.sun {
  opacity: 0.3;
}

.theme-checkbox:checked ~ .theme-slider .theme-icon.moon {
  opacity: 1;
}

.theme-checkbox:not(:checked) ~ .theme-slider .theme-icon.sun {
  opacity: 1;
}

.theme-checkbox:not(:checked) ~ .theme-slider .theme-icon.moon {
  opacity: 0.3;
}

/* Состояние для темной темы */
.theme-checkbox:checked + .theme-slider {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.theme-checkbox:checked + .theme-slider::before {
  left: 32px;
  background: var(--component-background);
}

.theme-checkbox:checked + .theme-slider .sun {
  opacity: 0.3;
}

.theme-checkbox:checked + .theme-slider .moon {
  opacity: 1;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5715;
  color: var(--text-primary);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: none; /* Убираем ограничение */
  margin: 0;
  padding: 0 var(--padding-md);
}

/* Header - Ant Design */
.header {
  background: var(--component-background);
  border-bottom: 1px solid var(--border-color-split);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  padding: 0 var(--padding-lg);
}

.logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--padding-md);
}

#user-info {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  padding: 4px var(--padding-xs);
  background: var(--background-color);
  border-radius: var(--border-radius-sm);
}

/* User Profile */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--background-color);
  border-radius: 8px;
  border: 1px solid var(--border-color-split);
  transition: all 0.3s;
}

.user-profile:hover {
  background: var(--component-background);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #1564d6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 4px rgba(24, 144, 255, 0.2);
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  .user-details {
    display: none;
  }
}

/* Buttons - Ant Design */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-base);
  font-size: var(--font-size-base);
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  min-height: var(--height-base);
  background: var(--component-background);
  color: var(--text-primary);
  user-select: none;
  touch-action: manipulation;
}

.btn:hover {
  color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn:active {
  color: var(--primary-active);
  border-color: var(--primary-active);
}

.btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--component-background);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--component-background);
}

.btn-primary:active {
  background: var(--primary-active);
  border-color: var(--primary-active);
}

.btn-secondary {
  background: var(--component-background);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  color: var(--primary-hover);
  border-color: var(--primary-hover);
}
/* Main Layout - Ant Design */
.main {
  padding: 0;
  min-height: calc(100vh - 64px);
  background: var(--background-color);
}

.main .container {
  display: grid;
  grid-template-columns: 256px 1fr;
  gap: 0;
  align-items: start;
  width: 100%;
  height: calc(100vh - 64px);
  padding: 0;
  transition: grid-template-columns 0.3s ease;
  position: relative; /* Добавили */
}

.main .container.sidebar-hidden {
  grid-template-columns: 0px 1fr;
}






/* Sidebar - Ant Design */
.sidebar {
  background: var(--component-background);
  border: 1px solid var(--border-color-split);
  height: 100%;
  overflow-y: auto;
  position: sticky;
  top: 0;
  transition: transform 0.3s ease;
  z-index: 1000;
    border-radius: 7px;
  margin-top: 7px;
}

.sidebar.hide {
  transform: translateX(-100%);
}

.menu {
  list-style: none;
  padding: var(--padding-md) 0;
}

.menu li {
  margin: 0;
}

.menu a {
  display: flex;
  align-items: center;
  padding: 12px var(--padding-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--font-size-base);
  font-weight: 400;
  transition: all 0.3s;
  border-radius: 0;
  margin: 0 var(--padding-xs);
  gap: 12px;
  min-height: 40px;
}

.menu a:hover {
  background: var(--menu-hover-bg, #e6f7ff);
  color: var(--primary-color);
}

.menu a.active {
  background: var(--menu-active-bg, var(--primary-color));
  color: var(--menu-active-text, var(--component-background));
}

.menu a.active:hover {
  background: var(--primary-hover);
  color: var(--component-background);
}
/* Дополнительные стили для темной темы */
[data-theme="dark"] .menu a:hover {
  background: rgba(22, 104, 220, 0.15);
  color: var(--primary-hover);
}

[data-theme="dark"] .menu a.active {
  background: var(--primary-color);
  color: white;
}

[data-theme="dark"] .menu a.active:hover {
  background: var(--primary-hover);
  color: white;
}


.menu-icon {
  min-width: 18px; /* Фиксированная ширина для выравнивания */
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0; /* Не сжимается */
}

.menu-icon svg {
  width: 18px; /* Увеличили размер иконок */
  height: 18px;
  transition: all 0.3s;
}

.menu-text {
  flex: 1;
  line-height: 1.5;
  font-size: 14px;
  font-weight: 500;
}

/* Hover эффекты для иконок */
.menu a:hover .menu-icon svg {
  transform: scale(1.1);
}

.menu a.active .menu-icon svg {
  transform: scale(1.05);
}

/* Content Area - Ant Design */
.content {
  background: var(--component-background);
  border-radius: 0;
  padding: var(--padding-md);
  border: none;
  box-shadow: none;
  height: 100%;
  overflow-y: auto;
  margin: var(--padding-xs);
  margin-left: 10px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color-split);
  grid-column: 2;
  align-self: start; /* Добавили */
  position: relative; /* Добавили */
  top: 0; /* Добавили */
}




/* Form Elements - Ant Design */
.form-input,
.form-select {
  width: 100%;
  padding: 4px 11px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-base);
  font-size: var(--font-size-base);
  background: var(--component-background);
  transition: all 0.3s;
  min-height: var(--height-base);
  color: var(--text-primary);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.form-input::placeholder {
  color: var(--text-disabled);
}

.form-label {
  display: block;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--padding-xs);
  line-height: 1.5715;
}

.form-group {
  margin-bottom: var(--padding-md);
}
/* Burger Menu */
/* Burger Menu */
/* Burger Menu */
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: all 0.3s;
}

.burger-btn:hover {
  background: var(--background-color);
}

.burger-line {
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  margin: 2px 0;
  border-radius: 1px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;

}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Mobile sidebar */
@media (max-width: 768px) {
  .main .container {
    grid-template-columns: 0fr;
  }
  
  .sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 280px;
    height: calc(100vh - 64px);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 1001; /* УБЕДИТЬСЯ ЧТО ЗНАЧЕНИЕ ПРАВИЛЬНОЕ */
    background: var(--component-background);
  }
  
  .sidebar.show {
    transform: translateX(0) !important; /* ДОБАВИТЬ !important */
  }
  
  #sidebar-container.show .sidebar {
    transform: translateX(0);
  }
  
  .content {
    margin-left: 0;
  }
}

/* Module Loader Styles */
.module-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 60px 20px;
  text-align: center;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color-split);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

.module-loader p {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  margin: 0;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Skeleton для быстрого показа структуры */
.content-skeleton {
  padding: var(--padding-lg);
  background: var(--component-background);
  margin: var(--padding-xs);
  margin-left: 0;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color-split);
  min-height: calc(100vh - 100px);
}

.skeleton-header {
  height: 32px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 20px;
}

.skeleton-line {
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 12px;
}

.skeleton-line:nth-child(2) { width: 80%; }
.skeleton-line:nth-child(3) { width: 60%; }
.skeleton-line:nth-child(4) { width: 90%; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.card-item-checkbox.assigned-current {
    border: 2px solid #52c41a;
    background: #f6ffed;
}

.card-item-checkbox.assigned-other {
    opacity: 0.6;
    background: #f5f5f5;
}

.card-item-checkbox.assigned-other input[type="checkbox"] {
    cursor: not-allowed;
}

.assigned-badge {
    color: #52c41a;
    font-weight: 500;
}

.other-badge {
    color: #999;
}

.buyers-title-group {
    display: flex;
    align-items: center;
}

.date-filter-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-filter-container .form-select,
.date-filter-container .form-input {
    min-width: 120px;
    height: 32px;
    padding: 4px 8px;
    font-size: 14px;
}

.date-filter-group .form-select {
    min-width: 140px;
}

.custom-date-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-date-inputs .form-input {
    width: 140px;
}

.custom-date-inputs span {
    color: var(--text-secondary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.buyers-title-group {
    display: flex;
    align-items: center;
}

/* Header Styles */
.header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  max-width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-link {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.logo-link:hover {
  opacity: 0.8;
}

.logo {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--primary-color);
  animation: rotate3d 4s ease-in-out infinite;
  transform-style: preserve-3d;
}

@keyframes rotate3d {
  0%, 100% { 
    transform: rotateY(0deg) rotateX(0deg);
  }
  25% { 
    transform: rotateY(180deg) rotateX(0deg);
  }
  50% { 
    transform: rotateY(180deg) rotateX(180deg);
  }
  75% { 
    transform: rotateY(0deg) rotateX(180deg);
  }
}

.logo-text {
  color: var(--text-primary);
  font-weight: 700;
}





.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.user-avatar:hover {
  transform: scale(1.1);
}

.user-avatar svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  
  .user-greeting {
    padding: 6px 12px;
  }
  
  .logo-text {
    display: none;
  }
  
  .logo-icon {
    font-size: 32px;
  }
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 40px 20px;
  text-align: center;
  animation: fadeIn 0.6s ease-out;
}

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

.welcome-icon {
  margin-bottom: 32px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.welcome-icon svg {
  color: var(--primary-color);
  filter: drop-shadow(0 4px 12px rgba(74, 144, 226, 0.3));
}

.welcome-title {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 48px;
  max-width: 500px;
}

.welcome-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 1000px;
  margin-top: 32px;
}

.feature-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px 24px;
  transition: all 0.3s ease;
  cursor: default;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: bounce 2s ease-in-out infinite;
}

.feature-card:nth-child(1) .feature-icon {
  animation-delay: 0s;
}

.feature-card:nth-child(2) .feature-icon {
  animation-delay: 0.2s;
}

.feature-card:nth-child(3) .feature-icon {
  animation-delay: 0.4s;
}

.feature-card:nth-child(4) .feature-icon {
  animation-delay: 0.6s;
}

@keyframes bounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.feature-card h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
  .welcome-title {
    font-size: 32px;
  }
  
  .welcome-subtitle {
    font-size: 16px;
  }
  
  .welcome-features {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .feature-card {
    padding: 24px 20px;
  }
}