/*
 * rePrecinct listing widgets on the Perth theme (listing pages, search, filter, single listing, enquiry).
 *
 * The plugin is written for a neutral theme and its colours (Gorman's teal) are fixed in its own CSS, while the
 * Perth theme styles bare <button>, <select>, <label> and inputs for its own forms. This file does three things:
 *   1. takes the theme's element styles off the plugin's controls  (:where() keeps specificity at theme level)
 *   2. gives every control one set of dimensions, border, radius, focus and motion
 *   3. swaps the plugin's colours for Perth's: navy #102330, blue #00a3da, darker blue #0090c1, line #c3ccd2
 * Colours that the Elementor widgets expose (search button, badges...) are set in tools/build_listing_pages.py instead.
 */
:root {
	--pcp-navy: #102330;
	--pcp-blue: #00a3da;
	--pcp-blue-dark: #0090c1;
	--pcp-blue-soft: #e5f6fc;
	--pcp-line: #c3ccd2;
	--pcp-control-h: 48px;
	--pcp-radius: 4px;
	--pcp-ease: .18s ease;
}

/* ---------- 1. theme element styles off the plugin's controls ---------- */
:where([class*="rpl-"]) button {
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	line-height: inherit;
	margin: 0;
	padding: 0;
	text-align: inherit;
	transform: none;
	transition: none;
	max-width: none;
}
:where([class*="rpl-"]) button:hover,
:where([class*="rpl-"]) button:focus {
	background: none;
	border: 0;
	box-shadow: none;
	transform: none;
}
:where([class*="rpl-"]) select {
	width: auto;
	display: inline-block;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	font: inherit;
	background-color: transparent;
}
[class*="rpl-"] select {
	color: inherit !important;
	background-image: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}
:where([class*="rpl-"]) label {
	display: inline;
	margin: 0;
	font-size: inherit;
}
:where([class*="rpl-"]) :is(h2, h3, h4) {
	letter-spacing: normal;
	text-transform: none;
}
/* the theme draws inputs with its own border and grey text; the plugin's inputs get one look */
[class*="rpl-"] :is(input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="tel"], select, textarea) {
	box-shadow: none;
	max-width: 100%;
	font-family: inherit;
	color: var(--pcp-navy) !important;
}
[class*="rpl-"] ::placeholder { color: #6f7f8a; opacity: 1; font-weight: 400; }

/* keyboard focus, same everywhere; mouse clicks do not draw a ring */
[class*="rpl-"] :is(a, button, input, select, textarea, summary):focus { outline: none; }
[class*="rpl-"] :is(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--pcp-blue);
	outline-offset: 2px;
}

/* ---------- 2. search bar, filter and sort (listing + search pages) ---------- */
.pcp-elementor-page .rpl-sbar { gap: 12px; align-items: stretch; }
.pcp-elementor-page .rpl-sbar__input {
	min-height: var(--pcp-control-h);
	box-sizing: border-box;
	display: flex;
	align-items: center;
	background: #fff;
	border: 1px solid var(--pcp-line) !important;
	border-radius: var(--pcp-radius) !important;
	transition: border-color var(--pcp-ease), box-shadow var(--pcp-ease);
}
.pcp-elementor-page .rpl-sbar__input:hover { border-color: #9fb0ba !important; }
.pcp-elementor-page .rpl-sbar__input:focus-within {
	border-color: var(--pcp-blue) !important;
	box-shadow: 0 0 0 3px rgba(0, 163, 218, .16);
}
/* the typing field sits inside that box: no second border */
.pcp-elementor-page .rpl-sbar__suburb-input {
	flex: 1;
	min-width: 80px;
	height: calc(var(--pcp-control-h) - 2px) !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	padding: 0 14px 0 38px !important;
	margin: 0 !important;
	font-size: 15px !important;
	outline: 0 !important;
	box-shadow: none !important;
}
.pcp-elementor-page .rpl-sbar__chips:not(:empty) + .rpl-sbar__suburb-input { padding-left: 8px !important; }
.pcp-elementor-page .rpl-sbar__submit,
.pcp-elementor-page .rpl-sr__filterbtn,
.pcp-elementor-page .rpl-sr__sort {
	box-sizing: border-box;
	height: var(--pcp-control-h) !important;
	min-height: var(--pcp-control-h);
	padding: 0 20px !important;
	border-radius: var(--pcp-radius) !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 15px;
	line-height: 1;
	white-space: nowrap;
	transition: background-color var(--pcp-ease), border-color var(--pcp-ease), color var(--pcp-ease), box-shadow var(--pcp-ease);
}
.pcp-elementor-page .rpl-sbar__submit { padding: 0 28px !important; font-weight: 600; letter-spacing: .02em; }
.pcp-elementor-page .rpl-sbar__submit:hover { box-shadow: 0 4px 12px rgba(0, 163, 218, .3); }
.pcp-elementor-page .rpl-sr__filterbtn,
.pcp-elementor-page .rpl-sr__sort {
	border: 1px solid var(--pcp-line) !important;
	background: #fff;
	color: var(--pcp-navy);
	font-weight: 500;
	cursor: pointer;
}
.pcp-elementor-page .rpl-sr__filterbtn:hover,
.pcp-elementor-page .rpl-sr__sort:hover { border-color: var(--pcp-blue) !important; }
.pcp-elementor-page .rpl-sr__filterbtn .rpl-sr__ico,
.pcp-elementor-page .rpl-sr__sort .rpl-sr__sort-ico { color: var(--pcp-blue); }
.pcp-elementor-page .rpl-sr__sort select { height: 100%; padding-right: 4px; font-size: 15px; font-weight: 500; }
.pcp-elementor-page .rpl-sr__actions { gap: 12px; }
.pcp-elementor-page .rpl-sr__head { margin: 6px 0 18px; }

/* ---------- result cards ---------- */
.pcp-elementor-page .rpl-res__card { transition: transform var(--pcp-ease), box-shadow var(--pcp-ease); }
.pcp-elementor-page .rpl-res__thumb { border-radius: var(--pcp-radius); }
.pcp-elementor-page .rpl-res__thumb img { transition: transform .45s ease; }
.pcp-elementor-page .rpl-res__card:hover .rpl-res__thumb img { transform: scale(1.035); }
.pcp-elementor-page .rpl-res__body { padding-top: 12px; }
.pcp-elementor-page .rpl-res__type { margin: 0 0 4px; letter-spacing: .06em; }
.pcp-elementor-page .rpl-res__title {
	margin: 0 0 8px !important;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35 !important;
}
.pcp-elementor-page .rpl-res__title a { color: var(--pcp-navy); text-decoration: none; transition: color var(--pcp-ease); }
.pcp-elementor-page .rpl-res__card:hover .rpl-res__title a { color: var(--pcp-blue-dark); }
.pcp-elementor-page .rpl-res__price { margin: 0 0 2px; line-height: 1.4; }
.pcp-elementor-page .rpl-res__badge { line-height: 1; padding: 6px 8px; letter-spacing: .04em; }
.pcp-elementor-page .rpl-loadmore__btn {
	height: var(--pcp-control-h);
	padding: 0 32px;
	border-radius: var(--pcp-radius);
	font-weight: 600;
	background: var(--pcp-blue);
	color: #fff;
	transition: background-color var(--pcp-ease), box-shadow var(--pcp-ease);
}
.pcp-elementor-page .rpl-loadmore__btn:hover { background: var(--pcp-blue-dark); box-shadow: 0 4px 12px rgba(0, 163, 218, .3); }

/* ---------- filter popup (opened from the list pages and the search page) ---------- */
@keyframes pcp-pop { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pcp-fade { from { opacity: 0; } to { opacity: 1; } }
.rpl-filter:not([hidden]) .rpl-filter__backdrop { animation: pcp-fade .2s ease; }
.rpl-filter:not([hidden]) .rpl-filter__panel { animation: pcp-pop .24s ease; border-radius: 6px; }
.rpl-filter__title { font-family: "Montserrat", sans-serif; font-weight: 600; letter-spacing: .04em; }
.rpl-filter__search-input,
.rpl-filter__range input {
	height: 46px !important;
	box-sizing: border-box;
	border: 1px solid var(--pcp-line) !important;
	border-radius: var(--pcp-radius) !important;
	background: #fff !important;
	padding: 0 14px !important;
	font-size: 15px !important;
	transition: border-color var(--pcp-ease), box-shadow var(--pcp-ease);
}
.rpl-filter__search-input { padding-left: 40px !important; }
.rpl-filter__search-input:focus,
.rpl-filter__range input:focus { border-color: var(--pcp-blue) !important; box-shadow: 0 0 0 3px rgba(0, 163, 218, .16); outline: 0; }
.rpl-filter__set { color: var(--pcp-blue-dark); font-weight: 600; cursor: pointer; transition: color var(--pcp-ease); }
.rpl-filter__row:hover .rpl-filter__set { color: var(--pcp-navy); }
.rpl-filter__foot .rpl-filter__submit,
.rpl-filter__foot .rpl-filter__clear {
	box-sizing: border-box;
	height: var(--pcp-control-h);
	border-radius: var(--pcp-radius);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.rpl-filter__foot .rpl-filter__submit { padding: 0 28px; transition: background-color var(--pcp-ease), box-shadow var(--pcp-ease); }
.rpl-filter__foot .rpl-filter__clear { padding: 0 8px; opacity: 1; color: var(--pcp-navy); text-decoration: underline; text-underline-offset: 3px; }
.rpl-filter__foot .rpl-filter__clear:hover { color: var(--pcp-blue-dark); }
.rpl-chk input { accent-color: var(--pcp-blue); }
.rpl-sbar__switch button { transition: background-color var(--pcp-ease), color var(--pcp-ease); }

/* ---------- 3. classic single listing (/listings/{id}/{slug}/) ---------- */
.rpl-single { font-family: "Open Sans", sans-serif; color: var(--pcp-navy); }
.rpl-single :is(h1, h2, h3) { font-family: "Montserrat", sans-serif; }
.rpl-single .rpl-badge,
.rpl-single .rpl-thead,
.rpl-single .rpl-heading::before { background: var(--pcp-blue); }
.rpl-single .rpl-card__hd { background-color: var(--pcp-navy); }
.rpl-single .rpl-h2 > span { background: var(--pcp-blue-dark); }
.rpl-single .rpl-i--check { background: var(--pcp-blue-soft); }
.rpl-single .rpl-i--check:after { border-color: var(--pcp-blue-dark); }
.rpl-single .rpl-table, .rpl-single .rpl-card { border-radius: var(--pcp-radius); }

/* title + badge. The plugin prints "SALEANDLEASE" for Sale & Lease; shown spaced until the plugin is fixed */
.rpl-single .rpl-single__title {
	font-size: clamp(22px, 2.2vw, 28px);
	font-weight: 600;
	line-height: 1.3;
	margin-top: 36px;
}
.rpl-single .rpl-single__title .rpl-badge {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	height: 22px;
	box-sizing: border-box;
	padding: 0 8px;
	margin-left: 4px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .05em;
	line-height: 1;
	position: relative;
	top: -2px;
}
.rpl-single .rpl-single__title .rpl-badge--salelease { font-size: 0; }
.rpl-single .rpl-single__title .rpl-badge--salelease::after { content: "SALE & LEASE"; font-size: 12px; }

body .rpl-single .rpl-single__header-left { flex: 1 1 auto; min-width: 0; }

/* one button family: Back / Brochure = outline, Enquire / agent phone = Perth blue */
body .rpl-single .rpl-single__header .rpl-btn,
body .rpl-single .rpl-single__header .rpl-chip {
	box-sizing: border-box;
	height: 44px;
	padding: 0 18px;
	border: 1px solid var(--pcp-line);
	border-radius: var(--pcp-radius);
	background: #fff;
	color: var(--pcp-navy);
	box-shadow: none;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-decoration: none;
	transition: background-color var(--pcp-ease), border-color var(--pcp-ease), color var(--pcp-ease), box-shadow var(--pcp-ease);
}
body .rpl-single .rpl-single__header .rpl-btn:hover,
body .rpl-single .rpl-single__header .rpl-chip:hover { border-color: var(--pcp-blue); color: var(--pcp-blue-dark); filter: none; }
body .rpl-single .rpl-single__header .rpl-chip[data-rpl-open="enquiry"] {
	background: var(--pcp-blue);
	border-color: var(--pcp-blue);
	color: #fff;
}
body .rpl-single .rpl-single__header .rpl-chip[data-rpl-open="enquiry"]:hover {
	background: var(--pcp-blue-dark);
	border-color: var(--pcp-blue-dark);
	color: #fff;
	box-shadow: 0 4px 12px rgba(0, 163, 218, .3);
}
body .rpl-single .rpl-single__header .rpl-ico { flex: none; }
body .rpl-single .rpl-agent__cta .rpl-chip {
	box-sizing: border-box;
	height: 40px;
	padding: 0 14px;
	border-radius: var(--pcp-radius);
	background: var(--pcp-blue);
	color: #fff;
	font-size: 15px;
	transition: background-color var(--pcp-ease);
}
body .rpl-single .rpl-agent__cta .rpl-chip:hover { background: var(--pcp-blue-dark); }

@media (max-width: 767px) {
	/* the plugin keeps the title on one line with an ellipsis; let it wrap and put the buttons in one tidy row */
	body .rpl-single .rpl-single__title { white-space: normal; overflow: visible; text-overflow: clip; margin-top: 8px; }
	body .rpl-single .rpl-single__header { gap: 10px; overflow: visible; }
	body .rpl-single .rpl-single__header-right { flex: 1 1 auto; justify-content: flex-end; flex-wrap: nowrap; }
	body .rpl-single .rpl-single__header .rpl-btn,
	body .rpl-single .rpl-single__header .rpl-chip { height: 42px; padding: 0 14px; font-size: 14px; }
}
@media (max-width: 380px) {
	body .rpl-single .rpl-single__header-right { flex-basis: 100%; justify-content: stretch; }
	body .rpl-single .rpl-single__header-right .rpl-chip { flex: 1; }
}

/* ---------- enquiry popup ---------- */
.rpl-modal:not([hidden]) .rpl-modal__backdrop { animation: pcp-fade .2s ease; }
.rpl-modal:not([hidden]) .rpl-modal__dialog { animation: pcp-pop .24s ease; }
body .rpl-modal__dialog { border-radius: 6px; }
.rpl-modal__close { border-radius: var(--pcp-radius); width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; transition: background-color var(--pcp-ease); }
.rpl-modal__close:hover { background-color: #eef2f5 !important; }
.rpl-enq__title { font-family: "Montserrat", sans-serif; font-weight: 600; margin: 16px 0 18px; }
.rpl-enq__badge { background: var(--pcp-blue); border-radius: 3px; padding: 5px 8px; vertical-align: middle; }
.rpl-enq__form { gap: 18px; }
.rpl-enq__group label { font-size: 14px !important; font-weight: 600; margin-bottom: 6px; display: block; color: var(--pcp-navy); }
body .rpl-enq__form :is(input[type="text"], input[type="email"], input[type="tel"], select, textarea) {
	box-sizing: border-box;
	width: 100%;
	height: var(--pcp-control-h);
	padding: 0 14px !important;
	border: 1px solid var(--pcp-line);
	border-radius: var(--pcp-radius) !important;
	background: #fff;
	font-size: 16px;
	line-height: 1.4;
	transition: border-color var(--pcp-ease), box-shadow var(--pcp-ease);
}
body .rpl-enq__form textarea { height: auto; min-height: 120px; padding: 12px 14px !important; resize: vertical; }
body .rpl-enq__form :is(input, select, textarea):focus { border-color: var(--pcp-blue); box-shadow: 0 0 0 3px rgba(0, 163, 218, .16); outline: 0; }
.rpl-enq__phone { grid-template-columns: 96px 1fr; gap: 10px; align-items: stretch; }
body .rpl-enq__phone select,
body .rpl-enq__phone .rpl-enq__cc { height: var(--pcp-control-h); padding: 0 12px !important; }
body #rpl-enq-submit {
	box-sizing: border-box;
	height: var(--pcp-control-h);
	padding: 0 36px;
	border: 0;
	border-radius: var(--pcp-radius);
	background: var(--pcp-blue);
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: .02em;
	cursor: pointer;
	transition: background-color var(--pcp-ease), box-shadow var(--pcp-ease);
}
body #rpl-enq-submit:hover { background: var(--pcp-blue-dark); box-shadow: 0 4px 12px rgba(0, 163, 218, .3); }
@media (max-width: 767px) {
	body #rpl-enq-submit { width: 100%; }
	.rpl-enq__title { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
	.rpl-filter *, .rpl-modal *, .pcp-elementor-page .rpl-res__card *, .rpl-single * { animation: none !important; transition: none !important; }
}
