/* Monitech Part Finder — front-end styles. Scoped under .mpf-widget. */

.mpf-widget {
	--mpf-accent: #0b6cb0;
	--mpf-accent-dark: #084e7e;
	--mpf-bg: #ffffff;
	--mpf-border: #d9dee3;
	--mpf-text: #1c2733;
	--mpf-muted: #5a6b7b;
	--mpf-radius: 12px;
	max-width: 920px;
	margin: 0 auto;
	color: var(--mpf-text);
	font-family: inherit;
	box-sizing: border-box;
}
.mpf-widget *, .mpf-widget *::before, .mpf-widget *::after { box-sizing: border-box; }
/* Ensure the HTML [hidden] attribute always wins over component display rules. */
.mpf-widget [hidden] { display: none !important; }

.mpf-intro { text-align: center; margin-bottom: 1.25rem; }
.mpf-heading { margin: 0 0 .35rem; font-size: 1.5rem; line-height: 1.2; }
.mpf-subtext { margin: 0 auto; max-width: 560px; color: var(--mpf-muted); font-size: .95rem; }

/* Upload area */
.mpf-form { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.mpf-drop {
	position: relative;
	width: 100%;
	min-height: 220px;
	border: 2px dashed var(--mpf-border);
	border-radius: var(--mpf-radius);
	background: #f7f9fb;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	transition: border-color .15s, background .15s;
	overflow: hidden;
}
.mpf-drop:hover, .mpf-drop.dragging { border-color: var(--mpf-accent); background: #eef5fb; }
.mpf-drop-inner { text-align: center; padding: 1.5rem; color: var(--mpf-muted); }
.mpf-icon { color: var(--mpf-accent); margin-bottom: .5rem; }
.mpf-drop-text { display: block; font-weight: 600; color: var(--mpf-text); }
.mpf-drop-hint { display: block; font-size: .8rem; margin-top: .25rem; }
.mpf-drop.has-image { min-height: 120px; }

/* Photo thumbnails (multi-upload, up to 4) */
.mpf-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; width: 100%; margin-top: -.25rem; }
.mpf-thumb { position: relative; aspect-ratio: 1/1; border: 1px solid var(--mpf-border); border-radius: 8px; overflow: hidden; background: #f2f5f8; }
.mpf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mpf-thumb-x {
	position: absolute; top: 3px; right: 3px;
	width: 22px; height: 22px; line-height: 20px;
	border: 0; border-radius: 50%;
	background: rgba(0,0,0,.6); color: #fff; font-size: 16px;
	cursor: pointer; padding: 0;
}
.mpf-thumb-x:hover { background: rgba(0,0,0,.85); }
.mpf-thumb-add {
	display: flex; align-items: center; justify-content: center;
	font-size: 2rem; color: var(--mpf-accent);
	background: #f7f9fb; border: 1px dashed var(--mpf-border); cursor: pointer;
}
.mpf-thumb-add:hover { background: #eef5fb; border-color: var(--mpf-accent); }

/* Submit */
.mpf-submit {
	background: var(--mpf-accent);
	color: #fff;
	border: 0;
	border-radius: 8px;
	padding: .8rem 1.8rem;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s, opacity .15s;
}
.mpf-submit:hover:not(:disabled) { background: var(--mpf-accent-dark); }
.mpf-submit:disabled { opacity: .5; cursor: not-allowed; }

/* Status */
.mpf-status { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: 1.25rem; color: var(--mpf-muted); }
.mpf-spinner {
	width: 18px; height: 18px;
	border: 3px solid #cfd8e0;
	border-top-color: var(--mpf-accent);
	border-radius: 50%;
	animation: mpf-spin .8s linear infinite;
}
@keyframes mpf-spin { to { transform: rotate(360deg); } }

/* Results */
.mpf-results { margin-top: 1.75rem; }
.mpf-results-title { font-size: 1.1rem; margin: 0 0 .9rem; }
.mpf-results-title--sub { margin-top: 1.6rem; font-size: 1rem; color: var(--mpf-muted); }

.mpf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 720px) { .mpf-grid { grid-template-columns: 1fr; } }

.mpf-card {
	border: 1px solid var(--mpf-border);
	border-radius: var(--mpf-radius);
	background: var(--mpf-bg);
	overflow: hidden;
	display: flex; flex-direction: column;
}
.mpf-card-media { position: relative; background: #f2f5f8; aspect-ratio: 4/3; }
.mpf-card-media img { width: 100%; height: 100%; object-fit: contain; }
.mpf-badge {
	position: absolute; top: .5rem; left: .5rem;
	font-size: .72rem; font-weight: 700;
	padding: .2rem .5rem; border-radius: 20px; color: #fff;
}
.mpf-badge--high { background: #1a8a4a; }
.mpf-badge--med  { background: #c47d12; }
.mpf-badge--low  { background: #8a8f97; }

.mpf-card-body { padding: .85rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.mpf-card-title { font-weight: 600; color: var(--mpf-text); text-decoration: none; line-height: 1.3; }
.mpf-card-title:hover { color: var(--mpf-accent); }
.mpf-sku { font-size: .78rem; color: var(--mpf-muted); letter-spacing: .02em; }
.mpf-price { font-weight: 700; color: var(--mpf-accent-dark); }
.mpf-price-was { font-weight: 400; color: var(--mpf-muted); text-decoration: line-through; font-size: .85em; margin-left: .35rem; }
.mpf-reason { font-size: .85rem; color: var(--mpf-muted); margin: .2rem 0; }
.mpf-stock { font-size: .78rem; font-weight: 600; }
.mpf-stock--in { color: #1a8a4a; }
.mpf-stock--out { color: #b5611a; }

.mpf-actions { margin-top: auto; display: flex; gap: .5rem; padding-top: .6rem; flex-wrap: wrap; }
.mpf-btn {
	flex: 1;
	display: inline-flex; align-items: center; justify-content: center;
	text-align: center; text-decoration: none !important;
	padding: .65rem .8rem; border-radius: 9px;
	font-size: .85rem; font-weight: 700; line-height: 1.1; white-space: nowrap;
	border: 1px solid transparent;
	transition: transform .12s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.mpf-btn--primary {
	background: var(--mpf-accent); color: #fff !important;
	box-shadow: 0 2px 6px rgba(11,108,176,.35);
}
.mpf-btn--primary:hover {
	background: var(--mpf-accent-dark); color: #fff !important;
	transform: translateY(-1px); box-shadow: 0 5px 14px rgba(11,108,176,.45);
}
.mpf-btn--ghost {
	background: #fff; color: var(--mpf-accent) !important;
	border-color: var(--mpf-accent);
}
.mpf-btn--ghost:hover { background: var(--mpf-accent); color: #fff !important; transform: translateY(-1px); }

/* "More matches" list */
.mpf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.mpf-list-row { display: flex; align-items: center; gap: .8rem; border: 1px solid var(--mpf-border); border-radius: 8px; padding: .5rem .7rem; }
.mpf-list-row img { width: 48px; height: 48px; object-fit: contain; background: #f2f5f8; border-radius: 5px; flex: none; }
.mpf-list-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mpf-list-main a { color: var(--mpf-text); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpf-list-main a:hover { color: var(--mpf-accent); }

/* Divider */
.mpf-divider { display: flex; align-items: center; text-align: center; color: var(--mpf-muted); margin: 1.75rem 0 1.25rem; font-size: .9rem; }
.mpf-divider::before, .mpf-divider::after { content: ""; flex: 1; border-top: 1px solid var(--mpf-border); }
.mpf-divider span { padding: 0 .9rem; }

/* Manual search */
.mpf-manual { width: 100%; display: flex; flex-direction: column; gap: .9rem; }
.mpf-manual-title { margin: 0 0 1rem; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em; }

/* Primary search field (the one users should notice first) */
.mpf-field--main > span { font-size: .82rem; }
.mpf-search-box { position: relative; display: block; }
.mpf-search-icon { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--mpf-muted); pointer-events: none; z-index: 1; }
/* High specificity + !important so the theme can't strip the icon padding. */
.mpf-widget .mpf-field--main .mpf-search-box input.mpf-keyword {
	width: 100%;
	padding: .95rem 1rem .95rem 3rem !important;
	font-size: 1.05rem;
	border: 1px solid var(--mpf-border);
	border-radius: 10px;
	background: #fff;
}
.mpf-widget .mpf-field--main .mpf-search-box input.mpf-keyword:focus { outline: none; border-color: var(--mpf-accent); box-shadow: 0 0 0 3px rgba(11,108,176,.14); }
.mpf-manual .mpf-submit--alt { width: 100%; margin-top: 0; }

/* Advanced filters — a quiet text link, NOT a button (override theme button styles) */
.mpf-widget .mpf-adv-toggle {
	align-self: center;
	display: inline-flex; align-items: center; gap: .35rem;
	width: auto !important;
	padding: .35rem .5rem !important;
	margin: 0 auto !important;
	background: none !important;
	border: 0 !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	color: var(--mpf-muted) !important;
	font-weight: 600; font-size: .88rem; line-height: 1.2;
	text-transform: none !important;
	cursor: pointer;
}
.mpf-widget .mpf-adv-toggle:hover { color: var(--mpf-accent) !important; background: none !important; text-decoration: underline; }
.mpf-adv-caret { transition: transform .18s ease; font-size: .7rem; }
.mpf-adv-toggle.is-open .mpf-adv-caret { transform: rotate(180deg); }
.mpf-adv { padding-top: 1rem; border-top: 1px dashed var(--mpf-border); }
.mpf-manual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .mpf-manual-grid { grid-template-columns: 1fr; } }
.mpf-field { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; color: var(--mpf-muted); }
.mpf-field > span { font-weight: 600; text-transform: uppercase; letter-spacing: .02em; font-size: .78rem; }
.mpf-field select, .mpf-field input {
	width: 100%;
	padding: .65rem .75rem;
	border: 1px solid var(--mpf-border);
	border-radius: 8px;
	font-size: .95rem;
	color: var(--mpf-text);
	background: #fff;
}
.mpf-field select:focus, .mpf-field input:focus { outline: none; border-color: var(--mpf-accent); box-shadow: 0 0 0 3px rgba(11,108,176,.12); }
.mpf-submit--alt { width: 100%; margin-top: 1.1rem; }

/* Site-wide popup — top dropdown panel ("mega menu" feel) */
html.mpf-modal-open { overflow: hidden; }
.mpf-modal { position: fixed; inset: 0; z-index: 100000; display: block; }
.mpf-modal[hidden] { display: none !important; }
.mpf-modal-overlay { position: absolute; inset: 0; background: rgba(15, 23, 32, .5); backdrop-filter: blur(2px); }
.mpf-modal-dialog {
	position: relative;
	background: #fff;
	width: min(1140px, 100vw);
	max-height: 88vh;
	margin: 0 auto;
	border-radius: 0 0 16px 16px;
	box-shadow: 0 18px 50px rgba(0,0,0,.28);
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	animation: mpf-slidedown .22s ease-out;
}
@keyframes mpf-slidedown { from { transform: translateY(-14px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.mpf-modal-body { padding: 2rem 1.75rem 2.25rem; }
.mpf-modal-close {
	position: absolute; top: .9rem; right: 1rem;
	width: 38px; height: 38px;
	border: 0; border-radius: 50%;
	background: #eef2f6; color: #1c2733;
	font-size: 22px; line-height: 1; cursor: pointer;
	z-index: 2;
}
.mpf-modal-close:hover { background: #dde5ec; }
@media (max-width: 600px) {
	.mpf-modal-dialog { width: 100vw; max-height: 100vh; border-radius: 0; }
	.mpf-modal-body { padding: 1.5rem 1rem 2rem; }
}

/* Section title (when manual + photo both shown) */
.mpf-section-title { margin: 0 0 .9rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .03em; color: var(--mpf-muted); }

/* Autocomplete suggestions */
.mpf-field--ac { position: relative; }
.mpf-suggest {
	position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
	background: #fff; border: 1px solid var(--mpf-border); border-top: 0;
	border-radius: 0 0 8px 8px; box-shadow: 0 10px 24px rgba(0,0,0,.12);
	max-height: 320px; overflow: auto;
}
.mpf-suggest-item { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; text-decoration: none; color: var(--mpf-text); border-bottom: 1px solid #eef2f5; }
.mpf-suggest-item:last-of-type { border-bottom: 0; }
.mpf-suggest-item:hover { background: #f3f8fc; }
.mpf-suggest-item img { width: 40px; height: 40px; object-fit: contain; background: #f2f5f8; border-radius: 5px; flex: none; }
.mpf-suggest-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mpf-suggest-title { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpf-suggest-price { font-weight: 700; color: var(--mpf-accent-dark); font-size: .85rem; white-space: nowrap; }
.mpf-suggest-empty { padding: .7rem .8rem; color: var(--mpf-muted); font-size: .88rem; }
.mpf-suggest-all {
	display: block; width: 100%; text-align: center;
	padding: .6rem; border: 0; border-top: 1px solid var(--mpf-border);
	background: #f7f9fb; color: var(--mpf-accent-dark); font-weight: 600; cursor: pointer; font-size: .85rem;
}
.mpf-suggest-all:hover { background: #eef5fb; }

/* Messages */
.mpf-message { border-radius: var(--mpf-radius); padding: 1rem 1.2rem; }
.mpf-error { background: #fdecec; color: #9b1c1c; border: 1px solid #f5c2c2; }
.mpf-nomatch { background: #f3f7fb; border: 1px solid var(--mpf-border); color: var(--mpf-text); }
.mpf-fallback { font-size: .88rem; color: var(--mpf-muted); margin-top: 1rem; text-align: center; }
.mpf-contact-link { color: var(--mpf-accent) !important; text-decoration: underline !important; font-weight: 600; }
.mpf-contact-link:hover { color: var(--mpf-accent-dark) !important; }
