// All colors reference the app-wide design-token CSS variables (libs/common/.../uitokenservice)
// rather than hardcoded hex values, so partner/tenant branding (resolved via
// GB5.Partner.Brand.GetResolved) applies to metaform-rendered screens automatically.

// ─── Required-field legend ─────────────────────────────────────────────────────
.required-legend {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.required-marker {
  color: var(--status-error-text);
  font-weight: 600;
}

// ─── CodeDefine badge (Overview tab) ───────────────────────────────────────────
.code-define-bar {
  margin-bottom: 12px;
}

.cd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;

  &.cd-auto {
    background: var(--badge-success);
    color: var(--status-success-text);
  }

  &.cd-manual {
    background: var(--badge-warning);
    color: var(--status-warning-error);
  }
}

.overview-hint {
  color: var(--text-tertiary);
  font-size: 13px;
  font-style: italic;
  padding: 12px 0;
}

// ─── Page tabs ────────────────────────────────────────────────────────────────
.page-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border-default);
  margin-bottom: 16px;
}

.page-tab {
  padding: 8px 18px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: -2px;
  transition: color 0.15s, background-color 0.15s;

  &.active {
    border-bottom-color: var(--action-primary-default);
    color: var(--action-primary-default);
    font-weight: 600;
  }

  &:hover:not(.active) { background: var(--bg-subtle); }
}

// ─── Form container ───────────────────────────────────────────────────────────
.form-container {
  width: 100%;
}

// ─── Section card ─────────────────────────────────────────────────────────────
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s;

  &:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  }
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.section-description {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: -8px 0 14px;
  max-width: 720px;
}

// ─── Field grid ───────────────────────────────────────────────────────────────
.section-grid {
  display: grid;
  gap: 14px 16px;
}

.field-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-inline-start: 8px;
  border-inline-start: 2px solid transparent;
  transition: border-color 0.15s;

  // A subtle accent, not red — red is reserved for actual validation errors
  // (.field-error below), so it isn't mistaken for "this field already failed."
  &.field-required {
    border-inline-start-color: var(--border-focus);
  }

  gb-input, gb-textarea, gb-date, gb-checkbox,
  gb-radiobutton, gb-combobox, gb-newpicklist { width: 100%; }
}

.field-help-text {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-tertiary, var(--text-secondary));
  margin: 0;
}

// ─── Field / server validation error ───────────────────────────────────────────
.field-error {
  color: var(--status-error-text);
  background: var(--status-error-bg);
  border: 1px solid var(--status-error-border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  margin-top: 2px;
}

// ─── Metadata-driven select ───────────────────────────────────────────────────
.meta-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.meta-select {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 13px;
  width: 100%;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color 0.15s;

  &:focus {
    outline: none;
    border-color: var(--border-focus);
  }
}

// ─── Grid wrapper (gb-formgrid) ────────────────────────────────────────────────
.grid-wrapper {
  margin-top: 12px;
}

// ─── Page navigation ──────────────────────────────────────────────────────────
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
}

.page-indicator {
  font-size: 13px;
  color: var(--text-tertiary);
}

.btn-nav {
  padding: 8px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.15s, border-color 0.15s;

  &:disabled { opacity: 0.4; cursor: default; }
  &:not(:disabled):hover { background: var(--bg-subtle); border-color: var(--action-primary-default); }
}

// Chevrons are inherently directional (unlike padding/margin/text-align, which have true
// logical equivalents) — flip them explicitly rather than relying on `dir` to do it for us.
.btn-nav-arrow {
  display: inline-block;

  [dir="rtl"] & { transform: scaleX(-1); }
}
