/* Ajustes exclusivos da lista administrativa de imóveis. */
@media (min-width: 1024px) {
  /*
   * A tabela original somava vários min-widths internos e ultrapassava a área
   * disponível ao lado do menu. O layout fixo distribui as seis colunas dentro
   * do espaço real sem empurrar Diagnóstico, Status e Ações para fora da tela.
   */
  .imob-property-list-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }

  .imob-property-list-table th,
  .imob-property-list-table td {
    min-width: 0 !important;
    padding-left: 0.6rem !important;
    padding-right: 0.6rem !important;
  }

  .imob-property-list-table th:nth-child(1),
  .imob-property-list-table td:nth-child(1) { width: 29%; }
  .imob-property-list-table th:nth-child(2),
  .imob-property-list-table td:nth-child(2) { width: 25%; }
  .imob-property-list-table th:nth-child(3),
  .imob-property-list-table td:nth-child(3) { width: 13%; }
  .imob-property-list-table th:nth-child(4),
  .imob-property-list-table td:nth-child(4) { width: 10%; }
  .imob-property-list-table th:nth-child(5),
  .imob-property-list-table td:nth-child(5) { width: 10%; }
  .imob-property-list-table th:nth-child(6),
  .imob-property-list-table td:nth-child(6) { width: 13%; }

  .imob-property-list-table td:first-child > div,
  .imob-property-list-table td:nth-child(2),
  .imob-property-list-table td:nth-child(3),
  .imob-property-list-table td:nth-child(4),
  .imob-property-list-table td:nth-child(5) {
    min-width: 0 !important;
  }

  .imob-property-list-table td:first-child h3,
  .imob-property-list-table td:first-child p {
    max-width: 100% !important;
  }

  /* A explicação extensa já aparece no cabeçalho da tela e consumia largura. */
  .imob-property-list-table td:nth-child(2) > p {
    display: none;
  }

  .imob-property-list-table td:nth-child(3) label {
    gap: 0.35rem !important;
    padding-left: 0.55rem !important;
    padding-right: 0.55rem !important;
  }

  .imob-property-list-table td:nth-child(4) > div {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.3rem !important;
  }

  .imob-property-list-table td:nth-child(5) select {
    min-width: 0 !important;
    padding-left: 0.45rem !important;
    padding-right: 1.25rem !important;
  }

  /*
   * A coluna de ações fica sempre visível e os dois comandos permanecem
   * horizontais. O fundo e a sombra evitam que ela se confunda com a coluna
   * anterior quando houver uma largura excepcionalmente pequena.
   */
  .imob-property-list-table th:last-child,
  .imob-property-list-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
    min-width: 0 !important;
    background: #fff;
    box-shadow: -8px 0 14px -14px rgba(15, 23, 42, 0.55);
  }

  .imob-property-list-table th:last-child {
    z-index: 3;
    background: #f8fafc;
  }

  .imob-property-list-table tr:hover td:last-child {
    background: #f8fafc;
  }

  .imob-property-list-actions {
    display: flex !important;
    width: 100%;
    flex-direction: row !important;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0.35rem !important;
  }

  .imob-property-list-actions button {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 0;
    white-space: nowrap;
    overflow-wrap: normal !important;
    padding: 0.52rem 0.35rem !important;
    font-size: 0.67rem !important;
    line-height: 1 !important;
  }

  .imob-property-list-actions .imob-action-edit {
    border-color: #0f172a !important;
    background: #0f172a !important;
    color: #fff !important;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.18);
  }

  .imob-property-list-actions .imob-action-edit:hover {
    background: #1e293b !important;
  }

  .imob-property-list-actions .imob-action-delete {
    background: #fff !important;
  }
}

.imob-property-gallery-trigger {
  cursor: zoom-in;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.imob-property-gallery-trigger:hover,
.imob-property-gallery-trigger:focus-visible {
  transform: scale(1.035);
  filter: brightness(1.04);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.16);
  outline: none;
}

.imob-gallery-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(6px);
}

.imob-gallery-backdrop[hidden] {
  display: none;
}

.imob-gallery-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, 96vw);
  height: min(820px, 94vh);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1rem;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.imob-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.imob-gallery-heading {
  min-width: 0;
}

.imob-gallery-code {
  color: #94a3b8;
  font: 700 0.72rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.imob-gallery-title {
  margin-top: 0.2rem;
  overflow: hidden;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.imob-gallery-location {
  margin-top: 0.15rem;
  color: #94a3b8;
  font-size: 0.75rem;
}

.imob-gallery-header-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
}

.imob-gallery-edit,
.imob-gallery-close,
.imob-gallery-nav {
  border: 0;
  color: #fff;
  cursor: pointer;
}

.imob-gallery-edit {
  display: inline-flex;
  min-height: 2.35rem;
  align-items: center;
  border-radius: 0.65rem;
  background: #fff;
  padding: 0.55rem 0.85rem;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 800;
  text-decoration: none;
}

.imob-gallery-close {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.45rem;
}

.imob-gallery-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: #020617;
}

.imob-gallery-main-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.imob-gallery-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: #cbd5e1;
  text-align: center;
}

.imob-gallery-nav {
  position: absolute;
  top: 50%;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  font-size: 1.75rem;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3);
}

.imob-gallery-nav:hover {
  background: rgba(30, 41, 59, 0.95);
}

.imob-gallery-prev { left: 1rem; }
.imob-gallery-next { right: 1rem; }

.imob-gallery-counter {
  position: absolute;
  right: 1rem;
  bottom: 0.8rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.76);
  padding: 0.4rem 0.7rem;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.imob-gallery-thumbnails {
  display: flex;
  min-height: 5.4rem;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.7rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: #0f172a;
  scrollbar-width: thin;
}

.imob-gallery-thumb {
  width: 5.5rem;
  height: 4rem;
  flex: 0 0 5.5rem;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 0.55rem;
  background: #1e293b;
  padding: 0;
  cursor: pointer;
}

.imob-gallery-thumb[aria-current="true"] {
  border-color: #fff;
  box-shadow: 0 0 0 2px #0f172a, 0 0 0 4px #38bdf8;
}

.imob-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 640px) {
  .imob-gallery-backdrop {
    padding: 0;
  }

  .imob-gallery-dialog {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .imob-gallery-header {
    padding: 0.75rem;
  }

  .imob-gallery-title {
    max-width: 56vw;
    font-size: 0.9rem;
  }

  .imob-gallery-edit {
    display: none;
  }

  .imob-gallery-nav {
    width: 2.65rem;
    height: 2.65rem;
  }

  .imob-gallery-prev { left: 0.55rem; }
  .imob-gallery-next { right: 0.55rem; }
}
