/**
 * Smart Form Styles with Google Places Integration
 test
 */

/* Toast notifications */
#toast {
  position: fixed;
  bottom: 6rem;
  right: 1rem;
  z-index: 9999;
}

.toast {
  position: relative;
  margin-top: 0.75rem;
  padding: 1rem 1.5rem;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  font-family: inherit;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast.success {
  background: #2ecc71;
  color: #fff;
}

.toast.error {
  background: #e74c3c;
  color: #fff;
}

.toast button {
  all: unset;
  position: absolute;
  top: 0.2rem;
  right: 0.4rem;
  cursor: pointer;
}

/* Form wrapper */
.form-steps-wrapper {
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* Progress container */
.progress-container {
  display: flex;
  align-items: center;
  position: relative;
  margin-bottom: 1rem;
  height: 4px;
  background-color: hsl(var(--background-light-8));
}

.progress-line {
  position: absolute;
  left: 0;
  top: 0;
  height: 4px;
  background-color: hsl(var(--secondary-dark-2));
  width: 0%;
  transition: width 0.3s ease;
}

.progress-step {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: hsl(var(--background-light-6));
  position: relative;
  z-index: 2;
  margin: 0 0;
  transform: translateY(0%);
  border: 3px solid hsl(var(--background-light-10));
  margin-left: calc((100% - 60px) / 2);
}

.progress-step[data-step='1'] {
  margin-left: 0;
}

.progress-step[data-step='3'] {
  margin-right: 0;
}

.progress-step.completed {
  background-color: hsl(var(--secondary-dark-2));
}

.progress-step.active-indicator {
  background-color: hsl(var(--secondary-dark-2));
}

/* Form steps container */
.form-steps-container {
  position: relative;
  transition: height 0.3s ease;
}

.form-step {
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
}

.form-step.active {
  opacity: 1;
  visibility: visible;
  position: relative;
}

/* Form groups */
.form-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid hsla(var(--primary-dark-2), 0.5);
  border-bottom-width: 0;
  position: relative;
  overflow: visible;
  align-items: center;
}
.form-group.zipcode-group {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid hsla(var(--primary-dark-2), 0.5);
  border-bottom-width: 0;
  position: relative;
  overflow: visible;
  align-items: center;
}
.form-group.zipcode-group::before {
  display: none;
}

.form-group::before,
.form-group.template-third::after {
  content: '';
  width: 1px;
  height: 100%;
  background-color: hsla(var(--primary-dark-2), 0.5);
  position: absolute;
  top: 0;
}

.form-group::before {
  left: calc(100% / 2);
}

.form-group.template-third::before {
  left: calc(100% / 3);
}

.form-group.template-third::after {
  left: calc((100% / 3) * 2);
}

.form-group.template-third {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-group input,
.form-group textarea,
.form-group select {
  border: none;
  background-color: transparent;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  font-weight: 400;
}

/* Select field styling */
.form-group select {
  padding: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  color: hsl(var(--foreground-dark-10));
  background-color: transparent;
  border: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1rem;
  padding-right: 2rem;
}

.form-group select:focus {
  outline: none;
  background-color: hsl(var(--background-light-9));
}

.form-group select option {
  background-color: white;
  color: hsl(var(--foreground-dark-10));
  padding: 0.5rem;
}

.form-group label {
  user-select: none;
}

.form-group input:focus-visible,
.form-group textarea:focus-visible {
  outline: none;
}

/* Smart address container */
.smart-address-container {
  position: relative;
}

.address-autocomplete {
  position: relative;
  z-index: 1;
}

/* Address suggestions */
.address-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid hsl(var(--primary-light-6));
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.address-suggestion {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid hsl(var(--background-light-8));
  transition: background-color 0.2s;
  background-color: hsl(var(--primary-light-8));
}

.address-suggestion:hover {
  background-color: hsl(var(--background-light-9));
}

.address-suggestion:last-child {
  border-bottom: none;
}

.suggestion-main {
  font-weight: 600;
  color: hsl(var(--foreground-dark-10));
  margin-bottom: 2px;
}

.suggestion-secondary {
  font-size: 0.9em;
  color: hsl(var(--foreground-dark-6));
}

/* Required field indicator */
.required-field {
  color: hsl(var(--negative));
  font-weight: 800;
}

/* Step buttons */
.step-buttons-single {
  text-align: center;
}

.step-buttons-single .form-button {
  width: 100%;
}

.step-buttons-double {
  display: flex;
  justify-content: center;
}

.step-buttons-double .form-button {
  flex: 1;
  text-align: center;
}

.next-step.border-l-0 {
  border-left-width: 0px;
}

/* Form styling */
.oxanium input,
.oxanium textarea {
  font-family: 'Oxanium';
  font-weight: 600;
  color: hsl(var(--foreground-dark-10));
}

form.oxanium button {
  font-family: 'Oxanium';
  font-weight: 600;
}

form button.form-button {
  background-color: hsl(var(--primary-dark-4));
  padding: 1.25rem 1rem;
  border: solid 1px hsl(var(--primary-light-2));
  color: hsl(var(--primary-light-10));
  cursor: pointer;
}

/* Checkbox styling */
.form-round {
  position: relative;
}

.form-round-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2rem;
}

.form-round label {
  background-color: hsl(var(--primary-light-8));
  border: 1px solid hsl(var(--primary-light-6));
  border-radius: 50%;
  cursor: pointer;
  height: 28px;
  left: 0;
  position: relative;
  top: 0;
  width: 28px;
}

.form-round label:after {
  border: 2px solid #fff;
  border-top: none;
  border-right: none;
  content: '';
  height: 6px;
  left: 7px;
  opacity: 0;
  position: absolute;
  top: 8px;
  transform: rotate(-45deg);
  width: 12px;
}

.form-round input[type='checkbox'] {
  visibility: hidden;
  appearance: none;
  display: none;
}

.form-round input[type='checkbox']:checked + label {
  background-color: hsl(var(--positive-dark-1));
  border-color: hsl(var(--positive-light-2));
}

.form-round input[type='checkbox']:checked + label:after {
  opacity: 1;
}

/* Choices.js customization */
.choices__list--multiple .choices__item {
  background-color: hsl(var(--primary)) !important;
  border: 1px solid hsl(var(--primary-light-2));
  color: hsl(var(--background-light-10)) !important;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0.25rem;
}

.choices__list--multiple .choices__item.is-highlighted {
  background-color: hsl(var(--primary)) !important;
  border: 1px solid hsl(var(--primary-light-2));
}

.choices__inner {
  background-color: transparent;
  border: none;
  border-radius: 0px;
  padding: 0.5rem;
  min-height: 2.5rem;
}

.is-open .choices__list--dropdown {
  border-color: hsl(var(--primary-light-6));
}

.choices__list--dropdown {
  background-color: hsl(var(--primary-light-10)) !important;
  border: 1px solid hsl(var(--primary-light-6)) !important;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
  background-color: hsl(var(--primary-light-8));
}

.is-focused .choices__inner,
.is-open .choices__inner {
  background-color: hsl(var(--background-light-9)) !important;
  border: none;
}

.choices[data-type*='select-multiple'] .choices__button,
.choices[data-type*='text'] .choices__button {
  border-left: 1px solid hsl(var(--primary-light-4));
}

/* Mobile responsive */
@media (max-width: 768px) {
  .form-group {
    display: flex;
    flex-direction: column;
  }

  .form-group::before,
  .form-group.template-third::after {
    display: none;
  }

  /* Tighter padding on mobile */
  .form-group label {
    padding: 0.6rem 0.5rem 0.25rem !important;
  }

  .form-group input,
  .form-group textarea {
    padding: 0.4rem 0.5rem !important;
  }

  .form-group select {
    padding: 0.4rem 0.5rem !important;
    width: 100%;
  }

  .form-group .smart-address-container {
    padding: 0.4rem 0.5rem !important;
  }

  /* Fix state select wrapper alignment */
  .form-group .px-2.pb-2.w-full,
  .form-group .px-2.mobile-py-2.w-full,
  .form-group .px-2.mobile-py-2.py-2.w-full {
    padding: 0.4rem 0.5rem !important;
  }

  form button.form-button {
    padding: 0.85rem 0.75rem;
  }

  /* Contact fields order */
  .form-group label[for='first_name'] {
    order: 1;
  }

  .form-group input#first_name {
    order: 2;
  }

  .form-group label[for='last_name'] {
    order: 3;
  }

  .form-group input#last_name {
    order: 4;
  }

  .form-group label[for='email'] {
    order: 1;
  }

  .form-group input#email {
    order: 2;
  }

  .form-group label[for='phone_number'] {
    order: 3;
  }

  .form-group input#phone_number {
    order: 4;
  }

  /* Address fields order */
  .form-group.template-third label[for='address_street'] {
    order: 2;
  }

  .form-group.template-third input#address_street {
    order: 3;
  }

  .form-group.template-third label[for='address_city'] {
    order: 4;
  }

  .form-group.template-third input#address_city {
    order: 5;
  }

  .form-group.template-third label[for='address_state'] {
    order: 0;
  }

  .form-group.template-third select#address_state {
    order: 1;
  }

  .form-group label[for='zipcode'] {
    order: 1;
  }

  .form-group input#zipcode {
    order: 2;
    padding-top: 0px;
  }

  .form-group label[for='job_type'] {
    order: 0;
  }

  .form-group select#job_type {
    order: 1;
  }

  .form-group label[for='checkbox'] {
    order: 1;
  }

  .form-round {
    order: 2;
  }

  /* Mobile address suggestions — keep absolute so they stay attached to the input */
  .address-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-height: 40vh;
    z-index: 10000;
    -webkit-overflow-scrolling: touch;
  }

  .address-suggestion {
    padding: 14px 16px;
    min-height: 44px;
  }

  /* Ensure the suggestions container can overflow its parent */
  .smart-address-container {
    position: relative;
    overflow: visible !important;
    z-index: 10000;
  }
}
