/**
 * Vehicle Tire Catalogue — front-end styles.
 *
 * Scoped under .vtc-catalogue / .vtc-* to avoid clashing with themes.
 *
 * @package VehicleTireCatalogue
 */

.vtc-catalogue {
	--vtc-accent: #1f6feb;
	--vtc-accent-dark: #1554b8;
	--vtc-border: #e2e6ea;
	--vtc-bg: #ffffff;
	--vtc-muted: #6b7280;
	--vtc-radius: 10px;
	max-width: 100%;
	margin: 0 0 2rem;
	color: #1f2933;
	font-size: 16px;
	line-height: 1.5;
}

.vtc-catalogue *,
.vtc-catalogue *::before,
.vtc-catalogue *::after {
	box-sizing: border-box;
}

.vtc-catalogue__title {
	margin: 0 0 1rem;
	font-size: 1.6rem;
	font-weight: 700;
}

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

.vtc-filter-form {
	background: var(--vtc-bg);
	border: 1px solid var(--vtc-border);
	border-radius: var(--vtc-radius);
	padding: 1.5rem;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.04 );
}

.vtc-filter-grid {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.vtc-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.vtc-label {
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--vtc-muted);
}

.vtc-select {
	width: 100%;
	min-height: 44px;
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--vtc-border);
	border-radius: 8px;
	background: #fff;
	font-size: 1rem;
}

.vtc-select:disabled {
	background: #f3f4f6;
	color: #9ca3af;
	cursor: not-allowed;
}

.vtc-arrow {
	text-align: center;
	color: var(--vtc-accent);
	font-size: 1.1rem;
	line-height: 1;
	margin: -0.15rem 0;
}

.vtc-field.is-loading .vtc-select {
	background-image: linear-gradient( 90deg, #f3f4f6 0, #e5e7eb 40%, #f3f4f6 80% );
	background-size: 200% 100%;
	animation: vtc-shimmer 1.1s infinite;
}

@keyframes vtc-shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* --------------------------------------------------------------- Button */

.vtc-field--submit {
	margin-top: 0.5rem;
}

.vtc-search-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	min-height: 48px;
	padding: 0.75rem 1.5rem;
	border: 0;
	border-radius: 8px;
	background: var(--vtc-accent);
	color: #fff;
	font-size: 1.05rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

.vtc-search-btn:hover {
	background: var(--vtc-accent-dark);
}

.vtc-search-btn:disabled {
	opacity: 0.7;
	cursor: default;
}

/* -------------------------------------------------------------- Spinner */

.vtc-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid rgba( 255, 255, 255, 0.5 );
	border-top-color: #fff;
	border-radius: 50%;
	animation: vtc-spin 0.7s linear infinite;
}

.vtc-search-btn.is-loading .vtc-spinner {
	display: inline-block;
}

.vtc-spinner--lg {
	width: 26px;
	height: 26px;
	border-width: 3px;
	border-color: rgba( 31, 111, 235, 0.25 );
	border-top-color: var(--vtc-accent);
	display: inline-block;
	vertical-align: middle;
}

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

.vtc-loading {
	padding: 2rem 0;
	text-align: center;
	color: var(--vtc-muted);
}

/* -------------------------------------------------------------- Results */

.vtc-results {
	margin-top: 1.5rem;
}

.vtc-results-summary {
	margin-bottom: 1rem;
	font-size: 0.95rem;
}

.vtc-results-summary__label {
	color: var(--vtc-muted);
	margin-right: 0.35rem;
}

.vtc-results-summary__value {
	font-weight: 600;
}

.vtc-results-count {
	margin-bottom: 1rem;
	font-weight: 600;
	color: var(--vtc-muted);
}

.vtc-empty {
	padding: 2rem;
	text-align: center;
	background: #f9fafb;
	border: 1px dashed var(--vtc-border);
	border-radius: var(--vtc-radius);
	color: var(--vtc-muted);
}

/* --------------------------------------------------------- Catalogue card */

.vtc-catalogue-card {
	border: 1px solid var(--vtc-border);
	border-radius: var(--vtc-radius);
	background: #fff;
	overflow: hidden;
	margin-bottom: 1.5rem;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.05 );
}

.vtc-catalogue-card__header {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	padding: 1.5rem;
}

.vtc-catalogue-card__image {
	flex: 0 0 240px;
	max-width: 240px;
}

.vtc-catalogue-card__image img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
}

.vtc-catalogue-card__intro {
	flex: 1 1 320px;
	min-width: 260px;
}

.vtc-badge {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 0.5rem;
}

.vtc-badge--featured {
	background: #fff3cd;
	color: #92600a;
}

.vtc-catalogue-card__title {
	margin: 0 0 0.75rem;
	font-size: 1.4rem;
	font-weight: 700;
}

.vtc-spec-list {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	gap: 0.35rem 1.5rem;
}

.vtc-spec-list li {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.35rem 0;
	border-bottom: 1px solid #f1f3f5;
	font-size: 0.92rem;
}

.vtc-spec-list li span {
	color: var(--vtc-muted);
}

.vtc-catalogue-card__desc {
	color: #374151;
	font-size: 0.95rem;
}

/* -------------------------------------------------------------- Products */

.vtc-products {
	border-top: 1px solid var(--vtc-border);
	padding: 1.5rem;
	background: #fafbfc;
}

.vtc-products__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.vtc-products__heading {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 700;
}

.vtc-sort {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
	color: var(--vtc-muted);
}

.vtc-sort-select {
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--vtc-border);
	border-radius: 6px;
	background: #fff;
}

.vtc-product-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 200px, 1fr ) );
	gap: 1rem;
}

.vtc-product {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--vtc-border);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.vtc-product:hover {
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.08 );
	transform: translateY( -2px );
}

.vtc-product__link {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	color: inherit;
	text-decoration: none;
}

.vtc-product__link:hover .vtc-product__name {
	color: var(--vtc-accent);
}

.vtc-product__link:focus-visible {
	outline: 2px solid var(--vtc-accent);
	outline-offset: 2px;
}

.vtc-product__image {
	aspect-ratio: 1 / 1;
	background: #f3f4f6;
	display: flex;
	align-items: center;
	justify-content: center;
}

.vtc-product__image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 0.75rem;
}

.vtc-product__body {
	flex: 1 1 auto;
	padding: 0.85rem;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.vtc-product__brand {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--vtc-accent);
}

.vtc-product__name {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}

.vtc-product__sku {
	font-size: 0.78rem;
	color: var(--vtc-muted);
}

.vtc-product__price {
	margin-top: 0.25rem;
	font-size: 1.15rem;
	font-weight: 700;
	color: #111827;
}

.vtc-product__footer {
	padding: 0 0.85rem 0.85rem;
}

.vtc-product__btn {
	display: block;
	width: 100%;
	text-align: center;
	padding: 0.55rem 0.75rem;
	border-radius: 6px;
	background: var(--vtc-accent);
	color: #fff !important;
	font-weight: 600;
	font-size: 0.9rem;
	text-decoration: none;
	transition: background 0.15s ease;
}

.vtc-product__btn:hover {
	background: var(--vtc-accent-dark);
	color: #fff !important;
}

.vtc-no-products {
	padding: 1.5rem;
	color: var(--vtc-muted);
	font-style: italic;
}

/* --------------------------------------------------------- Select2 tweaks */

.vtc-catalogue .select2-container--default .select2-selection--single {
	height: 44px;
	border: 1px solid var(--vtc-border);
	border-radius: 8px;
}

.vtc-catalogue .select2-container--default .select2-selection--single .select2-selection__rendered {
	line-height: 42px;
	padding-left: 12px;
}

.vtc-catalogue .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 42px;
}

/* ------------------------------------------------------------ Responsive */

@media ( min-width: 782px ) {
	.vtc-filter-grid {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: flex-end;
		gap: 0.5rem 0.75rem;
	}

	.vtc-filter-grid .vtc-field {
		flex: 1 1 0;
		min-width: 130px;
	}

	.vtc-filter-grid .vtc-arrow {
		flex: 0 0 auto;
		align-self: center;
		transform: rotate( -90deg );
		margin: 0;
		padding-bottom: 0.6rem;
	}

	.vtc-field--submit {
		flex: 0 0 auto;
		margin-top: 0;
	}

	.vtc-search-btn {
		width: auto;
	}
}

@media ( max-width: 520px ) {
	.vtc-spec-list {
		grid-template-columns: 1fr;
	}

	.vtc-catalogue-card__image {
		flex: 1 1 100%;
		max-width: 100%;
	}
}

/* ------------------------------------------ Form-only (vertical) variant */

/* The [vehicle_catalogue_form] shortcode renders a compact, always-vertical
   form (wrapper carries .vtc-catalogue--redirect), even on wide screens. */
.vtc-catalogue--redirect {
	max-width: 360px;
}

/* Hide the connecting arrows for the compact form. */
.vtc-catalogue--redirect .vtc-arrow {
	display: none;
}

/* Tighter spacing + smaller controls. */
.vtc-catalogue--redirect .vtc-filter-form {
	padding: 1rem;
}

.vtc-catalogue--redirect .vtc-filter-grid {
	gap: 0.5rem;
}

.vtc-catalogue--redirect .vtc-field {
	gap: 0.2rem;
}

.vtc-catalogue--redirect .vtc-label {
	font-size: 0.7rem;
}

.vtc-catalogue--redirect .vtc-select {
	min-height: 38px;
	padding: 0.4rem 0.6rem;
	font-size: 0.95rem;
}

.vtc-catalogue--redirect .vtc-field--submit {
	margin-top: 0.35rem;
}

.vtc-catalogue--redirect .vtc-search-btn {
	width: 100%;
	min-height: 42px;
	padding: 0.55rem 1rem;
	font-size: 1rem;
}

/* Compact Select2 controls for the form-only variant. */
.vtc-catalogue--redirect .select2-container--default .select2-selection--single {
	height: 38px;
}

.vtc-catalogue--redirect .select2-container--default .select2-selection--single .select2-selection__rendered {
	line-height: 36px;
}

.vtc-catalogue--redirect .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 36px;
}

/* Keep the compact form vertical on wide screens too. */
@media ( min-width: 782px ) {
	.vtc-catalogue--redirect .vtc-filter-grid {
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: stretch;
		gap: 0.5rem;
	}

	.vtc-catalogue--redirect .vtc-filter-grid .vtc-field {
		flex: 1 1 auto;
		min-width: 0;
	}

	.vtc-catalogue--redirect .vtc-search-btn {
		width: 100%;
	}
}

/* ---------------------------------------------------- Product detail page */

.vtc-product-page {
	color: #1f2933;
	font-size: 16px;
	line-height: 1.55;
}

.vtc-back-link {
	display: inline-block;
	margin-bottom: 1rem;
	font-size: 0.9rem;
	color: #1f6feb;
	text-decoration: none;
}

.vtc-back-link:hover {
	text-decoration: underline;
}

.vtc-pp-top {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid #e2e6ea;
}

.vtc-pp-media {
	flex: 0 0 320px;
	max-width: 320px;
}

.vtc-pp-logo {
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b7280;
	margin-bottom: 0.5rem;
}

.vtc-pp-image {
	background: #f3f4f6;
	border: 1px solid #e2e6ea;
	border-radius: 12px;
	padding: 1.5rem;
	text-align: center;
}

.vtc-pp-image img {
	max-width: 100%;
	height: auto;
}

.vtc-pp-info {
	flex: 1 1 340px;
	min-width: 300px;
}

.vtc-pp-brand,
.vtc-pp-subbrand {
	font-size: 0.85rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #1f6feb;
}

.vtc-pp-title {
	margin: 0.25rem 0 0.5rem;
	font-size: 1.8rem;
	font-weight: 700;
	line-height: 1.2;
}

.vtc-pp-model {
	font-size: 1.05rem;
	color: #374151;
	margin-bottom: 1rem;
}

.vtc-pp-specs {
	width: 100%;
	border-collapse: collapse;
	margin: 0.5rem 0 1rem;
}

.vtc-pp-specs th,
.vtc-pp-specs td {
	text-align: left;
	padding: 0.4rem 0.75rem 0.4rem 0;
	border-bottom: 1px solid #f1f3f5;
	font-size: 0.95rem;
	vertical-align: top;
}

.vtc-pp-specs th {
	color: #6b7280;
	font-weight: 600;
	white-space: nowrap;
	width: 45%;
}

.vtc-pp-price {
	font-size: 1.6rem;
	font-weight: 700;
	margin: 0.75rem 0;
}

.vtc-pp-reviews-count {
	color: #6b7280;
	font-size: 0.9rem;
	margin-bottom: 1rem;
}

.vtc-stars {
	color: #f0b429;
	margin-right: 0.35rem;
	letter-spacing: 2px;
}

.vtc-pp-actions {
	margin-top: 1rem;
}

.vtc-pp-buy {
	display: inline-block;
	width: auto;
	padding: 0.7rem 1.5rem;
}

.vtc-pp-section {
	padding: 1.5rem 0;
	border-bottom: 1px solid #e2e6ea;
}

.vtc-pp-section h2 {
	font-size: 1.25rem;
	font-weight: 700;
	margin: 0 0 0.75rem;
}

.vtc-pp-section h3 {
	font-size: 1rem;
	font-weight: 700;
	margin: 1rem 0 0.5rem;
	color: #374151;
}

.vtc-pp-specs--additional th {
	width: 40%;
}

.vtc-pp-features {
	margin: 0.5rem 0 0;
	padding-left: 1.25rem;
}

.vtc-pp-features li {
	margin-bottom: 0.35rem;
}

.vtc-muted {
	color: #6b7280;
}

.vtc-pp-review-btn,
.vtc-pp-buy {
	color: #fff !important;
}

@media ( max-width: 620px ) {
	.vtc-pp-media {
		flex: 1 1 100%;
		max-width: 100%;
	}
}
