/* ============================================================
   Mahira Virtual Try-On — frontend.css
   Scoped under .mvt-wrap to avoid theme bleed.
   Mobile-first, responsive.
============================================================ */

.mvt-wrap, .mvt-wrap * { box-sizing: border-box; }

/* Force-hide the [hidden] attribute even when the active theme overrides it. */
.mvt-wrap [hidden],
.mvt-modal[hidden],
.mvt-modal [hidden] { display: none !important; }

.mvt-wrap {
	--mvt-accent:    #b8895a;
	--mvt-accent-2:  #8d643b;
	--mvt-text:      #1a1a1a;
	--mvt-muted:     #6b6b6b;
	--mvt-bg:        #ffffff;
	--mvt-soft:      #faf6f1;
	--mvt-border:    #ece4d8;
	--mvt-danger:    #b91c1c;
	--mvt-radius:    14px;
	--mvt-shadow:    0 4px 18px rgba(0,0,0,.06);
	--mvt-shadow-lg: 0 20px 60px rgba(0,0,0,.22);

	max-width: 1200px;
	margin: 0 auto;
	padding: 24px 16px;
	color: var(--mvt-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Header ---------- */
.mvt-header { text-align: center; margin-bottom: 22px; }
.mvt-title {
	font-size: clamp(22px, 3.4vw, 32px);
	font-weight: 700;
	margin: 0 0 6px;
	color: var(--mvt-text);
	letter-spacing: -0.01em;
}
.mvt-subtitle {
	font-size: 15px;
	color: var(--mvt-muted);
	margin: 0 auto;
	max-width: 620px;
	line-height: 1.5;
}

/* ---------- Tabs ---------- */
.mvt-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	margin: 18px 0 22px;
	border-bottom: 1px solid var(--mvt-border);
	padding-bottom: 12px;
}
.mvt-tab {
	appearance: none;
	border: 1px solid var(--mvt-border);
	background: var(--mvt-bg);
	color: var(--mvt-text);
	padding: 9px 18px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all .18s ease;
}
.mvt-tab:hover { border-color: var(--mvt-accent); color: var(--mvt-accent-2); }
.mvt-tab.is-active {
	background: var(--mvt-accent);
	color: #fff;
	border-color: var(--mvt-accent);
	box-shadow: 0 4px 12px rgba(184,137,90,.25);
}

/* ---------- Grid ---------- */
.mvt-panel { display: none; }
.mvt-panel.is-active { display: block; }

.mvt-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 18px;
}
@media (max-width: 480px) {
	.mvt-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

.mvt-card {
	appearance: none;
	background: var(--mvt-bg);
	border: 1px solid var(--mvt-border);
	border-radius: var(--mvt-radius);
	padding: 0;
	cursor: pointer;
	overflow: hidden;
	text-align: left;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
	display: flex;
	flex-direction: column;
}
.mvt-card:hover {
	border-color: var(--mvt-accent);
	transform: translateY(-3px);
	box-shadow: var(--mvt-shadow);
}
.mvt-card-img {
	display: block;
	background: var(--mvt-soft);
	aspect-ratio: 1 / 1;
	overflow: hidden;
}
.mvt-card-img img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 14px;
	display: block;
}
.mvt-card-body {
	padding: 12px 14px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.mvt-card-title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--mvt-text);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.mvt-card-price {
	font-size: 13px;
	color: var(--mvt-accent-2);
	font-weight: 600;
}
.mvt-card-cta {
	font-size: 12px;
	color: var(--mvt-accent);
	font-weight: 600;
	margin-top: 6px;
}
.mvt-empty { color: var(--mvt-muted); text-align: center; padding: 24px; }

/* ---------- Buttons ---------- */
.mvt-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 22px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 999px;
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
	line-height: 1.2;
	transition: all .18s ease;
	min-height: 44px;
	font-family: inherit;
}
.mvt-btn-primary {
	background: var(--mvt-accent);
	color: #fff;
	border-color: var(--mvt-accent);
}
.mvt-btn-primary:hover { background: var(--mvt-accent-2); border-color: var(--mvt-accent-2); }
.mvt-btn-secondary {
	background: #fff;
	color: var(--mvt-accent-2);
	border-color: var(--mvt-accent);
}
.mvt-btn-secondary:hover { background: var(--mvt-soft); }
.mvt-btn-ghost {
	background: transparent;
	color: var(--mvt-muted);
	border-color: var(--mvt-border);
}
.mvt-btn-ghost:hover { color: var(--mvt-text); border-color: var(--mvt-muted); }

/* ---------- Modal ---------- */
body.mvt-modal-open { overflow: hidden; }

.mvt-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.mvt-modal[hidden] { display: none; }

.mvt-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 15, 10, .72);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}
.mvt-modal-dialog {
	position: relative;
	background: #fff;
	border-radius: 18px;
	max-width: 560px;
	width: 100%;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	box-shadow: var(--mvt-shadow-lg);
	padding: 28px 24px 24px;
	animation: mvt-pop .25s cubic-bezier(.2,.8,.2,1.05);
}
@keyframes mvt-pop {
	from { transform: scale(.95); opacity: 0; }
	to   { transform: scale(1);   opacity: 1; }
}
.mvt-modal-close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	color: #555;
	cursor: pointer;
}
.mvt-modal-close:hover { background: #f3f3f3; color: #000; }

/* Selected product header */
.mvt-selected {
	display: flex;
	gap: 14px;
	align-items: center;
	padding: 10px 12px;
	background: var(--mvt-soft);
	border-radius: 12px;
	margin-bottom: 18px;
}
.mvt-selected img {
	width: 56px;
	height: 56px;
	object-fit: contain;
	background: #fff;
	border-radius: 10px;
	padding: 6px;
}
.mvt-sel-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--mvt-muted);
}
.mvt-sel-name {
	font-size: 15px;
	font-weight: 600;
	margin-top: 2px;
}
.mvt-sel-tip {
	font-size: 12px;
	color: var(--mvt-muted);
	margin-top: 4px;
	line-height: 1.4;
}

/* Source picker */
.mvt-source h3 {
	font-size: 18px;
	margin: 0 0 16px;
	text-align: center;
	font-weight: 600;
}
.mvt-source-buttons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}
@media (max-width: 420px) {
	.mvt-source-buttons { grid-template-columns: 1fr; }
}

/* Camera */
.mvt-camera video {
	width: 100%;
	max-height: 60vh;
	object-fit: cover;
	border-radius: 12px;
	background: #000;
	transform: scaleX(-1); /* mirror for selfie UX */
}
.mvt-cam-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-top: 14px;
	flex-wrap: wrap;
}

/* Preview */
.mvt-preview img {
	width: 100%;
	max-height: 60vh;
	object-fit: contain;
	background: var(--mvt-soft);
	border-radius: 12px;
	display: block;
}
.mvt-preview-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-top: 14px;
	flex-wrap: wrap;
}

/* Loading */
.mvt-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 50px 10px;
	text-align: center;
}
.mvt-spinner {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 4px solid var(--mvt-border);
	border-top-color: var(--mvt-accent);
	animation: mvt-spin 0.9s linear infinite;
}
@keyframes mvt-spin { to { transform: rotate(360deg); } }
.mvt-loading p { margin: 0; color: var(--mvt-muted); font-size: 14px; }

/* Result */
.mvt-result img {
	width: 100%;
	max-height: 65vh;
	object-fit: contain;
	background: var(--mvt-soft);
	border-radius: 12px;
	display: block;
}
.mvt-result-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-top: 16px;
	flex-wrap: wrap;
}
.mvt-quota-notice {
	margin-top: 12px;
	padding: 8px 14px;
	background: #fef6e0;
	color: #8a6d1a;
	border: 1px solid #f4d77b;
	border-radius: 8px;
	font-size: 13px;
	text-align: center;
}

/* Error */
.mvt-error {
	margin-top: 14px;
	padding: 10px 14px;
	background: #fdecec;
	color: var(--mvt-danger);
	border-radius: 10px;
	font-size: 14px;
	text-align: center;
	line-height: 1.4;
}
.mvt-error[hidden] { display: none; }

/* Small screens */
@media (max-width: 520px) {
	.mvt-modal-dialog { padding: 20px 16px 18px; border-radius: 14px; }
	.mvt-title { font-size: 22px; }
	.mvt-subtitle { font-size: 14px; }
	.mvt-tab { padding: 8px 14px; font-size: 13px; }
}
