/* =========================================================
   MODALS (estate/location/mobile) — updated with your colors
   Blue: #318fe3
   Gray: #a3a3a3
========================================================= */

/* 🧱 z-index for all modals */
.modal {
  z-index: 1070 !important;
}

/* ================================
   📐 Base scaling for Estate Modals
================================= */
#estateModal.estate-modal,
#estateModalNew.estate-modal {
  --base-w: 1300px;
  --base-h: 820px;

  --gutter: 16px;

  --fit-w: calc(100vw - var(--gutter));
  --fit-h: calc(100vh - var(--gutter));

  --sx: calc(var(--fit-w) / var(--base-w));
  --sy: calc(var(--fit-h) / var(--base-h));

  --scale: min(var(--sx), var(--sy), 1);
}

/* center + scale */
#estateModal .estate-modal-dialog,
#estateModalNew .estate-modal-dialog {
  width: var(--base-w);
  height: var(--base-h);
  max-width: none;

  position: fixed;
  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%) scale(var(--scale));
  transform-origin: center center;

  margin: 0 !important;
}

/* base content box (scale applies on container) */
#estateModal .estate-modal-content,
#estateModalNew .estate-modal-content {
  width: var(--base-w);
  height: var(--base-h);
  overflow: hidden;
  position: relative;
}

/* topbar */
#estateModal .estate-topbar,
#estateModalNew .estate-topbar {
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: 0.5rem 1rem;

  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  z-index: 10;

  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: row-reverse;
}

/* body */
#estateModal .estate-body,
#estateModalNew .estate-body {
  padding-top: 3rem;
  height: calc(100% - 3rem);
  overflow: hidden;

  display: flex;
  justify-content: space-evenly;
  align-items: center;
  flex-direction: column;
}

/* footer */
#estateModal .estate-footer,
#estateModalNew .estate-footer {
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  padding: 0.5rem 1rem;
}

/* prevent background scroll */
body.modal-open {
  overflow: hidden;
}

/* RTL modal header */
.modal-header {
  direction: rtl;
  display: flex !important;
  align-items: center !important;
}

/* move close button left in RTL */
.modal-header .btn-close {
  margin-right: auto !important;
  margin-left: 0 !important;
}

/* rows that should match the modal scaling */
.estate-row-fixed {
  width: calc(var(--base-w) * var(--scale));
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.estate-row-fixed .estate-row-inner {
  width: var(--base-w);
  transform: scale(var(--scale));
  transform-origin: top center;
  display: flex;
  gap: 0.5rem;
}

/* compact table */
.compact-table th,
.compact-table td {
  padding: 0.15rem 0.3rem;
  font-size: 0.8rem;
  height: 28px;
  vertical-align: middle;
  line-height: 1.2;
}

.compact-table input.form-control-sm,
.compact-table select.form-select-sm {
  height: 100% !important;
  min-height: 26px;
  font-size: 0.8rem;
  padding: 0;
  text-align: center;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* features row */
.estate-features-row .chk {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* highlight bg */
.yelloInputBg {
  background-color: rgba(203, 203, 25, 0.809) !important;
}

/* invalid */
.is-invalid {
  border: 1px solid red !important;
  background-color: transparent !important;
}

/* input highlight */
.input-highlight {
  background-color: rgba(255, 255, 0, 0.166) !important;
  transition: background-color 0.2s ease;
}

/* remove select arrow */
select.no-arrow {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
  background-color: transparent;
}

select.no-arrow.form-select {
  padding-right: 0.5rem;
}

select.no-arrow::-ms-expand {
  display: none;
}

/* =========================================================
   Custom buttons (UPDATED BLUE)
========================================================= */
.btn-custom {
  background-color: #318fe3;
  color: #fff;
  border: none;
}

.btn-custom:hover {
  background-color: #2779bd;
}

/* focus state */
.btn-custom:focus,
.btn-custom:focus-visible,
.btn-custom:active:focus {
  background-color: #ffe083 !important;
  border-color: #ffd44f !important;
  box-shadow: none !important;
  color: #000 !important;
}

/* saveBtn focus glow (keep same glow but use your blue) */
#saveBtn:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(49, 143, 227, 0.5);
  transform: scale(1.03);
  transition: 0.15s ease;
}

/* =========================================================
   Location Modal (UPDATED BLUE/GRAY)
========================================================= */
#locationModal {
  direction: rtl;
  text-align: right;
}

#locationModal .btn-close {
  margin-left: 0;
  margin-right: auto;
}

#locationModal .modal-body {
  text-align: right;
}

#locationModal ul.list-group {
  padding-right: 0;
  border: 1px solid #a3a3a3;
  border-radius: 5px;
  overflow: hidden;
}

#locationModal .list-group-item {
  background-color: #fff !important;
  color: #333 !important;
  border: none !important;
  text-align: right;
  cursor: pointer;
  padding: 10px 12px;
  transition: 0.2s ease !important;
}

#locationModal .list-group-item:hover {
  color: #318fe3 !important;
}

#locationModal .list-group-item.active,
#locationModal .list-group-item:active,
#locationModal .list-group-item:focus {
  color: #2779bd !important;
}

#locationModal .list-group-item + .list-group-item {
  border-top: 1px solid #e5e5e5 !important;
}

#locationModal .modal-footer {
  direction: rtl;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* prev */
#locationModal #btn-prev {
  border-color: #2779bd !important;
  color: #2779bd !important;
}
#locationModal #btn-prev:hover {
  background-color: #2779bd !important;
  color: #fff !important;
}

/* next */
#locationModal #btn-next {
  background-color: #318fe3 !important;
  border-color: #318fe3 !important;
  color: #fff !important;
}
#locationModal #btn-next:hover {
  background-color: #2779bd !important;
  border-color: #2779bd !important;
}

/* =========================================================
   Mobile Modal (UPDATED BLUE/GRAY)
========================================================= */
#mobileModal .btn-close {
  filter: brightness(0.8);
}
#mobileModal .btn-close:hover {
  filter: brightness(0.4);
}

#mobileModal .invalid-feedback {
  color: #d9534f;
}

/* primary save */
#mobileModal #saveMobile {
  background-color: #318fe3;
  border-color: #318fe3;
  color: #fff;
  transition: 0.2s;
}
#mobileModal #saveMobile:hover {
  background-color: #2779bd;
  border-color: #2779bd;
}

/* secondary (gray) */
#mobileModal .btn-secondary {
  background-color: #a3a3a3;
  border-color: #a3a3a3;
  color: #fff;
}
#mobileModal .btn-secondary:hover {
  background-color: #8c8c8c;
  border-color: #8c8c8c;
}
