/**
 * Registrační flow — styling pro krok 3 (jednotlivec/firma) + legacy krok 5 (done).
 *
 * Krok 3: brandované sekce v kartách s pill inputs / radio cards / mint checkboxes.
 * Třída wrapperu: .b-individual-form / .b-company-form
 */

.boarder-row__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .boarder-row__fields {
    grid-template-columns: 1fr;
  }
}

/* ---- Legacy registration-done page (.tb-registration) ---- */
.tb-registration {
  max-width: 48rem;
  margin: 2rem auto;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.tb-registration h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #111827;
}

.tb-registration h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: #1f2937;
}

.tb-mapy-suggest {
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* ---- Krok 3 — společné pro b-individual-form + b-company-form ---- */

.b-individual-form,
.b-company-form {
  --tb-border: #d9d9d9;
  --tb-primary: #e73f0c;
  --tb-secondary: #26c7a7;
  --tb-foreground: #000;
  --tb-foreground-muted: #666;
  --tb-bg-muted: #fafafa;
  --tb-danger: #c4350a;
}

/* Section card — bílá karta s rámem, padding, gap. */
.b-individual-form .b-form-section__card,
.b-company-form .b-form-section__card {
  border: 1px solid var(--tb-border);
  background: #fff;
  border-radius: 20px;
  padding: 16px;
}

@media (min-width: 1024px) {
  .b-individual-form .b-form-section__card,
  .b-company-form .b-form-section__card {
    padding: 20px;
  }
}

.b-individual-form .b-form-section__label,
.b-company-form .b-form-section__label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--tb-foreground);
  margin-bottom: 10px;
}

/* Form-item label (Drupal default → handoff field-label) */
.b-individual-form .form-item,
.b-company-form .form-item {
  margin: 0;
}

.b-individual-form .form-item > label,
.b-company-form .form-item > label,
.b-individual-form .password-confirm > label,
.b-company-form .password-confirm > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--tb-foreground);
  margin-bottom: 4px;
}

.b-individual-form .form-required::after,
.b-company-form .form-required::after {
  content: "*";
  color: var(--tb-primary);
  margin-left: 2px;
  background: none;
  width: auto;
  height: auto;
}

/* Pill input — všechna textová pole + textarea */
.b-individual-form .field-input,
.b-company-form .field-input {
  width: 100%;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--tb-border);
  border-radius: 9999px;
  background: #fff;
  font-size: 15px;
  line-height: 1.5;
  color: var(--tb-foreground);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}

.b-individual-form textarea.field-input,
.b-company-form textarea.field-input,
.b-individual-form .field-input--textarea,
.b-company-form .field-input--textarea {
  height: auto;
  min-height: 96px;
  border-radius: 18px;
  padding: 12px 18px;
  resize: vertical;
}

.b-individual-form .field-input::placeholder,
.b-company-form .field-input::placeholder {
  color: #9a9a9a;
}

.b-individual-form .field-input:focus,
.b-company-form .field-input:focus {
  outline: none;
  border-color: var(--tb-primary);
  box-shadow: 0 0 0 3px rgba(231, 63, 12, 0.18);
}

.b-individual-form .field-input:user-invalid,
.b-company-form .field-input:user-invalid {
  border-color: var(--tb-danger);
  box-shadow: 0 0 0 3px rgba(196, 53, 10, 0.15);
}

/* Form item description / hint */
.b-individual-form .form-item .description,
.b-company-form .form-item .description {
  margin-top: 6px;
  font-size: 13px;
  color: var(--tb-foreground-muted);
  line-height: 1.4;
}

/* Drupal validation error (server-side) */
.b-individual-form .form-item--error-message,
.b-company-form .form-item--error-message,
.b-individual-form .form-item .error,
.b-company-form .form-item .error {
  margin-top: 6px;
  font-size: 13px;
  color: var(--tb-danger);
  line-height: 1.4;
}

.b-individual-form .form-item .error.field-input,
.b-company-form .form-item .error.field-input {
  border-color: var(--tb-danger);
}

/* Checkbox — mint square s checkmark.
   Drupal 10 wrapper class je `form-type--checkbox` (dvojitá pomlčka), ne `form-type-checkbox`. */
.b-individual-form .form-type-checkbox,
.b-company-form .form-type-checkbox,
.b-individual-form .form-type--checkbox,
.b-company-form .form-type--checkbox,
.b-individual-form .js-form-type-checkbox,
.b-company-form .js-form-type-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.b-individual-form .form-type-checkbox input[type="checkbox"],
.b-company-form .form-type-checkbox input[type="checkbox"],
.b-individual-form .form-type--checkbox input[type="checkbox"],
.b-company-form .form-type--checkbox input[type="checkbox"],
.b-individual-form .js-form-type-checkbox input[type="checkbox"],
.b-company-form .js-form-type-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid var(--tb-border);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
  position: relative;
}

.b-individual-form .form-type-checkbox input[type="checkbox"]:hover,
.b-company-form .form-type-checkbox input[type="checkbox"]:hover,
.b-individual-form .form-type--checkbox input[type="checkbox"]:hover,
.b-company-form .form-type--checkbox input[type="checkbox"]:hover,
.b-individual-form .js-form-type-checkbox input[type="checkbox"]:hover,
.b-company-form .js-form-type-checkbox input[type="checkbox"]:hover {
  border-color: #b5b5b5;
}

.b-individual-form .form-type-checkbox input[type="checkbox"]:checked,
.b-company-form .form-type-checkbox input[type="checkbox"]:checked,
.b-individual-form .form-type--checkbox input[type="checkbox"]:checked,
.b-company-form .form-type--checkbox input[type="checkbox"]:checked,
.b-individual-form .js-form-type-checkbox input[type="checkbox"]:checked,
.b-company-form .js-form-type-checkbox input[type="checkbox"]:checked {
  background: var(--tb-secondary);
  border-color: var(--tb-secondary);
}

.b-individual-form .form-type-checkbox input[type="checkbox"]:checked::after,
.b-company-form .form-type-checkbox input[type="checkbox"]:checked::after,
.b-individual-form .form-type--checkbox input[type="checkbox"]:checked::after,
.b-company-form .form-type--checkbox input[type="checkbox"]:checked::after,
.b-individual-form .js-form-type-checkbox input[type="checkbox"]:checked::after,
.b-company-form .js-form-type-checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 6px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.b-individual-form .form-type-checkbox input[type="checkbox"]:focus-visible,
.b-company-form .form-type-checkbox input[type="checkbox"]:focus-visible,
.b-individual-form .form-type--checkbox input[type="checkbox"]:focus-visible,
.b-company-form .form-type--checkbox input[type="checkbox"]:focus-visible,
.b-individual-form .js-form-type-checkbox input[type="checkbox"]:focus-visible,
.b-company-form .js-form-type-checkbox input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--tb-primary);
  outline-offset: 2px;
}

.b-individual-form .form-type-checkbox label,
.b-company-form .form-type-checkbox label,
.b-individual-form .form-type--checkbox label,
.b-company-form .form-type--checkbox label {
  display: inline;
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  color: var(--tb-foreground);
  cursor: pointer;
  line-height: 1.4;
}

/* Souhlasy — agree_gdpr / agree_marketing — render as toggle uvnitř .b-summary-consents
   (existující summary styling). Schovej Drupal default checkbox label pak. */
.b-summary-consents .js-form-type-checkbox {
  display: contents;
}

.b-summary-consents .js-form-type-checkbox > label {
  display: none;
}

/* Password_confirm — 2 input pole vedle sebe (Drupal default) → pill style */
.b-individual-form .password-confirm,
.b-company-form .password-confirm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.b-individual-form .password-confirm .form-type-password,
.b-company-form .password-confirm .form-type-password {
  margin: 0;
}

.b-individual-form .password-confirm input.form-password,
.b-company-form .password-confirm input.form-password,
.b-individual-form .password-confirm input.form-password-confirm,
.b-company-form .password-confirm input.form-password-confirm {
  width: 100%;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--tb-border);
  border-radius: 9999px;
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}

.b-individual-form .password-confirm input:focus,
.b-company-form .password-confirm input:focus {
  outline: none;
  border-color: var(--tb-primary);
  box-shadow: 0 0 0 3px rgba(231, 63, 12, 0.18);
}

.b-individual-form .password-confirm .password-strength,
.b-company-form .password-confirm .password-strength,
.b-individual-form .password-confirm .password-suggestions,
.b-company-form .password-confirm .password-suggestions,
.b-individual-form .password-confirm .password-confirm-message,
.b-company-form .password-confirm .password-confirm-message {
  font-size: 13px;
  color: var(--tb-foreground-muted);
  margin-top: 6px;
}

/* Boarders fieldset — viditelná jen pro ordering_mode=individual (Drupal #states) */
.b-company-form #edit-boarders,
.b-company-form fieldset[name="boarders"] {
  border: 1px solid var(--tb-border);
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  margin: 0;
}

.b-company-form #edit-boarders > legend,
.b-company-form fieldset[name="boarders"] > legend {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--tb-foreground);
  padding: 0;
  margin-bottom: 16px;
}

.b-company-form #edit-boarders fieldset,
.b-company-form fieldset[name="boarders"] fieldset {
  border: 1px solid var(--tb-border);
  border-radius: 18px;
  padding: 16px;
  margin-top: 12px;
  background: #fff;
}

.b-company-form #edit-boarders fieldset > legend,
.b-company-form fieldset[name="boarders"] fieldset > legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--tb-foreground-muted);
  padding: 0 6px;
}

.b-company-form #edit-boarders fieldset > .fieldset-wrapper,
.b-company-form fieldset[name="boarders"] fieldset > .fieldset-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .b-company-form #edit-boarders fieldset > .fieldset-wrapper,
  .b-company-form fieldset[name="boarders"] fieldset > .fieldset-wrapper {
    grid-template-columns: 1fr 1fr;
  }
}

/* Form actions — submit button */
.b-individual-form .form-actions,
.b-company-form .form-actions {
  margin: 0;
}

/* Mapy.cz autocomplete dropdown — používá billing_address na firma formu */
.tb-mapy-suggest a {
  display: block;
  padding: 0.5rem 0.75rem;
}

.tb-mapy-suggest a:hover {
  background: #f3f4f6;
}

/* ---- Mapy.cz autocomplete spinner ---- */
.tb-mapy-spinner {
  position: absolute;
  top: 36px;
  left: 550px;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  border: 3px solid #e5e7eb;
  border-top-color: #6b7280;
  border-radius: 50%;
  animation: tb-mapy-spin 0.8s linear infinite;
  pointer-events: none;
}

.tb-mapy-spinner.hidden {
  display: none;
}

/* =============================================================================
   HP entry point — HomeAddressCheckForm (ADR 0015)
   ============================================================================= */

.b-home-address-check-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 60%;
  max-width: 460px;
}

@media (max-width: 768px) {
  .b-home-address-check-form {
    width: 100%;
  }
}

/* Pill wrapper = positioned context pro Mapy.cz suggest dropdown.
   JS attachuje `<div class="tb-mapy-suggest absolute ...">` jako sibling
   inputu uvnitř .form-item, ale .form-item má `display: contents` (níže) →
   dropdown se musí pozicovat vůči pill wrapperu, jinak skočí pod body. */
.b-home-address-check-form__field {
  position: relative;
}

/* Form-item div je transparentní wrapper (Drupal generuje
   .form-item > label + input). `display: contents` rozpustí wrapper,
   aby flex layout pill inputu fungoval. */
.b-home-address-check-form__field .form-item {
  display: contents;
  margin: 0;
}

/* Suggest dropdown pod pill input — top: 100% místo defaultu (který by ho
   překryl přes input kvůli `display: contents` na .form-item). */
.b-home-address-check-form__field .tb-mapy-suggest {
  top: 100%;
  left: 0;
  right: 0;
  width: auto;
  margin-top: 0.5rem;
  border-radius: 12px;
  border-color: var(--color-border-light, #d9d9d9);
}

.b-home-address-check-form__field .visually-hidden {
  display: none;
}

.b-home-address-check-form__icon {
  flex-shrink: 0;
  color: var(--color-primary, #e73f0c);
}

.b-home-address-check-form__field input.form-text,
.b-home-address-check-form__field input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 1rem;
  color: inherit;
  padding: 0;
}

.b-home-address-check-form__field input.form-text::placeholder {
  color: #9a9a9a;
}

.b-home-address-check-form__submit .form-actions {
  margin: 0;
}

/* Native input[type=submit] nemá inner `.e-button__content` span (na rozdíl
   od button.twig). Cílíme uppercase + letter-spacing přímo na element. */
input.e-button--uppercase,
button.e-button--uppercase {
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
}

@keyframes tb-mapy-spin {
  to { transform: rotate(360deg); }
}

/* Souhlasy: celé pole klikací (JS toggluje checkbox). */
.b-summary-consents li {
  cursor: pointer;
}
.b-summary-consents li a {
  cursor: auto;
}
