/*
 * Inscrevi UI — baseline de produção v6.0.12
 * Camada canônica de consistência visual.
 * Não altera regras de negócio, visibilidade funcional ou fluxos.
 */

:root {
  --ui-page-max: 1440px;
  --ui-content-gap: 20px;
  --ui-field-height: 46px;
  --ui-control-radius: 14px;
  --ui-card-radius: 22px;
  --ui-border: #e2e8f0;
  --ui-muted: #64748b;
}

html { overflow-x: hidden; }
body { min-width: 0; }
main.container {
  width: 100%;
  max-width: var(--ui-page-max);
  margin-inline: auto;
}

/* Cabeçalhos e ações: mesmo eixo visual em toda a área administrativa. */
.workspace-head,
.event-workspace-head,
.section-title,
.panel-card-head,
.card-heading-row {
  min-width: 0;
}
.workspace-head > div,
.event-workspace-head > div,
.section-title > div,
.panel-card-head > div,
.card-heading-row > div {
  min-width: 0;
}
.workspace-head h1,
.event-workspace-head h1,
.wizard-panel-head h2,
.section-title h2,
.panel-card-head h2,
.panel-card-head h3 {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.workspace-actions,
.actions,
.form-actions,
.right-actions {
  align-items: center;
}

/* Controles com altura, tipografia e box sizing previsíveis. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
select,
textarea {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
select {
  min-height: var(--ui-field-height);
}
textarea {
  min-height: 112px;
  resize: vertical;
}
.form-grid > *,
.studio-fields > *,
.form-field,
.field-wide {
  min-width: 0;
}
.form-grid label,
.form-field > label,
.studio-fields label {
  line-height: 1.35;
}
.helptext {
  line-height: 1.45;
}

/* Checkboxes/radios: caixa e texto permanecem no mesmo eixo. */
label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]),
.mini-check,
.check-field,
.switch-line,
.section-switch,
.toggle-card label {
  min-width: 0;
}
.mini-check,
.check-field,
.toggle-card label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mini-check input[type="checkbox"],
.check-field input[type="checkbox"],
.toggle-card input[type="checkbox"],
.switch-line input[type="checkbox"],
.section-switch input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px !important;
  min-width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
}

/* Cards: filhos nunca ultrapassam seus limites. */
.card,
.panel-card,
.review-card,
.editor-section,
.editor-repeat-card,
.base-choice-card,
.base-upload-card,
.toggle-card,
.modality-card-v6011 {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.card img,
.panel-card img,
.review-card img {
  max-width: 100%;
}

/* Tabelas: scroll horizontal só no invólucro, nunca na página inteira. */
.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table {
  margin: 0;
}
th, td {
  overflow-wrap: break-word;
}

/* Botões: alinhamento consistente e área de toque adequada. */
.btn {
  min-height: 42px;
  justify-content: center;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}
.btn-nowrap { white-space: nowrap; }
.actions form,
.workspace-actions form,
.right-actions form {
  margin: 0;
}

/* Wizard: trilho estável e painel sem vazamento de conteúdo. */
.wizard-studio {
  align-items: start;
}
.wizard-rail,
.wizard-panel {
  min-width: 0;
  max-width: 100%;
}
.wizard-panel {
  overflow: hidden;
}
.wizard-panel-head,
.wizard-section {
  min-width: 0;
}
#wizard-form .studio-fields {
  align-items: start;
}
#wizard-form .url-preview-box,
#wizard-form .share-preview,
#wizard-form pre {
  max-width: 100%;
  overflow-wrap: anywhere;
}
#wizard-form pre {
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Modalidades: três cartões simétricos no desktop; nenhum campo vaza. */
#wizard-form .modalities-grid-v6011 {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px !important;
  align-items: stretch !important;
}
#wizard-form .modality-card-v6011 {
  height: 100%;
  overflow: visible !important;
}
#wizard-form .modality-head-v6011 {
  grid-template-columns: 20px minmax(0, 1fr) !important;
  align-items: start !important;
}
#wizard-form .modality-head-v6011 input[type="checkbox"] {
  align-self: start;
  margin-top: 1px !important;
}
#wizard-form .modality-copy-v6011 {
  min-width: 0;
}
#wizard-form .modality-copy-v6011 strong,
#wizard-form .modality-copy-v6011 small {
  overflow-wrap: break-word !important;
  word-break: normal !important;
}
#wizard-form .modality-fields-v6011 {
  margin-top: auto;
}
#wizard-form .modality-field-v6011 input {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Página pública: cards Sobre/Informações iguais por CSS puro. */
.event-public-shell .event-content-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr) !important;
  align-items: stretch !important;
  gap: var(--ui-content-gap) !important;
}
.event-public-shell .event-content-grid > .event-about-card,
.event-public-shell .event-content-grid > .event-summary-card {
  min-width: 0 !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: none !important;
  margin-bottom: 0 !important;
  align-self: stretch !important;
}
.event-public-shell .event-about-card {
  overflow: auto !important;
}
.event-public-shell .event-summary-card .summary-list > div {
  min-width: 0;
}

/* Conteúdo gerado pelo usuário não pode romper cards. */
.rich-content,
.rich-content * {
  max-width: 100%;
}
.rich-content img,
.rich-content video,
.rich-content iframe {
  max-width: 100%;
  height: auto;
}
.rich-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

/* Navegação evita quebra visual em larguras intermediárias. */
.topbar,
.nav,
.brand {
  min-width: 0;
}
.nav a {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  #wizard-form .modalities-grid-v6011 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 980px) {
  .event-public-shell .event-content-grid {
    grid-template-columns: 1fr !important;
  }
  .event-public-shell .event-content-grid > .event-about-card,
  .event-public-shell .event-content-grid > .event-summary-card {
    height: auto !important;
    min-height: 0 !important;
  }
  .event-public-shell .event-about-card {
    overflow: visible !important;
  }
}

@media (max-width: 760px) {
  main.container {
    padding-inline: 14px;
  }
  .workspace-head,
  .event-workspace-head,
  .section-title,
  .panel-card-head,
  .card-heading-row {
    align-items: flex-start;
  }
  .workspace-actions,
  .actions,
  .form-actions,
  .right-actions {
    width: 100%;
  }
  #wizard-form .modalities-grid-v6011 {
    grid-template-columns: 1fr !important;
  }
  #wizard-form .inscrevi-step2-fee-row-v5966,
  #wizard-form .inscrevi-extra-fields-head-v5970,
  #wizard-form .inscrevi-extra-field-list-v5970 {
    margin-left: 18px !important;
    margin-right: 18px !important;
  }
}

@media (max-width: 520px) {
  .btn:not(.btn-nowrap) {
    width: 100%;
  }
  .topbar {
    align-items: flex-start;
  }
  .nav {
    width: 100%;
  }
  .nav a {
    white-space: normal;
  }
}
