/**
 * Recruitment Form Styles
 *
 * Design tokens from Figma specification.
 * Font: Inter (400 regular, 500 medium, 600 semi-bold)
 *
 * @package PS5_Theme\Recruitment
 * @since 1.0.0
 */

/* ==========================================================================
   Page wrapper — purple gradient background
   ========================================================================== */

.ps-rf-page {
  min-height: 100vh;
  background: linear-gradient(120.02deg, #4d1278 4.22%, #e8c9ff 96.3%);
  padding: 150px 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: 'Inter', sans-serif;
}

.ps-rf-page-inner {
  width: 100%;
  max-width: 1300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

/* ==========================================================================
   Header — logo + tagline
   ========================================================================== */

.ps-rf-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ps-rf-logo {
  height: 48px;
  width: auto;
}

.ps-rf-tagline {
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  color: #ffffff;
}

/* ==========================================================================
   Form card — frosted white container
   ========================================================================== */

.ps-rf-card {
  width: 100%;
  max-width: 1300px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 40px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ==========================================================================
   Authenticated state — "already a panelist" card
   ========================================================================== */

.ps-rf-authenticated {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 48px 24px;
}

.ps-rf-authenticated h2 {
  font-weight: 600;
  font-size: 28px;
  color: #111113;
  margin: 0;
}

.ps-rf-authenticated p {
  font-size: 16px;
  color: #4f4f55;
  max-width: 480px;
  margin: 0;
}

.ps-rf-authenticated .ps-rf-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 8px;
}

/* ==========================================================================
   Submission success state
   ========================================================================== */

.ps-rf-card-success {
  width: 100%;
  max-width: 540px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 40px;
  padding: 100px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

.ps-rf-submission-success__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.ps-rf-submission-success__text h2 {
  font-weight: 700;
  font-size: 28px;
  line-height: 120%;
  color: #111113;
  margin: 0;
}

.ps-rf-submission-success__text p {
  font-weight: 500;
  font-size: 16px;
  line-height: 19px;
  color: #4f4f55;
  margin: 0;
}

.ps-rf-submission-success__btn {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px;
  width: 100%;
  max-width: 460px;
  height: 48px;
  background: #59ac36;
  border-radius: 32px;
  font-weight: 600;
  font-size: 20px;
  line-height: 24px;
  color: #ffffff;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.ps-rf-submission-success__btn:hover {
  background: #4e9a2f;
  color: #ffffff;
}

/* ==========================================================================
   Notice text
   ========================================================================== */

.ps-rf-notice {
  font-weight: 600;
  font-size: 18px;
  line-height: 1.4;
  color: #111113;
  margin: 20px 0;
}

/* ==========================================================================
   Status messages
   ========================================================================== */

.ps-rf-message {
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.ps-rf-message--success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.ps-rf-message--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ==========================================================================
   Form layout
   ========================================================================== */

.ps-rf-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Row containers */
.ps-rf-row {
  display: flex;
  gap: 16px;
  width: 100%;
}

.ps-rf-row--2 > .ps-rf-field {
  flex: 1 1 0%;
  min-width: 0;
}

.ps-rf-row--3 > .ps-rf-field {
  flex: 1 1 0%;
  min-width: 0;
}

/* ==========================================================================
   Field base
   ========================================================================== */

.ps-rf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ps-rf-field label {
  font-weight: 400;
  font-size: 16px;
  line-height: 1.4;
  color: #111113;
}

/* Text / email / tel inputs */
.ps-rf-field input[type='text'],
.ps-rf-field input[type='email'],
.ps-rf-field input[type='tel'] {
  height: 48px;
  padding: 0 20px;
  background: #f3f6f9;
  border: 1px solid transparent;
  border-radius: 32px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #111113;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.ps-rf-field input::placeholder {
  color: #4f4f55;
  font-weight: 500;
}

.ps-rf-field input:focus {
  border-color: #4d1278;
}

/* Validation error state */
.ps-rf-field input.ps-rf-invalid {
  border-color: #dc2626;
}

/* ==========================================================================
   Phone field with prefix
   ========================================================================== */

.ps-rf-phone-group {
  display: flex;
  height: 48px;
  background: #f3f6f9;
  border-radius: 32px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.ps-rf-phone-group:focus-within {
  border-color: #4d1278;
}

.ps-rf-phone-group.ps-rf-invalid {
  border-color: #dc2626;
}

.ps-rf-phone-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 78px;
  min-width: 78px;
  border-inline-end: 1px solid #cdcdcd;
}

.ps-rf-phone-prefix-input {
  width: 50px;
  text-align: center;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  height: auto !important;
  padding: 0 !important;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #111113;
  outline: none;
}

.ps-rf-phone-group input[type='tel'] {
  flex: 1;
  height: 100%;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 20px !important;
}

/* ==========================================================================
   Checkboxes
   ========================================================================== */

.ps-rf-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.ps-rf-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.ps-rf-checkbox input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.ps-rf-checkbox-box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1px solid #111113;
  border-radius: 4px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
  margin-top: 2px;
}

.ps-rf-checkbox input:checked + .ps-rf-checkbox-box {
  background: #4d1278;
  border-color: #4d1278;
}

.ps-rf-checkbox input:checked + .ps-rf-checkbox-box::after {
  content: '';
  display: block;
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.ps-rf-checkbox-label {
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: #111113;
}

.ps-rf-checkbox-label a {
  color: #4d1278;
  text-decoration: none;
  font-weight: 700;
}

.ps-rf-checkbox-label a:hover {
  color: #371057;
}

/* Error for checkboxes */
.ps-rf-checkboxes .ps-rf-field-error {
  margin-inline-start: 32px;
}

/* ==========================================================================
   Field error text
   ========================================================================== */

.ps-rf-field-error {
  font-size: 13px;
  font-weight: 500;
  color: #dc2626;
  min-height: 0;
  line-height: 1.3;
  display: block;
}

.ps-rf-field-error:empty {
  display: none;
}

/* ==========================================================================
   Submit button
   ========================================================================== */

.ps-rf-submit-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.ps-rf-submit {
  width: 460px;
  max-width: 100%;
  height: 48px;
  background: #59ac36;
  color: #ffffff;
  border: none;
  border-radius: 32px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 20px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    opacity 0.2s ease;
}

.ps-rf-submit:hover {
  background: #4e9a2f;
}

.ps-rf-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   Loading spinner on submit
   ========================================================================== */

.ps-rf-submit.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.ps-rf-submit.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-block-start: -11px;
  margin-inline-end: 0;
  margin-block-end: 0;
  margin-inline-start: -11px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: ps-rf-spin 0.6s linear infinite;
}

@keyframes ps-rf-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Responsive — tablet
   ========================================================================== */

@media (max-width: 1024px) {
  .ps-rf-page {
    padding: 132px 16px;
  }

  .ps-rf-card {
    padding: 32px 24px;
    border-radius: 24px;
  }

  .ps-rf-row--3 {
    flex-wrap: wrap;
  }

  .ps-rf-row--3 > .ps-rf-field {
    flex: 1 1 calc(50% - 8px);
  }
}

/* ==========================================================================
   Responsive — mobile
   ========================================================================== */

@media (max-width: 640px) {
  .ps-rf-page {
    padding: 120px 12px;
  }

  .ps-rf-page-inner {
    gap: 24px;
  }

  .ps-rf-header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .ps-rf-tagline {
    font-size: 20px;
  }

  .ps-rf-notice {
    font-size: 15px;
  }

  .ps-rf-card {
    padding: 24px 16px;
    border-radius: 20px;
    gap: 16px;
  }

  .ps-rf-row,
  .ps-rf-row--2,
  .ps-rf-row--3 {
    flex-direction: column;
    gap: 12px;
  }

  .ps-rf-row--3 > .ps-rf-field {
    flex: 1 1 100%;
  }

  .ps-rf-submit {
    width: 100%;
    font-size: 18px;
  }
}
