/**
 * Matezex Catalog — Filters & Product Table.
 *
 * All selectors prefixed with .matezex-catalog to override WP theme styles.
 *
 * @package Matezex_Catalog_Mode
 */

/* === Catalog wrapper === */
.matezex-catalog {
	position: relative;
}

/* === Loading overlay === */
.matezex-catalog .matezex-loading {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
}

.matezex-catalog .matezex-spinner {
	width: 30px;
	height: 30px;
	border: 3px solid #ddd;
	border-top-color: #333;
	border-radius: 50%;
	animation: matezex-spin 0.6s linear infinite;
}

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

/* =========================================================================
   Filter panel — header + collapsible body
   ========================================================================= */

.matezex-catalog .matezex-filter-panel {
	display: flex;
	flex-direction: column;
	margin-bottom: 16px;
}

/* --- Filter header bar --- */
.matezex-catalog .matezex-filter-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #d9e1e7;
	padding: 8px 24px;
	border-radius: 16px 16px 0 0;
	min-height: 44px;
	box-sizing: border-box;
}

.matezex-catalog .matezex-filter-title {
	font-size: 20px;
	font-weight: 500;
	color: #0a0d0f;
	line-height: 1;
}

.matezex-catalog .matezex-filter-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.matezex-catalog .matezex-clear-all-filters {
	font-size: 16px;
	font-weight: 500;
	color: #0a0d0f !important;
	background: none !important;
	background-color: transparent !important;
	border: none;
	cursor: pointer;
	text-decoration: underline;
	padding: 12px 16px;
	line-height: 20px;
}

.matezex-catalog .matezex-clear-all-filters:hover,
.matezex-catalog .matezex-clear-all-filters:focus {
	color: #004cfe !important;
	background: none !important;
	background-color: transparent !important;
}

.matezex-catalog .matezex-filter-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	background: none !important;
	background-color: transparent !important;
	border: none;
	cursor: pointer;
	padding: 8px;
	color: #0a0d0f !important;
	transition: transform 0.2s ease;
}

.matezex-catalog .matezex-filter-toggle:hover,
.matezex-catalog .matezex-filter-toggle:focus {
	background: none !important;
	background-color: transparent !important;
	color: #004cfe !important;
}

.matezex-catalog .matezex-filter-toggle[aria-expanded="false"] {
	transform: rotate(180deg);
}

/* --- Filter body --- */
.matezex-catalog .matezex-filter-body {
	display: flex;
	flex-direction: column;
	gap: 16px;
	background: #ecf0f3;
	padding: 24px;
	border-radius: 0 0 16px 16px;
	overflow: hidden;
	transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
}

.matezex-catalog .matezex-filter-body.is-collapsed {
	max-height: 0 !important;
	padding-top: 0;
	padding-bottom: 0;
	opacity: 0;
	overflow: hidden;
}

/* --- Filter row (label left, pills right) --- */
.matezex-catalog .matezex-filter-row {
	display: flex;
	align-items: flex-start;
	gap: 24px;
	width: 100%;
}

.matezex-catalog .matezex-filter-label {
	flex-shrink: 0;
	font-size: 16px;
	font-weight: 500;
	color: #52697a;
	line-height: 1;
	padding-top: 8px;
	white-space: nowrap;
}

.matezex-catalog .matezex-filter-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	flex: 1 1 0;
	min-width: 0;
}

/* === Filter pills === */
.matezex-catalog .matezex-filter-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 16px;
	border: 1.5px solid transparent !important;
	border-radius: 9999px !important;
	background: #fff !important;
	background-color: #fff !important;
	font-size: 14px !important;
	font-weight: 500;
	color: #0a0d0f !important;
	cursor: pointer;
	transition: all 0.15s ease;
	line-height: 20px;
	height: 36px;
	box-sizing: border-box;
}

.matezex-catalog .matezex-filter-pill:hover,
.matezex-catalog .matezex-filter-pill:focus {
	border-color: #004cfe !important;
	background: #fff !important;
	background-color: #fff !important;
	color: #0a0d0f !important;
}

.matezex-catalog .matezex-filter-pill.is-active {
	background: #fff !important;
	background-color: #fff !important;
	color: #0a0d0f !important;
	border-color: #004cfe !important;
}

.matezex-catalog .matezex-filter-pill.is-active:hover,
.matezex-catalog .matezex-filter-pill.is-active:focus {
	background: #f0f4ff !important;
	background-color: #f0f4ff !important;
	color: #0a0d0f !important;
	border-color: #004cfe !important;
}

.matezex-catalog .matezex-filter-pill.is-disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.matezex-catalog .matezex-filter-pill.is-disabled:hover,
.matezex-catalog .matezex-filter-pill.is-disabled:focus {
	border-color: transparent !important;
	background: #fff !important;
	background-color: #fff !important;
	color: #0a0d0f !important;
}

/* --- Filter info text --- */
.matezex-catalog .matezex-filter-info {
	font-size: 16px;
	font-weight: 500;
	color: #0a0d0f;
	line-height: 1;
	min-height: 44px;
	display: flex;
	align-items: center;
}

/* --- "Zvolené produkty" scroll button --- */
.matezex-catalog .matezex-filter-scroll-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 16px;
	background: #004cfe !important;
	background-color: #004cfe !important;
	color: #eff2f5 !important;
	border: none !important;
	border-radius: 9999px !important;
	font-size: 16px !important;
	font-weight: 500;
	cursor: pointer;
	line-height: 20px;
	transition: background 0.15s ease;
	align-self: flex-start;
}

.matezex-catalog .matezex-filter-scroll-btn:hover,
.matezex-catalog .matezex-filter-scroll-btn:focus {
	background: #0040d6 !important;
	background-color: #0040d6 !important;
	color: #eff2f5 !important;
}

.matezex-catalog .matezex-filter-scroll-btn svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

/* === Results count === */
.matezex-catalog .matezex-results-count {
	font-size: 13px;
	color: #666;
	margin-bottom: 8px;
}

/* =========================================================================
   Table wrapper — horizontal scroll safety
   ========================================================================= */

.matezex-catalog .matezex-table-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* =========================================================================
   Product table
   ========================================================================= */

.matezex-catalog .matezex-product-table {
	width: 100% !important;
	border-collapse: collapse !important;
	border-spacing: 0 !important;
	font-size: 14px !important;
	table-layout: auto !important;
	border: none !important;
}

/* --- Blue title row --- */
.matezex-catalog .matezex-table-title-row th {
	background: #004cfe !important;
	color: #fff !important;
	font-size: 18px !important;
	font-weight: 500 !important;
	padding: 8px 16px !important;
	text-align: left !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
	line-height: 40px !important;
	border: none !important;
	border-radius: 16px 16px 0 0;
	position: sticky;
	top: 0;
	z-index: 6;
}

/* --- Column header row --- */
.matezex-catalog .matezex-table-columns-row th {
	background: #d9e1e7 !important;
	color: #000f26 !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	padding: 16px 24px !important;
	text-align: left !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
	border: none !important;
	border-bottom: 1px solid #fff !important;
	vertical-align: top;
	line-height: 1.3;
	position: sticky;
	top: 56px;
	z-index: 5;
}

/* --- Column sizing ---
 * Množství: shrink-to-fit (1% + nowrap) — takes only what buttons need.
 * Attr + Produkt: stretch to fill remaining space evenly.
 */
.matezex-catalog .matezex-col-quantity {
	width: 1% !important;
	white-space: nowrap;
}

/* --- Body cells --- */
.matezex-catalog .matezex-product-table tbody td {
	padding: 16px 24px !important;
	border: none !important;
	border-bottom: 1px solid #fff !important;
	vertical-align: middle;
	background: #ecf0f3 !important;
}

.matezex-catalog .matezex-product-table tbody td.matezex-col-name {
	min-width: 180px;
}

.matezex-catalog .matezex-product-table tbody tr:hover td {
	background: #e4eaf0 !important;
}

.matezex-catalog .matezex-table-row.is-on-sale td {
	background: #ecf0f3 !important;
}

/* --- Row highlight: product is in a cart --- */
.matezex-catalog .matezex-table-row.is-in-cart td {
	background: #d2dfff !important;
}

.matezex-catalog .matezex-table-row.is-in-cart:hover td {
	background: #c5d4fc !important;
}

/* --- Active cart button: hide original icon, show close icon --- */
.matezex-catalog button.matezex-btn.is-active .matezex-btn-icon {
	display: none !important;
}

.matezex-catalog button.matezex-btn.is-active .matezex-btn-close {
	display: inline-flex !important;
	align-items: center;
	margin-left: 4px;
}

.matezex-catalog button.matezex-btn.is-active .matezex-btn-close svg {
	width: 14px !important;
	height: 14px !important;
	stroke: currentColor;
}

.matezex-catalog button.matezex-btn:not(.is-active) .matezex-btn-close {
	display: none !important;
}

/* === SKU === */
.matezex-catalog .matezex-sku {
	display: block;
	font-size: 16px;
	font-weight: 400;
	color: #000f26;
	margin-top: 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* === Availability chips === */
.matezex-catalog .matezex-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 0;
}

.matezex-catalog .matezex-chip {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 9999px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	white-space: nowrap;
}

.matezex-catalog .matezex-chip-sale {
	background: #fe5000;
	color: #eff2f5;
}

.matezex-catalog .matezex-chip-instock {
	background: #7fe700;
	color: #0a0d0f;
}

.matezex-catalog .matezex-chip-within-week {
	background: #fdd700;
	color: #0a0d0f;
}

.matezex-catalog .matezex-chip-within-2-weeks {
	background: #fdd700;
	color: #0a0d0f;
}

.matezex-catalog .matezex-chip-on-order {
	background: #c2cdd6;
	color: #0a0d0f;
}

.matezex-catalog .matezex-chip-second-quality {
	background: #00a9fd;
	color: #eff2f5;
}

/* =========================================================================
   Quantity row  —  [−] [qty unit] [+]  [Objednat]  [Poptat]
   ========================================================================= */

.matezex-catalog .matezex-qty-row {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: nowrap;
}

.matezex-catalog .matezex-qty-control {
	display: inline-flex;
	align-items: center;
	gap: 0;
	flex-shrink: 0;
	background: #fff;
	border-radius: 9999px;
	height: 36px;
}

/* --- Minus button (secondary) --- */
.matezex-catalog button.matezex-qty-minus {
	width: 36px !important;
	height: 36px !important;
	min-width: 36px !important;
	min-height: 36px !important;
	max-width: 36px !important;
	max-height: 36px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	background: #c2cdd6 !important;
	background-color: #c2cdd6 !important;
	color: #0a0d0f !important;
	cursor: pointer;
	font-size: 0 !important;
	line-height: 1 !important;
	border-radius: 9999px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0 !important;
	box-shadow: none !important;
	outline: none !important;
	transition: background 0.15s ease;
	box-sizing: border-box !important;
}

.matezex-catalog button.matezex-qty-minus:hover,
.matezex-catalog button.matezex-qty-minus:focus {
	background: #a8b8c5 !important;
	background-color: #a8b8c5 !important;
	color: #0a0d0f !important;
}

.matezex-catalog button.matezex-qty-minus svg {
	width: 14px !important;
	height: 14px !important;
	flex-shrink: 0;
	stroke: currentColor;
}

/* --- Plus button (primary) --- */
.matezex-catalog button.matezex-qty-plus {
	width: 36px !important;
	height: 36px !important;
	min-width: 36px !important;
	min-height: 36px !important;
	max-width: 36px !important;
	max-height: 36px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	background: #0a0d0f !important;
	color: #fff !important;
	cursor: pointer;
	font-size: 0 !important;
	line-height: 1 !important;
	border-radius: 9999px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0 !important;
	box-shadow: none !important;
	outline: none !important;
	transition: background 0.15s ease;
	box-sizing: border-box !important;
}

.matezex-catalog button.matezex-qty-plus:hover,
.matezex-catalog button.matezex-qty-plus:focus {
	background: #333 !important;
	background-color: #333 !important;
	color: #fff !important;
}

.matezex-catalog button.matezex-qty-plus svg {
	width: 14px !important;
	height: 14px !important;
	flex-shrink: 0;
	stroke: currentColor;
}

/* --- Quantity display (number + unit) --- */
.matezex-catalog .matezex-qty-display {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 2px;
	width: 56px;
	height: 36px;
	padding: 4px 8px;
	box-sizing: border-box;
}

.matezex-catalog .matezex-qty-input {
	width: 28px !important;
	height: auto !important;
	text-align: center !important;
	border: none !important;
	outline: none !important;
	background: transparent !important;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	color: #0a0d0f !important;
	box-shadow: none !important;
	-moz-appearance: textfield;
	line-height: normal !important;
}

.matezex-catalog .matezex-qty-input::-webkit-inner-spin-button,
.matezex-catalog .matezex-qty-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.matezex-catalog .matezex-unit {
	font-size: 14px;
	font-weight: 500;
	color: #0a0d0f;
}

/* =========================================================================
   Action buttons  —  Objednat / Poptat  (outline style)
   ========================================================================= */

.matezex-catalog .matezex-action-buttons {
	display: flex;
	gap: 6px;
	align-items: center;
	flex-shrink: 1;
	min-width: 0;
}

/* Shared base style for both buttons — override ALL theme styles */
.matezex-catalog button.matezex-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	line-height: 16px !important;
	padding: 10px 14px !important;
	margin: 0 !important;
	white-space: nowrap !important;
	border-radius: 9999px !important;
	cursor: pointer !important;
	box-shadow: none !important;
	outline: none !important;
	text-decoration: none !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
	box-sizing: border-box !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.matezex-catalog button.matezex-btn svg {
	width: 14px !important;
	height: 14px !important;
	flex-shrink: 0;
}

/* --- Objednat (outline, dark border) --- */
.matezex-catalog button.matezex-add-order {
	border: 1.5px solid #0a0d0f !important;
	background: transparent !important;
	background-color: transparent !important;
	color: #0a0d0f !important;
}

.matezex-catalog button.matezex-add-order:hover,
.matezex-catalog button.matezex-add-order:focus {
	background: #0a0d0f !important;
	background-color: #0a0d0f !important;
	color: #fff !important;
}

.matezex-catalog button.matezex-add-order:hover svg,
.matezex-catalog button.matezex-add-order:focus svg {
	stroke: #fff;
}

/* --- Poptat (outline, dark border) --- */
.matezex-catalog button.matezex-add-inquiry {
	border: 1.5px solid #0a0d0f !important;
	background: transparent !important;
	background-color: transparent !important;
	color: #0a0d0f !important;
}

.matezex-catalog button.matezex-add-inquiry:hover,
.matezex-catalog button.matezex-add-inquiry:focus {
	background: #0a0d0f !important;
	background-color: #0a0d0f !important;
	color: #fff !important;
}

.matezex-catalog button.matezex-add-inquiry:hover svg,
.matezex-catalog button.matezex-add-inquiry:focus svg {
	stroke: #fff;
}

/* --- Active state: V objednávce (filled blue) --- */
.matezex-catalog button.matezex-add-order.is-active {
	border-color: #004cfe !important;
	background: #004cfe !important;
	color: #eff2f5 !important;
}

.matezex-catalog button.matezex-add-order.is-active svg {
	stroke: #eff2f5;
}

.matezex-catalog button.matezex-add-order.is-active:hover {
	background: #0040d6 !important;
	border-color: #0040d6 !important;
}

/* --- Active state: V poptávce (filled blue) --- */
.matezex-catalog button.matezex-add-inquiry.is-active {
	border-color: #004cfe !important;
	background: #004cfe !important;
	color: #eff2f5 !important;
}

.matezex-catalog button.matezex-add-inquiry.is-active svg {
	stroke: #eff2f5;
}

.matezex-catalog button.matezex-add-inquiry.is-active:hover {
	background: #0040d6 !important;
	border-color: #0040d6 !important;
}

/* =========================================================================
   Load More button
   ========================================================================= */

.matezex-catalog .matezex-pagination {
	display: flex;
	justify-content: center;
	margin-top: 24px;
}

.matezex-catalog .matezex-load-more-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 32px;
	background: #fff;
	color: #1a1a2e;
	border: 1.5px solid #1a1a2e;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.matezex-catalog .matezex-load-more-btn:hover {
	background: #1a1a2e;
	color: #fff;
}

.matezex-catalog .matezex-load-more-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* === Empty state === */
.matezex-catalog .matezex-empty-state {
	text-align: center;
	padding: 40px 20px;
	color: #666;
}

/* === Price === */
.matezex-catalog .matezex-price-from {
	font-size: 14px;
	color: #666;
}

/* =========================================================================
   Responsive — tablet (≤1200px)
   ========================================================================= */

@media (max-width: 1200px) {
	.matezex-catalog .matezex-product-table {
		font-size: 13px !important;
	}

	.matezex-catalog .matezex-table-columns-row th {
		font-size: 13px !important;
		padding: 12px 12px !important;
	}

	.matezex-catalog .matezex-product-table tbody td {
		padding: 12px 12px !important;
	}

	.matezex-catalog button.matezex-btn {
		padding: 8px 10px !important;
		font-size: 13px !important;
	}

	.matezex-catalog button.matezex-btn svg {
		width: 14px !important;
		height: 14px !important;
	}

	.matezex-catalog button.matezex-qty-minus,
	.matezex-catalog button.matezex-qty-plus {
		width: 32px !important;
		height: 32px !important;
		min-width: 32px !important;
		min-height: 32px !important;
		max-width: 32px !important;
		max-height: 32px !important;
	}

	.matezex-catalog .matezex-qty-control {
		height: 32px;
	}

	.matezex-catalog .matezex-qty-display {
		width: 48px;
		height: 32px;
	}

	.matezex-catalog .matezex-qty-input {
		font-size: 13px !important;
	}

	.matezex-catalog .matezex-unit {
		font-size: 13px;
	}

	.matezex-catalog .matezex-sku {
		font-size: 14px;
	}
}

/* =========================================================================
   Responsive — narrow (≤1024px): qty row wraps
   ========================================================================= */

@media (max-width: 1024px) {
	.matezex-catalog .matezex-qty-row {
		flex-wrap: wrap;
		gap: 6px;
	}

	/* columns auto-size, row wraps */
}

/* =========================================================================
   Responsive — mobile (≤768px): card layout
   ========================================================================= */

@media (max-width: 768px) {
	/* Stack table into cards */
	.matezex-catalog .matezex-product-table thead,
	.matezex-catalog .matezex-product-table tbody,
	.matezex-catalog .matezex-product-table tr,
	.matezex-catalog .matezex-product-table td {
		display: block !important;
	}

	/* Keep title row visible as full-width bar */
	.matezex-catalog .matezex-table-title-row {
		display: block !important;
	}

	.matezex-catalog .matezex-table-title-row th {
		display: block !important;
		border-radius: 16px 16px 0 0;
		position: static;
		font-size: 16px !important;
		line-height: 36px !important;
		padding: 6px 16px !important;
	}

	/* Hide column header row */
	.matezex-catalog .matezex-table-columns-row {
		display: none !important;
	}

	/* Card-style rows */
	.matezex-catalog .matezex-product-table tbody tr {
		border: 1px solid #e5e7eb !important;
		border-radius: 8px;
		padding: 12px !important;
		margin-bottom: 8px;
		background: #fff;
	}

	.matezex-catalog .matezex-product-table tbody td {
		border: none !important;
		border-bottom: none !important;
		padding: 4px 0 !important;
		width: 100% !important;
	}

	.matezex-catalog .matezex-product-table tbody td::before {
		content: attr(data-label);
		font-weight: 600;
		font-size: 11px;
		text-transform: uppercase;
		display: block;
		color: #6b7280;
		margin-bottom: 2px;
	}

	/* Reset column widths */
	.matezex-catalog .matezex-col-name,
	.matezex-catalog .matezex-col-attr,
	.matezex-catalog .matezex-col-quantity {
		width: 100% !important;
	}

	/* Quantity row */
	.matezex-catalog .matezex-qty-row {
		flex-wrap: wrap;
		gap: 8px;
	}

	.matezex-catalog .matezex-action-buttons {
		flex-wrap: wrap;
	}

	/* Filter panel: stack rows vertically */
	.matezex-catalog .matezex-filter-row {
		flex-direction: column;
		gap: 8px;
	}

	.matezex-catalog .matezex-filter-label {
		padding-top: 0;
	}

	.matezex-catalog .matezex-filter-header {
		padding: 8px 16px;
	}

	.matezex-catalog .matezex-filter-body {
		padding: 16px;
	}

	.matezex-catalog .matezex-filter-title {
		font-size: 18px;
	}
}
