/* =============================================================================
   Jawność Cen Mieszkań – Widget CSS
   ============================================================================= */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&display=swap');

.jcm-offers-table-wrapper {
	width: 100%;
	font-family: 'Manrope', sans-serif;
	font-size: 15px;
	color: #1d1d1d;
}

.jcm-empty {
	text-align: center;
	padding: 40px 20px;
	color: #6b6c7e;
	font-size: 14px;
}

/* ── Scroll wrapper tabeli ────────────────────────────────────────────────── */
.jcm-table-scroll {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ── Grid layout (kolumny) ────────────────────────────────────────────────── */
/*
	10 kolumn: Numer | Piętro | Powierzchnia | Cena | Cena/m² | Garaż | Miejsce post. | Status | Karta | Historia
*/
.jcm-offers-header,
.jcm-offer-row {
	display: grid;
	grid-template-columns: 80px 80px 130px 140px 150px 120px 125px 145px 60px 65px;
	align-items: center;
	min-width: 1095px;
}

.jcm-offers-header .jcm-col,
.jcm-offer-row .jcm-col {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (max-width: 1024px) {
	.jcm-offer-row .jcm-col {
		white-space: normal;
		overflow: visible;
		text-overflow: clip;
	}
}

/* ── Hint "przewiń w prawo" ───────────────────────────────────────────────── */
.jcm-filters-top {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
}

.jcm-scroll-hint {
	display: none;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: #6b6c7e;
	white-space: nowrap;
}

.jcm-scroll-hint svg {
	flex-shrink: 0;
	opacity: 0.7;
}

/* Hint widoczność zarządzana przez JS (initScrollHint) */
/* Na mobile (widok kart) hint nigdy nie jest potrzebny */
@media (max-width: 1024px) {
	.jcm-scroll-hint {
		display: none !important;
	}
}

/* ── Nagłówek tabeli ──────────────────────────────────────────────────────── */
.jcm-offers-header {
	background-color: #3d3d3d;
	color: #ffffff;
	font-weight: 700;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0 20px;
	height: 52px;
	border-radius: 4px 4px 0 0;
}

.jcm-offers-header .jcm-col {
	padding: 0 8px;
}

/* ── Wiersz ───────────────────────────────────────────────────────────────── */
.jcm-offer-row {
	padding: 0 20px;
	min-height: 64px;
	border-bottom: 1px solid #E7E7ED;
	background-color: #ffffff;
	transition: background-color 0.15s ease, box-shadow 0.15s ease;
	position: relative;
}

.jcm-offer-row:last-child {
	border-bottom: none;
	border-radius: 0 0 4px 4px;
}

.jcm-offer-row:hover {
	background-color: #fafafa;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	z-index: 1;
}

.jcm-offer-row .jcm-col {
	padding: 16px 8px;
	font-size: 14px;
}

/* ── Kolumny ikony ────────────────────────────────────────────────────────── */
.jcm-col-karta,
.jcm-col-historia {
	text-align: center;
}

/* ── Badge statusu ────────────────────────────────────────────────────────── */
.jcm-status-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 3px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border: 2px solid transparent;
	white-space: nowrap;
}

.jcm-status-badge--dostepny {
	background-color: #e8f5eb;
	color: #118632;
	border-color: #98D4A9;
}

.jcm-status-badge--zarezerwowany {
	background-color: #fff5e6;
	color: #a05c00;
	border-color: #f0a040;
}

.jcm-status-badge--sprzedany {
	background-color: #fdecea;
	color: #861111;
	border-color: #e8b0b0;
}

/* ── Przycisk pobierania karty ────────────────────────────────────────────── */
.jcm-card-download {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 5px;
	color: #6b6c7e;
	background: transparent;
	transition: background 0.15s, color 0.15s;
	text-decoration: none;
}

.jcm-card-download:hover {
	background: #f0f0f0;
	color: #1d1d1d;
}

.jcm-no-card {
	color: #c0c0c0;
	font-size: 13px;
}

/* ── Przycisk historii ────────────────────────────────────────────────────── */
.jcm-price-history-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 5px;
	color: #6b6c7e;
	background: transparent;
	border: none;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	padding: 0;
}

.jcm-price-history-btn:hover {
	background: #f0f0f0;
	color: #0073aa;
}

/* ── Przycisk mobile toggle (ukryty na desktop) ───────────────────────────── */
.jcm-mobile-toggle-btn {
	display: none;
}

/* =============================================================================
   Modal historii cen
   ============================================================================= */
.jcm-price-history-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.jcm-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	cursor: pointer;
}

.jcm-modal-box {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 8px;
	width: 100%;
	max-width: 480px;
	margin: 16px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	animation: jcm-slide-in 0.2s ease;
	overflow: hidden;
}

@keyframes jcm-slide-in {
	from { opacity: 0; transform: translateY(-16px); }
	to   { opacity: 1; transform: translateY(0); }
}

.jcm-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid #E7E7ED;
}

.jcm-modal-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: #1d1d1d;
}

.jcm-modal-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	border-radius: 4px;
	cursor: pointer;
	color: #6b6c7e;
	padding: 0;
	transition: background 0.15s;
}

.jcm-modal-close:hover {
	background: #f0f0f0;
	color: #1d1d1d;
}

.jcm-modal-body {
	padding: 16px 20px;
	max-height: 60vh;
	overflow-y: auto;
}

.jcm-modal-loading {
	text-align: center;
	color: #6b6c7e;
	padding: 24px;
	font-size: 14px;
}

/* Lista historii */
.jcm-price-history-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.jcm-history-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 0;
	border-bottom: 1px solid #f0f0f0;
	font-size: 14px;
}

.jcm-history-item:last-child {
	border-bottom: none;
}

.jcm-history-date {
	color: #6b6c7e;
	min-width: 90px;
}

.jcm-history-price {
	font-weight: 600;
	color: #1d1d1d;
}

.jcm-history-change {
	font-size: 12px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 3px;
	min-width: 80px;
	justify-content: flex-end;
}

.jcm-history-change--up    { color: #d73a49; }
.jcm-history-change--down  { color: #22863a; }
.jcm-history-change--same  { color: #6b6c7e; }

.jcm-history-first-entry {
	font-size: 11px;
	color: #6b6c7e;
	margin-top: 12px;
	text-align: center;
}

/* =============================================================================
   MOBILE — breakpoint 1024px
   ============================================================================= */
@media (max-width: 1024px) {

	/* Wyłącz horizontal scroll – karty mają pełną szerokość */
	.jcm-table-scroll {
		overflow-x: visible;
	}

	/* Ukryj nagłówek tabeli */
	.jcm-offers-header {
		display: none;
	}

	/* Każdy wiersz jako karta – reset min-width z desktop */
	.jcm-offer-row {
		display: flex;
		flex-direction: column;
		min-width: 0;
		width: 100%;
		padding: 50px 16px 16px 16px;
		margin-bottom: 8px;
		border: 1px solid #E7E7ED;
		border-radius: 8px;
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
		position: relative;
	}

	/* Kolumna jako wiersz z etykietą */
	.jcm-offer-row .jcm-col {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 8px 0;
		border-bottom: 1px solid #f0f0f0;
		font-size: 14px;
	}

	.jcm-offer-row .jcm-col:last-of-type {
		border-bottom: none;
	}

	/* Etykiety kolumn przez ::before */
	.jcm-offer-row .jcm-col::before {
		content: attr(data-label);
		font-size: 11px;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		color: #6b6c7e;
		margin-right: 12px;
		flex-shrink: 0;
	}

	/* Kolumna Numer – zawsze widoczna, wyróżniona */
	.jcm-col-numer {
		font-size: 18px !important;
		font-weight: 700;
		border-bottom: 2px solid #E7E7ED !important;
	}

	/* Kolumna Status – zawsze widoczna */
	.jcm-col-status {
		border-bottom: none !important;
	}

	/* Cena – zawsze widoczna */
	.jcm-col-cena {
		font-weight: 600;
	}

	/* Kolumny chowane domyślnie */
	.jcm-mobile-hidden {
		display: none !important;
	}

	/* Gdy rozwinięte */
	.jcm-offer-row.jcm-expanded .jcm-mobile-hidden {
		display: flex !important;
	}

	/* Kolumny ikony na mobile – wyrównaj do lewej */
	.jcm-col-karta,
	.jcm-col-historia {
		text-align: left;
		justify-content: space-between;
	}

	/* Przycisk toggle */
	.jcm-mobile-toggle-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		top: 12px;
		right: 12px;
		width: 32px;
		height: 32px;
		border-radius: 50%;
		background: #f0f0f0;
		border: none;
		cursor: pointer;
		color: #1d1d1d;
		padding: 0;
		transition: background 0.15s, transform 0.2s;
	}

	.jcm-offer-row.jcm-expanded .jcm-mobile-toggle-btn {
		transform: rotate(45deg);
		background: #1d1d1d;
		color: #fff;
	}

	/* Status badge na mobile */
	.jcm-status-badge {
		font-size: 10px;
	}
}

@media (max-width: 480px) {
	.jcm-modal-box {
		border-radius: 8px 8px 0 0;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		margin: 0;
		max-width: 100%;
		animation: jcm-slide-up 0.25s ease;
	}

	@keyframes jcm-slide-up {
		from { transform: translateY(100%); }
		to   { transform: translateY(0); }
	}

	.jcm-modal-body {
		max-height: 50vh;
	}
}

/* =============================================================================
   Filtry
   ============================================================================= */

/* ── Przycisk toggle filtrów ─────────────────────────────────────────────── */
.jcm-filters-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	background: transparent;
	border: 1px solid #d0d0d8;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 600;
	color: #6b6c7e;
	cursor: pointer;
	letter-spacing: 0.02em;
	transition: border-color 0.15s, color 0.15s;
}

.jcm-filters-toggle:hover,
.jcm-filters-toggle[aria-expanded="true"] {
	border-color: #3d3d3d;
	color: #1d1d1d;
}

.jcm-filters-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	padding: 16px 20px;
	background: #f7f7f8;
	border: 1px solid #E7E7ED;
	border-radius: 4px;
	margin-bottom: 4px;
}

.jcm-filter-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
	min-width: 160px;
}

.jcm-filter-group--range {
	min-width: 220px;
	flex: 2;
}

.jcm-filter-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b6c7e;
}

/* ── Select ──────────────────────────────────────────────────────────────── */
.jcm-filter-select {
	height: 36px;
	padding: 0 10px;
	border: 1px solid #d0d0d8;
	border-radius: 4px;
	background: #fff;
	font-size: 13px;
	color: #1d1d1d;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6c7e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	padding-right: 28px;
	transition: border-color 0.15s;
}

.jcm-filter-select:focus {
	outline: none;
	border-color: #3d3d3d;
}

/* ── Dual range slider ───────────────────────────────────────────────────── */
.jcm-range-wrap {
	position: relative;
	height: 36px;
	display: flex;
	align-items: center;
}

.jcm-range-track {
	position: absolute;
	height: 4px;
	width: 100%;
	background: #d0d0d8;
	border-radius: 2px;
}

.jcm-range-fill {
	position: absolute;
	height: 100%;
	background: #3d3d3d;
	border-radius: 2px;
}

.jcm-range {
	position: absolute;
	width: 100%;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	pointer-events: none;
	height: 4px;
	z-index: 2;
	margin: 0;
}

.jcm-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	pointer-events: all;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid #3d3d3d;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	transition: border-color 0.15s;
}

.jcm-range::-moz-range-thumb {
	pointer-events: all;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid #3d3d3d;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.jcm-range:focus {
	outline: none;
}

.jcm-range-vals {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	font-weight: 600;
	color: #1d1d1d;
	margin-top: 2px;
}

/* ── Brak wyników ────────────────────────────────────────────────────────── */
.jcm-no-results {
	text-align: center;
	padding: 32px 20px;
	color: #6b6c7e;
	font-size: 14px;
	border: 1px dashed #d0d0d8;
	border-radius: 4px;
	margin: 0;
}

/* ── Pokaż więcej ────────────────────────────────────────────────────────── */
.jcm-show-more-wrap {
	text-align: center;
	padding: 20px 0 4px;
}

.jcm-show-more-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 24px;
	background: transparent;
	border: 2px solid #3d3d3d;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 700;
	color: #1d1d1d;
	cursor: pointer;
	letter-spacing: 0.02em;
	transition: background 0.15s, color 0.15s;
}

.jcm-show-more-btn:hover {
	background: #3d3d3d;
	color: #fff;
}

.jcm-show-more-count {
	font-weight: 400;
	color: #6b6c7e;
}

.jcm-show-more-btn:hover .jcm-show-more-count {
	color: rgba(255, 255, 255, 0.7);
}

/* ── Filtry – mobile ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.jcm-filters-bar {
		gap: 12px;
		padding: 12px 16px;
	}

	.jcm-filter-group {
		min-width: calc(50% - 8px);
	}

	.jcm-filter-group--range {
		min-width: 100%;
		flex: unset;
		width: 100%;
	}
}
