/* Product details with supplier */
.product-info .product-details {
  display: flex;
  flex-direction: column;
}
.product-info .product-supplier {
  font-size: 0.8em;
  color: #666;
  margin-top: 2px;
}

/* SKU Link */
.sku-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}
.sku-link:hover {
  text-decoration: underline;
}

/* Clickable row */
.product-row {
  cursor: pointer;
}
.product-row:hover {
  background: var(--color-bg-hover);
}

/* ========================================
   PRODUCT DETAIL TABS
   ======================================== */
.product-detail-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Tab Navigation */
.product-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.product-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.product-tab-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.product-tab-btn.active {
  background: var(--color-accent);
  color: white;
}

.product-tab-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.product-tab-btn .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--color-bg-secondary);
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
}

.product-tab-btn.active .tab-badge {
  background: rgba(255,255,255,0.2);
}

/* Tab Content */
.product-tabs-content {
  flex: 1;
  overflow-y: auto;
  max-height: 50vh;
}

.product-tab-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}

.product-tab-panel.active {
  display: block;
}

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

/* Tab Panel Sections */
.tab-section {
  margin-bottom: 24px;
}

.tab-section:last-child {
  margin-bottom: 0;
}

.tab-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.tab-section-title svg {
  width: 16px;
  height: 16px;
  color: var(--color-accent);
}

/* Data Grid in Tabs */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.data-grid-2 { grid-template-columns: repeat(2, 1fr); }
.data-grid-3 { grid-template-columns: repeat(3, 1fr); }
.data-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .data-grid-2, .data-grid-3, .data-grid-4 {
    grid-template-columns: 1fr;
  }
}

.data-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.data-field-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-field-value {
  font-size: 14px;
  color: var(--color-text-primary);
  font-weight: 500;
}

.data-field-value.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: -0.5px;
}

.data-field-value.large {
  font-size: 18px;
  font-weight: 700;
}

.data-field-value.success { color: var(--color-success); }
.data-field-value.warning { color: var(--color-warning); }
.data-field-value.danger { color: var(--color-danger); }

/* Status Tags */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.status-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-tag.active {
  background: var(--color-success-light);
  color: var(--color-success);
}
.status-tag.active::before { background: var(--color-success); }

.status-tag.inactive {
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
}
.status-tag.inactive::before { background: var(--color-text-muted); }

.status-tag.promo {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.status-tag.promo::before { background: var(--color-danger); }

.status-tag.bestseller {
  background: var(--color-gold-light);
  color: var(--color-gold);
}
.status-tag.bestseller::before { background: var(--color-gold); }

.status-tag.new {
  background: var(--color-info-light);
  color: var(--color-info);
}
.status-tag.new::before { background: var(--color-info); }

/* Variants Table in Tabs */
.variants-table-container {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.variants-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.variants-data-table th,
.variants-data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.variants-data-table th {
  background: var(--color-bg-tertiary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}

.variants-data-table tbody tr:last-child td {
  border-bottom: none;
}

.variants-data-table tbody tr:hover {
  background: var(--color-bg-hover);
}

.variants-data-table td:first-child {
  font-weight: 600;
}

.variants-data-table .stock-cell {
  font-weight: 600;
  text-align: center;
}

.variants-data-table .stock-cell.has-stock { color: var(--color-success); }
.variants-data-table .stock-cell.unlimited { color: var(--color-info); }
.variants-data-table .stock-cell.out { color: var(--color-text-muted); }

.variants-data-table .reserved-cell {
  color: var(--color-warning);
  font-weight: 600;
  text-align: center;
}

/* Image Preview */
.product-image-preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  object-fit: contain;
  background: var(--color-bg-tertiary);
}

.product-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 200px;
  height: 200px;
  border-radius: 8px;
  border: 1px dashed var(--color-border);
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
}

.product-image-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.5;
}

/* Description Text */
.description-text {
  background: var(--color-bg-tertiary);
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  max-height: 150px;
  overflow-y: auto;
}

.description-text:empty::before {
  content: 'Brak opisu';
  color: var(--color-text-muted);
  font-style: italic;
}

/* Empty State in Tab */
.tab-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--color-text-muted);
  text-align: center;
}

.tab-empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.tab-empty-state p {
  font-size: 13px;
}

/* Quick Stats Row */
.product-quick-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--color-bg-tertiary);
  border-radius: 8px;
}

@media (max-width: 900px) {
  .product-quick-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .product-quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.quick-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-stat-label {
  font-size: 11px;
  color: var(--color-text-muted);
}

.quick-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.quick-stat-value.success { color: var(--color-success); }
.quick-stat-value.warning { color: var(--color-warning); }
.quick-stat-value.danger { color: var(--color-danger); }

/* Language Tabs for descriptions */
.lang-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.lang-tab-btn {
  padding: 4px 10px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-tab-btn:hover {
  background: var(--color-bg-hover);
}

.lang-tab-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.lang-content {
  display: none;
}

.lang-content.active {
  display: block;
}

/* Responsive tabs - show only icons on smaller screens */
@media (max-width: 1100px) {
  .product-tab-btn span {
    display: none;
  }
  .product-tab-btn {
    padding: 8px 10px;
  }
  .product-tabs-nav {
    justify-content: center;
  }
}

/* ========================================
   SKU CELL WITH EXTERNAL LINK
   ======================================== */
.sku-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sku-text {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-weight: 500;
  color: var(--color-text-primary);
}

.sku-external-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--color-text-muted);
  transition: all 0.15s ease;
  opacity: 0.6;
}

.sku-external-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-accent);
  opacity: 1;
}

.sku-external-link svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   MARGIN MISSING BUTTON
   ======================================== */
.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.margin-missing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-warning-light);
  color: var(--color-warning);
  border: 1px solid var(--color-warning);
}

.margin-missing:hover {
  background: var(--color-warning);
  color: white;
}

.margin-value.missing {
  color: var(--color-text-muted);
}

.margin-value.positive {
  color: var(--color-success);
  font-weight: 600;
}

.margin-value.neutral {
  color: var(--color-warning);
  font-weight: 600;
}

.margin-value.negative {
  color: var(--color-danger);
  font-weight: 600;
}

/* ========================================
   PURCHASE PRICE MODAL
   ======================================== */
.purchase-price-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.15s ease;
}

.purchase-price-modal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.2s ease;
}

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

.purchase-price-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.purchase-price-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.purchase-price-modal-body {
  padding: 20px;
}

.purchase-price-modal-body p {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.purchase-price-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  border-radius: 0 0 12px 12px;
}

/* Product thumb placeholder */
.product-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: var(--color-bg-tertiary);
  border: 1px dashed var(--color-border);
}

/* Activity Logs - Changes display */
.changes-cell {
  font-size: 0.85rem;
  max-width: 400px;
}

.change-item {
  margin-bottom: 4px;
  line-height: 1.4;
}

.change-field {
  font-weight: 600;
  color: var(--text-primary);
}

.change-old {
  color: #dc3545;
  text-decoration: line-through;
  opacity: 0.8;
}

.change-new {
  color: #28a745;
  font-weight: 500;
}

.change-fields {
  color: var(--text-secondary);
}

/* Feedback Status Tags */
.status-tag.feedback-nowy {
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
}
.status-tag.feedback-nowy::before { background: var(--color-text-muted); }

.status-tag.feedback-przygotowana {
  background: var(--color-warning-light);
  color: var(--color-warning);
}
.status-tag.feedback-przygotowana::before { background: var(--color-warning); }

.status-tag.feedback-zaakceptowana {
  background: var(--color-info-light);
  color: var(--color-info);
}
.status-tag.feedback-zaakceptowana::before { background: var(--color-info); }

.status-tag.feedback-opublikowana {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.status-tag.feedback-opublikowana::before { background: var(--color-primary); }

.status-tag.feedback-kontakt {
  background: #e8f4fd;
  color: #0277bd;
}
.status-tag.feedback-kontakt::before { background: #0277bd; }

.status-tag.feedback-fix {
  background: #e0f2f1;
  color: #00897b;
}
.status-tag.feedback-fix::before { background: #00897b; }

.status-tag.feedback-prosba {
  background: #fff3e0;
  color: #ef6c00;
}
.status-tag.feedback-prosba::before { background: #ef6c00; }

.status-tag.feedback-usunieta {
  background: var(--color-success-light);
  color: var(--color-success);
}
.status-tag.feedback-usunieta::before { background: var(--color-success); }

.status-tag.feedback-nieusunie {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.status-tag.feedback-nieusunie::before { background: var(--color-danger); }

.status-tag.feedback-spam {
  background: #f5f5f5;
  color: #757575;
}
.status-tag.feedback-spam::before { background: #757575; }

/* ========================================
   CATEGORIES TREE - Sestimi
   ======================================== */

.categories-tree {
  font-size: 14px;
}

.category-tree-root {
  padding: 0;
  margin: 0;
}

.category-item {
  border-left: 2px solid transparent;
  transition: border-color 0.15s;
}

.category-item:hover {
  border-left-color: var(--color-primary);
}

.category-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 12px;
  border-bottom: 1px solid var(--color-border-light, #f1f5f9);
}

.category-row:hover {
  background: var(--color-bg-hover, #f8fafc);
}

.category-item.level-0 > .category-row {
  font-weight: 600;
  font-size: 15px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 8px;
  margin-bottom: 4px;
}

.category-item.level-1 > .category-row {
  padding-left: 36px;
}

.category-item.level-2 > .category-row {
  padding-left: 56px;
  font-size: 13px;
}

.category-item.level-3 > .category-row {
  padding-left: 76px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.category-toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.category-row:hover .category-toggle {
  background: var(--color-primary);
  color: white;
}

.category-toggle-placeholder {
  width: 20px;
  flex-shrink: 0;
}

.category-children {
  display: none;
  margin-left: 8px;
  border-left: 1px dashed var(--color-border, #e2e8f0);
}

.category-children.expanded {
  display: block;
}

.category-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.category-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.category-product-count {
  background: var(--color-primary);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  min-width: 24px;
  text-align: center;
}

.category-product-count.zero {
  background: var(--color-text-muted);
  opacity: 0.5;
}

.category-flags {
  font-size: 12px;
  display: flex;
  gap: 2px;
}

.category-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.category-row:hover .category-actions {
  opacity: 1;
}

.category-actions .btn {
  padding: 4px 8px;
  font-size: 11px;
}

/* Category Edit Modal */
.category-edit-form {
  display: grid;
  gap: 16px;
}

.category-edit-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.category-edit-form .form-group {
  margin-bottom: 0;
}

.category-edit-form .lang-input {
  position: relative;
}

.category-edit-form .lang-flag {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

/* ========================================
   CATEGORIES TREE v2 - Fixed
   ======================================== */

.cat-tree-root {
  padding: 0;
}

.cat-item {
  margin: 2px 0;
}

.cat-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  border-radius: 8px;
  transition: background 0.15s;
  cursor: default;
}

.cat-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.cat-item.level-0 > .cat-row {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

.cat-item.level-1 > .cat-row { padding-left: 40px; }
.cat-item.level-2 > .cat-row { padding-left: 64px; }
.cat-item.level-3 > .cat-row { padding-left: 88px; }

.cat-toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.cat-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cat-toggle svg {
  transition: transform 0.2s;
}

.cat-toggle.rotated svg {
  transform: rotate(90deg);
}

.cat-toggle-placeholder {
  width: 24px;
  flex-shrink: 0;
}

.cat-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.cat-name {
  flex: 1;
  cursor: pointer;
  color: var(--color-text, #e2e8f0);
}

.cat-badge {
  background: var(--color-primary, #6366f1);
  color: white;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.cat-edit-btn {
  opacity: 0;
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  color: var(--color-text-muted, #94a3b8);
}

.cat-row:hover .cat-edit-btn {
  opacity: 1;
}

.cat-edit-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-primary, #6366f1);
}

.cat-children {
  display: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 28px;
}

.cat-children.expanded {
  display: block;
}

.cat-edit-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.loading-state, .error-state, .empty-state {
  padding: 40px;
  text-align: center;
  color: var(--color-text-muted, #94a3b8);
}

.error-state {
  color: var(--color-error, #ef4444);
}
