/*
===================================================
NICHOLAS 14/09/2026

Modal "Comparar Camadas" (#swipe-config-modal) — layout em dois cards:
esquerda (azul, passo 1) e direita (verde, passo 2).

Identidade visual dos outros modais (ADR-121) mantida: borda verde de 5px
no topo, cantos de 6px, sombra, título, botão X de fechar e padding do
cabeçalho/rodapé vêm das regras compartilhadas de layoutOverrides.css e
mobile-modals.css — este arquivo não sobrescreve nenhum deles. A tipografia
segue os mesmos valores medidos no modal "Publicar Tema": Open Sans, título
16,8px/600 #4d627b, textos de corpo em 14px.

Não usar !important em "display" de botões e grupos: o JS esconde e mostra
#btnDeactivateSwipe e os grupos Base/WMS com .show()/.hide() (estilo inline).
===================================================
*/

#swipe-config-modal {
  --swipe-title: #4d627b;
  --swipe-text: #4d627b;
  --swipe-muted: #8f9ea6;
  --swipe-border: #dfe6ef;
  --swipe-blue: #2f6fed;
  --swipe-blue-soft: #edf3ff;
  --swipe-blue-tint: #e1eafd;
  --swipe-blue-border: #d7e3fa;
  --swipe-green: #1f9d5b;
  --swipe-green-soft: #ecf9f2;
  --swipe-green-tint: #d9f2e5;
  --swipe-green-border: #cdeedb;
  background: rgba(15, 23, 42, 0.42);
  -webkit-backdrop-filter: blur(3px) saturate(0.8);
  backdrop-filter: blur(3px) saturate(0.8);
}

/* ---------- Container ---------- */

#swipe-config-modal .modal-dialog {
  width: 1100px !important;
  max-width: calc(100vw - 48px) !important;
}

/* Borda verde, cantos e sombra vêm do padrão compartilhado; aqui só o layout
   em coluna, para o corpo rolar e o cabeçalho/rodapé ficarem fixos. */
#swipe-config-modal .modal-content {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px) !important;
  overflow: hidden !important;
}

/* ---------- Cabeçalho ---------- */

#swipe-config-modal .swipe-modal__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 64px 16px 24px !important;
}

#swipe-config-modal .swipe-modal__header::before,
#swipe-config-modal .swipe-modal__header::after,
#swipe-config-modal .swipe-modal__footer::before,
#swipe-config-modal .swipe-modal__footer::after {
  content: none;
}

#swipe-config-modal .swipe-modal__icon {
  flex: 0 0 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--swipe-blue-soft);
  color: var(--swipe-blue);
}

#swipe-config-modal .swipe-modal__icon svg {
  width: 22px;
  height: 22px;
}

#swipe-config-modal .swipe-modal__titles {
  flex: 1 1 auto;
  min-width: 0;
}

#swipe-config-modal .swipe-modal__header .modal-title {
  margin: 0;
}

#swipe-config-modal .swipe-modal__subtitle {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--swipe-muted);
}

/* Mesmo X do "Publicar Tema" (glyphicon-remove preto de 22px) */
#swipe-config-modal .modal-header .close,
#swipe-config-modal .modal-header .close i {
  color: #000 !important;
}

/* ---------- Cards esquerda / direita ---------- */

#swipe-config-modal .swipe-modal__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  padding: 4px 24px 24px !important;
  overflow-y: auto;
}

#swipe-config-modal .swipe-side {
  min-width: 0;
  padding: 22px 24px 8px;
  border: 1px solid var(--swipe-blue-border);
  border-radius: 10px;
  background: linear-gradient(180deg, #f6f9ff 0%, #fbfcff 100%);
}

#swipe-config-modal .swipe-side--right {
  border-color: var(--swipe-green-border);
  background: linear-gradient(180deg, #f4fbf7 0%, #fbfefc 100%);
}

#swipe-config-modal .swipe-side__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

#swipe-config-modal .swipe-side__step {
  flex: 0 0 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--swipe-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

#swipe-config-modal .swipe-side--right .swipe-side__step {
  background: var(--swipe-green);
}

#swipe-config-modal .swipe-side__titles {
  flex: 1 1 auto;
  min-width: 0;
}

#swipe-config-modal .swipe-side__title {
  margin: 1px 0 2px;
  font-size: 16px;
  font-weight: 600;
  color: var(--swipe-title);
}

#swipe-config-modal .swipe-side__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--swipe-muted);
}

#swipe-config-modal .swipe-side__badge {
  flex: 0 0 auto;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--swipe-blue-tint);
  color: var(--swipe-blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

#swipe-config-modal .swipe-side--right .swipe-side__badge {
  background: var(--swipe-green-tint);
  color: #17804a;
}

#swipe-config-modal .swipe-side .form-group {
  margin-bottom: 18px;
}

#swipe-config-modal .swipe-side label {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--swipe-text);
}

#swipe-config-modal .swipe-help {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--swipe-muted);
}

#swipe-config-modal .swipe-help svg {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

/* ---------- Campo "Tipo de Camada" (select nativo com ícone) ---------- */

#swipe-config-modal .swipe-field {
  display: flex;
  align-items: stretch;
  height: 46px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--swipe-border);
  border-radius: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#swipe-config-modal .swipe-field:focus-within {
  border-color: var(--swipe-blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

#swipe-config-modal .swipe-side--right .swipe-field:focus-within {
  border-color: var(--swipe-green);
  box-shadow: 0 0 0 3px rgba(31, 157, 91, 0.14);
}

#swipe-config-modal .swipe-field__icon {
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--swipe-border);
  color: var(--swipe-muted);
}

#swipe-config-modal .swipe-field__icon svg {
  width: 18px;
  height: 18px;
}

#swipe-config-modal .swipe-field select.form-control {
  flex: 1 1 auto;
  min-width: 0;
  height: 100% !important;
  padding: 0 40px 0 12px;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  background-color: transparent !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238f9ea6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  color: var(--swipe-text);
  font-size: 14px;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* ---------- Select2: campo fechado ---------- */

#swipe-config-modal .select2-container--default .select2-selection--single {
  height: 46px;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--swipe-border);
  border-radius: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#swipe-config-modal .swipe-side--left .select2-container--default.select2-container--open .select2-selection--single,
#swipe-config-modal .swipe-side--left .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--swipe-blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

#swipe-config-modal .swipe-side--right .select2-container--default.select2-container--open .select2-selection--single,
#swipe-config-modal .swipe-side--right .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--swipe-green);
  box-shadow: 0 0 0 3px rgba(31, 157, 91, 0.14);
}

#swipe-config-modal .select2-container--default .select2-selection--single .select2-selection__rendered {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 64px 0 6px;
  line-height: normal;
  color: var(--swipe-text);
}

#swipe-config-modal .select2-container--default .select2-selection--single .select2-selection__placeholder,
#swipe-config-modal .select2-selection__placeholder .swipe-opt__name {
  color: var(--swipe-muted);
  font-weight: 400;
}

#swipe-config-modal .select2-container--default .select2-selection--single .select2-selection__clear {
  position: absolute;
  right: 38px;
  top: 50%;
  margin: 0;
  float: none;
  transform: translateY(-50%);
  color: var(--swipe-muted);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

#swipe-config-modal .select2-container--default .select2-selection--single .select2-selection__clear:hover {
  color: var(--millenio-danger);
}

#swipe-config-modal .select2-container--default .select2-selection--single .select2-selection__arrow {
  top: 0;
  right: 12px;
  width: 16px;
  height: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238f9ea6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
  transition: transform 0.15s ease;
}

#swipe-config-modal .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow {
  transform: rotate(180deg);
}

#swipe-config-modal .select2-container--default .select2-selection--single .select2-selection__arrow b {
  display: none;
}

/* ---------- Select2: lista aberta ---------- */

/* A lista é anexada direto no .modal (dropdownParent), que o tema centraliza
   (text-align: center); por isso o alinhamento é redefinido aqui. */
#swipe-config-modal .select2-dropdown {
  text-align: left;
  margin-top: 6px;
  padding: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--swipe-border);
  border-radius: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#swipe-config-modal .select2-dropdown--above {
  margin-top: -6px;
}

#swipe-config-modal .select2-search--dropdown {
  padding: 0 0 8px;
}

#swipe-config-modal .select2-search--dropdown .select2-search__field {
  height: 40px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--swipe-border);
  border-radius: 6px;
  outline: none;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238f9ea6' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='5.5'/%3E%3Cpath d='M13.5 13.5 17 17'/%3E%3C/svg%3E") no-repeat 12px center / 16px;
  color: var(--swipe-text);
  font-size: 14px;
}

#swipe-config-modal .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--swipe-blue);
  background-color: #fff;
}

#swipe-config-modal .swipe-dropdown--right .select2-search__field:focus {
  border-color: var(--swipe-green);
}

#swipe-config-modal .select2-results > .select2-results__options {
  max-height: 340px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cdd6e2 transparent;
}

#swipe-config-modal .select2-results > .select2-results__options::-webkit-scrollbar {
  width: 8px;
}

#swipe-config-modal .select2-results > .select2-results__options::-webkit-scrollbar-track {
  background: transparent;
}

#swipe-config-modal .select2-results > .select2-results__options::-webkit-scrollbar-thumb {
  background: #cdd6e2;
  border-radius: 8px;
}

#swipe-config-modal .select2-results__group {
  padding: 8px 10px 6px;
  color: var(--swipe-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#swipe-config-modal .select2-results__option,
#swipe-config-modal .select2-results__option .select2-results__option {
  margin: 1px 0;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--swipe-text);
}

#swipe-config-modal .swipe-opt__text,
#swipe-config-modal .select2-results__group,
#swipe-config-modal .select2-results__option {
  text-align: left;
}

#swipe-config-modal .select2-results__option[role="group"] {
  padding: 0;
}

#swipe-config-modal .select2-results__option[aria-disabled="true"] {
  display: none;
}

#swipe-config-modal .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: #f2f5fa;
  color: var(--swipe-text);
}

#swipe-config-modal .select2-container--default .select2-results__option[aria-selected="true"] {
  background: var(--swipe-blue-soft);
  color: var(--swipe-title);
}

#swipe-config-modal .swipe-dropdown--right .select2-results__option[aria-selected="true"] {
  background: var(--swipe-green-soft);
}

/* ---------- Item de camada (lista e campo fechado) ---------- */

#swipe-config-modal .swipe-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

/* Caixas sempre 4:3, a mesma proporção da imagem WMS pedida (96x72) */
#swipe-config-modal .swipe-opt__thumb {
  flex: 0 0 56px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  background-color: #e9eef5;
  color: var(--swipe-muted);
  box-shadow: inset 0 0 0 1px rgba(15, 39, 71, 0.06);
}

#swipe-config-modal .swipe-opt__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Miniatura WMS: imagem transparente sobre o recorte do tile de fundo */
#swipe-config-modal .swipe-opt__thumb--layered {
  background-repeat: no-repeat;
  background-size: 266.667% 355.556%;
}

#swipe-config-modal .swipe-opt__thumb svg {
  width: 20px;
  height: 20px;
}

#swipe-config-modal .swipe-opt__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

#swipe-config-modal .swipe-opt__name,
#swipe-config-modal .swipe-opt__desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#swipe-config-modal .swipe-opt__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--swipe-title);
}

#swipe-config-modal .swipe-opt__desc {
  font-size: 13px;
  line-height: 1.35;
  color: var(--swipe-muted);
}

#swipe-config-modal .swipe-opt__check {
  flex: 0 0 18px;
  display: flex;
  color: var(--swipe-blue);
  opacity: 0;
}

#swipe-config-modal .swipe-dropdown--right .swipe-opt__check {
  color: var(--swipe-green);
}

#swipe-config-modal .swipe-opt__check svg {
  width: 18px;
  height: 18px;
}

#swipe-config-modal .select2-results__option[aria-selected="true"] .swipe-opt__check {
  opacity: 1;
}

#swipe-config-modal .swipe-opt--selection {
  gap: 10px;
}

#swipe-config-modal .swipe-opt--selection .swipe-opt__thumb {
  flex-basis: 40px;
  height: 30px;
  border-radius: 4px;
}

#swipe-config-modal .swipe-opt--selection .swipe-opt__thumb svg {
  width: 16px;
  height: 16px;
}

#swipe-config-modal .swipe-opt--selection .swipe-opt__name {
  font-weight: 400;
  color: var(--swipe-text);
}

/* ---------- Rodapé ---------- */

#swipe-config-modal .swipe-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px !important;
}

#swipe-config-modal .swipe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  margin: 0 !important;
  padding: 0 24px !important;
  font-size: 14px;
  line-height: 1;
}

#swipe-config-modal .swipe-btn svg {
  width: 18px;
  height: 18px;
}

#swipe-config-modal .swipe-btn:focus-visible {
  outline: 3px solid rgba(47, 111, 237, 0.35);
  outline-offset: 2px;
}

#swipe-config-modal .swipe-btn--cancel {
  background-color: var(--millenio-danger) !important;
  border: 1px solid var(--millenio-danger) !important;
  color: #fff !important;
}

#swipe-config-modal .swipe-btn--cancel:hover,
#swipe-config-modal .swipe-btn--cancel:focus {
  background-color: var(--millenio-danger-hover) !important;
  border-color: var(--millenio-danger-hover) !important;
  color: #fff !important;
}

#swipe-config-modal .swipe-btn--primary {
  min-width: 180px;
  background-color: var(--millenio-green) !important;
  border: 1px solid var(--millenio-green) !important;
  color: #fff !important;
}

#swipe-config-modal .swipe-btn--primary:hover,
#swipe-config-modal .swipe-btn--primary:focus {
  background-color: var(--millenio-green-hover) !important;
  border-color: var(--millenio-green-hover) !important;
  color: #fff !important;
}

/* Desativar só aparece com o swipe ativo; contorno vermelho para não se
   confundir com o Cancelar. */
#swipe-config-modal #btnDeactivateSwipe.swipe-btn--danger {
  margin-right: auto !important;
  background-color: #fff !important;
  border: 1px solid var(--millenio-danger) !important;
  color: var(--millenio-danger) !important;
}

#swipe-config-modal #btnDeactivateSwipe.swipe-btn--danger:hover {
  background-color: #fdf1f0 !important;
}

/* ---------- Telas estreitas ---------- */

@media (max-width: 767px) {
  #swipe-config-modal .modal-dialog {
    width: calc(100vw - 24px) !important;
    max-width: none !important;
  }

  #swipe-config-modal .modal-content {
    max-height: calc(100vh - 24px) !important;
  }

  #swipe-config-modal .swipe-modal__header {
    padding: 16px 56px 12px 16px !important;
  }

  #swipe-config-modal .swipe-modal__icon {
    display: none;
  }

  #swipe-config-modal .swipe-modal__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 0 16px 16px !important;
  }

  #swipe-config-modal .swipe-side {
    padding: 16px 16px 4px;
  }

  #swipe-config-modal .swipe-modal__footer {
    flex-wrap: wrap;
    padding: 12px 16px !important;
  }

  #swipe-config-modal .swipe-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  #swipe-config-modal #btnDeactivateSwipe.swipe-btn--danger {
    flex-basis: 100%;
    margin-right: 0 !important;
  }
}
