/* ============================================================
   SUBMIT FORM MODULE – GENERIC FORM PANEL
   Path: /modules/submit-form/submit-form.css
   Uses global tokens + button system from style.css
   ============================================================ */

/* ------------------------------------------------------------
   CONFIGURABLE TOKENS (override in custom.css if needed)
   ------------------------------------------------------------ */

:root {
  /* Section spacing */
  --submit-form-section-padding-top: 2.5rem;
  --submit-form-section-padding-bottom: 2.5rem;

  /* Heading spacing (outside panel) */
  --submit-form-heading-padding-top: 0.5rem;
  --submit-form-heading-padding-bottom: 0.75rem;

  /* Field/entry gap */
  --submit-form-field-gap: 1.5rem;

  /* Field background color (slightly darker than panel) */
  --submit-form-field-bg: #f5f5f5;

  /* Panel max width (configurable) */
  --submit-form-panel-max-width: var(--wrap-max-width);
}

/* ------------------------------------------------------------
   Alias: section-heading class (used by submit-form heading)
   Reuse same styling as .atx-section-heading
   ------------------------------------------------------------ */

.section-heading {
  font-weight: var(--section-heading-font-weight);
  text-transform: var(--section-heading-text-transform);
  letter-spacing: var(--section-heading-letter-spacing);
  line-height: var(--section-heading-line-height);
  text-align: var(--section-heading-text-align);
  margin: var(--section-heading-margin);

  font-size: clamp(
    var(--section-heading-size-min),
    var(--section-heading-size-fluid),
    var(--section-heading-size-max)
  );
}

@media (min-width: 768px) {
  .section-heading {
    font-size: clamp(
      var(--section-heading-size-min-desktop),
      var(--section-heading-size-fluid-desktop),
      var(--section-heading-size-max-desktop)
    );
  }
}

/* ------------------------------------------------------------
   Wrapper + heading outside panel
   ------------------------------------------------------------ */

.atx-submit-form {
  padding-top: var(--submit-form-section-padding-top);
  padding-bottom: var(--submit-form-section-padding-bottom);
  background-color: var(--page-bg);
}

/* When heading is disabled: keep only a small top padding */
.atx-submit-form--no-heading {
  padding-top: 0.75rem;
}

/* Heading is OUTSIDE the panel */
.atx-submit-form__headingwrap {
  max-width: var(--wrap-max-width);
  margin: 0 auto 1.5rem auto;
  padding-left: var(--wrap-pad-x);
  padding-right: var(--wrap-pad-x);
  text-align: center;
}

.atx-submit-form__heading {
  padding-top: var(--submit-form-heading-padding-top);
  padding-bottom: var(--submit-form-heading-padding-bottom);
  margin: 0;
}

/* ------------------------------------------------------------
   Panel
   ------------------------------------------------------------ */

.atx-submit-form__inner {
  max-width: var(--submit-form-panel-max-width);
  margin: 0 auto;
  padding-left: var(--wrap-pad-x);
  padding-right: var(--wrap-pad-x);
  padding-top: 1.75rem;
  padding-bottom: 2.25rem;

  background-color: var(--are-panel-color-1);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

/* Intro/guide text now sits INSIDE the panel */
.atx-submit-form__intro {
  max-width: 40rem;
  margin: 0 0 1.5rem 0;
  text-align: left;
  color: var(--font-body-color);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Intro + CTA row */
.atx-submit-form__intro-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.atx-submit-form__intro-cta a {
  white-space: nowrap;
  display: flex;
  justify-content: flex-end; /* right align on desktop/tablet */
}

/* Mobile: stack intro over CTA */
@media (max-width: 640px) {
  .atx-submit-form__intro-row {
    flex-direction: column;
    align-items: flex-start;
    text-align: center;
  }
  .atx-submit-form__intro-cta {
    width: 100%;
    justify-content: center; /* center the button */
  }
}

/* ------------------------------------------------------------
   Messages
   ------------------------------------------------------------ */

.atx-submit-form__message {
  max-width: 40rem;
  margin: 0 0 1.5rem 0;
  padding: 0.9rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.atx-submit-form__message--success {
  background-color: #e7f7ec;
  border: 1px solid #b7e4c4;
  color: #245a32;
}

.atx-submit-form__message--error {
  background-color: #fdecec;
  border: 1px solid #f4b7b7;
  color: #7e1414;
}

/* ------------------------------------------------------------
   Form layout
   ------------------------------------------------------------ */

.atx-submit-form__form {
  max-width: 100%;           /* fields now stretch across the panel */
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--submit-form-field-gap); /* gap between top-level groups */
}

/* Groups = logical sections of fields */
.atx-submit-form__group {
  display: flex;
  flex-direction: column;
  gap: var(--submit-form-field-gap); /* gap between entries in the group */
  margin-bottom: 1.75rem;
}

.atx-submit-form__group--security {
  margin-top: 1.5rem;
}

/* ------------------------------------------------------------
   Fields
   ------------------------------------------------------------ */

.atx-submit-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem; /* label vs input */
}

.atx-submit-form__label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--are-dark-gray);
}

.atx-submit-form__required {
  color: var(--are-red);
  margin-left: 0.25rem;
}

/* Inputs */

.atx-submit-form__input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  font: inherit;
  color: var(--font-body-color);
  background-color: var(--submit-form-field-bg);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.atx-submit-form__input--textarea {
  min-height: 130px;
  resize: vertical;
}

.atx-submit-form__input--select {
  cursor: pointer;
}

.atx-submit-form__input--checkbox {
  width: auto;
  padding: 0;
  background-color: transparent;
}

.atx-submit-form__input--file {
  padding: 0.4rem 0;
}

.atx-submit-form__input:focus {
  border-color: var(--are-color);
  box-shadow: 0 0 0 1px rgba(229,39,19,0.15);
  outline: none;
}

/* File info + hint */

.atx-submit-form__fileinfo {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
}

.atx-submit-form__filehint {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--are-gray);
}

/* Extra gap before photo/file entry */
.atx-submit-form__field--photos {
  margin-top: calc(var(--submit-form-field-gap) * 0.5);
}

/* Field-level errors */

.atx-submit-form__field-error {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--are-red);
}

/* Checkbox wrapper */

.atx-submit-form__checkboxwrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Gotcha */

.atx-submit-form__field--gotcha {
  margin-top: 0.75rem;
}

.atx-submit-form__gotcha-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.atx-submit-form__gotcha-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  background-color: var(--are-light-gray);
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
}

/* ------------------------------------------------------------
   Date + time on same row
   ------------------------------------------------------------ */

.atx-submit-form__row--datetime {
  display: flex;
  flex-direction: column;
  gap: var(--submit-form-field-gap);
}

.atx-submit-form__field--half {
  flex: 1 1 0;
}

@media (min-width: 640px) {
  .atx-submit-form__row--datetime {
    flex-direction: row;
  }
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */

.atx-submit-form__buttons {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center; /* center on mobile + tablet */
}

.atx-submit-form__button {
  min-width: 210px;
  text-align: center;
}

/* Reuse global button sizes */
.atx-submit-form__button.atx-btn {
  padding: var(--btn-padding-lg);
  font-size: var(--btn-font-lg);
}

/* Secondary button: light gray border in normal state */
.atx-submit-form__button--secondary.atx-btn {
  border-color: var(--btn-secondary-bg);
}

/* Ensure Åre-color border on hover for secondary */
.atx-submit-form__button--secondary.atx-btn:hover {
  border-color: var(--btn-primary-bg);
}

/* Desktop: left align buttons */
@media (min-width: 1161px) {
  .atx-submit-form__buttons {
    justify-content: flex-start;
  }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (min-width: 768px) {
  /* nothing extra here for now; desktop handled at 1161px */
}


/* ============================================================
   CTA: center align on mobile
   ============================================================ */
@media (max-width: 768px) {
  .atx-submit-form__introrow {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .atx-submit-form__introrow .atx-submit-form__introcta {
    justify-content: center;
  }
}

/* ============================================================
   Padding between intro row (CTA) and first fields
   ============================================================ */
.atx-submit-form__inner {
  /* add small gap before the first field group */
  padding-top: 1rem;
}

/* ============================================================
   FIX: Intro row adjustments (mobile)
   ============================================================ */

/* Center CTA button text + reduce top spacing + justify intro text */
@media (max-width: 640px) {

  /* the whole row stacks, so reduce gap at the top */
  .atx-submit-form__intro-row {
    margin-bottom: 1.5rem;   /* smaller gap */
    gap: 0rem;              /* tighter spacing */
    align-items: center;      /* center row content */
  }

  /* justify the intro text */
  .atx-submit-form__intro {
    text-align: justify;
  }

  /* center align CTA button AND its text */
  .atx-submit-form__intro-cta {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .atx-submit-form__intro-cta a {
    text-align: center;  /* center caption */
    justify-content: center;
  }
}

