/**
 * Panorama Widget — front-end styles.
 * Everything is scoped under .pano-widget so partner themes cannot clash.
 * Layout mirrors the reference maquettes.
 */

.pano-widget {
	--pano-primary: #2D6A4F;
	--pano-primary-dark: #1B4332;
	--pano-secondary: #52B788;
	--pano-light: #E8F5E9;
	--pano-text: #1A1A2E;
	--pano-muted: #667085;
	--pano-line: #e3e8e5;
	--pano-bg: #ffffff;
	color: var(--pano-text, #1A1A2E);
	font-size: 15px;
	line-height: 1.55;
}

.pano-widget *,
.pano-widget *::before,
.pano-widget *::after {
	box-sizing: border-box;
}

.pano-widget a {
	color: var(--pano-primary, #2D6A4F);
}

/* --- Notices --------------------------------------------------------- */

.pano-widget__degraded,
.pano-widget__error,
.pano-widget__empty {
	margin: 0 0 16px;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 14px;
}

.pano-widget__degraded { background: #fff8e1; color: #5d4037; border: 1px solid #ffe0a3; }
.pano-widget__error    { background: #fdecea; color: #8a1f11; border: 1px solid #f5c6c0; }
.pano-widget__empty    { background: var(--pano-light, #E8F5E9); color: #1b5e20; border: 1px solid #cfe8d2; }
.pano-widget__error-detail { margin: -8px 0 16px; color: var(--pano-muted, #667085); }

/* --- Hero ---------------------------------------------------------- */

.pano-widget__hero {
	background: linear-gradient( 135deg, var(--pano-primary-dark, #1B4332), var(--pano-primary, #2D6A4F) 65%, var(--pano-secondary, #52B788) );
	color: #fff;
	border-radius: 16px;
	padding: 26px 24px;
	margin-bottom: 18px;
}

.pano-widget__hero-title { margin: 0 0 6px; font-size: 24px; line-height: 1.2; color: #fff; }
.pano-widget__hero-sub   { margin: 0; opacity: .92; font-size: 14px; max-width: 640px; }

.pano-widget__hero-stats { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 18px; }
.pano-widget__hero-num   { display: block; font-size: 26px; font-weight: 800; }
.pano-widget__hero-lbl   { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }

/* --- Filter bar --------------------------------------------------- */

.pano-widget__fbar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	padding: 12px 0;
	margin-bottom: 12px;
	border-bottom: 1px solid var(--pano-line, #e3e8e5);
}

.pano-widget__search {
	flex: 1 1 220px;
	min-width: 200px;
	padding: 8px 14px;
	border: 1.5px solid var(--pano-line, #e3e8e5);
	border-radius: 999px;
	font-size: 14px;
	outline: none;
}

.pano-widget__search:focus { border-color: var(--pano-primary, #2D6A4F); }

.pano-widget__chips { display: flex; flex-wrap: wrap; gap: 6px; }

.pano-widget__chip {
	padding: 6px 12px;
	border: 1.5px solid var(--pano-line, #e3e8e5);
	background: #fff;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	color: #555;
	cursor: pointer;
	transition: .15s;
}

.pano-widget__chip:hover { border-color: var(--pano-primary, #2D6A4F); color: var(--pano-primary, #2D6A4F); }

.pano-widget__chip.is-active {
	background: var(--pano-primary, #2D6A4F);
	border-color: var(--pano-primary, #2D6A4F);
	color: #fff;
}

/* --- Layout: sidebar + results ---------------------------------- */

.pano-widget__layout {
	display: grid;
	grid-template-columns: 210px 1fr;
	gap: 20px;
	align-items: start;
}

.pano-widget__layout--nosidebar { grid-template-columns: 1fr; }

.pano-widget__sidebar {
	background: #fafbfa;
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 12px;
	padding: 14px 16px;
}

.pano-widget__side-title {
	font-size: 10px;
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: #98a2b3;
	margin: 14px 0 6px;
}
.pano-widget__side-title:first-child { margin-top: 0; }

.pano-widget__check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #475467;
	padding: 4px 0;
	cursor: pointer;
}
.pano-widget__check input { accent-color: var(--pano-primary, #2D6A4F); }

.pano-widget__results { min-height: 120px; position: relative; transition: opacity .15s; }
.pano-widget__results.is-loading { opacity: .5; pointer-events: none; }

/* --- Card grid --------------------------------------------------- */

.pano-widget__grid {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat( var(--pano-cols, 3), minmax( 0, 1fr ) );
}

@media (max-width: 900px) { .pano-widget__grid { grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); } }
@media (max-width: 560px) { .pano-widget__grid { grid-template-columns: 1fr; } }

.pano-widget__card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, .035 );
	transition: box-shadow .18s;
}
.pano-widget__card:hover { box-shadow: 0 8px 20px rgba( 0, 0, 0, .09 ); }

.pano-widget__card-img {
	position: relative;
	height: 120px;
	background-size: cover;
	background-position: center;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pano-widget__card-img--placeholder {
	font-size: 40px;
	background: linear-gradient( 135deg, color-mix( in srgb, var(--pano-band) 30%, #fff ), var(--pano-band) );
}

/* Fallback for browsers without color-mix. */
@supports not ( background: color-mix( in srgb, red, blue ) ) {
	.pano-widget__card-img--placeholder { background: var(--pano-band, var(--pano-primary, #2D6A4F)); }
}

.pano-widget__badge,
.pano-widget__commune {
	position: absolute;
	top: 8px;
	font-size: 10px;
	font-weight: 800;
	border-radius: 999px;
	padding: 3px 8px;
}
.pano-widget__badge   { left: 8px; background: rgba( 0, 0, 0, .6 ); color: #fff; }
.pano-widget__commune { right: 8px; background: rgba( 255, 255, 255, .92 ); color: #344; }

.pano-widget__card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }

.pano-widget__tag {
	align-self: flex-start;
	border: 1px solid var(--pano-tag, var(--pano-primary, #2D6A4F) );
	color: var(--pano-tag, var(--pano-primary, #2D6A4F) );
	border-radius: 999px;
	padding: 2px 10px;
	font-size: 11px;
	font-weight: 800;
}

.pano-widget__card-title { margin: 0; font-size: 16px; line-height: 1.3; }
.pano-widget__card-title a { color: inherit; text-decoration: none; }
.pano-widget__card-title a:hover { text-decoration: underline; }

.pano-widget__card-desc { margin: 0; color: var(--pano-muted, #667085); font-size: 13px; }

.pano-widget__card-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }

.pano-widget__pill {
	background: #f2f4f3;
	border-radius: 6px;
	padding: 2px 8px;
	font-size: 11px;
	color: #344054;
}
.pano-widget__pill--repro { background: var(--pano-light, #E8F5E9); color: #1b5e20; }

/* --- Pagination ------------------------------------------------------ */

.pano-widget__pagination {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 18px;
}

.pano-widget__page-btn {
	border: 1.5px solid var(--pano-line, #e3e8e5);
	background: #fff;
	border-radius: 999px;
	padding: 7px 14px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}
.pano-widget__page-btn:hover { border-color: var(--pano-primary, #2D6A4F); color: var(--pano-primary, #2D6A4F); }
.pano-widget__page-info { font-size: 13px; color: var(--pano-muted, #667085); }

/* --- Compact list ----------------------------------------------- */

.pano-widget__list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 12px;
	overflow: hidden;
}
.pano-widget__list-item + .pano-widget__list-item { border-top: 1px solid var(--pano-line, #e3e8e5); }
.pano-widget__list-link { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; text-decoration: none; color: inherit; }
.pano-widget__list-link:hover { background: var(--pano-light, #E8F5E9); }
.pano-widget__list-title { font-weight: 600; }
.pano-widget__list-meta { font-size: 13px; color: var(--pano-muted, #667085); }

/* --- Stats -------------------------------------------------------- */

.pano-widget__stats { display: flex; flex-wrap: wrap; gap: 16px; }
.pano-widget__stat {
	flex: 1 1 120px;
	background: #fff;
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 12px;
	padding: 16px;
	text-align: center;
}
.pano-widget__stats--compact .pano-widget__stat { padding: 10px 12px; }
.pano-widget__stat-num { display: block; font-size: 26px; font-weight: 800; color: var(--pano-primary, #2D6A4F); }
.pano-widget__stat-label { display: block; font-size: 13px; color: var(--pano-muted, #667085); }
.pano-widget__stat-breakdown { margin: 16px 0 0; padding-left: 18px; color: var(--pano-muted, #667085); font-size: 14px; }

/* --- Detail sheet ---------------------------------------------------- */

.pano-widget__detail { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
@media (max-width: 780px) { .pano-widget__detail { grid-template-columns: 1fr; } }

.pano-widget__detail-title { margin: 8px 0; font-size: 24px; line-height: 1.2; }
.pano-widget__detail-lead { font-size: 15px; color: #3f4b45; }

.pano-widget__detail-photo {
	width: 100%;
	height: 180px;
	object-fit: cover;
	border-radius: 14px;
}
.pano-widget__detail-photo--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 56px;
	background: linear-gradient( 135deg, #c8e6c9, var(--pano-band, var(--pano-secondary, #52B788) ) );
}

.pano-widget__info {
	margin-top: 12px;
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 12px;
	padding: 6px 14px;
}
.pano-widget__info-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
	font-size: 13px;
	border-bottom: 1px solid #f0f3f2;
}
.pano-widget__info-row:last-child { border-bottom: 0; }

.pano-widget__section {
	background: #fff;
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 12px;
	padding: 14px 16px;
	margin-top: 12px;
}
.pano-widget__section h3 {
	margin: 0 0 6px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--pano-primary, #2D6A4F);
}
.pano-widget__section p { margin: 0; color: #3f4b45; }

.pano-widget__canonical { margin-top: 14px; font-size: 13px; }

/* --- Buttons ------------------------------------------------------- */

.pano-widget__btn {
	display: inline-block;
	border: 1.5px solid var(--pano-primary, #2D6A4F);
	/* !important: beats both the generic ".pano-widget a" link color above
	   (higher specificity would otherwise win) and any host-theme link/hover
	   rule — without it the primary variant renders white-on-white/green-on-
	   green text, invisible until some other rule happens to override it. */
	color: var(--pano-primary, #2D6A4F) !important;
	background: #fff;
	border-radius: 999px;
	padding: 8px 18px;
	font-weight: 800;
	font-size: 14px;
	text-decoration: none !important;
	cursor: pointer;
}
.pano-widget__btn--primary,
.pano-widget__btn--primary:hover,
.pano-widget__btn--primary:focus { background: var(--pano-primary, #2D6A4F) !important; color: #fff !important; }
.pano-widget__btn--ghost,
.pano-widget__btn--ghost:hover,
.pano-widget__btn--ghost:focus { border-color: #ccd6d0 !important; color: #3f4b45 !important; background: transparent !important; }
.pano-widget__btn:disabled { opacity: .6; cursor: default; }

/* --- Toolbar (back/add links above catalogue, sheet, form) --------- */

.pano-widget__toolbar { margin: 0 0 16px; }
.pano-widget__toolbar--row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* --- Form ------------------------------------------------------------ */

.pano-widget__form { max-width: 720px; }

.pano-widget__fieldset {
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 12px;
	padding: 14px 16px;
	margin: 0 0 14px;
}
.pano-widget__fieldset legend { font-weight: 800; color: var(--pano-primary, #2D6A4F); padding: 0 6px; }

.pano-widget__field { display: block; margin-bottom: 12px; }
.pano-widget__label { display: block; font-size: 12px; font-weight: 800; color: #475467; margin-bottom: 5px; }

.pano-widget__field input,
.pano-widget__field textarea,
.pano-widget__field select {
	width: 100%;
	border: 1.5px solid var(--pano-line, #e3e8e5);
	border-radius: 9px;
	padding: 9px 10px;
	font-size: 14px;
	font-family: inherit;
}
.pano-widget__field textarea { min-height: 78px; resize: vertical; }
.pano-widget__field input:focus,
.pano-widget__field textarea:focus,
.pano-widget__field select:focus { border-color: var(--pano-primary, #2D6A4F); outline: none; }

.pano-widget__help { display: block; font-size: 11px; color: #98a2b3; margin-top: 3px; }

/* --- Custom combo (commune / thème) --------------------------------- */
/* Not a <select> on purpose — see class-widget-renderer.php::field_combo(). */

.pano-widget__combo { position: relative; }

.pano-widget__combo-btn {
	width: 100%;
	text-align: left;
	background: #fff;
	border: 1.5px solid var(--pano-line, #e3e8e5);
	border-radius: 9px;
	padding: 9px 30px 9px 10px;
	font-size: 14px;
	font-family: inherit;
	color: inherit;
	cursor: pointer;
	position: relative;
}
.pano-widget__combo-btn:focus,
.pano-widget__combo-btn[aria-expanded="true"] { border-color: var(--pano-primary, #2D6A4F); outline: none; }

.pano-widget__combo-btn::after {
	content: "";
	position: absolute;
	right: 13px;
	top: 45%;
	width: 7px;
	height: 7px;
	border-right: 2px solid var(--pano-muted, #667085);
	border-bottom: 2px solid var(--pano-muted, #667085);
	transform: translateY(-50%) rotate(45deg);
	pointer-events: none;
}

/* The open/closed state is the native `hidden` attribute (toggled by
   bindCombos() in JS) — it relies on the UA stylesheet's `[hidden] {
   display: none }` rule, which a partner theme's own sitewide reset can
   silently out-rank (same class of bug as the invisible-button saga
   elsewhere in this plugin). Pin both states explicitly so the dropdown
   actually closes regardless of what else is loaded on the page. */
.pano-widget__combo-list { display: block; }
.pano-widget__combo-list[hidden] { display: none !important; }

.pano-widget__combo-list {
	position: absolute;
	z-index: 30;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	max-height: 220px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 9px;
	box-shadow: 0 10px 26px rgba(0, 0, 0, .14);
	margin: 0;
	padding: 4px;
	list-style: none;
}

.pano-widget__combo-option {
	padding: 8px 10px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	color: var(--pano-text, #1A1A2E);
}
.pano-widget__combo-option:hover,
.pano-widget__combo-option.is-selected {
	background: var(--pano-light, #E8F5E9);
	color: #1b5e20;
}

.pano-widget__charte {
	background: #fafbfa;
	border: 1px solid var(--pano-line, #e3e8e5);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 13px;
	max-height: 180px;
	overflow: auto;
	margin-bottom: 10px;
}

.pano-widget__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.pano-widget__form-msg { margin: 12px 0; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.pano-widget__form-msg--ok  { background: var(--pano-light, #E8F5E9); color: #1b5e20; border: 1px solid #cfe8d2; }
.pano-widget__form-msg--err { background: #fdecea; color: #8a1f11; border: 1px solid #f5c6c0; }

/* --- Map ----------------------------------------------------------- */

.pano-widget__map {
	width: 100%;
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid var(--pano-line, #e3e8e5);
}
