/**
 * Products Add/Edit form — scoped under #productFormSection.
 * Do not restyle Products List, LED Calculator, or global form controls. No !important.
 */

#productFormSection.products-form-modern {
  --pf-gap: 12px;
  --pf-radius: 10px;
  --pf-control-h: var(--ds-control-height, 36px);
  --pf-touch: var(--ds-touch-min, 44px);
  --pf-line: var(--ds-color-line, var(--line, #e8ecef));
  --pf-ink: var(--ds-color-ink, var(--ink, #24262d));
  --pf-muted: var(--ds-color-muted, var(--muted, #6b7280));
  --pf-surface: var(--ds-color-surface, #fff);
  --pf-bg: var(--ds-color-bg, var(--bg, #f6f8fa));
  --pf-accent: var(--ds-color-accent, #0f766e);
  --pf-soft: var(--ds-color-accent-soft, #e4f4f1);
  max-width: 52rem;
  min-width: 0;
  overflow-x: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

#productFormSection.products-form-modern .pf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 12px;
  margin: 0 0 14px;
  padding: 0 0 12px;
  background: var(--pf-bg);
  border-bottom: 1px solid var(--pf-line);
}

#productFormSection.products-form-modern .pf-toolbar__copy {
  min-width: 0;
  flex: 1 1 12rem;
}

#productFormSection.products-form-modern .pf-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--pf-ink);
  line-height: 1.3;
}

#productFormSection.products-form-modern .pf-sub {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--pf-muted);
}

#productFormSection.products-form-modern .pf-toolbar__actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Protected #newProductButton stays in DOM for reset/save gating; page header owns the visible Yeni Ürün. */
#productFormSection.products-form-modern #newProductButton {
  display: none;
}

#productFormSection.products-form-modern .pf-toolbar__actions .ds-button,
#productFormSection.products-form-modern .pf-toolbar__actions .ghost-button,
#productFormSection.products-form-modern .pf-toolbar__actions .primary-button {
  min-height: var(--pf-control-h);
  padding: 0 14px;
}

#productFormSection.products-form-modern .form-grid.compact-form,
#productFormSection.products-form-modern .pf-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}

#productFormSection.products-form-modern .pf-card {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--pf-line);
  border-radius: var(--pf-radius);
  background: var(--pf-surface);
  box-shadow: 0 1px 2px rgba(36, 38, 45, 0.04);
}

#productFormSection.products-form-modern .pf-card__title {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--pf-muted);
}

#productFormSection.products-form-modern .pf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  min-width: 0;
}

#productFormSection.products-form-modern .pf-grid--stack,
#productFormSection.products-form-modern .pf-field--full {
  grid-template-columns: minmax(0, 1fr);
}

#productFormSection.products-form-modern .pf-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--pf-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
}

#productFormSection.products-form-modern .pf-label {
  color: var(--pf-ink);
}

#productFormSection.products-form-modern .pf-req {
  color: var(--ds-color-danger, #b42318);
  font-weight: 700;
}

#productFormSection.products-form-modern .pf-help,
#productFormSection.products-form-modern .ds-field-help {
  font-weight: 400;
  color: var(--pf-muted);
}

#productFormSection.products-form-modern .ds-input,
#productFormSection.products-form-modern .ds-select,
#productFormSection.products-form-modern .ds-textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#productFormSection.products-form-modern .ds-textarea {
  resize: vertical;
}

#productFormSection.products-form-modern .pf-checks {
  display: grid;
  gap: 8px;
}

#productFormSection.products-form-modern .pf-check:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--pf-touch);
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--pf-line);
  border-radius: 8px;
  background: var(--pf-bg);
  font-weight: 600;
  cursor: pointer;
}

#productFormSection.products-form-modern .pf-check:not([hidden]):hover {
  border-color: color-mix(in srgb, var(--pf-accent) 28%, var(--pf-line));
}

#productFormSection.products-form-modern .pf-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--pf-accent);
}

#productFormSection.products-form-modern .pf-check__copy {
  min-width: 0;
  line-height: 1.35;
}

#productFormSection.products-form-modern .pf-check input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

#productFormSection.products-form-modern .pf-image-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 12rem);
  gap: 10px;
  align-items: center;
}

#productFormSection.products-form-modern #productImageFileInput {
  width: 100%;
  max-width: 100%;
  min-height: var(--pf-touch);
  padding: 8px 10px;
  box-sizing: border-box;
  border: 1px solid var(--pf-line);
  border-radius: 8px;
  background: var(--pf-bg);
}

#productFormSection.products-form-modern .pf-image-preview,
#productFormSection.products-form-modern #productImagePreview {
  display: grid;
  place-items: center;
  min-height: 160px;
  max-height: 320px;
  margin-top: 10px;
  padding: 12px;
  overflow: hidden;
  border: 1px dashed var(--pf-line);
  border-radius: 10px;
  background: var(--pf-bg);
  color: var(--pf-muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

#productFormSection.products-form-modern #productImagePreview.has-image {
  border-style: solid;
  background: var(--pf-surface);
}

#productFormSection.products-form-modern #productImagePreview img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  border-radius: 8px;
}

#productFormSection.products-form-modern #productInfoUrlInput,
#productFormSection.products-form-modern #productImageInput {
  overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
  #productFormSection.products-form-modern {
    max-width: none;
  }
}

@media (max-width: 768px) {
  #productFormSection.products-form-modern.active {
    display: flex;
    flex-direction: column;
    padding-bottom: 8px;
  }

  #productFormSection.products-form-modern .pf-stack {
    order: 1;
  }

  #productFormSection.products-form-modern .pf-toolbar {
    order: 2;
    align-items: stretch;
    margin: 12px 0 0;
    padding: 12px 0 4px;
    border-bottom: 0;
    border-top: 1px solid var(--pf-line);
  }

  #productFormSection.products-form-modern .pf-toolbar__actions,
  #productFormSection.products-form-modern .pf-toolbar__actions .ds-button,
  #productFormSection.products-form-modern .pf-toolbar__actions .ghost-button,
  #productFormSection.products-form-modern .pf-toolbar__actions .primary-button {
    width: 100%;
    justify-content: center;
    min-height: var(--pf-touch);
  }

  #productFormSection.products-form-modern .pf-grid,
  #productFormSection.products-form-modern .pf-grid--price,
  #productFormSection.products-form-modern .pf-image-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  #productFormSection.products-form-modern .pf-card {
    padding: 14px;
  }

  #productFormSection.products-form-modern .ds-input,
  #productFormSection.products-form-modern .ds-select,
  #productFormSection.products-form-modern .ds-textarea {
    min-height: var(--pf-touch);
  }

  #productFormSection.products-form-modern .ds-textarea {
    min-height: 88px;
  }
}

@media (max-width: 430px) {
  #productFormSection.products-form-modern .pf-title {
    font-size: 1rem;
  }

  #productFormSection.products-form-modern .pf-card {
    padding: 12px;
  }
}
