/*
  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.
*/
/* copyright Brian Tayler 2026*/
/* ---------------------------------------------------------------- */
/* 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;
}

.input,
.select,
.textarea {
  appearance: none;
  width: 100%;
  min-height: var(--tap-target-min);
  border: 1px solid var(--color-stone-400);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-slate-900);
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: 0 var(--space-3);
}

.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);
}

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

.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;
}

/* ---------------------------------------------------------------- */
/* Saved Agreements dashboard (Stage 7)                               */
/* ---------------------------------------------------------------- */

.btn--sm {
  min-height: 40px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
}

.agreement-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.agreement-card {
  border: 1px solid var(--color-stone-200);
  border-radius: var(--radius-md);
  background: var(--color-stone-50);
  padding: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.agreement-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
}

.agreement-card__number {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-forest-800);
}

.agreement-card__meta {
  font-size: var(--text-sm);
  color: var(--color-slate-700);
}

.agreement-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.email-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
}

.email-badge--pending {
  background: var(--color-amber-100);
  color: #5a3c17;
}

.email-badge--sent {
  background: var(--color-moss-200);
  color: var(--color-forest-800);
}

@media (max-width: 600px) {
  .agreement-card {
    flex-direction: column;
    align-items: stretch;
  }

  .agreement-card__actions {
    justify-content: flex-start;
  }
}
#customer-address, #customer-name, #telephone, #email, #secondary-contact, #other-riders { 
    background-color: rgba(92, 180, 92, 0.3); 
