/* Shared source-port components: panel, forms, buttons, hero.
   Loaded globally so trainer/admin pages that reuse AliTraining markup render correctly. */

/* —— Buttons —— */
.primary-btn,
.secondary-btn,
.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--fs-body-sm, 13px);
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.primary-btn {
  border-color: var(--primary, #ff6a00);
  background: var(--primary, #ff6a00);
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 106, 0, 0.22);
}

.primary-btn:hover {
  background: var(--primary-strong, #e85f00);
  border-color: var(--primary-strong, #e85f00);
}

.secondary-btn {
  border-color: var(--border, #e9edf2);
  background: #fff;
  color: #475467;
}

.secondary-btn:hover {
  border-color: #ffd7bb;
  background: var(--primary-soft, #fff4ec);
  color: var(--primary-strong, #e85f00);
}

.text-btn {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary, #ff6a00);
  font-weight: 600;
  box-shadow: none;
}

.text-btn:hover {
  color: var(--primary-strong, #e85f00);
  text-decoration: underline;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.text-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* —— Page hero (ops / admin education pages) —— */
.v6-ops-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding: 22px 24px;
  border: 1px solid #ffd7bb;
  border-left: 4px solid var(--primary, #ff6a00);
  border-radius: 10px;
  background: linear-gradient(135deg, #fff7f1 0%, #ffffff 60%);
}

.v6-ops-hero .eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--primary-strong, #e85f00);
  font-size: var(--fs-body-sm, 13px);
  font-weight: 800;
}

.v6-ops-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.25;
  color: var(--text, #18212f);
}

.v6-ops-hero p,
.v6-ops-hero .muted {
  margin: 0;
  max-width: 68ch;
  color: var(--muted, #667085);
  font-size: var(--fs-body, 14px);
  line-height: 1.6;
}

.v6-ops-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

/* —— Panels —— */
.panel {
  margin-bottom: 16px;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--border, #e9edf2);
  border-radius: 10px;
  box-shadow: var(--shadow, 0 8px 26px rgba(24, 33, 47, 0.08));
}

.panel:last-child {
  margin-bottom: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head > div {
  min-width: 0;
}

.panel-head .eyebrow {
  display: block;
  margin: 0 0 4px;
  color: var(--primary-strong, #e85f00);
  font-size: var(--fs-caption, 12px);
  font-weight: 800;
}

.panel-head h2 {
  margin: 0;
  font-size: var(--fs-title, 18px);
  line-height: 1.35;
  color: var(--text, #18212f);
}

.panel-head p {
  margin: 6px 0 0;
  max-width: 72ch;
  color: var(--muted, #667085);
  font-size: var(--fs-body-sm, 13px);
  line-height: 1.55;
}

/* —— Stack forms: vertical fields, top-aligned controls —— */
.stack-form {
  display: grid;
  gap: 14px;
  align-items: start;
}

.stack-form label,
.stack-form .field-control {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  color: #344054;
  font-size: var(--fs-body-sm, 13px);
  font-weight: 700;
  line-height: 1.45;
}

.stack-form .field-control > .field-caption,
.field-control > .field-caption {
  display: block;
  color: inherit;
  font: inherit;
}

.stack-form input,
.stack-form select,
.stack-form textarea,
.field-control input,
.field-control select,
.field-control textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  color: var(--text, #18212f);
  font: inherit;
  font-size: var(--fs-body, 14px);
  line-height: 1.45;
  outline: none;
  box-sizing: border-box;
}

.stack-form textarea,
.field-control textarea {
  min-height: 120px;
  resize: vertical;
}

.stack-form input[type="file"] {
  min-height: 0;
  padding: 8px 0;
  border: 0;
  background: transparent;
}

.stack-form input::placeholder,
.stack-form textarea::placeholder {
  color: #98a2b3;
}

.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus,
.field-control input:focus,
.field-control select:focus,
.field-control textarea:focus {
  border-color: #ffad72;
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.12);
}

.stack-form > .primary-btn,
.stack-form > .secondary-btn,
.stack-form .form-actions {
  justify-self: start;
}

.stack-form label:has(> input[type="checkbox"]),
.stack-form label:has(> input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.stack-form label:has(> input[type="checkbox"]) input,
.stack-form label:has(> input[type="radio"]) input {
  width: auto;
  min-height: 0;
  margin: 0;
}

/* Multi-field create forms: 2 columns, button full width */
.stack-form--grid,
#admin-create-form,
#admin-category-form,
#admin-course-form,
#admin-class-form,
#admin-roster-enroll-form,
#bootstrap-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack-form--grid > .primary-btn,
.stack-form--grid > .secondary-btn,
.stack-form--grid > .form-actions,
.stack-form--grid > label.wide,
.stack-form--grid > .span-all,
#admin-create-form > .primary-btn,
#admin-category-form > .primary-btn,
#admin-course-form > .primary-btn,
#admin-class-form > .primary-btn,
#admin-roster-enroll-form > .primary-btn,
#bootstrap-form > .primary-btn {
  grid-column: 1 / -1;
}

/* Import / tall textarea forms stay single column */
#admin-import-form,
#admin-categories-import-form,
#case-form {
  grid-template-columns: 1fr;
}

/* —— Code / result blocks —— */
.code-block {
  display: block;
  min-height: 72px;
  max-height: 280px;
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  overflow: auto;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: var(--fs-caption, 12px);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* —— Page state banner —— */
.v5-page-state {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border, #e9edf2);
  background: #fafbfb;
  color: var(--text, #18212f);
  font-size: var(--fs-body, 14px);
  line-height: 1.55;
}

.v5-page-state--warn {
  border-color: #ffd7bb;
  background: #fff7f1;
  color: #9a3412;
}

.v5-page-state b {
  display: block;
  margin-bottom: 4px;
}

.v5-page-state p {
  margin: 0 0 6px;
}

.v5-page-state p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .v6-ops-hero {
    flex-direction: column;
  }

  .stack-form--grid,
  #admin-create-form,
  #admin-category-form,
  #admin-course-form,
  #admin-class-form,
  #admin-roster-enroll-form,
  #bootstrap-form {
    grid-template-columns: 1fr;
  }
}
