/*
 * Estates7 form fields — premium look, labels ABOVE the fields.
 * Labels never sit inside a field, so nothing can overlap — whether a value is typed, filled by
 * the browser, copied by "Same as phone number", or the field is locked.
 *   1. Fields: white, rounded, violet focus glow.
 *   2. Prefix (+91) inside the same field with a thin divider (pure CSS).
 *   3. Dropdowns open a picker sheet (bottom sheet on phones) — fields.js.
 *   4. Custom checkboxes with an animated tick.
 * Everything is styled by this file alone, so the page looks final from its first paint.
 */
:root {
  --fx-line: #e6e2f1;           /* field border at rest */
  --fx-line-hover: #cfc4f6;
  --fx-violet: #7a5cf0;         /* focus colour (same as the main button) */
  --fx-violet-ink: #5536c9;
  --fx-ring: rgba(122, 92, 240, .14);
  --fx-ink: #1b1930;
  --fx-label: #4a4560;
  --fx-off: #f5f4f9;            /* locked / read-only fields */
  --fx-bad: #e0475a;
  --fx-h: 52px;                 /* field height */
}

/* ---------- 1. Fields ---------- */
.form-label { font-size: 13.5px; font-weight: 600; color: var(--fx-label); margin-bottom: 7px; }
.form-label .text-danger { color: var(--fx-violet) !important; }
.form-label .small, .form-label .text-muted { font-weight: 400; color: #716C86 !important; font-size: 0.8rem; }

.form-control, .form-select {
  min-height: var(--fx-h);
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 500;
  color: var(--fx-ink);
  background-color: #fff;
  border: 1px solid var(--fx-line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(27, 25, 48, .04);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
textarea.form-control { min-height: 110px; line-height: 1.5; resize: vertical; }
.form-control::placeholder { color: #716C86; font-weight: 400; opacity: 1; }   /* 5.0:1 */
.form-control:hover:not(:disabled):not([readonly]), .form-select:hover:not(:disabled) { border-color: var(--fx-line-hover); }
.form-control:focus, .form-select:focus { border-color: var(--fx-violet); box-shadow: 0 0 0 4px var(--fx-ring); outline: 0; }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background: var(--fx-off); color: #6f6a85; border-color: transparent; box-shadow: none; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--fx-bad); background-image: none; padding-right: 16px; }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 4px rgba(224, 71, 90, .12); }
.invalid-feedback { font-size: 13px; font-weight: 500; color: var(--fx-bad); padding-left: 2px; margin-top: 6px; }

/* Small fields in admin filters keep a compact size */
.form-control-sm, .form-select-sm { min-height: 40px; padding: 8px 12px; font-size: 14px; border-radius: 12px; }

/* Dropdowns: the plain <select> already looks exactly like the picker button fields.js puts in
   its place (same box, same round violet arrow), so nothing changes visually when it swaps. */
.form-select:not(.form-select-sm):not([multiple]) {
  padding-right: 52px; cursor: pointer;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%237a5cf0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    radial-gradient(circle, #f3effe 0 11px, transparent 11.5px);
  background-repeat: no-repeat, no-repeat;
  background-position: right 21px center, right 16px center;
  background-size: 12px 12px, 22px 22px;
}
.form-select:has(option[value=""]:checked) { color: #716C86; font-weight: 400; }   /* "Choose…" hint, same as the picker */
.form-select-sm {
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%237a5cf0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
}

/* ---------- 2. Prefix (+91) inside the field — pure CSS, correct from the first paint ---------- */
.input-group-text { border-color: var(--fx-line); background: #f6f3fe; color: var(--fx-violet-ink); font-weight: 600; border-radius: 14px; }
.input-group:not(.input-group-sm):has(> .input-group-text) {
  position: relative; flex-wrap: nowrap; background: #fff;
  border: 1px solid var(--fx-line); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(27, 25, 48, .04);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.input-group:not(.input-group-sm):has(> .input-group-text):hover { border-color: var(--fx-line-hover); }
.input-group:not(.input-group-sm):has(> .input-group-text):focus-within { border-color: var(--fx-violet); box-shadow: 0 0 0 4px var(--fx-ring); }
.input-group:not(.input-group-sm):has(> .is-invalid) { border-color: var(--fx-bad); margin-bottom: 26px; }
.input-group:not(.input-group-sm):has(> .form-control:disabled),
.input-group:not(.input-group-sm):has(> .form-control[readonly]) { background: var(--fx-off); border-color: transparent; box-shadow: none; }
.input-group:not(.input-group-sm):has(> .input-group-text) > .input-group-text {
  position: relative; min-height: calc(var(--fx-h) - 2px); padding: 0 12px 0 16px;
  background: none; border: 0; font-size: 16px; color: var(--fx-violet-ink);
}
.input-group:not(.input-group-sm):has(> .input-group-text) > .input-group-text::after { content: ""; position: absolute; right: 0; top: 14px; bottom: 14px; width: 1px; background: var(--fx-line); }
.input-group:not(.input-group-sm):has(> .input-group-text) > .form-control {
  min-height: calc(var(--fx-h) - 2px); padding-left: 12px; margin-left: 0 !important;
  border: 0 !important; box-shadow: none !important; background: none; border-radius: 0 14px 14px 0 !important;
}
/* Error text sits just below the rounded box */
.input-group:not(.input-group-sm):has(> .input-group-text) > .invalid-feedback { position: absolute; left: 0; top: calc(100% + 6px); margin: 0; }

/* ---------- 3. Picker (dropdown replacement made by fields.js) ---------- */
.fx-native { position: absolute !important; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.fx-pick {
  position: relative; display: flex; align-items: center; width: 100%;
  min-height: var(--fx-h); padding: 13px 52px 13px 16px;
  font: inherit; font-size: 16px; font-weight: 500; color: var(--fx-ink); text-align: left;
  background: #fff; border: 1px solid var(--fx-line); border-radius: 14px; cursor: pointer; box-shadow: 0 1px 2px rgba(27, 25, 48, .04);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.fx-pick:hover { border-color: var(--fx-line-hover); }
.fx-pick:focus-visible, .fx-pick[aria-expanded="true"] { border-color: var(--fx-violet); box-shadow: 0 0 0 4px var(--fx-ring); outline: 0; }
.fx-pick.is-invalid { border-color: var(--fx-bad); }
.fx-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-pick.is-empty span { color: #716C86; font-weight: 400; }   /* "Choose…" hint */
.fx-pick::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 22px; height: 22px; margin-top: -11px;
  border-radius: 50%; background: #f3effe url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%237a5cf0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat;
  transition: transform .2s ease;
}
.fx-pick[aria-expanded="true"]::after { transform: rotate(180deg); }
.fx-pick:disabled { background: var(--fx-off); cursor: default; }

/* Sheet: slides up from the bottom on phones, a centred card on larger screens */
.fx-sheet-bg { position: fixed; inset: 0; z-index: 1080; background: rgba(20, 16, 40, .38); opacity: 0; transition: opacity .22s ease; }
.fx-sheet {
  position: fixed; z-index: 1081; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; max-height: min(78vh, 620px);
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px rgba(30, 20, 80, .18);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.fx-sheet.show { transform: none; }
.fx-sheet-bg.show { opacity: 1; }
.fx-sheet-grip { width: 40px; height: 4px; margin: 4px auto 10px; border-radius: 4px; background: #dcd7ea; }
.fx-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 20px 10px; }
.fx-sheet-head strong { font-size: 17px; color: var(--fx-ink); }
.fx-sheet-find { margin: 0 16px 8px; }
.fx-sheet-find input { width: 100%; height: 46px; padding: 0 14px 0 40px; font: inherit; font-size: 16px; border: 0; border-radius: 14px; background: #f5f3fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239a94b3' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 13px center no-repeat; outline: 0; }
.fx-sheet-find input:focus { box-shadow: 0 0 0 2px var(--fx-violet) inset; background-color: #fff; }
.fx-sheet-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 10px; }
.fx-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 50px; padding: 12px 14px; border: 0; border-radius: 14px; background: none;
  font: inherit; font-size: 16px; color: var(--fx-ink); text-align: left; cursor: pointer;
}
.fx-opt:hover, .fx-opt:focus-visible { background: #f6f3fe; outline: 0; }
.fx-opt[aria-selected="true"] { background: #f1ecfe; color: var(--fx-violet-ink); font-weight: 600; }
.fx-opt[aria-selected="true"]::after { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--fx-violet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.5l3 3 6-7' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat; }
.fx-empty { padding: 18px; text-align: center; color: var(--fx-label); }
@media (min-width: 640px) {
  .fx-sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 420px; border-radius: 22px; padding-bottom: 10px; transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform .22s ease, opacity .22s ease; }
  .fx-sheet.show { transform: translate(-50%, -50%); opacity: 1; }
  .fx-sheet-grip { display: none; }
  .fx-sheet-head { padding-top: 10px; }
}

/* ---------- 4. Checkboxes, radios, switches ---------- */
.form-check { display: flex; align-items: center; gap: 10px; padding-left: 0; min-height: 28px; }
.form-check .form-check-input { float: none; margin: 0; flex: none; }
.form-check-input[type="checkbox"]:not([role="switch"]) {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid #cdc6e2; background-color: #fff;
  cursor: pointer; transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.form-check-input[type="checkbox"]:not([role="switch"]):checked {
  background-color: var(--fx-violet); border-color: var(--fx-violet);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.5l3 3 6-7' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 14px; animation: fx-tick .22s ease;
}
.form-check-input[type="radio"] { width: 22px; height: 22px; border: 1.5px solid #cdc6e2; cursor: pointer; }
.form-check-input[type="radio"]:checked { background-color: #fff; border: 7px solid var(--fx-violet); background-image: none; }
.form-switch .form-check-input { width: 44px; height: 26px; border: 0; background-color: #e3dfee; cursor: pointer; }
.form-switch .form-check-input:checked { background-color: var(--fx-violet); }
.form-check-input:focus { box-shadow: 0 0 0 4px var(--fx-ring); border-color: var(--fx-violet); }
.form-check-label { cursor: pointer; font-size: 14.5px; color: #3e3955; }
@keyframes fx-tick { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* ---------- Menus opened from a button ---------- */
.dropdown-menu { padding: 6px; border: 1px solid #ece8f6; border-radius: 16px; box-shadow: 0 18px 40px -12px rgba(45, 30, 110, .22); }
.dropdown-item { border-radius: 10px; padding: 10px 12px; }
.dropdown-item:hover, .dropdown-item:focus { background: #f3effe; color: var(--fx-violet-ink); }
.dropdown-item.active, .dropdown-item:active { background: var(--fx-violet); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .fx-sheet, .fx-sheet-bg, .form-control, .fx-pick { transition: none; }
  .form-check-input:checked { animation: none; }
}

/* Plain dropdown and picker button share one exact height, so the swap is invisible */
.form-select:not(.form-select-sm):not([multiple]), .fx-pick { height: var(--fx-h); }

/* The website's own popup (E7Dialog in forms.js) — replaces the browser's alert / confirm boxes.
   Desktop: centred card. Phone: sheet from the bottom with full-width buttons. */
.e7-dialog { width: min(440px, calc(100% - 32px)); padding: 22px 22px 18px; border: 0; border-radius: 16px; background: #fff; color: #171a2b;
  box-shadow: 0 24px 60px rgba(20, 16, 40, .22); }
.e7-dialog::backdrop { background: rgba(20, 16, 40, .45); }
.e7-dialog h2 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.e7-dialog p { margin: 0 0 18px; font-size: 14.5px; line-height: 1.5; color: #4a4f63; }
.e7-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.e7-dialog-actions .btn { min-width: 96px; min-height: 42px; }
@media (max-width: 575.98px) {
  .e7-dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .e7-dialog-actions { flex-direction: column-reverse; }
  .e7-dialog-actions .btn { width: 100%; }
}
