/**
 * Truck Parts Finder — Frontend Stylesheet
 * Industrial / Heavy-Duty theme: dark slate + safety yellow.
 */

/* ---------- Variables ---------- */
:root {
	--tpf-slate-900: #0f172a;
	--tpf-slate-800: #1e293b;
	--tpf-slate-700: #334155;
	--tpf-slate-600: #475569;
	--tpf-slate-500: #64748b;
	--tpf-slate-400: #94a3b8;
	--tpf-slate-300: #cbd5e1;
	--tpf-slate-200: #e2e8f0;
	--tpf-slate-100: #f1f5f9;
	--tpf-slate-50:  #f8fafc;

	--tpf-yellow:    #facc15;
	--tpf-yellow-dark: #ca8a04;
	--tpf-yellow-glow: #fde047;

	--tpf-steel:     #94a3b8;
	--tpf-iron:      #475569;
	--tpf-rust:      #b91c1c;
	--tpf-cream:     #fef3c7;

	--tpf-radius-sm: 4px;
	--tpf-radius:    6px;
	--tpf-radius-lg: 10px;

	--tpf-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
	--tpf-shadow:    0 4px 12px rgba(15, 23, 42, 0.15);
	--tpf-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.25);

	--tpf-font-heading: "Oswald", "Bebas Neue", "Impact", "Arial Narrow", sans-serif;
	--tpf-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--tpf-font-mono: "JetBrains Mono", "Consolas", monospace;
}

/* ---------- Wrapper ---------- */
.tpf-wrap {
	--tpf-accent: var(--tpf-yellow);
	font-family: var(--tpf-font-body);
	color: var(--tpf-slate-800);
	background:
		linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
	background-color: var(--tpf-slate-900);
	border: 1px solid var(--tpf-slate-700);
	border-radius: var(--tpf-radius-lg);
	overflow: hidden;
	box-shadow: var(--tpf-shadow-lg);
	margin: 1.5em 0;
	position: relative;
}

/* Hazard stripe accent along the top edge */
.tpf-wrap::before {
	content: "";
	display: block;
	height: 6px;
	background: repeating-linear-gradient(
		45deg,
		var(--tpf-yellow) 0,
		var(--tpf-yellow) 14px,
		var(--tpf-slate-900) 14px,
		var(--tpf-slate-900) 28px
	);
}

/* ---------- Header ---------- */
.tpf-header {
	padding: 28px 28px 18px;
	color: var(--tpf-slate-50);
	text-align: left;
	border-bottom: 1px solid rgba(250, 204, 21, 0.15);
	position: relative;
}

.tpf-header__title {
	font-family: var(--tpf-font-heading);
	font-size: 2rem;
	line-height: 1.1;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--tpf-slate-50);
	margin: 0 0 6px 0;
	position: relative;
	display: inline-block;
}

/* Yellow underline accent */
.tpf-header__title::after {
	content: "";
	display: block;
	width: 56px;
	height: 4px;
	background: var(--tpf-yellow);
	margin-top: 8px;
	border-radius: 2px;
}

.tpf-header__subtitle {
	font-size: 0.95rem;
	color: var(--tpf-slate-300);
	margin: 0;
	max-width: 720px;
	line-height: 1.5;
}

/* ---------- Notice (admin warning) ---------- */
.tpf-notice {
	padding: 12px 28px;
	font-size: 0.875rem;
	line-height: 1.5;
}
.tpf-notice--warning {
	background: var(--tpf-cream);
	color: #78350f;
	border-bottom: 1px solid #fde68a;
}

/* ---------- Form / Filters ---------- */
.tpf-form {
	padding: 22px 28px 8px;
	background: var(--tpf-slate-800);
}

.tpf-filters {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
	margin-bottom: 18px;
}

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

.tpf-field {
	background: var(--tpf-slate-900);
	border: 1px solid var(--tpf-slate-700);
	border-radius: var(--tpf-radius);
	padding: 12px 14px 10px;
	transition: border-color 0.2s, background 0.2s;
	position: relative;
}

.tpf-field.is-enabled {
	border-color: var(--tpf-yellow);
	background: linear-gradient(180deg, var(--tpf-slate-900) 0%, #18233a 100%);
}

.tpf-field.is-disabled {
	opacity: 0.55;
}

.tpf-field.is-loading {
	border-color: var(--tpf-slate-500);
}
.tpf-field.is-loading .tpf-field__spinner {
	display: inline-block;
}

.tpf-field__label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--tpf-slate-400);
	margin: 0 0 8px;
}

.tpf-field.is-enabled .tpf-field__label {
	color: var(--tpf-yellow);
}

.tpf-field__label .dashicons {
	width: 14px;
	height: 14px;
	font-size: 14px;
}

.tpf-field__control {
	position: relative;
	display: flex;
	align-items: center;
}

.tpf-select {
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-color: var(--tpf-slate-50);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231e293b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	border: 2px solid var(--tpf-slate-600);
	border-radius: var(--tpf-radius-sm);
	color: var(--tpf-slate-900);
	font-family: var(--tpf-font-body);
	font-size: 0.95rem;
	font-weight: 600;
	padding: 10px 36px 10px 12px;
	line-height: 1.4;
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.tpf-select:focus {
	outline: none;
	border-color: var(--tpf-yellow);
	box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.25);
}

.tpf-select:disabled {
	background-color: var(--tpf-slate-200);
	color: var(--tpf-slate-500);
	cursor: not-allowed;
	border-color: var(--tpf-slate-500);
}

.tpf-select option {
	color: var(--tpf-slate-900);
	background: white;
	font-weight: 500;
}

/* Lock icon — shown only when disabled */
.tpf-field__lock {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--tpf-slate-500);
	font-size: 16px;
	width: 16px;
	height: 16px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s;
}
.tpf-field.is-disabled .tpf-field__lock {
	opacity: 1;
}

/* Spinner — shown while loading via AJAX */
.tpf-field__spinner {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid var(--tpf-slate-500);
	border-top-color: var(--tpf-yellow);
	border-radius: 50%;
	animation: tpf-spin 0.7s linear infinite;
}

@keyframes tpf-spin {
	to { transform: translateY(-50%) rotate(360deg); }
}

.tpf-field__hint {
	font-size: 0.72rem;
	color: var(--tpf-slate-500);
	margin: 6px 0 0;
	min-height: 14px;
	line-height: 1.3;
}
.tpf-field.is-enabled .tpf-field__hint {
	color: var(--tpf-slate-400);
}

/* ---------- Action buttons ---------- */
.tpf-actions {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 18px;
}

.tpf-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--tpf-font-heading);
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	border: none;
	border-radius: var(--tpf-radius-sm);
	padding: 12px 22px;
	cursor: pointer;
	transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
	line-height: 1;
}

.tpf-btn .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
}

.tpf-btn--primary {
	background: var(--tpf-yellow);
	color: var(--tpf-slate-900);
	box-shadow: 0 4px 0 var(--tpf-yellow-dark);
}
.tpf-btn--primary:hover:not(:disabled) {
	background: var(--tpf-yellow-glow);
	transform: translateY(-1px);
	box-shadow: 0 5px 0 var(--tpf-yellow-dark);
}
.tpf-btn--primary:active:not(:disabled) {
	transform: translateY(2px);
	box-shadow: 0 2px 0 var(--tpf-yellow-dark);
}
.tpf-btn--primary:disabled {
	background: var(--tpf-slate-600);
	color: var(--tpf-slate-400);
	cursor: not-allowed;
	box-shadow: 0 4px 0 var(--tpf-slate-700);
}

.tpf-btn--ghost {
	background: transparent;
	color: var(--tpf-slate-200);
	border: 2px solid var(--tpf-slate-600);
}
.tpf-btn--ghost:hover {
	color: var(--tpf-yellow);
	border-color: var(--tpf-yellow);
	background: rgba(250, 204, 21, 0.05);
}

/* ---------- Results ---------- */
.tpf-results {
	background: var(--tpf-slate-50);
	padding: 22px 28px 28px;
	min-height: 200px;
}

.tpf-results__initial {
	text-align: center;
	padding: 36px 20px;
	color: var(--tpf-slate-500);
	font-size: 0.95rem;
	line-height: 1.6;
}
.tpf-results__initial .dashicons {
	font-size: 36px;
	width: 36px;
	height: 36px;
	color: var(--tpf-slate-400);
	display: block;
	margin: 0 auto 12px;
}
.tpf-results__initial p {
	margin: 0;
}

.tpf-results__summary {
	font-family: var(--tpf-font-heading);
	font-size: 0.9rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--tpf-slate-600);
	margin-bottom: 16px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--tpf-slate-200);
}
.tpf-results__summary strong {
	color: var(--tpf-slate-900);
}

.tpf-results__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
}

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

/* ---------- Product card ---------- */
.tpf-product-card {
	background: white;
	border: 1px solid var(--tpf-slate-200);
	border-radius: var(--tpf-radius);
	overflow: hidden;
	transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
	display: flex;
	flex-direction: column;
	box-shadow: var(--tpf-shadow-sm);
}
.tpf-product-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--tpf-shadow);
	border-color: var(--tpf-slate-300);
}

.tpf-product-card__image {
	position: relative;
	display: block;
	background: var(--tpf-slate-100);
	aspect-ratio: 4 / 3;
	overflow: hidden;
}
.tpf-product-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}
.tpf-product-card:hover .tpf-product-card__image img {
	transform: scale(1.04);
}

.tpf-product-card__badge {
	position: absolute;
	top: 8px;
	right: 8px;
	background: var(--tpf-rust);
	color: white;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 4px 8px;
	border-radius: var(--tpf-radius-sm);
}
.tpf-product-card__badge--out { background: var(--tpf-rust); }

.tpf-product-card__body {
	padding: 14px 14px 12px;
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 6px;
}

.tpf-product-card__category {
	display: inline-block;
	font-family: var(--tpf-font-heading);
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--tpf-yellow-dark);
	background: rgba(250, 204, 21, 0.15);
	padding: 3px 8px;
	border-radius: 3px;
	align-self: flex-start;
}

.tpf-product-card__title {
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
	margin: 0;
	color: var(--tpf-slate-900);
}
.tpf-product-card__title a {
	color: inherit;
	text-decoration: none;
}
.tpf-product-card__title a:hover {
	color: var(--tpf-iron);
}

.tpf-product-card__fitment {
	font-size: 0.78rem;
	color: var(--tpf-slate-500);
	line-height: 1.4;
	font-weight: 500;
}

.tpf-product-card__sku {
	font-family: var(--tpf-font-mono);
	font-size: 0.72rem;
	color: var(--tpf-slate-500);
}
.tpf-product-card__sku-label {
	color: var(--tpf-slate-400);
	margin-right: 4px;
}
.tpf-product-card__sku-value {
	color: var(--tpf-slate-700);
	font-weight: 600;
}

.tpf-product-card__footer {
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid var(--tpf-slate-100);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.tpf-product-card__price {
	font-family: var(--tpf-font-heading);
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--tpf-slate-900);
	letter-spacing: 0.02em;
}
.tpf-product-card__price del {
	color: var(--tpf-slate-400);
	font-weight: 400;
	font-size: 0.85rem;
	margin-right: 4px;
}
.tpf-product-card__price ins {
	background: none;
	text-decoration: none;
	color: var(--tpf-rust);
}

.tpf-product-card__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--tpf-slate-900);
	color: white;
	font-family: var(--tpf-font-heading);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 8px 14px;
	border-radius: var(--tpf-radius-sm);
	text-decoration: none;
	transition: background 0.15s, transform 0.1s;
	border: 2px solid var(--tpf-slate-900);
}
.tpf-product-card__button:hover {
	background: var(--tpf-yellow);
	color: var(--tpf-slate-900);
	border-color: var(--tpf-yellow);
	transform: translateY(-1px);
}

/* ---------- Empty results ---------- */
.tpf-results__empty {
	text-align: center;
	padding: 40px 20px;
	background: var(--tpf-slate-100);
	border-radius: var(--tpf-radius);
	border: 1px dashed var(--tpf-slate-300);
}
.tpf-results__empty .dashicons {
	font-size: 36px;
	width: 36px;
	height: 36px;
	color: var(--tpf-slate-400);
	display: block;
	margin: 0 auto 12px;
}
.tpf-results__empty p {
	color: var(--tpf-slate-500);
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.5;
	max-width: 420px;
	margin: 0 auto;
}

/* ---------- Pagination ---------- */
.tpf-pagination {
	margin-top: 22px;
	display: flex;
	justify-content: center;
}
.tpf-pagination ul {
	display: flex;
	gap: 4px;
	list-style: none;
	padding: 0;
	margin: 0;
	flex-wrap: wrap;
	justify-content: center;
}
.tpf-pagination__item a,
.tpf-pagination__item span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	font-family: var(--tpf-font-heading);
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--tpf-slate-700);
	background: white;
	border: 1px solid var(--tpf-slate-300);
	border-radius: var(--tpf-radius-sm);
	text-decoration: none;
	cursor: pointer;
	transition: all 0.12s;
}
.tpf-pagination__item a:hover {
	background: var(--tpf-slate-100);
	border-color: var(--tpf-slate-500);
}
.tpf-pagination__item.is-active span,
.tpf-pagination__item.is-active a {
	background: var(--tpf-yellow);
	border-color: var(--tpf-yellow-dark);
	color: var(--tpf-slate-900);
}

/* ---------- Error state ---------- */
.tpf-error {
	padding: 16px 20px;
	background: #fef2f2;
	border-left: 4px solid var(--tpf-rust);
	color: #7f1d1d;
	border-radius: var(--tpf-radius-sm);
	font-size: 0.9rem;
	line-height: 1.5;
}

/* ---------- Loading overlay ---------- */
.tpf-results.is-loading {
	position: relative;
}
.tpf-results.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(248, 250, 252, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
}

/* ---------- RTL support ---------- */
[dir="rtl"] .tpf-select {
	background-position: left 12px center;
	padding: 10px 12px 10px 36px;
}
[dir="rtl"] .tpf-field__lock,
[dir="rtl"] .tpf-field__spinner {
	right: auto;
	left: 12px;
}
