/* ==========================================
   DASHBOARD — СТИЛИ
   ========================================== */

.dashboard {
  display: flex;
  min-height: calc(100vh - 70px);
  background: var(--bg-body);
}

/* Боковое меню */
.dashboard__sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-white);
  border-right: 1px solid var(--border-light);
  padding: 20px 12px;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  text-align: left;
}

.dash-nav__item:hover {
  background: var(--bg-gray);
  color: var(--text-primary);
}

.dash-nav__item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.dash-nav__item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

/* Контент */
.dashboard__content {
  flex: 1;
  padding: 30px;
  min-width: 0;
}

/* Вкладки */
.dash-tab {
  display: none;
}

.dash-tab.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dash-tab__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.dash-tab__header h1 {
  font-size: 26px;
  font-weight: 800;
}

.dash-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}

.dash-btn:hover {
  background: var(--primary-dark);
}

/* Форма */
.product-form {
  max-width: 800px;
}

.form-section {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.form-section__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.form-section__title i {
  color: var(--primary);
}

.form-section__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.2s;
  background: var(--bg-white);
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(231,76,60,0.08);
}

.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  resize: vertical;
  transition: border-color 0.2s;
  font-family: inherit;
  line-height: 1.6;
}

.form-textarea:focus {
  border-color: var(--primary);
  outline: none;
}

.form-hint {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
  display: block;
}

/* Превью цены */
.price-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-gray);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.price-preview__current {
  font-size: 20px;
  font-weight: 700;
}

.price-preview__old {
  font-size: 14px;
  color: var(--text-light);
  text-decoration: line-through;
}

.price-preview__badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* ==========================================
   ЗАГРУЗЧИК КАРТИНОК (Шаг 6 — стили)
   ========================================== */
.image-uploader {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-area i {
  font-size: 40px;
  color: var(--text-light);
}

.upload-area:hover i,
.upload-area.drag-over i {
  color: var(--primary);
}

.upload-area p {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.upload-area span {
  font-size: 12px;
  color: var(--text-light);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.upload-btn:hover {
  background: var(--primary-dark);
}

.upload-hint {
  font-size: 11px;
  color: var(--text-light);
}

/* Превью загруженных картинок */
.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.preview-item {
  position: relative;
  aspect-ratio: 1/1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item:first-child {
  border-color: var(--primary);
}

.preview-item:first-child::after {
  content: 'Главное';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 3px;
}

.remove-img {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

.remove-img:hover {
  background: var(--primary);
}

/* Прогресс загрузки */
.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-progress__track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress__bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

#progressText {
  font-size: 13px;
  color: var(--text-muted);
}

/* Переключатель */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-slider {
  width: 48px;
  height: 26px;
  background: var(--border);
  border-radius: 13px;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::after {
  left: 25px;
}

.toggle-label {
  font-size: 14px;
  font-weight: 600;
}

/* Кнопки формы */
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.form-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  transition: var(--transition);
}

.form-btn--primary {
  background: var(--primary);
  color: #fff;
}

.form-btn--primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.form-btn--secondary {
  background: var(--bg-gray);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.form-btn--secondary:hover {
  background: #e0e0e0;
}

/* Таблица товаров */
.products-table {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.products-table-header {
  display: grid;
  grid-template-columns: 80px 1fr 120px 100px 100px 120px;
  padding: 14px 18px;
  background: var(--bg-gray);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-row {
  display: grid;
  grid-template-columns: 80px 1fr 120px 100px 100px 120px;
  padding: 16px 18px;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

.product-row:last-child { border-bottom: none; }
.product-row:hover { background: var(--bg-gray); }

.product-row__img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.product-row__title {
  font-size: 13px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 12px;
}

.product-row__price {
  font-size: 15px;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.status-badge.available {
  background: #e8f5e9;
  color: #27ae60;
}

.status-badge.unavailable {
  background: var(--primary-light);
  color: var(--primary);
}

.product-row__actions {
  display: flex;
  gap: 6px;
}

.row-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.row-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.row-btn.delete:hover { border-color: #e74c3c; color: #e74c3c; background: var(--primary-light); }

/* Статистика */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-card__icon {
  width: 56px;
  height: 56px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto 14px;
}

.stat-card__value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-card__label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Загрузка */
.loading {
  padding: 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Seller info в шапке */
.seller-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-gray);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
}

.seller-info img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* Адаптив */
@media (max-width: 900px) {
  .dashboard { flex-direction: column; }
  .dashboard__sidebar { width: 100%; height: auto; position: static; display: flex; overflow-x: auto; padding: 10px; }
  .dash-nav { flex-direction: row; }
  .dashboard__content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .products-table-header { display: none; }
  .product-row { grid-template-columns: 60px 1fr; grid-template-rows: auto auto auto; gap: 8px; }
}

/* ==========================================
   ЗАГРУЗКА ФОТО ТОВАРА
   ========================================== */
.image-uploader {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-gray);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-area i {
  font-size: 36px;
  color: var(--text-light);
}

.upload-area:hover i,
.upload-area.drag-over i {
  color: var(--primary);
}

.upload-area p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.upload-area span {
  font-size: 12px;
  color: var(--text-light);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.upload-btn:hover {
  background: var(--primary-dark);
}

.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}

.preview-item {
  position: relative;
  aspect-ratio: 1/1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
  background: #fff;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item.main {
  border-color: var(--primary);
}

.preview-item.main::after {
  content: 'Главное';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 3px;
}

.preview-item .remove-img {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.preview-item .remove-img:hover {
  background: var(--primary);
}

.preview-item .make-main {
  position: absolute;
  top: 4px;
  left: 4px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  cursor: pointer;
}

.preview-item .make-main:hover {
  color: var(--primary);
}

.upload-progress {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.upload-progress.visible {
  display: flex;
}

.upload-progress__track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress__bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.25s ease;
}

.upload-progress__text {
  font-size: 12px;
  color: var(--text-muted);
}

/* Иконка видео на превью */
.preview-item.video-preview::before {
  content: '\f04b'; /* Иконка play */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 24px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  z-index: 2;
  pointer-events: none;
}