/* ═══════════════════════════════════════════════════════════
   MM Chiptuning Konfigurator - Frontend Styles
   ═══════════════════════════════════════════════════════════ */

/* CSS Variables (overridden via wp_add_inline_style) */
:root {
	--mm-ct-primary: #e63946;
	--mm-ct-accent: #1d3557;
	--mm-ct-bg: #f8f9fa;
	--mm-ct-card-bg: #ffffff;
	--mm-ct-text: #212529;
	--mm-ct-text-muted: #6c757d;
	--mm-ct-border: #dee2e6;
	--mm-ct-radius: 8px;
	--mm-ct-shadow: 0 2px 8px rgba(0,0,0,0.08);
	--mm-ct-gain: #28a745;
}

/* ─── Container ───────────────────────────────────────────── */
.mm-ct-konfigurator {
	max-width: 900px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--mm-ct-text);
	line-height: 1.5;
}

.mm-ct-konfigurator * {
	box-sizing: border-box;
}

/* ─── Steps ───────────────────────────────────────────────── */
.mm-ct-step {
	display: none;
}
.mm-ct-step.mm-ct-active {
	display: block;
	animation: mmCtFadeIn 0.3s ease;
}

@keyframes mmCtFadeIn {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ─── Step Header ─────────────────────────────────────────── */
.mm-ct-step-header {
	text-align: center;
	margin-bottom: 32px;
}
.mm-ct-title {
	font-size: 28px;
	font-weight: 700;
	margin: 0 0 8px;
	color: var(--mm-ct-text);
}
.mm-ct-subtitle {
	color: var(--mm-ct-text-muted);
	margin: 0;
	font-size: 16px;
}

/* ─── Selectors ───────────────────────────────────────────── */
.mm-ct-selectors {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.mm-ct-select-group label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
	color: var(--mm-ct-text);
}

.mm-ct-dropdown {
	width: 100%;
	padding: 12px 16px;
	border: 2px solid var(--mm-ct-border);
	border-radius: var(--mm-ct-radius);
	background: var(--mm-ct-card-bg);
	font-size: 15px;
	line-height: 1.4;
	height: auto;
	min-height: 48px;
	color: var(--mm-ct-text);
	cursor: pointer;
	transition: border-color 0.2s;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c757d' stroke-width='2' fill='none'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	background-size: 12px 8px;
	padding-right: 40px;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}

.mm-ct-dropdown:focus {
	outline: none;
	border-color: var(--mm-ct-primary);
	box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.mm-ct-dropdown:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background-color: #f0f0f1;
}

/* ─── Loading ─────────────────────────────────────────────── */
.mm-ct-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 20px;
	color: var(--mm-ct-text-muted);
}

.mm-ct-spinner {
	width: 20px;
	height: 20px;
	border: 3px solid var(--mm-ct-border);
	border-top-color: var(--mm-ct-primary);
	border-radius: 50%;
	animation: mmCtSpin 0.6s linear infinite;
}

@keyframes mmCtSpin {
	to { transform: rotate(360deg); }
}

/* ─── Error ───────────────────────────────────────────────── */
.mm-ct-error {
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
	border-radius: var(--mm-ct-radius);
	padding: 12px 16px;
	margin: 16px 0;
	text-align: center;
}

/* ─── Results Header ──────────────────────────────────────── */
.mm-ct-results-header {
	margin-bottom: 32px;
}
.mm-ct-results-title {
	font-size: 24px;
	font-weight: 700;
	margin: 16px 0 4px;
}
.mm-ct-results-subtitle {
	color: var(--mm-ct-text-muted);
	margin: 0;
	font-size: 15px;
}

/* ─── Back Button ─────────────────────────────────────────── */
.mm-ct-btn {
	display: inline-block;
	padding: 10px 20px;
	border: 2px solid var(--mm-ct-border);
	border-radius: var(--mm-ct-radius);
	background: var(--mm-ct-card-bg);
	color: var(--mm-ct-text);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
	text-decoration: none;
}
.mm-ct-btn:hover {
	border-color: var(--mm-ct-text-muted);
	background: var(--mm-ct-bg);
}

.mm-ct-btn-primary {
	background: var(--mm-ct-primary);
	border-color: var(--mm-ct-primary);
	color: #fff;
}
.mm-ct-btn-primary:hover {
	background: color-mix(in srgb, var(--mm-ct-primary) 85%, black);
	border-color: color-mix(in srgb, var(--mm-ct-primary) 85%, black);
	color: #fff;
}
.mm-ct-btn-primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ─── Stage Cards ─────────────────────────────────────────── */
.mm-ct-stages-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
	gap: 20px;
	margin-bottom: 40px;
}

.mm-ct-stage-card {
	background: var(--mm-ct-card-bg);
	border: 2px solid var(--mm-ct-border);
	border-radius: var(--mm-ct-radius);
	overflow: hidden;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.mm-ct-stage-card:hover {
	border-color: var(--mm-ct-primary);
	box-shadow: var(--mm-ct-shadow);
}

.mm-ct-stage-header {
	background: var(--mm-ct-accent);
	color: #fff;
	padding: 16px 20px;
}
.mm-ct-stage-header h3 {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
}
.mm-ct-stage-price {
	margin-top: 4px;
	font-size: 18px;
	font-weight: 600;
	color: rgba(255,255,255,0.9);
}
.mm-ct-stage-price small {
	font-size: 12px;
	font-weight: 400;
	opacity: 0.7;
}

.mm-ct-stage-body {
	padding: 20px;
}

.mm-ct-stat-row {
	padding: 8px 0;
	border-bottom: 1px solid var(--mm-ct-border);
}
.mm-ct-stat-row:last-child { border-bottom: none; }

.mm-ct-stat-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--mm-ct-text-muted);
	margin-bottom: 4px;
}

.mm-ct-stat-values {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.mm-ct-stat-original {
	color: var(--mm-ct-text-muted);
	font-size: 15px;
}
.mm-ct-stat-arrow {
	color: var(--mm-ct-primary);
	font-size: 16px;
}
.mm-ct-stat-tuned {
	font-weight: 700;
	font-size: 17px;
	color: var(--mm-ct-text);
}
.mm-ct-stat-gain {
	background: rgba(40, 167, 69, 0.1);
	color: var(--mm-ct-gain);
	font-weight: 700;
	font-size: 13px;
	padding: 2px 8px;
	border-radius: 4px;
	margin-left: auto;
}

.mm-ct-stage-desc {
	padding: 12px 20px;
	font-size: 14px;
	color: var(--mm-ct-text-muted);
	border-top: 1px solid var(--mm-ct-border);
}

.mm-ct-stage-footer {
	padding: 12px 20px 20px;
}
.mm-ct-stage-footer .mm-ct-btn {
	width: 100%;
	text-align: center;
	font-size: 15px;
	padding: 12px;
}

.mm-ct-no-stages {
	text-align: center;
	padding: 40px;
	color: var(--mm-ct-text-muted);
	font-size: 16px;
}

/* ─── Chart ───────────────────────────────────────────────── */
.mm-ct-chart {
	background: var(--mm-ct-card-bg);
	border: 2px solid var(--mm-ct-border);
	border-radius: var(--mm-ct-radius);
	padding: 24px;
	margin-bottom: 32px;
}
.mm-ct-chart-title {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 20px;
}

.mm-ct-chart-group {
	margin-bottom: 24px;
}
.mm-ct-chart-group:last-child { margin-bottom: 0; }

.mm-ct-chart-label {
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 8px;
	color: var(--mm-ct-text);
}

.mm-ct-chart-bars {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.mm-ct-bar-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.mm-ct-bar-label {
	width: 70px;
	flex-shrink: 0;
	font-size: 12px;
	color: var(--mm-ct-text-muted);
	text-align: right;
}

.mm-ct-bar-track {
	flex: 1;
	background: var(--mm-ct-bg);
	border-radius: 4px;
	overflow: hidden;
	height: 28px;
}

.mm-ct-bar {
	height: 100%;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding: 0 10px;
	min-width: 60px;
	transition: width 0.6s ease;
}
.mm-ct-bar span {
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	white-space: nowrap;
}

.mm-ct-bar-original {
	background: var(--mm-ct-accent);
}
.mm-ct-bar-tuned {
	background: var(--mm-ct-primary);
}

/* ─── Inquiry Form ────────────────────────────────────────── */
.mm-ct-inquiry-header {
	margin-bottom: 24px;
}

.mm-ct-inquiry-badge {
	display: inline-block;
	background: var(--mm-ct-bg);
	border: 1px solid var(--mm-ct-border);
	border-radius: var(--mm-ct-radius);
	padding: 10px 16px;
	font-weight: 500;
	margin-bottom: 24px;
}

.mm-ct-inquiry-form {
	max-width: 520px;
}

.mm-ct-form-row {
	margin-bottom: 16px;
}
.mm-ct-form-row label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
}

.mm-ct-inquiry-form input[type="text"],
.mm-ct-inquiry-form input[type="email"],
.mm-ct-inquiry-form input[type="tel"],
.mm-ct-inquiry-form textarea {
	width: 100%;
	padding: 10px 14px;
	border: 2px solid var(--mm-ct-border);
	border-radius: var(--mm-ct-radius);
	font-size: 15px;
	color: var(--mm-ct-text);
	transition: border-color 0.2s;
	font-family: inherit;
}
.mm-ct-inquiry-form input:focus,
.mm-ct-inquiry-form textarea:focus {
	outline: none;
	border-color: var(--mm-ct-primary);
	box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.mm-ct-form-privacy label {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	font-weight: 400;
	font-size: 14px;
	color: var(--mm-ct-text-muted);
}
.mm-ct-form-privacy a {
	color: var(--mm-ct-primary);
}

.mm-ct-form-actions {
	margin-top: 24px;
}
.mm-ct-btn-submit {
	font-size: 16px;
	padding: 14px 32px;
}

/* Field Errors */
.mm-ct-field-error {
	border-color: #dc3545 !important;
}
.mm-ct-field-error-msg {
	display: block;
	color: #dc3545;
	font-size: 13px;
	margin-top: 4px;
}

/* ─── Success ─────────────────────────────────────────────── */
.mm-ct-inquiry-success {
	text-align: center;
	padding: 40px 20px;
}
.mm-ct-success-icon {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--mm-ct-gain);
	color: #fff;
	font-size: 30px;
	line-height: 60px;
	margin: 0 auto 16px;
}
.mm-ct-inquiry-success h3 {
	font-size: 22px;
	margin: 0 0 8px;
}
.mm-ct-inquiry-success p {
	color: var(--mm-ct-text-muted);
	margin: 0 0 24px;
}

/* ─── Maintenance Mode ────────────────────────────────────── */
.mm-ct-maintenance {
	text-align: center;
	padding: 60px 30px;
	background: var(--mm-ct-bg);
	border: 2px solid var(--mm-ct-border);
	border-radius: var(--mm-ct-radius);
}
.mm-ct-maintenance-icon {
	font-size: 56px;
	line-height: 1;
	margin-bottom: 16px;
}
.mm-ct-maintenance-title {
	font-size: 24px;
	font-weight: 700;
	margin: 0 0 12px;
	color: var(--mm-ct-text);
}
.mm-ct-maintenance-text {
	color: var(--mm-ct-text-muted);
	font-size: 16px;
	max-width: 480px;
	margin: 0 auto 20px;
	line-height: 1.6;
}
.mm-ct-maintenance-contact {
	font-size: 14px;
	color: var(--mm-ct-text-muted);
}
.mm-ct-maintenance-contact a {
	color: var(--mm-ct-primary);
	text-decoration: none;
	font-weight: 600;
}
.mm-ct-maintenance-contact a:hover {
	text-decoration: underline;
}

/* Admin maintenance notice (only visible for admins) */
.mm-ct-admin-maintenance-notice {
	background: #fff3cd;
	color: #856404;
	border: 1px solid #ffc107;
	border-radius: var(--mm-ct-radius);
	padding: 10px 16px;
	margin-bottom: 16px;
	font-size: 14px;
	text-align: center;
}
.mm-ct-admin-maintenance-notice a {
	color: #856404;
	font-weight: 600;
}

/* ─── CTA Button ──────────────────────────────────────────── */
.mm-ct-cta-wrapper {
	margin: 20px 0;
}
.mm-ct-cta-align-center { text-align: center; }
.mm-ct-cta-align-left   { text-align: left; }
.mm-ct-cta-align-right  { text-align: right; }

.mm-ct-cta-button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	border: 2px solid var(--mm-ct-primary);
	border-radius: var(--mm-ct-radius);
	font-weight: 700;
	cursor: pointer;
	transition: all 0.3s ease;
	text-transform: none;
	letter-spacing: 0.3px;
	font-family: inherit;
	position: relative;
	overflow: hidden;
}

.mm-ct-cta-button::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,0.15);
	transform: translateX(-100%);
	transition: transform 0.3s ease;
}
.mm-ct-cta-button:hover::after {
	transform: translateX(0);
}

/* Filled style */
.mm-ct-cta-filled {
	background: var(--mm-ct-primary);
	color: #fff;
}
.mm-ct-cta-filled:hover {
	background: color-mix(in srgb, var(--mm-ct-primary) 85%, black);
	border-color: color-mix(in srgb, var(--mm-ct-primary) 85%, black);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Outline style */
.mm-ct-cta-outline {
	background: transparent;
	color: var(--mm-ct-primary);
}
.mm-ct-cta-outline:hover {
	background: var(--mm-ct-primary);
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Sizes */
.mm-ct-cta-large {
	font-size: 18px;
	padding: 16px 36px;
}
.mm-ct-cta-small {
	font-size: 14px;
	padding: 10px 22px;
}

.mm-ct-cta-icon {
	font-size: 1.2em;
	line-height: 1;
}

/* Pulse animation on the CTA button */
@keyframes mmCtPulse {
	0% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.4); }
	70% { box-shadow: 0 0 0 12px rgba(230, 57, 70, 0); }
	100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0); }
}
.mm-ct-cta-filled {
	animation: mmCtPulse 2.5s infinite;
}
.mm-ct-cta-filled:hover {
	animation: none;
}

/* ─── Modal ───────────────────────────────────────────────── */
.mm-ct-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	align-items: center;
	justify-content: center;
}
.mm-ct-modal.mm-ct-modal-open {
	display: flex;
}

.mm-ct-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	animation: mmCtFadeIn 0.3s ease;
}

.mm-ct-modal-container {
	position: relative;
	background: #fff;
	border-radius: 12px;
	width: 95%;
	max-width: 960px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	animation: mmCtSlideUp 0.35s ease;
	z-index: 1;
}

@keyframes mmCtSlideUp {
	from {
		opacity: 0;
		transform: translateY(30px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.mm-ct-modal-close {
	position: sticky;
	top: 0;
	float: right;
	z-index: 10;
	width: 44px;
	height: 44px;
	border: none;
	background: rgba(0,0,0,0.05);
	border-radius: 50%;
	font-size: 28px;
	line-height: 1;
	color: var(--mm-ct-text-muted);
	cursor: pointer;
	transition: all 0.2s;
	margin: 12px 12px 0 0;
}
.mm-ct-modal-close:hover {
	background: rgba(0,0,0,0.1);
	color: var(--mm-ct-text);
	transform: rotate(90deg);
}

.mm-ct-modal-body {
	padding: 20px 32px 32px;
}

/* Prevent body scroll when modal is open */
body.mm-ct-modal-active {
	overflow: hidden;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
	.mm-ct-selectors {
		grid-template-columns: 1fr;
	}
	.mm-ct-stages-grid {
		grid-template-columns: 1fr;
	}
	.mm-ct-title {
		font-size: 22px;
	}
	.mm-ct-bar-label {
		width: 55px;
		font-size: 11px;
	}
	.mm-ct-stat-values {
		font-size: 14px;
	}
}

@media (max-width: 480px) {
	.mm-ct-konfigurator {
		padding: 0 8px;
	}
	.mm-ct-stage-header {
		padding: 12px 16px;
	}
	.mm-ct-stage-body {
		padding: 16px;
	}
	.mm-ct-stat-values {
		gap: 4px;
	}
	.mm-ct-stat-gain {
		margin-left: 0;
		margin-top: 4px;
	}
	.mm-ct-chart {
		padding: 16px;
	}
	.mm-ct-modal-body {
		padding: 12px 16px 20px;
	}
	.mm-ct-modal-container {
		width: 100%;
		max-height: 100vh;
		border-radius: 0;
	}
	.mm-ct-cta-large {
		font-size: 16px;
		padding: 14px 24px;
		width: 100%;
		justify-content: center;
	}
	.mm-ct-maintenance {
		padding: 40px 20px;
	}
	.mm-ct-maintenance-icon {
		font-size: 40px;
	}
	.mm-ct-maintenance-title {
		font-size: 20px;
	}
}
