/* --- Rental Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal-panel {
  background: #0a0e1a;
  border: 1px solid #1a2540;
  border-radius: 8px;
  width: 100%;
  max-width: min(80vw, 700px);
  max-height: 90vh;
  overflow-y: auto;
  color: #c8dae8;
  font-family: inherit;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #1a2540;
  font-weight: 700;
  font-size: 0.95rem;
}
.modal-header button {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}
.modal-header button:hover { color: #fff; }

.modal-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-row {
  display: flex;
  gap: 10px;
}
.modal-row .modal-field { flex: 1; }

.modal-row-top { align-items: flex-end; }

.modal-field label {
  display: block;
  font-size: 0.72rem;
  color: #666;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-row-dates { display: flex; gap: 10px; }
.modal-row-dates > .modal-field { flex: 1; }
.modal-row-sgp { display: flex; gap: 10px; }
.modal-row-sgp > .modal-field-status { flex: 2 1 0; min-width: 0; }
.modal-row-sgp > .modal-field { flex: 1 1 0; min-width: 0; }

.modal-split { display: flex; gap: 16px; }
.modal-split-left { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.modal-split-right { flex: 1; display: flex; align-items: flex-start; }
.modal-row-mgr { display: flex; gap: 10px; align-items: flex-end; }

/* Villa selector buttons */
.villa-btn-group { display: flex; gap: 3px; }
.villa-btn {
  flex: 1;
  padding: 6px 2px;
  border: 1px solid #1a2540;
  border-radius: 4px;
  color: #888;
  background: #111828;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}
.villa-btn.active { color: #fff; }
.villa-btn-1.active { background: #1870c0; border-color: #1870c0; }
.villa-btn-2.active { background: #a07020; border-color: #a07020; }
.villa-btn-3.active { background: #18a868; border-color: #18a868; }
.villa-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.villa-btn:not(.active):not(:disabled):hover { color: #c8dae8; }

/* Renter picker */
.renter-picker { position: relative; }
.renter-picker input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  background: #111828;
  border: 1px solid #1a2540;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 0.85rem;
  font-family: inherit;
  box-sizing: border-box;
}
.renter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 180px;
  overflow-y: auto;
  background: #111828;
  border: 1px solid #1a2540;
  border-radius: 0 0 4px 4px;
  z-index: 210;
}
.renter-dropdown.hidden { display: none; }
.renter-opt { padding: 5px 8px; cursor: pointer; font-size: 0.85rem; }
.renter-opt:hover, .renter-opt.highlighted { background: #1a2540; }
.renter-opt-new { color: #20d4f4; border-top: 1px solid #1a2540; font-style: italic; }

.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%;
  padding: 6px 8px;
  background: #111828;
  border: 1px solid #1a2540;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 0.85rem;
  font-family: inherit;
  color-scheme: dark;
  box-sizing: border-box;
}
.modal-field textarea { resize: vertical; }

.modal-footer {
  padding: 10px 16px;
  border-top: 1px solid #1a2540;
  text-align: right;
}

.modal-btn {
  padding: 7px 16px;
  border-radius: 4px;
  border: 1px solid #1a2540;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.modal-btn-save { background: #1870c0; color: #fff; border-color: #1870c0; }
.modal-btn-save:hover:not(:disabled) { background: #2090e0; }
.modal-btn-save:disabled { background: #333; color: #666; border-color: #333; cursor: not-allowed; }

/* Mobile */
@media (max-width: 600px) {
  .modal-panel { max-width: 100%; border-radius: 0; max-height: 100dvh; height: 100dvh; padding-top: env(safe-area-inset-top); }
  .modal-row { flex-direction: column; gap: 10px; }
  /* Dates: always side by side */
  .modal-row-dates { flex-direction: row !important; }
  /* Status/Guests/Platform: always side by side */
  .modal-row-sgp { flex-direction: row !important; gap: 6px; }
  /* Manager/Renter: side by side */
  .modal-row-mgr { flex-direction: row !important; }
  /* Stack split vertically on mobile */
  .modal-split { flex-direction: column; }
  .modal-split-right { order: 1; }
  /* Hide obvious labels on mobile */
  .mobile-hide-label label { display: none; }
  /* Sizing */
  .modal-btn { padding: 12px 16px; font-size: 1rem; }
  .villa-btn { padding: 10px 0; font-size: 1rem; }
  .modal-field input, .modal-field select { padding: 10px; font-size: 1rem; }
}
