/* ── Formol app styles ───────────────────────────────────────────────
   dolfin-suite.css loads first → provides all --ctp-* variables,
   base resets, and .dn-bar nav. This file: app-specific overrides.
   ──────────────────────────────────────────────────────────────────── */

/* Element display rules (.entry-form flex, .radio-option inline-flex, ...)
   must not override the hidden attribute. */
[hidden] { display: none !important; }

/* ── Typography ─────────────────────────────────────────────────────── */
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── Page container (pangloss-web's convention — was missing here, which
   left every `<main class="pg-main">` page with no side gutter/max-width) */
.pg-main {
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}
.pg-main > h1 {
  font-size: 1.375rem;
  color: var(--ctp-text);
  margin: 0 0 1.25rem;
}

/* ── Login page ─────────────────────────────────────────────────────── */
.login-page {
  max-width: 380px;
  margin: 8rem auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2.5rem 2rem 2rem;
  background: var(--ctp-mantle);
  border: 1px solid var(--ctp-surface1);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .login-page {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .login-page {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
  }
}

.login-page h2 {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ctp-subtext1);
  margin: 0;
}

.login-page .btn-primary {
  width: 100%;
  padding: 0.65rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ctp-blue) 30%, transparent);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.login-page .btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--ctp-blue) 40%, transparent);
}
.login-page .btn-primary:active {
  transform: translateY(0);
}

/* ── Connect form (M3) ──────────────────────────────────────────────── */
.connect-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 420px;
}
.connect-form label {
  font-weight: 600;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}
.connect-form .btn-primary {
  margin-top: 0.5rem;
  align-self: flex-start;
}

/* ── Entry form (M4) ────────────────────────────────────────────────── */
.entry-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 640px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-field-wrap,
.form-field {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* The 200px basis is a width only in a .form-row; in a column-flex parent
   (.entry-form, .form-field-wrap, .nested-block) it would become a height. */
.form-row > .form-field-wrap,
.form-row > .form-field {
  flex: 1 1 200px;
}

/* A stretched checkbox renders centred in its box: keep it at the left. */
.form-field > input[type="checkbox"] {
  align-self: flex-start;
}

.form-field label {
  font-weight: 600;
  font-size: 0.875rem;
}

.form-field .req {
  color: var(--ctp-red);
  font-weight: 400;
}

.form-field textarea {
  min-height: 5rem;
  resize: vertical;
}

.field-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-list-row {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
}

.field-list-row > :first-child {
  flex: 1;
  min-width: 0;
}

.field-list-add {
  align-self: flex-start;
}

.field-help {
  font-size: 0.8rem;
  margin: 0;
}

.field-error {
  font-size: 0.8rem;
  margin: 0;
}

.nested-block,
.ref-create-panel {
  border: 1px solid var(--ctp-surface0);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  background: var(--ctp-mantle);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* One inherited group per super concept (NestedBlock). */
.form-section {
  border: 1px solid var(--ctp-surface1);
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-section > legend {
  padding: 0 0.25rem;
  font-weight: 600;
  color: var(--ctp-subtext1);
}

.ref-create-panel h4 {
  margin: 0;
  font-size: 0.9rem;
}

.ref-create-actions {
  display: flex;
  gap: 0.5rem;
}

.ref-pending {
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
}

.recent-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.recent-list li {
  border-bottom: 1px solid var(--ctp-surface0);
  padding-bottom: 0.4rem;
}

/* Quantity: number input + unit select / suffix on one line. */
.quantity-input {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.quantity-input > input {
  flex: 1;
  min-width: 0;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.radio-option {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  font-weight: normal;
}

/* ── Share links (M6) ───────────────────────────────────────────────── */
.share-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}
.share-new-url {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--ctp-yellow);
  border-radius: 8px;
  background: var(--ctp-mantle);
}
.share-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.share-table th,
.share-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--ctp-surface0);
}
.share-badge {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--ctp-base);
}
.share-badge--active { background: var(--ctp-green); }
.share-badge--expired { background: var(--ctp-overlay1); }
.share-badge--exhausted { background: var(--ctp-peach); }
.share-badge--revoked { background: var(--ctp-red); }

/* Top-level form (entry and public) renders through NestedBlock: no box. */
.entry-form > .nested-block {
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
}
/* ── Public share-link form (/f/:share_token) ───────────────────────── */
.public-concepts {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 640px;
}
.public-concepts button {
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid var(--ctp-surface1);
  border-radius: 8px;
  background: var(--ctp-mantle);
  color: var(--ctp-text);
  cursor: pointer;
}
.public-concepts button:hover {
  border-color: var(--ctp-blue);
}
.public-back {
  margin-bottom: 1rem;
}
.public-unavailable,
.public-thanks {
  text-align: center;
  margin-top: 3rem;
  color: var(--ctp-text);
}
/* Honeypot: offscreen, not display:none (see pages/public_form.rs). */
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
