/*
  Reusable UI components.

  Stage 2: the full visual design system. Buttons, notices/callouts, and
  form-control styling (inputs, select, textarea, checkbox) are all finished
  here so Stage 3 can drop in real markup without a second styling pass.
  The signature pad's own chrome is finished in Stage 4.
*/

/* ---------------------------------------------------------------- */
/* Buttons                                                           */
/* ---------------------------------------------------------------- */

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 var(--space-5);
  min-height: var(--tap-target-min);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: background-color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
}

.btn__icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--color-forest-800);
  color: var(--color-stone-50);
}

.btn--primary:hover:not(:disabled) {
  background: var(--color-forest-700);
  box-shadow: var(--shadow-raised);
}

.btn--secondary {
  background: var(--color-stone-50);
  color: var(--color-forest-800);
  border: 1px solid var(--color-moss-400);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--color-moss-200);
}

.btn--danger {
  background: var(--color-stone-50);
  color: var(--color-red-700);
  border: 1px solid var(--color-red-700);
}

.btn--danger:hover:not(:disabled) {
  background: var(--color-red-100);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------------------------------------------------------------- */
/* Notices / callouts — used for agreement warnings in Stage 3        */
/* ---------------------------------------------------------------- */

.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.notice__icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.notice--warning {
  background: var(--color-amber-100);
  color: #5a3c17;
  border: 1px solid var(--color-amber-700);
}

.notice--warning .notice__icon {
  color: var(--color-amber-700);
}

.notice--info {
  background: var(--color-moss-200);
  color: var(--color-forest-950);
  border: 1px solid var(--color-moss-400);
}

.notice--info .notice__icon {
  color: var(--color-forest-800);
}

.notice--error {
  background: var(--color-red-100);
  color: #5c231c;
  border: 1px solid var(--color-red-700);
}

.notice--error .notice__icon {
  color: var(--color-red-700);
}

/* ---------------------------------------------------------------- */
/* Form controls — styled ahead of Stage 3 wiring                    */
/* ---------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-slate-900);
}

.required-mark {
  color: var(--color-red-700);
  font-weight: 700;
}

.required-legend {
  font-size: var(--text-xs);
  color: var(--color-slate-700);
  margin: 0 0 var(--space-3);
}

.field__hint {
  font-size: var(--text-xs);
  color: var(--color-slate-700);
}

.field__error {
  font-size: var(--text-xs);
  color: var(--color-red-700);
  font-weight: 600;
}

/*
  !important on the visual properties below is deliberate here, unlike
  everywhere else in this stylesheet: this form is embedded inside a
  WordPress page whose theme (or Elementor itself) commonly ships a
  global reset like `input[type="text"] { border: none; background:
  none; }`. That selector's specificity (one element + one attribute)
  actually outranks a plain `.input` class selector, so without
  !important here the theme's reset silently wins and every text/date/
  time/number/tel/email input loses its border and background — exactly
  the bug this fixes. Textareas and selects aren't typically targeted by
  '[type=...]' resets the same way, which is why they weren't affected.
*/
.input,
.select,
.textarea {
  appearance: none !important;
  width: 100% !important;
  min-height: var(--tap-target-min);
  border: 1px solid var(--color-stone-400) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--color-white) !important;
  color: var(--color-slate-900);
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: 0 var(--space-3);
  box-shadow: none !important;
}

.textarea {
  padding: var(--space-3);
  min-height: calc(var(--tap-target-min) * 1.6);
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--color-forest-700) !important;
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--color-red-700) !important;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--color-stone-400);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.field--full {
  grid-column: 1 / -1;
}

@media (max-width: 600px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}

/* Checkbox — sized for a confident, unambiguous touch target since this
   drives the declaration in Stage 3. */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.checkbox-row input[type="checkbox"] {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  accent-color: var(--color-forest-800);
  margin-top: 2px;
}

.checkbox-row label {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

/* ---------------------------------------------------------------- */
/* Signature pad                                                      */
/* ---------------------------------------------------------------- */

.signature-pad-wrap {
  position: relative;
}

.signature-canvas {
  display: block;
  width: 100%;
  height: 220px;
  background: var(--color-white);
  border: 1px solid var(--color-stone-400);
  border-radius: var(--radius-md);
  touch-action: none;
  cursor: crosshair;
}

.signature-pad-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-stone-400);
  pointer-events: none;
  transition: opacity 120ms ease;
}

.signature-pad-hint[data-hidden="true"] {
  opacity: 0;
}

.signature-actions {
  margin-top: var(--space-3);
  display: flex;
  justify-content: flex-end;
}

