/* Sistema de Cores: tokens por função, com valores do modo Claro e do modo Escuro */
:root {
  --primary: #173955;
  --primary-2: #2E1744;
  --primary-3: #551744;
  --gradient: linear-gradient(90deg, #BF1A6F, #E65D52, #01CFA3, #6475B5);

  --accent-1: #572A6E;
  --accent-3: #BF1A6F;
  --success: #01CFA3;
  --warning: #E65D52;
  --error: #D93D4F;
  --info: #6475B5;

  --text: #18081F;
  --text-2: #21262F;
  --text-soft: #555A62;
  --text-off: #92969C;
  --text-inverse: #FFFFFF;

  --surface: #FFFFFF;
  --surface-2: #EDEDED;
  --surface-3: #BDBDBD;
  --surface-off: rgb(109 109 109 / 30%);

  --radius: 16px;
  --font: 'Ubuntu Sans', system-ui, sans-serif;
  --mono: 'Ubuntu Sans Mono', ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-1: #BF1A6F;
    --accent-3: #01CFA3;
    --info: #6475B5;
    --text: #FFFFFF;
    --text-2: #EDEDED;
    --text-soft: #BFC3C5;
    --text-off: #858B8D;
    --text-inverse: #18081F;
    --surface: #18081F;
    --surface-2: #26112F;
    --surface-3: #34313A;
    --surface-off: rgb(52 49 58 / 30%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --accent-1: #BF1A6F;
  --accent-3: #01CFA3;
  --text: #FFFFFF;
  --text-2: #EDEDED;
  --text-soft: #BFC3C5;
  --text-off: #858B8D;
  --text-inverse: #18081F;
  --surface: #18081F;
  --surface-2: #26112F;
  --surface-3: #34313A;
  --surface-off: rgb(52 49 58 / 30%);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

code,
pre {
  font-family: var(--mono);
}

svg {
  width: 1.25em;
  height: 1.25em;
  fill: currentColor;
  flex: none;
}

/* [hidden] vence classes que definem display (.button, .link) */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* topo: faixa da identidade com o gradiente embaixo */
.topbar {
  background: var(--primary);
  color: #FFFFFF;
  border-bottom: 4px solid transparent;
  border-image: var(--gradient) 1;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px;
}

.topbar__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.topbar__subtitle {
  margin: 0;
  color: #BFC3C5;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

/* seletor PT | EN: o idioma ativo fica preenchido */
.lang-switch {
  display: flex;
  padding: 3px;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 22px;
}

.lang-switch__option {
  min-width: 44px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #FFFFFF;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.lang-switch__option:hover {
  background: rgb(255 255 255 / 12%);
}

.lang-switch__option[aria-pressed="true"] {
  background: #FFFFFF;
  color: var(--primary);
}

.lang-switch__option:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 2px;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 50%;
  background: transparent;
  color: #FFFFFF;
  cursor: pointer;
}

.theme-toggle:hover {
  background: rgb(255 255 255 / 12%);
}

/* mostra o tema para o qual o botão leva */
.theme-toggle__sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__moon {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle__sun {
    display: block;
  }
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  align-items: start;
  gap: 24px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.card {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 24px;
}

.card__title {
  margin: 0 0 20px;
  font-size: 1.125rem;
  font-weight: 700;
}

.field {
  margin-bottom: 20px;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-2);
}

.field__optional {
  font-weight: 400;
  color: var(--text-soft);
}

.field__hint {
  margin: 6px 0 0;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.field__error {
  margin: 6px 0 0;
  font-size: 0.875rem;
  color: var(--error);
}

.field__error:empty {
  display: none;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--surface-3);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.input::placeholder {
  color: var(--text-off);
}

textarea.input {
  resize: vertical;
}

.input[aria-invalid="true"] {
  border-color: var(--error);
}

.input:focus-visible,
.button:focus-visible,
.theme-toggle:focus-visible,
.dropzone:focus-within,
.source summary:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 2px;
}

/* ícone: área clicável que também aceita arrastar */
.dropzone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 2px dashed var(--surface-3);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--accent-3);
}

.dropzone[aria-invalid="true"] {
  border-color: var(--error);
}

.dropzone__preview {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-soft);
  overflow: hidden;
}

.dropzone__preview img {
  width: 92px;
  height: 92px;
}

.dropzone__text {
  display: flex;
  flex-direction: column;
}

.notice {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-left: 4px solid;
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.875rem;
}

.notice--warning {
  border-color: var(--warning);
}

.notice--error {
  border-color: var(--error);
  color: var(--error);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent-1);
  color: #FFFFFF;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.1);
}

.button:disabled {
  background: var(--surface-off);
  color: var(--text-off);
  cursor: progress;
  filter: none;
}

/* versão e chave privada lado a lado; empilham no celular */
.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 0 16px;
}

/* seletor de arquivo nativo, só com a moldura dos outros campos */
.input--file {
  padding: 9px 10px;
  color: var(--text-soft);
  cursor: pointer;
}

.input--file::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  border: 1px solid var(--surface-3);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.field__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 6px 0 0;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-1);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link:hover {
  color: var(--text);
}

.link:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 2px;
  border-radius: 2px;
}

/* prévia: como o app aparece no launcher */
.preview {
  position: sticky;
  top: 24px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 24px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--primary), var(--primary-2) 60%, var(--primary-3));
  color: #FFFFFF;
}

.tile__icon {
  width: 92px;
  height: 92px;
  border-radius: 20px;
  background: rgb(255 255 255 / 12%);
  overflow: hidden;
}

.tile__icon img {
  width: 92px;
  height: 92px;
}

.tile__name {
  max-width: 100%;
  font-weight: 500;
  text-align: center;
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0 0 16px;
  font-size: 0.875rem;
}

.facts dt {
  color: var(--text-soft);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.source {
  margin-top: 8px;
  border-radius: 10px;
  background: var(--surface);
}

.source summary {
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 0.875rem;
  cursor: pointer;
}

.source pre {
  margin: 0;
  padding: 0 14px 14px;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-2);
}

@media (max-width: 760px) {
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 20px;
  }

  .preview {
    position: static;
  }

  .card {
    padding: 20px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dropzone {
    transition: none;
  }
}
