/*
 * REACH Supply shared form components.
 * Canonical upload, legal-consent, validation, submit-state and success patterns.
 */

/* Upload */
body.reach-design-system .rs-form-upload-field{box-sizing:border-box;min-width:0;width:100%}
body.reach-design-system .rs-upload-dropzone,
body.reach-design-system .rs-form-upload-field .breakdance-form-dropzone{align-items:center;background:var(--rs-color-surface);border:1px dashed var(--rs-color-border-strong);border-radius:var(--rs-radius-md);box-sizing:border-box;color:var(--rs-color-ink);column-gap:var(--rs-space-4);display:grid;grid-template-areas:"icon title" "icon help";grid-template-columns:3.5rem minmax(0,1fr);grid-template-rows:auto auto;min-height:7rem;overflow:hidden;padding:var(--rs-space-4) var(--rs-space-5);row-gap:var(--rs-space-1);text-align:left;width:100%}
body.reach-design-system .rs-upload-dropzone__icon,
body.reach-design-system .rs-upload-dropzone .breakdance-form-dropzone__icon{align-self:center;background:var(--rs-color-ink);border-radius:var(--rs-radius-md);box-sizing:border-box;color:var(--rs-color-gold);grid-area:icon;height:3.25rem;justify-self:start;margin:0;min-height:3.25rem;min-width:3.25rem;padding:.75rem;width:3.25rem}
body.reach-design-system .rs-upload-dropzone__title,
body.reach-design-system .rs-upload-dropzone .breakdance-form-dropzone__title{align-self:end;color:var(--rs-color-ink);display:block;font-size:var(--rs-font-size-base);font-weight:var(--rs-font-weight-bold);grid-area:title;line-height:1.4;margin:0;min-width:0;white-space:normal;width:100%;word-break:normal}
body.reach-design-system .rs-upload-dropzone__help,
body.reach-design-system .rs-upload-dropzone .breakdance-form-dropzone__accepts{align-self:start;color:#405d6e;display:block;font-size:var(--rs-font-size-sm);font-weight:var(--rs-font-weight-medium);grid-area:help;line-height:1.45;margin:0;max-width:none;min-width:0;white-space:normal;width:100%;word-break:normal}
body.reach-design-system .rs-form-upload-field .breakdance-form-files-list{display:grid;gap:var(--rs-space-2);margin:var(--rs-space-3) 0 0;padding:0;width:100%}
body.reach-design-system .rs-form-upload-field .breakdance-form-files-list>li{background:var(--rs-color-surface);border:var(--rs-border-default);border-radius:var(--rs-radius-sm);box-sizing:border-box;color:var(--rs-color-ink);min-height:3.25rem;padding:var(--rs-space-3);width:100%}

/* Legal / policy consent */
body.reach-design-system .rs-consent-card,
body.reach-design-system .rs-legal-consent{background:#fff9ee;border:1px solid #e5d1a4;border-left:5px solid var(--rs-color-gold);border-radius:var(--rs-radius-md);box-shadow:var(--rs-shadow-xs);box-sizing:border-box;color:var(--rs-color-ink);min-width:0;padding:var(--rs-space-5);width:100%}
body.reach-design-system .rs-legal-consent>.breakdance-form-field__label,
body.reach-design-system .rs-legal-consent>label.breakdance-form-field__label,
body.reach-design-system .rs-consent-card__title,
body.reach-design-system .rs-legal-consent__title{align-items:center;color:var(--rs-color-ink);display:flex;font-size:var(--rs-font-size-base);font-weight:var(--rs-font-weight-bold);gap:var(--rs-space-2);line-height:1.4;margin:0 0 var(--rs-space-3);min-width:0;padding:0;width:100%}
body.reach-design-system .rs-consent-card__title b,
body.reach-design-system .rs-legal-consent__title b,
body.reach-design-system .rs-consent-card .required,
body.reach-design-system .rs-legal-consent .required,
body.reach-design-system .rs-legal-consent .breakdance-form-field__required{color:var(--rs-color-error);display:inline;margin-left:var(--rs-space-1);position:static;white-space:nowrap}
body.reach-design-system .rs-consent-card fieldset,
body.reach-design-system .rs-legal-consent fieldset{border:0;display:block;margin:0;min-width:0;padding:0;width:100%}
body.reach-design-system .rs-consent-card :where(.rs-check,.breakdance-form-checkbox),
body.reach-design-system .rs-legal-consent :where(.rs-check,.breakdance-form-checkbox){align-items:flex-start;display:grid;gap:.875rem;grid-template-columns:1.5rem minmax(0,1fr);line-height:1.6;margin:0;min-width:0;padding:0;width:100%}
body.reach-design-system .rs-legal-consent input[type="checkbox"]{-webkit-appearance:none;appearance:none;align-self:start;background:var(--rs-color-surface);border:1.5px solid var(--rs-color-border-strong);border-radius:4px;box-shadow:none;box-sizing:border-box;cursor:pointer;display:block;height:1.5rem;margin:.1rem 0 0;max-height:1.5rem;max-width:1.5rem;min-height:1.5rem;min-width:1.5rem;opacity:1;padding:0;position:relative;width:1.5rem}
body.reach-design-system .rs-legal-consent input[type="checkbox"]::after{border:solid var(--rs-color-ink);border-width:0 2px 2px 0;content:"";display:none;height:.72rem;left:.46rem;position:absolute;top:.19rem;transform:rotate(45deg);width:.36rem}
body.reach-design-system .rs-legal-consent input[type="checkbox"]:checked{background:var(--rs-color-gold);border-color:var(--rs-color-gold-hover)}
body.reach-design-system .rs-legal-consent input[type="checkbox"]:checked::after{display:block}
body.reach-design-system .rs-legal-consent input[type="checkbox"]:focus-visible{outline:3px solid rgb(226 166 60 / 35%);outline-offset:2px}
body.reach-design-system .rs-legal-consent .breakdance-form-checkbox__text,
body.reach-design-system .rs-legal-consent .rs-check__text{color:var(--rs-color-ink);display:block;font-size:.9375rem;font-weight:var(--rs-font-weight-semibold);line-height:1.6;margin:0;max-width:none;min-width:0;overflow-wrap:break-word;padding:0;white-space:normal;width:100%;word-break:normal}
body.reach-design-system .rs-consent-card a,
body.reach-design-system .rs-legal-consent a{color:#173f57;font-weight:var(--rs-font-weight-bold);text-decoration:underline;text-decoration-color:var(--rs-color-gold);text-decoration-thickness:2px;text-underline-offset:3px}
body.reach-design-system .rs-legal-consent__review{align-items:center;border-top:var(--rs-border-default);color:var(--rs-color-muted);display:flex;flex-wrap:wrap;font-size:var(--rs-font-size-sm);gap:var(--rs-space-2) var(--rs-space-3);line-height:1.45;margin-top:var(--rs-space-4);padding-top:var(--rs-space-3);width:100%}
body.reach-design-system .rs-legal-consent__review>span{font-weight:var(--rs-font-weight-bold)}
body.reach-design-system .rs-legal-consent__note{color:var(--rs-color-muted);display:block;font-size:var(--rs-font-size-sm);line-height:1.5;margin-top:var(--rs-space-2);width:100%}

/* Validation */
body.reach-design-system .rs-form-error-summary{background:#fff8f7;border:1px solid #e0aaa4;border-left:5px solid var(--rs-color-error);border-radius:var(--rs-radius-md);box-sizing:border-box;color:#7a271a;padding:var(--rs-space-4);width:100%}
body.reach-design-system .rs-form-error-summary>strong{color:#7a271a;display:block;font-size:var(--rs-font-size-base);font-weight:var(--rs-font-weight-bold);line-height:1.4;margin:0 0 var(--rs-space-1)}
body.reach-design-system .rs-form-error-summary>p{color:#8a3b32;font-size:var(--rs-font-size-sm);line-height:1.5;margin:0 0 var(--rs-space-2)}
body.reach-design-system .rs-form-error-summary ul{display:grid;gap:var(--rs-space-2);grid-template-columns:repeat(2,minmax(0,1fr));list-style:none;margin:0;padding:0}
body.reach-design-system .rs-form-error-summary li{margin:0;padding:0}
body.reach-design-system .rs-form-error-summary button{-webkit-appearance:none;appearance:none;background:transparent;border:0;box-shadow:none;color:#7a271a;cursor:pointer;display:block;font:inherit;font-size:var(--rs-font-size-sm);font-weight:var(--rs-font-weight-semibold);margin:0;padding:.25rem 0;text-align:left;text-decoration:none;width:100%}
body.reach-design-system .rs-field-invalid>.breakdance-form-field__label,
body.reach-design-system .rs-field-invalid>label.breakdance-form-field__label{color:#8f211b!important}
body.reach-design-system .rs-field-invalid :where(input:not([type="checkbox"]):not([type="file"]),select,textarea){background:#fff8f7!important;border:2px solid var(--rs-color-error)!important;box-shadow:0 0 0 3px rgb(180 35 24 / 10%)!important}
body.reach-design-system .rs-field-invalid .breakdance-form-dropzone{background:#fff8f7!important;border-color:var(--rs-color-error)!important;box-shadow:0 0 0 3px rgb(180 35 24 / 8%)!important}
body.reach-design-system .rs-legal-consent.rs-field-invalid{background:#fff8f7;border-color:#d97a70;border-left-color:var(--rs-color-error)}
body.reach-design-system .rs-field-error{color:var(--rs-color-error);display:block;font-size:var(--rs-font-size-sm);font-weight:var(--rs-font-weight-semibold);line-height:1.4;margin-top:var(--rs-space-2);width:100%}

/* Optional trust strip */
body.reach-design-system .rs-form-trust-strip{display:grid;gap:var(--rs-space-2);grid-template-columns:repeat(3,minmax(0,1fr));width:100%}
body.reach-design-system .rs-form-trust-strip>span{align-items:center;background:var(--rs-color-surface);border:var(--rs-border-default);border-radius:var(--rs-radius-sm);color:var(--rs-color-muted);display:flex;font-size:var(--rs-font-size-sm);font-weight:var(--rs-font-weight-semibold);gap:var(--rs-space-2);justify-content:center;line-height:1.35;min-height:2.625rem;padding:var(--rs-space-2) var(--rs-space-3);text-align:center}
body.reach-design-system .rs-form-trust-strip>span::before{color:var(--rs-color-warning);content:"✓";font-weight:var(--rs-font-weight-bold)}

/* Submit */
body.reach-design-system .rs-form-submit{align-items:center;display:inline-flex;gap:var(--rs-space-2);justify-content:center}
body.reach-design-system .rs-form-submit.is-submitting,
body.reach-design-system button.rs-form-submit.is-submitting{cursor:wait}
body.reach-design-system .rs-form-submit.is-submitting::after,
body.reach-design-system button.rs-form-submit.is-submitting::after{animation:rs-form-spin .75s linear infinite;border:2px solid rgb(27 42 56 / 25%);border-radius:50%;border-top-color:var(--rs-color-ink);content:"";display:inline-block;flex:0 0 1.05rem;height:1.05rem;width:1.05rem}

/* Success */
body.reach-design-system .rs-form-success{background:var(--rs-color-surface);border:var(--rs-border-default);border-left:5px solid var(--rs-color-success);border-radius:var(--rs-radius-lg);box-shadow:var(--rs-shadow-sm);box-sizing:border-box;margin-inline:auto;max-width:54rem;padding:clamp(var(--rs-space-5),4vw,var(--rs-space-7));text-align:center;width:100%}
body.reach-design-system .rs-form-success__icon{background:var(--rs-color-success);border-radius:50%;color:#fff;display:grid;font-size:1.4rem;font-weight:var(--rs-font-weight-bold);height:3.25rem;margin:0 auto var(--rs-space-4);place-items:center;width:3.25rem}
body.reach-design-system .rs-form-success h3{color:var(--rs-color-ink);font-size:var(--rs-font-size-section-title);line-height:var(--rs-line-height-heading);margin:0}
body.reach-design-system .rs-form-success p{color:#334d5c;font-size:var(--rs-font-size-base);line-height:var(--rs-line-height-body);margin:var(--rs-space-3) auto 0;max-width:42rem}
body.reach-design-system .rs-form-success__actions{display:flex;flex-wrap:wrap;gap:var(--rs-space-3);justify-content:center;margin-top:var(--rs-space-5)}
body.reach-design-system .rs-form-success__actions :where(a,button){align-items:center;border-radius:var(--rs-radius-sm);cursor:pointer;display:inline-flex;font-size:var(--rs-font-size-sm);font-weight:var(--rs-font-weight-bold);justify-content:center;min-height:var(--rs-touch-target-min);padding:var(--rs-space-3) var(--rs-space-4);text-decoration:none}
body.reach-design-system .rs-form-success__again{background:var(--rs-color-gold);border:1px solid var(--rs-color-gold-hover);color:var(--rs-color-on-gold)}
body.reach-design-system .rs-form-success__lookup{background:var(--rs-color-surface);border:var(--rs-border-strong);color:var(--rs-color-ink)}
body.reach-design-system .rs-breakdance-success-hidden{display:none!important}

@keyframes rs-form-spin{to{transform:rotate(360deg)}}

@media(max-width:767px){
 body.reach-design-system .rs-upload-dropzone,
 body.reach-design-system .rs-form-upload-field .breakdance-form-dropzone{column-gap:var(--rs-space-3);grid-template-columns:3rem minmax(0,1fr);padding:var(--rs-space-4)}
 body.reach-design-system .rs-consent-card,
 body.reach-design-system .rs-legal-consent{padding:var(--rs-space-4)}
 body.reach-design-system .rs-form-error-summary ul{grid-template-columns:1fr}
 body.reach-design-system .rs-form-trust-strip{grid-template-columns:1fr}
 body.reach-design-system .rs-form-success__actions{display:grid;grid-template-columns:1fr}
 body.reach-design-system .rs-form-success__actions :where(a,button){width:100%}
}

@media(prefers-reduced-motion:reduce){
 body.reach-design-system .rs-form-submit.is-submitting::after,
 body.reach-design-system button.rs-form-submit.is-submitting::after{animation-duration:1.4s}
}
