/* =========================================================
   TOE BEANS DESIGN SYSTEM
   FORMS
   ========================================================= */

.ds-form {

  display:
    grid;

  gap:
    20px;

}


.ds-form-grid {

  display:
    grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap:
    16px;

}


.ds-form-field {

  min-width:
    0;

  display:
    grid;

  gap:
    7px;

}


.ds-form-field-full {

  grid-column:
    1 / -1;

}


.ds-form-field label {

  color:
    var(--ds-heading);

  font-size:
    14px;

  font-weight:
    750;

}


.ds-form-help {

  margin:
    var(--ds-space-1)
    0
    0;

  color:
    var(--ds-muted);

  font-size:
    13px;

  line-height:
    1.45;

}


.ds-form-field input::placeholder,
.ds-form-field textarea::placeholder {

  color:
    var(--ds-muted);

  opacity:
    1;

}


.ds-form-field option {

  background:
    var(--ds-surface);

  color:
    var(--ds-text);

}

.ds-form-field input:not([type="checkbox"]):not([type="radio"]),
.ds-form-field select,
.ds-form-field textarea {

  width:
    100%;

  min-height:
    44px;

  padding:
    10px 12px;

  border:
    1px solid
    var(--ds-border-strong);

  border-radius:
    10px;

  outline:
    none;

  background:
    var(--ds-surface);

  color:
    var(--ds-text);

}


.ds-form-field textarea {

  min-height:
    110px;

  resize:
    vertical;

}


.ds-form-field input:focus,
.ds-form-field select:focus,
.ds-form-field textarea:focus {

  border-color:
    var(--ds-primary);

  box-shadow:
    0 0 0 3px
    color-mix(
      in srgb,
      var(--ds-primary) 15%,
      transparent
    );

}


.ds-choice-grid {

  display:
    grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap:
    10px;

}


.ds-choice-item {

  display:
    grid;

  grid-template-columns:
    22px
    minmax(0, 1fr);

  align-items:
    center;

  gap:
    10px;

  min-height:
    52px;

  padding:
    11px 13px;

  border:
    1px solid
    var(--ds-border);

  border-radius:
    11px;

  background:
    var(--ds-surface);

}


.ds-choice-item input {

  width:
    20px;

  height:
    20px;

  margin:
    0;

}

/* USER PROFILE PHOTO FIELD */

.ds-user-account-edit-dialog {
  width: min(
    800px,
    calc(100vw - (var(--ds-space-4) * 2))
  );
  max-width: 800px;
  max-height: calc(100dvh - (var(--ds-space-4) * 2));
}

.ds-user-account-edit-dialog
.ds-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - (var(--ds-space-4) * 2));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ds-user-account-edit-dialog
.ds-modal-body {
  display: grid;
  gap: var(--ds-space-5);
}

.ds-user-account-edit-dialog
.ds-form-grid {
  row-gap: var(--ds-space-4);
}

.ds-user-profile-photo-field {
  display: grid;
  gap: var(--ds-space-2);
  padding: var(--ds-space-4);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface-soft);
}

.ds-user-profile-photo-label {
  color: var(--ds-heading);
  font-size: 1rem;
  font-weight: 800;
}

.ds-user-profile-photo-field
.ds-form-help {
  margin: 0;
}

.ds-user-profile-photo-editor {
  display: grid;
  grid-template-columns:
    104px
    minmax(0, 1fr);
  gap: var(--ds-space-4);
  align-items: center;
}

.ds-user-profile-photo-preview {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--ds-border);
  border-radius: 50%;
  background: var(--ds-surface);
  color: var(--ds-text-muted);
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
}

.ds-user-profile-photo-preview
span {
  max-width: 72px;
}

.ds-user-profile-photo-preview
img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
}

.ds-user-profile-photo-controls {
  display: grid;
  min-width: 0;
  gap: var(--ds-space-2);
}

.ds-user-profile-photo-controls
> label {
  color: var(--ds-heading);
  font-weight: 700;
}

.ds-user-profile-photo-controls
input[type="file"] {
  width: 100%;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text-muted);
  font: inherit;
}

.ds-user-profile-photo-controls
input[type="file"]::file-selector-button {
  margin-right: var(--ds-space-3);
  padding:
    var(--ds-space-2)
    var(--ds-space-3);
  border: 0;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-primary);
  color: var(--ds-on-primary);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.ds-user-profile-photo-controls
input[type="file"]::file-selector-button:hover {
  background: var(--ds-primary-dark);
}

.ds-user-profile-photo-controls
input[type="file"]:focus-visible {
  outline: 3px solid var(--ds-focus-ring);
  outline-offset: 2px;
}

.ds-user-profile-photo-controls
.ds-button {
  width: fit-content;
}

@media (max-width: 560px) {
  .ds-user-profile-photo-editor {
    grid-template-columns:
      80px
      minmax(0, 1fr);
  }

  .ds-user-profile-photo-preview {
    width: 80px;
    height: 80px;
  }

  .ds-user-profile-photo-preview
  span {
    max-width: 62px;
    font-size: 0.7rem;
  }

  .ds-user-profile-photo-controls
  .ds-button {
    width: 100%;
  }
}