/* Редакторы меток и подборок, поля, загрузка изображений. */

.pin.picking {
  background: #fff;
  border-color: #80d329;
  width: 38px;
  height: 44px;
}

.required {
  color: #e95e63;
}

.formerror {
  color: #e95e63 !important;
}

.picker {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 360px;
  max-width: calc(100% - 90px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 17px;
  box-shadow: 0 8px 40px #0002;

  @media (max-width: 760px) {
    padding: 12px;
    max-width: calc(100% - 25px);
    width: 350px;
  }

  :where([data-layout="mobile"]) & {
    position: fixed !important;
    width: calc(100% - 24px) !important;
    max-width: 440px !important;
    bottom: calc(140px + env(safe-area-inset-bottom)) !important;
  }
}

.picker strong {
  font-size: 14px;

  @media (max-width: 760px) {
    font-size: 12px;
  }
}

.picker p {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 13px;

  @media (max-width: 760px) {
    font-size: 10px;
  }
}

.picker > div {
  display: flex;
  gap: 7px;
}

.picker .primary {
  flex: 1;
  font-size: 11px;
  padding: 10px;
  min-height: 44px;

  @media (max-width: 760px) {
    font-size: 12px;
  }
}

.picker .quiet {
  padding: 10px;
  min-height: 44px;

  @media (max-width: 760px) {
    font-size: 12px;
  }
}

.uploadfield {
  margin-top: 15px;
}

.fieldtitle {
  display: block;
  font-size: 12px;
  margin-bottom: 7px;
}

.uploadbutton {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  background: var(--soft);
  border: 1px dashed var(--muted);
  border-radius: 11px;
  min-height: 48px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  margin: 0;

  @media (max-width: 760px) {
    min-height: 50px;
    font-size: 13px;
  }
}

.uploadbutton:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.uploadfield:focus-within .uploadbutton {
  outline: 2px solid var(--accent);
}

.photoPreview {
  margin-top: 10px;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--soft);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
  padding: 8px;
}

.photoPreview .photoThumb {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  background: var(--soft);
}

.photoPreview .photoThumb img {
  width: 100%;
  height: 86px;
  max-height: none;
  object-fit: cover;
  display: block;
}

.photoPreview .photoThumb button {
  display: grid;
  place-items: center;
  position: absolute;
  right: 3px;
  top: 3px;
  width: 28px;
  height: 28px;
  font-size: 17px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 2px 10px #0003;
  line-height: 1;
}

.picker #confirmPick:disabled {

  @media (max-width: 760px) {
    display: none;
  }
}

.picker #cancelPick {

  @media (max-width: 760px) {
    flex: 1;
  }
}

.photoPreview button {

  @media (max-width: 760px) {
    width: 44px;
    height: 44px;
  }
}

#dragPositionForm .textbutton {
  min-height: 44px;
}

.castColorPicker {
  border: 0;
  padding: 0;
  margin: 20px 0 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.castColorPicker legend {
  font-size: 13px;
  margin-bottom: 12px;
}

.castColorPicker label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 8px 4px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  min-width: 46px;
}

.castColorPicker label input {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  opacity: 0;
  padding: 0 !important;
  overflow: hidden;
}

.castColorPicker label > span {
  display: block;
  width: 29px;
  height: 29px;
  background: var(--swatch);
  border: 2px solid #14251c30;
  border-radius: 50%;
}

.castColorPicker label small {
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted);
}

.castColorPicker label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.castColorPicker label:has(input:checked) > span:after {
  content: "✓";
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 16px;
  color: #14251c;
  font-weight: 800;
}

.castColorPicker label:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.castColorPicker label:hover {
  background: var(--soft);
}

.castColorPicker.iconPicker label > span {
  background: none !important;
  border: none !important;
  font-size: 22px;
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
}

.castColorPicker.iconPicker label:has(input:checked) > span:after {
  content: "" !important;
  display: none !important;
}

body.dark .castColorPicker label:has(input:checked) {
  border-color: #555555;
  background: #303030;
}

.pin:not(.picking):not(.globalPin) {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--pin-cast, var(--accent));
  box-shadow: 0 1px 7px #0006;
  touch-action: none;
  cursor: pointer;
  font-size: 0;
  overflow: visible;
}

.privacyPicker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border: 0;
  padding: 0;
  margin: 20px 0 10px;
}

.privacyPicker legend {
  font-size: 13px;
  margin-bottom: 12px;
  padding: 0;
}

.privacyPicker label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 10px 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  min-width: 88px;
  background: var(--panel);
}

.privacyPicker label input {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  opacity: 0;
  padding: 0 !important;
  overflow: hidden;
}

.privacyPicker label > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--soft);
  font-size: 17px;
  line-height: 1;
}

.privacyPicker label small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.privacyPicker label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.privacyPicker label:has(input:checked) > span {
  background: var(--accent);
  color: var(--onaccent);
}

.privacyPicker label:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.privacyPicker label:hover {
  background: var(--soft);
}

body.dark .privacyPicker label:has(input:checked) {
  background: #303030;
}

.addressField {
  margin-top: 14px;
}

.addressField > label {
  display: block;
  font-size: 12px;
  margin: 0 0 5px;
}

.addressLine {
  display: flex;
  gap: 7px;
  align-items: stretch;
  position: relative;

  @media (max-width: 760px) {
    flex-wrap: wrap;
  }
}

.addressLine > input {
  flex: 1;
  min-width: 0;
  margin-top: 0 !important;
}

.addressLine > button {
  flex-shrink: 0;

  @media (max-width: 760px) {
    min-height: 42px;
    padding: 0 10px;
    font-size: 10px;
  }
}

.smallbutton {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  min-height: 44px;

  @media (max-width: 760px) {
    min-height: 46px;
  }
}

.smallbutton:hover {
  border-color: var(--accent);
}

.autogrow {
  resize: none;
  overflow: hidden;
  min-height: 75px;
}

.picker > .pickAddressWrap {
  display: block;
  gap: 0;
  position: relative;
  margin: 10px 0 12px;
}

.picker .pickAddressWrap input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 9px;
  padding: 11px;
  font-size: 12px;
  min-height: 44px;
}

.picker .pickActions {
  display: flex;
  gap: 7px;
}

.castSelectGroup {
  position: relative;
  margin-top: 14px;
}

.castSelectGroup > label {
  display: block;
  font-size: 12px;
  margin: 0 0 5px;
}

.castSelectCurrent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;

  :where([data-layout="mobile"]) & {
    min-height: 48px;
  }
}

.castSelectCurrent:hover {
  border-color: var(--accent);
}

.castSelectCurrent span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.castSelectCurrent svg {
  transition: transform 0.2s;
}

.castSelectCurrent.open svg {
  transform: rotate(180deg);
}

.castSelectMenu {
  position: static;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 8px 24px #0004;
  padding: 5px;
  margin-top: 4px;
  max-height: min(240px, 40dvh);
  overflow-y: auto;

  :where([data-layout="mobile"]) & {
    max-height: 230px;
  }
}

.castSelectMenu label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
  border-bottom: none;
  transition: background 0.2s;
  min-height: 48px;
}

.castSelectMenu label:hover {
  background: var(--accent-soft);
}

.castSelectMenu input[type="checkbox"] {
  -webkit-appearance: none;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  border: 2px solid var(--muted);
  border-radius: 5px;
  margin: 0;
  padding: 0 !important;
  display: grid;
  place-items: center;
  background: var(--panel);
  flex-shrink: 0;
  transition: all 0.2s;
  cursor: pointer;
  box-sizing: border-box;
}

.castSelectMenu input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.castSelectMenu input[type="checkbox"]:checked:after {
  content: "";
  width: 6px;
  height: 10px;
  border: solid #15250f;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  margin-bottom: 3px;
}

.castSelectMenu label:has(input:checked) {
  background: var(--accent-soft);
}

.castSelectMenu .newCastAction {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent);
  cursor: pointer;
  margin-top: 5px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.castSelectMenu .newCastAction:hover {
  background: var(--accent-soft);
}

.newCastInline {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}

.newCastInline input {
  flex: 1 !important;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  min-height: 44px !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
  border-radius: 8px !important;
}

.newCastInline button {
  flex-shrink: 0 !important;
  width: auto !important;
  margin: 0 !important;
  min-height: 44px !important;
  padding: 0 16px !important;
  font-size: 13px !important;
  border-radius: 8px !important;
}

#placeForm select[name="c"] {
  padding: 14px;
  border: 1px solid #9bb77b;
  border-radius: 12px;
  background: #f3f8eb;
  font-weight: 600;
}

#newCastInEditor {
  width: 100%;
  padding: 13px;
  border: 1px dashed #8fae6b;
  border-radius: 12px;
  margin: 0 0 16px;
  background: #f5f9ef;
  color: #46642b;
  cursor: pointer;
}

.castSelectCurrent:focus-visible {
  outline: 2px solid var(--accent);
}

.collectionPlacePicker {
  margin: 18px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.collectionPlacePicker summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 32px;
}

.collectionPlaceOptions {
  overflow-y: auto;
  margin-top: 10px;
  max-height: min(230px, 35dvh);
}

.collectionPlaceOptions label {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  margin: 0;
}

.collectionPlaceOptions label[hidden] {
  display: none;
}

.collectionPlaceOptions input {
  width: 20px;
  min-height: 20px;
  flex: 0 0 20px;
}

.collectionPlaceOptions small {
  display: block;
  color: var(--muted);
}

.castColorPicker:not(.iconPicker) label {
  min-width: 38px;
  padding: 8px;
}

.imageDropZone {
  border: 1px dashed var(--line);
  padding: 12px;
  border-radius: 12px;
}

.imageDropZone.dragOver {
  border-color: var(--accent);
  background: var(--accent-soft, var(--soft));
  outline: 2px solid var(--accent);
}

.uploadHint {
  display: block;
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.5;
}

.draftHint {
  margin: -8px 0 18px;
  font-size: 12px;
  color: var(--muted);
}

.selecting .picker {

  :where([data-layout="mobile"]) & {
    bottom: 20px !important;
  }
}
