/**
 * GLM Services & Prices — shortcodes styles
 *
 * @package GLM_Services_Prices
 * @since   1.1.0
 */

/* ── Wyszukiwarka [glm_search] ── */

.glm-search {
	position: relative;
	margin: 0 0 2em 0;
	text-align: center;
}

.glm-search__input-wrap {
	position: relative;
	max-width: 500px;
	margin: 0 auto;
}

.glm-search__input {
	width: 100%;
	padding: 12px 16px;
	font-size: 16px;
	border: 2px solid #005cab;
	border-radius: 10px !important;
	outline: none;
	transition: border-color 0.2s;
	box-sizing: border-box;
	color: #005cab;
}

.glm-search__input:focus {
	border-color: #005cab;
}

.glm-search__spinner {
	position: absolute;
	right: 14px;
	top: 50%;
	width: 18px;
	height: 18px;
	margin-top: -9px;
	border: 2px solid #ddd;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: glm-spin 0.6s linear infinite;
}

@keyframes glm-spin {
	to { transform: rotate(360deg); }
}

.glm-search__results {
	/* position, top, left, width, z-index ustawiane przez JS */
}

.glm-search__list {
	list-style: none;
	margin: 0;
	padding: 0;
	background: #fff;
	border: 1px solid #e2e4e7;
	border-radius: 4px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	max-height: 300px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.glm-search__item {
	padding: 10px 14px;
	border-bottom: 1px solid #f0f0f0;
	display: flex;
	align-items: baseline;
	justify-content: flex-start;
	gap: 12px;
	text-align: left;
	cursor: pointer;
}

.glm-search__item:last-child {
	border-bottom: none;
}

.glm-search__item:hover,
.glm-search__item:active {
	background: #f8f9fa;
}

.glm-search__item-title {
	font-weight: 600;
	flex: 1 1 auto;
}

.glm-search__item-price {
	font-weight: 600;
	color: #0073aa;
	white-space: nowrap;
}

.glm-search__empty {
	padding: 12px 14px;
	color: #888;
}

/* ── Lista usług [glm_services] ── */

.glm-services {
	margin: 0 0 2em 0;
}

/* Filtry kategorii */

.glm-services__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 1.2em;
	padding-bottom: 1em;
	border-bottom: 1px solid #eee;
}

.glm-services__filter {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid #ddd;
	border-radius: 20px;
	background: #fff;
	color: #333;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
	line-height: 1.4;
	outline: none;
	user-select: none;
}

.glm-services__filter:hover {
	border-color: #0073aa;
	color: #0073aa;
	background: #fff;
}

.glm-services__filter.glm-services__filter--active {
	background: #0073aa;
	border-color: #0073aa;
	color: #fff;
}

.glm-services__filter.glm-services__filter--active:hover {
	background: #005a87;
	border-color: #005a87;
	color: #fff;
}

.glm-services__filter-count {
	font-size: 0.85em;
	opacity: 0.7;
}

/* Przycisk Wyczyść */

.glm-services__reset {
	padding: 6px 14px;
	border: 1px solid #d63638;
	border-radius: 20px;
	background: #fff;
	color: #d63638;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.15s;
	line-height: 1.4;
	margin-left: 4px;
}

.glm-services__reset:hover {
	background: #d63638;
	color: #fff;
}

/* Loader */

.glm-services__loader {
	text-align: center;
	padding: 1em;
	color: #888;
}

/* Tabela */

.glm-services__table-wrap {
	transition: opacity 0.2s;
	overflow-x: auto;
}

.glm-services__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.glm-services__th {
	text-align: left;
	padding: 10px 8px;
	background: #f8f9fa;
	border-bottom: 2px solid #ddd;
	font-weight: 600;
	font-size: 13px;
	white-space: nowrap;
}

.glm-services__td {
	padding: 8px;
	border-bottom: 1px solid #f0f0f0;
	vertical-align: middle;
}

.glm-services__row:hover .glm-services__td {
	background: #f8f9fa;
}

/* Kolumny */

.glm-services__td--name {
	font-weight: 500;
}

.glm-services__name-link {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.glm-services__name-link:hover {
	color: #0073aa;
}

.glm-services__name-link:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.glm-services__name-btn {
	appearance: none;
	background: transparent;
	border: 0;
	padding: 0;
	margin: 0;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.glm-services__name-btn:hover {
	color: #0073aa;
}

.glm-services__name-btn:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* ── Popup opisu badania ── */

.glm-popup {
	position: fixed;
	inset: 0;
	display: none;
	z-index: 99999;
}

.glm-popup.glm-popup--open {
	display: block;
}

.glm-popup__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.glm-popup__dialog {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(720px, calc(100vw - 32px));
	max-height: min(80vh, 800px);
	overflow: auto;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	padding: 18px 18px 16px;
}

.glm-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 8px;
	background: #f0f0f0;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
}

.glm-popup__close:hover {
	background: #e5e5e5;
}

.glm-popup__title {
	margin: 0 40px 10px 0;
	font-size: 18px;
	line-height: 1.3;
}

.glm-popup__content {
	font-size: 14px;
	line-height: 1.55;
}

.glm-popup__content p:first-child {
	margin-top: 0;
}

.glm-popup-scroll-lock {
	overflow: hidden;
}

.glm-services__td--code {
	color: #888;
	font-size: 0.9em;
	white-space: nowrap;
}

.glm-services__td--price {
	font-weight: 600;
	color: #0073aa;
	white-space: nowrap;
}

.glm-services__td--material {
	font-size: 0.9em;
	color: #555;
}

.glm-services__td--days {
	white-space: nowrap;
	text-align: center;
}

.glm-services__td--home,
.glm-services__td--mail {
	text-align: center;
	white-space: nowrap;
}

.glm-services__th--home,
.glm-services__th--mail,
.glm-services__th--days {
	text-align: center;
}

.glm-services__count {
	margin-top: 0.8em;
	font-size: 13px;
	color: #888;
}

.glm-services__empty {
	padding: 2em 0;
	color: #888;
	text-align: center;
}

/* Paginacja */

.glm-services__pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 1em;
	justify-content: center;
}

.glm-services__page {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	color: #333;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
	line-height: 1.4;
	outline: none;
	user-select: none;
}

.glm-services__page:hover {
	border-color: #0073aa;
	color: #0073aa;
}

.glm-services__page.glm-services__page--active {
	background: #0073aa;
	border-color: #0073aa;
	color: #fff;
	cursor: default;
}

.glm-services__page--prev,
.glm-services__page--next {
	font-weight: 500;
}

/* ── Responsywność ── */

@media (max-width: 768px) {
	.glm-services__table {
		font-size: 13px;
	}

	.glm-services__th,
	.glm-services__td {
		padding: 6px 4px;
	}

	/* Ukryj mniej ważne kolumny na mobile */
	.glm-services__th--material,
	.glm-services__td--material,
	.glm-services__th--home,
	.glm-services__td--home,
	.glm-services__th--mail,
	.glm-services__td--mail {
		display: none;
	}

	.glm-search__item {
		flex-direction: column;
		gap: 4px;
	}
}
