/* iSOLD internal search - v6.4 (white top bar with the iSOLD logo, Comfortaa, row checkboxes,
   grouped reports, two-line column titles, centred numbers) - earlier notes below still apply.
   v6.1:
   Styled after the CRM: blue top bar, white cards on light grey, purple-to-blue section bars,
   blue / green / red buttons, chip-style checkboxes. Fluid width (fills the screen), two filter
   rows, wide Title column, and a phone layout below 720 px where each grid row becomes a card. */

:root {
    --blue: #2f6fe0;
    --blue-dark: #2854b8;
    --navy: #1b2a6b;
    --green: #2fb34a;
    --green-dark: #279a3e;
    --red: #e0473f;
    --red-dark: #c53a33;
    --bg: #f2f3f8;
    --card: #ffffff;
    --border: #d9deea;
    --text: #1f2430;
    --muted: #667085;
    --head-grad: linear-gradient(90deg, #2c1e6e 0%, #1f3f9c 100%);
    --row-alt: #f7f9fd;
    --row-hover: #eef3fd;
    --radius: 8px;
    --control-h: 34px;
    --brand-cyan: #01abe8;     /* iSOLD logo colours */
    --brand-purple: #5b2478;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: "Comfortaa", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    margin: 0; background: var(--bg); color: var(--text); font-size: 13.5px; line-height: 1.4;
    font-feature-settings: "tnum" 1, "cv11" 1;   /* tabular numbers: prices line up in the grids */
}

/* ---------- top bar ---------- */
/* v6.4: white bar with the iSOLD logo and a thin cyan -> purple line under it */
.topbar {
    background: #fff; color: var(--navy); padding: 0 20px 3px; height: 58px; position: relative; z-index: 20;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    box-shadow: 0 2px 6px rgba(20, 30, 60, .08);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--brand-cyan), var(--brand-purple)); }
.topbar .brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .brand a { display: block; line-height: 0; }
.topbar .brand img.logo { height: 38px; width: auto; display: block; }
.topbar .brand span { font-weight: 500; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .logout { color: var(--muted); text-decoration: none; font-size: 13px; white-space: nowrap; margin-left: auto; }

/* navigation (Search + Reports drop-down) */
.nav { display: flex; align-items: center; gap: 4px; margin-left: 16px; }
.nav-link { color: var(--navy); text-decoration: none; font-size: 13.5px; font-weight: 700; padding: 7px 12px; border-radius: 6px; cursor: pointer; list-style: none; white-space: nowrap; }
.nav-link:hover { background: #f1ecf6; color: var(--brand-purple); }
.nav-link.active { background: #ece3f3; color: var(--brand-purple); }
.menu { position: relative; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " \25BE"; font-size: 11px; }
.menu-list { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 30, 60, .18); padding: 6px; z-index: 50; }
.menu-group { font-size: 11px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .5px; padding: 5px 9px; margin: 6px 3px 3px; border-radius: 5px; background: #eef1f7; }
.menu-group:first-child { margin-top: 2px; }
.menu-group.g-crm { background: #e3f5e6; }   /* v6.4: one light colour per report section */
.menu-group.g-olx { background: #fdeede; }
.menu-group.g-fb  { background: #e2f0fb; }
.menu-list a { display: block; color: var(--text); text-decoration: none; font-size: 13.5px; padding: 7px 10px; border-radius: 6px; }
.menu-list a:hover { background: var(--row-hover); color: var(--blue-dark); }
.menu-list a.active { background: #e8effc; color: var(--blue-dark); font-weight: 600; }
.topbar .logout:hover { color: var(--navy); text-decoration: underline; }

/* ---------- page: fluid, fills the screen ---------- */
.page { width: 100%; margin: 0; padding: 16px 20px 32px; }

/* ---------- cards with a gradient header (CRM "Search Criteria" / "Properties" bars) ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 4px rgba(20, 30, 60, .08); margin-bottom: 16px; overflow: hidden; }
.card-head {
    background: var(--head-grad); color: #fff; font-weight: 600; font-size: 14px; padding: 9px 14px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.card-head .src { font-weight: 400; font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body { padding: 14px; }

/* "Search in" segmented control (RadioButtonList rendered as input + label pairs) in the criteria bar */
.seg { display: inline-flex; align-items: center; background: rgba(255, 255, 255, .16); border-radius: 6px; padding: 2px; gap: 2px; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg label { display: inline-block; padding: 4px 12px; border-radius: 5px; font-size: 12.5px; font-weight: 600; color: #fff; opacity: .85; cursor: pointer; user-select: none; line-height: 1.3; }
.seg label:hover { opacity: 1; }
.seg input:checked + label { background: #fff; color: var(--navy); opacity: 1; }
.seg input:focus-visible + label { outline: 2px solid #fff; outline-offset: 1px; }
/* filters that only apply to one source (toggled by the small script at the bottom of Search.aspx) */
.src-olx .fb-only, .src-fb .olx-only { display: none; }
.card-body-grid { padding: 0; }

/* ---------- filters: two rows, compact fields ---------- */
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filter-row + .filter-row { margin-top: 12px; }
.filter-field { display: flex; flex-direction: column; min-width: 0; }
.filter-field label, .filter-field .lbl { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }

/* widths: lg = lists, md = short lists, num = price, sm = sqm, xs = beds, grow = keyword */
.f-lg   { flex: 1 1 160px; max-width: 250px; }
.f-md   { flex: 0 1 118px; }
.f-sort { flex: 0 1 150px; }
.f-num  { flex: 0 1 100px; }
.f-sm   { flex: 0 1 80px; }
.f-xs   { flex: 0 1 60px; }
.f-grow { flex: 2 1 220px; }
.f-auto { flex: 0 0 auto; }

/* report parameters: width follows the label, inputs keep a sane minimum / maximum */
.filter-field.rp input[type=text], .filter-field.rp select { min-width: 120px; max-width: 320px; }
.filter-field select, .filter-field input[type=text], .filter-field input[type=password] {
    width: 100%; height: var(--control-h); padding: 5px 9px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13.5px; background: #fff; color: var(--text); font-family: inherit;
}
.filter-field select { padding-right: 24px; }
.filter-field input::placeholder { color: #a3aab8; font-size: 12.5px; }
.filter-field select:focus, .filter-field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 111, 224, .15); }

/* checkbox chips */
.checks { display: flex; gap: 5px; align-items: center; height: var(--control-h); flex-wrap: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 6px; padding: 0 8px; height: var(--control-h); background: #fff; font-size: 13px; white-space: nowrap; }
.chip input { margin: 0; accent-color: var(--blue); }
.chip label { margin: 0; font-size: 13px; color: var(--text); font-weight: 500; cursor: pointer; }

/* buttons: pushed to the right of row 2 */
.filter-field-btn { flex-direction: row; align-items: flex-end; gap: 8px; margin-left: auto; }
.btn { border: none; border-radius: 6px; padding: 0 14px; height: var(--control-h); font-size: 13px; font-weight: 600; color: #fff; cursor: pointer; font-family: inherit; background: var(--blue); white-space: nowrap; }
.btn:hover { background: var(--blue-dark); }
.btn-export { background: var(--green); }
.btn-export:hover { background: var(--green-dark); }
.btn-clear { background: var(--red); }
.btn-clear:hover { background: var(--red-dark); }

/* messages */
.notice { display: block; margin-top: 10px; font-size: 13px; }
.notice-info { color: var(--muted); font-style: italic; }
.notice-error { color: var(--red-dark); font-weight: 600; word-break: break-word; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 10px; }

/* ---------- grids ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.grid th { background: #eef1f7; color: var(--navy); text-align: left; padding: 8px 10px; font-weight: 700; font-size: 12px; border-bottom: 1px solid var(--border); white-space: normal; vertical-align: bottom; line-height: 1.25; }
/* v6.4: a number column's title wraps (two lines or more) instead of widening the column */
.grid th.numh, .grid th.num { max-width: 100px; min-width: 70px; }
.grid td { padding: 8px 10px; border-bottom: 1px solid #eceff5; vertical-align: top; }
.grid tr.alt td { background: var(--row-alt); }
.grid tr:hover td { background: var(--row-hover); }
.grid a { color: var(--blue); font-weight: 600; text-decoration: none; }
.grid a:hover { text-decoration: underline; }
.grid a.tel { font-weight: 500; }
.grid td.num, .grid th.num { text-align: center; white-space: nowrap; }   /* v6.4: every number centred */
.grid td.nowrap { white-space: nowrap; }
.grid td.center, .grid th.center { text-align: center; }
.grid td.col-title { min-width: 260px; max-width: 560px; font-weight: 500; }
.grid td.col-text { min-width: 120px; }
.grid td.col-district { min-width: 150px; white-space: nowrap; }
.grid td.col-phone { min-width: 120px; }
.grid tr.pager td { background: #fafbfe; border-bottom: none; padding: 8px 10px; }
.grid tr.pager table { border-collapse: collapse; }
.grid tr.pager a, .grid tr.pager span { display: inline-block; min-width: 26px; text-align: center; padding: 3px 6px; margin-right: 2px; border-radius: 4px; }
.grid tr.pager span { background: var(--blue); color: #fff; font-weight: 600; }
.grid tr.pager a { color: var(--blue); border: 1px solid var(--border); background: #fff; }

/* ---------- sign-in ---------- */
.login-box { max-width: 360px; margin: 70px auto; background: #fff; border-radius: 10px; box-shadow: 0 2px 10px rgba(20, 30, 60, .10); padding: 28px; }
.login-box h1 { font-size: 18px; color: var(--navy); margin: 0 0 14px; }
.login-box label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.login-box input[type=password] { width: 100%; height: 38px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; margin-top: 6px; font-family: inherit; }
.login-box .remember { margin: 10px 0 0; font-size: 13px; color: var(--text); }
.login-box .remember input { margin: 0 6px 0 0; accent-color: var(--blue); vertical-align: middle; }
.login-box .remember label { font-weight: 500; font-size: 13px; color: var(--text); }
.login-box .btn { margin-top: 12px; }
.error { color: var(--red-dark); display: block; margin-bottom: 10px; font-weight: 600; }

/* ---------- report grid extras ---------- */
.grid tr.row-overdue td { background: #fff1f0; }
.grid tr.row-overdue:hover td { background: #ffe4e1; }
.grid tr:hover td { background: #e9f0fc; }

/* sortable headers */
.grid th a { color: var(--navy); text-decoration: none; display: inline-block; }
.grid th a:hover { color: var(--blue); text-decoration: underline; }
.grid th.sorted { background: #e3e9f6; }
.grid th.sorted a { color: var(--blue-dark); }
.grid th.muted a, .grid td.muted { color: #9aa3b5; }
.grid td.muted { font-size: 12px; }

/* sticky header on desktop (the wrapper clips sideways instead of scrolling, so the page scrolls) */
@media (min-width: 1101px) {
    .table-wrap { overflow-x: clip; overflow-y: visible; }
    .grid th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--border); }
}

/* merged links column */
.grid td.links { text-align: center; }
.lnk { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin: 0 2px; text-decoration: none; border: 1px solid transparent; }
.lnk-olx { color: #b3261e; background: #fdecea; border-color: #f5c6c2; }
.lnk-olx:hover { background: #f9d9d5; text-decoration: none; }
.lnk-crm { color: var(--blue-dark); background: #e8effc; border-color: #c9d8f5; }
.lnk-crm:hover { background: #d9e5fa; text-decoration: none; }
.lnk-open { color: var(--navy); background: #eef1f7; border-color: var(--border); }

/* badges */
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .2px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.b-green { color: #1b6b2f; background: #e3f5e8; }
.b-red { color: #b3261e; background: #fdecea; }
.b-grey { color: #5b6473; background: #eceff4; }
.b-blue { color: var(--blue-dark); background: #e8effc; }
.b-purple { color: #5b21b6; background: #efe7fd; }
.b-navy { color: var(--navy); background: #e6e9f4; }
.b-teal { color: #0f6e6a; background: #e0f4f2; }
.b-amber { color: #9a4b00; background: #fff1dc; }

/* v6.2 "Search 2" (SearchAll.aspx) only - classes not used by the other pages */
.grid td.col-source { min-width: 110px; }
.grid td .sub { font-size: 11px; color: var(--muted); margin-top: 3px; white-space: normal; line-height: 1.25; max-width: 180px; }
.grid td.col-contact .badge + .badge { margin-left: 3px; }
.grid td.col-contact .sub { margin-top: 4px; }
.seg-multi label { white-space: nowrap; }
.card-head:has(.seg-multi) { flex-wrap: wrap; row-gap: 6px; }

/* filter combos row */
.filters { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.filters-hint { font-size: 12px; color: var(--muted); font-style: italic; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; line-height: 30px; text-decoration: none; display: inline-block; }
.card-head .count { font-weight: 400; opacity: .85; margin-left: 6px; font-size: 13px; }
.fchip { display: inline-block; font-size: 11.5px; font-weight: 600; background: rgba(255, 255, 255, .18); border-radius: 10px; padding: 2px 9px; margin-left: 4px; }
.fchip.sort { background: rgba(255, 255, 255, .10); font-weight: 500; }

/* description clamp with a "more" toggle */
.hint.desc { max-height: 1.5em; overflow: hidden; margin-bottom: 4px; }
.hint.desc.open { max-height: none; }
a.more { font-size: 12px; color: var(--blue); text-decoration: none; display: inline-block; margin-bottom: 8px; }

/* ---------- calendar view (Report.aspx, view="calendar") ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 2px 6px; }
.cal-d { min-height: 84px; border: 1px solid var(--border); border-radius: 6px; padding: 5px 6px; background: #fff; min-width: 0; }
.cal-d.we { background: #fafbfe; }
.cal-d.out { opacity: .45; }
.cal-d.today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.cal-n { font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 4px; display: flex; justify-content: space-between; align-items: baseline; }
.cal-full { display: none; }
.cal-today { font-size: 10px; font-weight: 700; color: #fff; background: var(--blue); border-radius: 4px; padding: 1px 5px; text-transform: uppercase; }
.cal-chips { display: flex; flex-direction: column; gap: 3px; }
.chip-ev { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--navy); background: #eef1f7; border-left: 3px solid var(--blue); border-radius: 4px; padding: 3px 6px; text-decoration: none; min-width: 0; }
.chip-ev:hover { background: #e2e8f6; text-decoration: none; }
.chip-ev .tag { font-size: 10px; font-weight: 700; color: #fff; background: var(--blue); border-radius: 3px; padding: 1px 5px; white-space: nowrap; }
.chip-ev.t-olx { border-left-color: var(--red); }
.chip-ev.t-olx .tag { background: var(--red); }
.chip-ev.t-olxf { border-left-color: #7c3aed; }
.chip-ev.t-olxf .tag { background: #7c3aed; }
.chip-ev.t-olxb { border-left-color: var(--green); }
.chip-ev.t-olxb .tag { background: var(--green); }
.chip-ev.t-renewb { border-left-color: #d97706; background: #fff4e5; }   /* ad expires: relist + boost */
.chip-ev.t-renewb .tag { background: #d97706; }
.cal-overdue { border: 1px solid #f3b9b4; background: #fff1f0; border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.cal-overdue-title { font-size: 12px; font-weight: 700; color: var(--red-dark); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.cal-overdue .cal-chips { flex-direction: row; flex-wrap: wrap; }
.cal-overdue .chip-ev { background: #fff; }

/* ---------- tablets: let the lists take a full half row ---------- */
@media (max-width: 1100px) {
    .f-lg { max-width: none; }
    .filter-field-btn { margin-left: 0; flex-basis: 100%; }
}

/* ---------- phones: one column of fields, buttons full width, grid rows become cards ---------- */
@media (max-width: 720px) {
    body { font-size: 14px; }
    .topbar { padding: 0 14px; height: 48px; }
    .topbar .brand span { display: none; }
    .page { padding: 12px 12px 28px; }
    .card-body { padding: 12px; }
    .card-head .src { display: none; }

    .filter-row { gap: 8px 10px; }
    .filter-field { flex: 1 1 100% !important; max-width: none; }
    .f-num, .f-sm, .f-xs, .f-md { flex: 1 1 calc(50% - 5px) !important; }   /* pairs: min / max */
    .f-xs { flex-basis: calc(33% - 7px) !important; }
    .filter-field .checks { height: auto; flex-wrap: wrap; }
    .filter-field select, .filter-field input[type=text] { font-size: 16px; height: 40px; }  /* 16px: iOS does not zoom */
    .chip { height: 38px; font-size: 14px; }
    .filter-field-btn { flex-direction: row; flex-wrap: wrap; margin-left: 0; }
    .filter-field-btn .btn { flex: 1 1 30%; height: 40px; font-size: 14px; }

    .nav { margin-left: 8px; }
    .nav-link { padding: 6px 9px; font-size: 13px; }
    .menu-list { left: auto; right: 0; min-width: 220px; }
    .cal { display: block; }
    .cal-h { display: none; }
    .cal-d { min-height: 0; margin-bottom: 6px; }
    .cal-d.empty, .cal-d.out { display: none; }
    .cal-n { font-size: 13px; }
    .cal-short { display: none; }
    .cal-full { display: inline; }
    .table-wrap { overflow: visible; }
    .grid, .grid tr, .grid td { display: block; width: 100%; }
    .grid tr.hdr { display: none; }
    .grid tr { border: 1px solid var(--border); border-radius: var(--radius); margin: 10px 10px 0; padding: 6px 12px 8px; background: #fff; }
    .grid tr.alt td { background: transparent; }
    .grid tr:hover td { background: transparent; }
    .grid tr:last-child { margin-bottom: 10px; }
    .grid td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; border-bottom: 1px dotted #e6e9f0; text-align: right; min-width: 0; }
    .grid td:last-child { border-bottom: none; }
    .grid td::before { content: attr(data-label); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: left; flex: 0 0 38%; }
    .grid td.col-title { display: block; text-align: left; font-size: 15px; font-weight: 600; min-width: 0; width: auto; padding: 4px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
    .grid td.col-title::before { display: none; }
    .grid td.num { text-align: right; }
    .grid td.center { text-align: right; }
    .grid td.links { text-align: right; }
    .filters .filter-field { flex: 1 1 100% !important; }
    .grid a.tel { font-size: 15px; }
    .grid tr.pager { border: none; padding: 0; margin: 10px; }
    .grid tr.pager td { display: block; text-align: center; padding: 6px 0; }
    .grid tr.pager td::before { display: none; }
    .grid tr.pager table { display: table; width: auto; margin: 0 auto; }
    .grid tr.pager table tr { display: table-row; border: none; margin: 0; padding: 0; }
    .grid tr.pager table td { display: table-cell; width: auto; border: none; padding: 2px; }
    .grid td.empty { display: none; }   /* no "Beds:" line when the listing has no value */
}

/* ---------- v6.4 ---------- */
/* toggle parameter (e.g. Sale | Rent) on a white card: the segmented control, light version */
.seg.seg-light { background: #eef1f7; height: var(--control-h); padding: 3px; border: 1px solid var(--border); }
.seg.seg-light label { color: var(--navy); opacity: 1; padding: 5px 16px; font-size: 13px; }
.seg.seg-light label:hover { background: #e2e7f2; }
.seg.seg-light input:checked + label { background: var(--blue); color: #fff; }
.seg.seg-light input:focus-visible + label { outline: 2px solid var(--blue); }

/* row checkboxes + "n rows selected" next to Export */
.grid th.sel, .grid td.sel { width: 30px; text-align: center; padding-left: 10px; padding-right: 4px; }
.grid input.row-sel, .grid input.row-sel-all { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: var(--brand-purple); vertical-align: middle; }
.grid tr.row-ticked td { background: #f6f0fb; }
.sel-count { align-self: center; font-size: 12.5px; font-weight: 700; color: var(--brand-purple); white-space: nowrap; }
.sel-count:empty { display: none; }

/* grouped reports: one title row per block (agent), the rows beyond the first ones folded */
.grid tr.grp-head td { background: #f3eef8; border-top: 2px solid #ddd0ea; border-bottom: 1px solid #e6dcf0; padding: 7px 10px; }
.grid tr.grp-head:hover td { background: #f3eef8; }
.grid td.grp-cell { display: table-cell; }
.grp-name { font-weight: 700; color: var(--brand-purple); font-size: 13.5px; }
.grp-count { margin-left: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.grp-toggle { margin-left: 12px; border: 1px solid #cdb9e0; background: #fff; color: var(--brand-purple); border-radius: 12px; padding: 2px 10px; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.grp-toggle:hover { background: #ece3f3; }
.grid tr.grp-more { display: none; }
.grid tr.grp-more.show { display: table-row; }

@media (max-width: 720px) {
    .topbar { height: 52px; }
    .topbar .brand img.logo { height: 30px; }
    .grid td.sel { justify-content: flex-start; }
    .grid tr.grp-head { background: #f3eef8; border-color: #ddd0ea; }
    .grid tr.grp-head td { display: block; text-align: left; border: none; }
    .grid tr.grp-head td::before { display: none; }
    .grid tr.grp-more.show { display: block; }
}

