/*
 * Gravity Forms in the TOPS design.
 * Gravity Forms' own CSS is turned off by the theme, so these rules give the
 * forms the same look as the design's .form grid. Field inputs, labels and
 * selects already pick up the global styles in main.css.
 */

.tops-gf .gform_heading,
.tops-gf .gform_validation_container,
.tops-gf .gform_ajax_spinner,
.tops-gf .gfield_visibility_hidden,
.tops-gf .gform_hidden,
.tops-gf .hidden_label > .gfield_label,
.tops-gf .gfield_required,
.tops-gf .screen-reader-text,
.tops-gf .gform-loader { display: none !important; }

.tops-gf form { margin: 0; }
.tops-gf .gform_fields { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; margin: 0; padding: 0; list-style: none; }
.tops-gf .gfield { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 0; border: 0; }
.tops-gf .gfield--width-half { grid-column: auto; }
.tops-gf fieldset.gfield { display: block; }

/* Labels: required fields plain, optional ones marked like the design */
.tops-gf .gfield_label { display: block; font-weight: 600; font-size: .88rem; margin: 0 0 6px; padding: 0; color: var(--ink); }
.tops-gf .gfield:not(.gfield_contains_required):not(.tops-noopt) > .gfield_label::after { content: " (optional)"; font-weight: 400; color: var(--muted); }
.tops-gf .gfield_description { font-size: .85rem; color: var(--muted); margin: -2px 0 8px; }
.tops-gf .gfield--type-fileupload .gfield_description,
.tops-gf .ginput_container + .gfield_description { margin: 8px 0 0; }

/* Inputs GF renders as plain text/number fields */
.tops-gf input[type=url], .tops-gf input[type=password] { width: 100%; font: 400 1rem 'DM Sans', sans-serif; color: var(--ink); background: var(--surface); border: 1px solid var(--field); border-radius: 6px; padding: 12px 14px; margin: 0; }
.tops-gf textarea { height: 110px; }
.tops-gf input[readonly] { background: var(--bg); color: var(--muted); }
.tops-gf .ginput_container_date { position: relative; }
.tops-gf .ginput_container_date img.ui-datepicker-trigger { display: none; }

/* Checkboxes as in the design (.checks / .check) */
.tops-gf .gfield_checkbox { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.tops-gf .gchoice { display: flex; gap: 10px; align-items: center; }
.tops-gf .gchoice input { width: 18px; height: 18px; margin: 0; accent-color: var(--red); flex-shrink: 0; }
.tops-gf .gchoice label { margin: 0; font-weight: 500; font-size: .88rem; }

/* Multi-file upload styled as the design's drop zone */
.tops-gf .gform_drop_area { border: 2px dashed var(--field); border-radius: var(--radius); padding: 32px 20px; text-align: center; background: var(--bg); transition: border-color .15s; }
.tops-gf .gform_drop_area:hover, .tops-gf .gform_drop_area.hover { border-color: var(--blue); }
.tops-gf .gform_drop_instructions { display: block; font-size: 1.05rem; font-weight: 700; color: var(--heading); margin-bottom: 10px; }
.tops-gf .gform_button_select_files { background: none; border: 1.5px solid var(--field); border-radius: 6px; padding: 8px 16px; font: 600 .92rem 'DM Sans', sans-serif; color: var(--red-ink); cursor: pointer; }
.tops-gf .gform_button_select_files:hover { border-color: var(--blue); }
.tops-gf .ginput_preview_list { margin-top: 12px; }
.tops-gf .ginput_preview { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 6px; font-size: .92rem; }
.tops-gf .ginput_preview .gform_delete_file { background: none; border: 0; color: var(--red-ink); cursor: pointer; font: 600 .85rem 'DM Sans', sans-serif; padding: 4px; }
.tops-gf .gform_fileupload_rules { display: block; font-size: .85rem; color: var(--muted); margin-top: 8px; }

/* Errors */
.tops-gf .gform_validation_errors { grid-column: 1 / -1; padding: 14px 16px; border-radius: 6px; font-weight: 500; background: var(--err-bg); color: var(--err-ink); margin: 0 0 20px; }
.tops-gf .gform_validation_errors h2 { font: inherit; color: inherit; margin: 0; }
.tops-gf .gform_validation_errors ol { margin: 6px 0 0 18px; padding: 0; }
.tops-gf .gform_validation_errors a { color: inherit; }
.tops-gf .gform_submission_error { font: inherit; color: inherit; margin: 0; }
.tops-gf .validation_message { color: var(--err-ink); font-size: .85rem; font-weight: 500; margin-top: 6px; }
.tops-gf .gfield_error input, .tops-gf .gfield_error select, .tops-gf .gfield_error textarea { border-color: var(--err-ink); }

/* Footer and button */
.tops-gf .gform_footer { margin-top: 20px; padding: 0; }
.tops-gf .gform_footer .btn { cursor: pointer; }

/* Confirmation, styled like the design's .done panel */
.tops-gf .gform_confirmation_message { padding: 40px 24px; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok-ink); text-align: center; }
.tops-gf .gform_confirmation_message h3 { color: var(--ok-ink); font-size: 1.6rem; margin-bottom: 8px; }
.tops-gf .gform_confirmation_message .ref { font-weight: 700; font-size: 1.2rem; letter-spacing: .03em; }
.tops-gf .gform_confirmation_message p + p { margin-top: 10px; }

/* Questionnaire: the step-by-step UI collects answers, then submits this form */
.tops-qz-gf[hidden] { display: none !important; }

@media (max-width: 640px) {
  .tops-gf .gform_fields { grid-template-columns: 1fr; }
  .tops-gf .gfield--width-half { grid-column: 1 / -1; }
  .tops-gf .gform_footer .btn { width: 100%; }
}
