/* ============================================================
   Hoff Admin — общие стили
   ============================================================ */

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

:root {
  --color-brand: #e30611;
  --color-brand-dark: #c0050e;
  --color-text: #1a1a1a;
  --color-text-muted: #888;
  --color-text-soft: #555;
  --color-border: #e8e8e8;
  --color-border-input: #ddd;
  --color-bg: #f5f5f5;
  --color-bg-soft: #fafafa;
  --color-bg-hover: #fff9f9;
  --radius-sm: 4px;
  --radius-md: 4px;
  --radius-lg: 4px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.4;
}
a {
  text-decoration: none;
}
/* ============================================================
   Шапка
   ============================================================ */

.header {
  background: #222;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 60px;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 24px;
  color: #fff;
  letter-spacing: -0.5px;
  text-decoration: none;
}

.logo img {
  height: 32px;
  border-radius: var(--radius-sm);
}

.logo small {
  font-weight: 400;
  font-size: 12px;
  color: #fff;
  margin-left: 4px;
  letter-spacing: 0;
}

.header-nav {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: #fff;
}

.header-nav a {
  text-decoration: none;
  color: #fff;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s;
}

.header-nav a:hover,
.header-nav a.active {
  color: #fff;
  font-weight: 600;
  border-bottom-color: var(--color-brand);
}

.header-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #fff;
  font-weight: 600;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

/* ============================================================
   Контейнер
   ============================================================ */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ============================================================
   Кнопки
   ============================================================ */

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}

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

.btn-secondary {
  background: #fff;
  color: var(--color-text);
  border-color: var(--color-border-input);
}

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

.btn-danger {
  background: transparent;
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}

.btn-danger:hover {
  background: var(--color-brand);
  color: #fff;
}

/* ============================================================
   Карточки
   ============================================================ */

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title small {
  font-size: 12px;
  font-weight: 400;
  color: #999;
}

/* ============================================================
   Поля формы
   ============================================================ */

.field {
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.field label .req {
  color: var(--color-brand);
}

.field input[type="text"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--color-brand);
}

.field input.error,
.field textarea.error {
  border-color: var(--color-brand);
  background: var(--color-bg-hover);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.field .hint {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.field .error-text {
  font-size: 12px;
  color: var(--color-brand);
  margin-top: 4px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ============================================================
   Страница: список товаров (index.php)
   ============================================================ */

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

.page-title {
  font-size: 28px;
  font-weight: 700;
}

.page-title span {
  font-size: 16px;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 8px;
}

.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 14px;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus {
  border-color: var(--color-brand);
}

.filter-select {
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  outline: none;
}

.filter-select:focus {
  border-color: var(--color-brand);
}

.products-table {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.table-header {
  display: grid;
  grid-template-columns: 60px 1fr 120px 200px 100px;
  padding: 12px 16px;
  background: var(--color-bg-soft);
  border-bottom: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.table-row {
  display: grid;
  grid-template-columns: 60px 1fr 120px 200px 100px;
  padding: 14px 16px;
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.1s;
}

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

.table-row:hover {
  background: var(--color-bg-hover);
}

.product-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.product-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-sku {
  font-size: 12px;
  color: #999;
}

.product-category {
  font-size: 15px;
  color: var(--color-text);
}

.product-stock {
  font-size: 13px;
  color: var(--color-text-soft);
}

.product-stock.low {
  color: var(--color-brand);
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.status-active {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-draft {
  background: #fff3e0;
  color: #e65100;
}

.status-archived {
  background: #f5f5f5;
  color: var(--color-text-muted);
}

.row-arrow {
  color: #ccc;
  font-size: 16px;
  text-align: right;
}

.table-row:hover .row-arrow {
  color: var(--color-brand);
}

.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #999;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pagination button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pagination button:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.pagination button.active {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
}

/* ============================================================
   Страница: редактирование товара (edit.html)
   ============================================================ */

.edit-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-soft);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 0;
}

.back-link:hover {
  color: var(--color-brand);
}

.edit-title {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-title .sku-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: #f0f0f0;
  padding: 3px 10px;
  border-radius: 20px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.edit-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

/* Статусы (радио) */
.status-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.status-option:hover {
  border-color: var(--color-brand);
}

.status-option input[type="radio"] {
  accent-color: var(--color-brand);
  width: 16px;
  height: 16px;
}

.status-option.selected {
  border-color: var(--color-brand);
  background: var(--color-bg-hover);
}

.status-option .status-name {
  font-size: 14px;
  font-weight: 600;
}

.status-option .status-desc {
  font-size: 12px;
  color: #999;
  margin-left: auto;
}

/* Изображения */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-item .image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.image-item:hover .image-remove {
  opacity: 1;
}

.image-item.main::after {
  content: 'Главное';
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--color-brand);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.image-upload {
  aspect-ratio: 1;
  border: 2px dashed var(--color-border-input);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  font-size: 12px;
  gap: 4px;
  transition: all 0.15s;
}

.image-upload:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.image-upload .plus {
  font-size: 24px;
  line-height: 1;
}

/* Боковая панель */
.side-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 20px;
  margin-bottom: 16px;
}

.meta-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.meta-row .meta-label {
  color: #999;
}

.meta-row .meta-value {
  font-weight: 600;
  text-align: right;
}

.danger-zone {
  border-color: #f5d5d5;
  background: #fffafa;
}

.danger-zone .danger-title {
  color: var(--color-brand);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.danger-zone p {
  font-size: 12px;
  color: #999;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ============================================================
   Адаптив
   ============================================================ */

@media (max-width: 1000px) {
  .edit-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .table-header,
  .table-row {
    grid-template-columns: 50px 1fr 80px 80px 50px;
  }
  .col-sku,
  .col-stock,
  .col-category {
    display: none;
  }
}

@media (max-width: 600px) {
  .field-row {
    grid-template-columns: 1fr;
  }
  .edit-title {
    font-size: 18px;
  }
}