/* Section shell and shared tokens */
.fp-masters-form-section {
  --fp-masters-content-high: var(--color-content-high, #001745);
  --fp-masters-content-mid: var(--color-content-mid, rgba(0, 23, 69, 0.7));
  --fp-masters-border-mid: var(--color-border-mid, rgba(0, 23, 69, 0.25));
  --fp-masters-background-low: var(--color-background-low, rgba(0, 23, 69, 0.05));
  --fp-masters-primary: var(--color-primary-mid, #205AE3);
  --fp-masters-aqua-low: var(--color-aqua-low, #B9FFF4);
  background: var(--color-background-base, #FFFFFF);
  color: var(--fp-masters-content-high);
  font-family: var(--font-outfit, "Outfit", Arial, sans-serif);
  width: 100%;
}

.fp-masters-form-section * {
  box-sizing: border-box;
}

.fp-masters-form-section p,
.fp-masters-form-section h2,
.fp-masters-form-section h3 {
  margin: 0;
}

.fp-masters-form-section .fp-masters-layout {
  display: grid;
  grid-template-columns: minmax(0, 495px) minmax(0, 540px);
  gap: 92px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px;
}

/* Header */
.fp-masters-form-section .fp-masters-header {
  width: 100%;
  min-height: 64px;
  background: var(--color-background-base, #FFFFFF);
  border-bottom: 1px solid var(--color-border-low, rgba(0, 23, 69, 0.1));
}

.fp-masters-form-section .fp-masters-header-inner {
  display: flex;
  align-items: center;
  max-width: 1280px;
  min-height: 64px;
  margin: 0 auto;
  padding: 12px 48px;
}

.fp-masters-form-section .fp-masters-header-logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.fp-masters-form-section .fp-masters-header-logo img {
  display: block;
  width: 200px;
  height: auto;
}

/* Left column: fp-masters-info */
.fp-masters-form-section .fp-masters-info {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
}

.fp-masters-form-section .fp-masters-heading {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.fp-masters-form-section .fp-masters-title {
  color: var(--fp-masters-content-high);
  font-size: 32px;
  font-weight: 500;
  line-height: 36px;
  letter-spacing: 0;
}

.fp-masters-form-section .fp-masters-description {
  color: var(--fp-masters-content-mid);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

.fp-masters-form-section .fp-masters-highlight {
  color: var(--fp-masters-content-high);
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
}

.fp-masters-form-section .fp-masters-benefits {
  display: flex;
  flex-direction: column;
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.fp-masters-form-section .fp-masters-benefit {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 58px;
  padding: 12px 16px 12px 12px;
  background: var(--fp-masters-aqua-low);
  border-radius: 12px;
}

.fp-masters-form-section .fp-masters-benefit-icon {
  display: grid;
  place-items: center;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
}

.fp-masters-form-section .fp-masters-benefit-icon img {
  display: block;
  width: 34px;
  height: 34px;
  filter: brightness(0) saturate(100%) invert(8%) sepia(99%) saturate(1852%) hue-rotate(212deg) brightness(92%) contrast(109%);
}

.fp-masters-form-section .fp-masters-benefit span {
  color: var(--fp-masters-content-high);
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
}

/* Right column: form layout */
.fp-masters-form-section .fp-masters-form-card {
  width: 100%;
}

.fp-masters-form-section .fp-masters-form-title {
  color: var(--fp-masters-content-high);
  font-size: 22px;
  font-weight: 600;
  line-height: 30px;
  margin-bottom: 20px;
}

.fp-masters-form-section .fp-masters-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fp-masters-form-section .fp-masters-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fp-masters-form-section .fp-masters-span-2 {
  grid-column: span 2;
}

.fp-masters-form-section .fp-masters-phone-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

/* Form fields and floating labels */
.fp-masters-form-section .form-group {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fp-masters-form-section .form-group label {
  position: absolute;
  top: 24px;
  left: 17px;
  z-index: 10;
  transform: translateY(-50%);
  transform-origin: left top;
  color: var(--fp-masters-content-mid);
  font-family: var(--font-outfit, "Outfit", Arial, sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0;
  margin: 0;
  pointer-events: none;
  text-transform: none;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.fp-masters-form-section .form-group:has(input:focus) label,
.fp-masters-form-section .form-group:has(input:not(:placeholder-shown)) label,
.fp-masters-form-section .form-group.custom-select-group:has(.findOptionInput:not(:placeholder-shown)) label {
  transform: translateY(-22px) scale(0.75);
}

.fp-masters-form-section .form-group input:not([type="checkbox"]),
.fp-masters-form-section .form-group select {
  width: 100%;
  min-height: 48px;
  padding: 17px 38px 5px 16px;
  background: var(--fp-masters-background-low);
  border: 1px solid var(--fp-masters-border-mid);
  border-radius: 12px;
  color: var(--fp-masters-content-high);
  font-family: var(--font-outfit, "Outfit", Arial, sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.fp-masters-form-section .form-group[id="fp-masters-group-phone-code"] input:not([type="checkbox"]) {
  padding: 12px 36px 12px 48px;
}

.fp-masters-form-section .form-group[id="fp-masters-group-phone-code"] .options-list {
  width: 150%;
}

.fp-masters-form-section .form-group input::placeholder {
  color: transparent;
}

.fp-masters-form-section .form-group input:focus:not([readonly]):not([disabled]) {
  border-color: var(--fp-masters-primary);
}

.fp-masters-form-section .form-group input.error,
.fp-masters-form-section .select-wrapper.error > input {
  border-color: var(--color-danger-mid, #DD3222);
}

.fp-masters-form-section .form-group.disabled { pointer-events: none; }

.fp-masters-form-section .form-group.disabled .select-wrapper {
  cursor: default !important;
  border-color: transparent !important;
}

.fp-masters-form-section .form-group.disabled .select-wrapper::after {
  opacity: 0.4 !important;
}

.fp-masters-form-section .form-group.disabled select,
.fp-masters-form-section .form-group.disabled input {
  border-color: transparent !important;
  outline: none !important;
  cursor: default !important;
}

.fp-masters-form-section .form-group.disabled label {
  color: var(--color-content-low) !important;
}

/* Form custom searchable selects */
.fp-masters-form-section .hidden-select {
  display: none !important;
}

.fp-masters-form-section .custom-select-group {
  position: relative;
}

.fp-masters-form-section .select-wrapper {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.fp-masters-form-section .select-wrapper::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  background: url("/wp-content/themes/fpuniversae/assets/img/chevron-sheet-selector.svg") center / contain no-repeat;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.fp-masters-form-section .select-wrapper.open::after {
  transform: translateY(-50%) rotate(180deg);
}

.fp-masters-form-section .findOptionInput {
  width: 100%;
  height: 100%;
  padding: 17px 40px 5px 16px;
  background: transparent;
  border: 0;
  color: var(--fp-masters-content-high);
  cursor: pointer;
  font-family: var(--font-outfit, "Outfit", Arial, sans-serif);
  font-size: 16px;
  line-height: 24px;
  outline: none;
}

.fp-masters-form-section [data-select-type="phone-code"] .findOptionInput {
  padding-left: 48px;
}

.fp-masters-form-section .phone-country-flag {
  position: absolute;
  top: 50%;
  left: 16px;
  z-index: 7;
  width: 20px;
  height: 20px;
  object-fit: cover;
  transform: translateY(-50%);
  pointer-events: none;
}

.fp-masters-form-section .options-list {
  position: absolute;
  top: 52px;
  left: 0;
  z-index: 1000;
  display: none;
  width: 100%;
  max-height: 250px;
  padding: 4px;
  margin: 0;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid #E6E8ED;
  border-radius: 8px;
  list-style: none;
}

.fp-masters-form-section .options-list.show {
  display: block;
}

.fp-masters-form-section .options-list li {
  padding: 10px 12px;
  border-radius: 8px;
  color: #475569;
  cursor: pointer;
  font-family: var(--font-outfit, "Outfit", Arial, sans-serif);
  font-size: 14px;
  line-height: 20px;
  list-style: none;
  transition: background 0.2s ease;
}

.fp-masters-form-section .options-list li:hover,
.fp-masters-form-section .options-list li.focused {
  background: #F2F3F5;
}

.fp-masters-form-section .options-list li.zeroResults {
  color: #94A3B8;
  font-style: italic;
  pointer-events: none;
}

/* Form validation messages */
.fp-masters-form-section .class-error {
  display: none;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  color: var(--color-danger-mid, #DD3222);
  font-family: var(--font-outfit, "Outfit", Arial, sans-serif);
  font-size: 12px;
  line-height: 16px;
}

.fp-masters-form-section .class-error.show {
  display: flex;
}

.fp-masters-form-section .class-error img {
  width: 16px;
  height: 16px;
  filter: brightness(0) saturate(100%) invert(25%) sepia(36%) saturate(5830%) hue-rotate(351deg) brightness(91%) contrast(90%);
}

/* Form legal text and consent checkbox */
.fp-masters-form-section .fp-masters-privacy-box {
  position: relative;
  grid-column: span 2;
  height: 56px;
  overflow: hidden;
  background: var(--fp-masters-background-low);
  border: 1px solid var(--fp-masters-border-mid);
  border-radius: 8px;
}

.fp-masters-form-section .fp-masters-privacy-box::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 100%);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.fp-masters-form-section .fp-masters-privacy-box:has(.is-at-bottom)::after {
  opacity: 0;
}

.fp-masters-form-section .fp-masters-privacy-box p {
  max-height: 56px;
  margin: 0 16px 0 0;
  padding: 8px 8px 8px 16px;
  overflow-y: auto;
  color: var(--fp-masters-content-mid);
  font-size: 12px;
  line-height: 16px;

  &::-webkit-scrollbar {
    width: 4px;
  }

  &::-webkit-scrollbar-track {
    background: #00174526;
    border-radius: 4px;
    margin: 8px 0;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
  }
}

.fp-masters-form-section .fp-masters-privacy-box a,
.fp-masters-form-section .fp-masters-checkbox a {
  color: var(--fp-masters-primary);
  text-decoration: underline;
}

.fp-masters-form-section .fp-masters-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--fp-masters-content-mid);
  font-size: 12px;
  line-height: 16px;
  margin: 8px 0;
  cursor: pointer;
}

.fp-masters-form-section .fp-masters-checkbox input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.fp-masters-form-section .fp-masters-checkbox-mark {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  background: var(--fp-masters-background-low);
  border: 1px solid var(--fp-masters-border-mid);
  border-radius: 4px;
}

.fp-masters-form-section .fp-masters-checkbox input:checked + .fp-masters-checkbox-mark {
  background: var(--fp-masters-primary);
  border-color: var(--fp-masters-primary);
}

.fp-masters-form-section .fp-masters-checkbox input:checked + .fp-masters-checkbox-mark::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #FFFFFF;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}

/* Form submit button */
.fp-masters-form-section #fp-masters-submit {
  width: 100%;

  @media (min-width: 1024px ) {
    width: fit-content;
  }
}

/* Responsive layout adjustments */
@media (max-width: 1180px) {
  .fp-masters-form-section .fp-masters-layout {
    gap: 48px;
  }
}

@media (max-width: 1023px) {
  .fp-masters-form-section .fp-masters-header-inner {
    padding: 12px 24px;
  }

  .fp-masters-form-section .fp-masters-layout {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 24px;
  }

  .fp-masters-form-section .fp-masters-info {
    max-width: 620px;
    order: 1;
  }
}

@media (max-width: 640px) {
  .fp-masters-form-section .fp-masters-header-inner {
    padding: 12px 16px;
  }

  .fp-masters-form-section .fp-masters-header-logo img {
    width: 160px;
  }

  .fp-masters-form-section .fp-masters-layout {
    padding: 32px 16px;
  }

  .fp-masters-form-section .fp-masters-title {
    font-size: 28px;
    line-height: 34px;
  }

  .fp-masters-form-section .fp-masters-fields {
    grid-template-columns: 1fr;
  }

  .fp-masters-form-section .fp-masters-phone-row {
    grid-template-columns: 120px 1fr;
  }

  .fp-masters-form-section .fp-masters-phone-row .form-group:last-child {
    grid-column: span 2;
  }

  .fp-masters-form-section .fp-masters-span-2,
  .fp-masters-form-section .fp-masters-privacy-box {
    grid-column: auto;
  }

  .fp-masters-form-section .fp-masters-benefit span {
    font-size: 16px;
    line-height: 24px;
  }
}
