/* ==========================================================================
   MSD WEBDESIGN - MULTI-STEP POPUP FORM
   Animated, Premium Gold & Blue Design
   ========================================================================== */

/* ===== OVERLAY ===== */

.msd-popup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(5, 10, 25, 0.85);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s ease, visibility 0.4s ease;
}

.msd-popup-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

/* ===== POPUP BOX ===== */

.msd-popup {
	position: relative;
	width: 100%;
	max-width: 540px;
	background: linear-gradient(160deg, #0d1e3a 0%, #0a1628 60%, #0d1e3a 100%);
	border: 1px solid rgba(201, 168, 76, 0.3);
	border-radius: 16px;
	overflow: hidden;
	box-shadow:
		0 0 0 1px rgba(201, 168, 76, 0.1),
		0 30px 80px rgba(0, 0, 0, 0.8),
		0 0 60px rgba(201, 168, 76, 0.08),
		inset 0 1px 0 rgba(255, 255, 255, 0.05);
	transform: translateY(30px) scale(0.96);
	transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.msd-popup-overlay.is-open .msd-popup {
	transform: translateY(0) scale(1);
}

/* Gold top accent line */
.msd-popup::before {
	content: '';
	position: absolute;
	top: 0; left: 0; right: 0;
	height: 2px;
	background: linear-gradient(90deg,
		transparent 0%,
		#c9a84c 20%,
		#e8c97a 50%,
		#c9a84c 80%,
		transparent 100%
	);
	animation: msd-form-gold-line 3s ease-in-out infinite;
}

@keyframes msd-form-gold-line {
	0%, 100% { opacity: 0.6; }
	50% { opacity: 1; }
}

/* ===== CLOSE BUTTON ===== */

.msd-popup__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: rgba(245, 240, 232, 0.5);
	font-size: 1.1rem;
	line-height: 1;
	transition: all 0.2s ease;
	z-index: 10;
}

.msd-popup__close:hover {
	background: rgba(201, 168, 76, 0.15);
	border-color: rgba(201, 168, 76, 0.4);
	color: var(--opt-gold);
	transform: rotate(90deg);
}

/* ===== PROGRESS BAR ===== */

.msd-popup__progress {
	padding: 1.8rem 2.5rem 0;
}

.msd-popup__progress-track {
	height: 3px;
	background: rgba(255, 255, 255, 0.06);
	border-radius: 10px;
	overflow: hidden;
	margin-bottom: 0.7rem;
}

.msd-popup__progress-fill {
	height: 100%;
	background: linear-gradient(90deg, #c9a84c, #e8c97a);
	border-radius: 10px;
	transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
	box-shadow: 0 0 10px rgba(201, 168, 76, 0.6);
	width: 20%;
}

.msd-popup__progress-label {
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: rgba(201, 168, 76, 0.6);
	text-align: right;
}

/* ===== STEPS WRAPPER ===== */

.msd-popup__body {
	padding: 2rem 2.5rem 2.5rem;
	min-height: 280px;
	position: relative;
}

/* ===== SINGLE STEP ===== */

.msd-popup__step {
	display: none;
	flex-direction: column;
	gap: 1.5rem;
	animation: msd-step-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.msd-popup__step.is-active {
	display: flex;
}

.msd-popup__step.is-leaving {
	animation: msd-step-out 0.3s ease forwards;
}

@keyframes msd-step-in {
	from {
		opacity: 0;
		transform: translateX(40px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes msd-step-out {
	from {
		opacity: 1;
		transform: translateX(0);
	}
	to {
		opacity: 0;
		transform: translateX(-40px);
	}
}

/* Step back animation */
.msd-popup__step.is-entering-back {
	animation: msd-step-in-back 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes msd-step-in-back {
	from {
		opacity: 0;
		transform: translateX(-40px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* ===== STEP ICON ===== */

.msd-popup__step-icon {
	width: 52px;
	height: 52px;
	border-radius: 14px;
	background: linear-gradient(135deg, rgba(201, 168, 76, 0.15), rgba(201, 168, 76, 0.05));
	border: 1px solid rgba(201, 168, 76, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	margin-bottom: 0.3rem;
}

/* ===== STEP TITLE & SUBTITLE ===== */

.msd-popup__step-title {
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-size: 1.7rem;
	font-weight: 400;
	color: #f5f0e8;
	line-height: 1.2;
	margin: 0;
}

.msd-popup__step-subtitle {
	font-size: 0.85rem;
	color: rgba(245, 240, 232, 0.5);
	margin: 0.3rem 0 0;
	line-height: 1.5;
}

/* ===== INPUT FIELDS ===== */

.msd-popup__field {
	position: relative;
}

.msd-popup__input,
.msd-popup__textarea {
	width: 100%;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	padding: 1rem 1.2rem;
	font-family: 'Outfit', sans-serif;
	font-size: 1rem;
	color: #f5f0e8;
	outline: none;
	transition: all 0.3s ease;
	box-sizing: border-box;
	caret-color: #c9a84c;
}

.msd-popup__input::placeholder,
.msd-popup__textarea::placeholder {
	color: rgba(245, 240, 232, 0.25);
}

.msd-popup__input:focus,
.msd-popup__textarea:focus {
	border-color: rgba(201, 168, 76, 0.6);
	background: rgba(201, 168, 76, 0.04);
	box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1),
	            0 0 20px rgba(201, 168, 76, 0.08);
}

.msd-popup__input.is-valid {
	border-color: rgba(90, 200, 130, 0.5);
	background: rgba(90, 200, 130, 0.04);
}

.msd-popup__input.is-error {
	border-color: rgba(220, 80, 80, 0.6);
	animation: msd-shake 0.4s ease;
}

@keyframes msd-shake {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-6px); }
	40% { transform: translateX(6px); }
	60% { transform: translateX(-4px); }
	80% { transform: translateX(4px); }
}

/* Validation checkmark */
.msd-popup__field-check {
	position: absolute;
	right: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: #5ac882;
	font-size: 1.1rem;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.msd-popup__input.is-valid + .msd-popup__field-check {
	opacity: 1;
}

.msd-popup__textarea {
	resize: none;
	height: 110px;
	line-height: 1.6;
}

/* Error message */
.msd-popup__error {
	font-size: 0.75rem;
	color: rgba(220, 100, 100, 0.9);
	margin-top: 0.4rem;
	display: none;
}

.msd-popup__error.is-visible {
	display: block;
	animation: msd-step-in 0.3s ease;
}

/* ===== TIME OPTIONS (Step 4) ===== */

.msd-popup__time-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.7rem;
}

.msd-popup__time-option {
	padding: 0.8rem 1rem;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	font-size: 0.82rem;
	color: rgba(245, 240, 232, 0.6);
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
	font-family: 'Outfit', sans-serif;
	position: relative;
	overflow: hidden;
}

.msd-popup__time-option:hover {
	border-color: rgba(201, 168, 76, 0.4);
	color: #e8c97a;
	background: rgba(201, 168, 76, 0.06);
}

.msd-popup__time-option.is-selected {
	border-color: rgba(201, 168, 76, 0.7);
	background: rgba(201, 168, 76, 0.12);
	color: #e8c97a;
	box-shadow: 0 0 15px rgba(201, 168, 76, 0.15);
}

.msd-popup__time-option.is-selected::before {
	content: '✓ ';
	color: #c9a84c;
}

/* Custom time input */
.msd-popup__time-custom {
	grid-column: 1 / -1;
	margin-top: 0.3rem;
}

/* ===== NAVIGATION BUTTONS ===== */

.msd-popup__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 0.5rem;
}

.msd-popup__back {
	background: none;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	padding: 0.85rem 1.5rem;
	font-family: 'Outfit', sans-serif;
	font-size: 0.8rem;
	color: rgba(245, 240, 232, 0.45);
	cursor: pointer;
	transition: all 0.2s ease;
	letter-spacing: 0.05em;
}

.msd-popup__back:hover {
	border-color: rgba(255, 255, 255, 0.25);
	color: rgba(245, 240, 232, 0.8);
}

.msd-popup__back:disabled {
	opacity: 0;
	pointer-events: none;
}

.msd-popup__next {
	flex: 1;
	position: relative;
	padding: 1rem 2rem;
	background: linear-gradient(135deg, #e8c97a 0%, #c9a84c 50%, #d4af5c 100%);
	border: none;
	border-radius: 10px;
	font-family: 'Outfit', sans-serif;
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: #0a1428;
	cursor: pointer;
	overflow: hidden;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
	            box-shadow 0.3s ease;
	box-shadow:
		0 0 20px rgba(201, 168, 76, 0.5),
		inset 0 -2px 8px rgba(255,255,255,0.3),
		inset 0 1px 2px rgba(255,255,255,0.5);
}

/* Gloss on next button */
.msd-popup__next::after {
	content: '';
	position: absolute;
	top: 0; left: 0; right: 0;
	height: 50%;
	background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, transparent 100%);
	border-radius: 10px 10px 0 0;
	pointer-events: none;
}

.msd-popup__next:hover {
	transform: translateY(-2px);
	box-shadow:
		0 8px 30px rgba(201, 168, 76, 0.7),
		inset 0 -2px 8px rgba(255,255,255,0.35);
}

.msd-popup__next:active {
	transform: translateY(0) scale(0.98);
}

/* ===== SUCCESS STATE ===== */

.msd-popup__success {
	display: none;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 1.2rem;
	padding: 1rem 0;
}

.msd-popup__success.is-active {
	display: flex;
	animation: msd-step-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.msd-popup__success-icon {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: linear-gradient(135deg, rgba(201, 168, 76, 0.2), rgba(201, 168, 76, 0.05));
	border: 2px solid rgba(201, 168, 76, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2rem;
	animation: msd-success-pulse 2s ease-in-out infinite;
	box-shadow: 0 0 30px rgba(201, 168, 76, 0.2);
}

@keyframes msd-success-pulse {
	0%, 100% { box-shadow: 0 0 20px rgba(201, 168, 76, 0.2); }
	50% { box-shadow: 0 0 40px rgba(201, 168, 76, 0.4); }
}

.msd-popup__success-title {
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-size: 1.8rem;
	color: #f5f0e8;
}

.msd-popup__success-text {
	font-size: 0.9rem;
	color: rgba(245, 240, 232, 0.55);
	line-height: 1.7;
	max-width: 340px;
}

.msd-popup__success-close {
	padding: 0.85rem 2rem;
	background: transparent;
	border: 1px solid rgba(201, 168, 76, 0.4);
	border-radius: 10px;
	color: #c9a84c;
	font-family: 'Outfit', sans-serif;
	font-size: 0.8rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-top: 0.5rem;
}

.msd-popup__success-close:hover {
	background: rgba(201, 168, 76, 0.1);
	border-color: rgba(201, 168, 76, 0.7);
}

/* ===== STEP DOTS ===== */

.msd-popup__dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 0 2.5rem 1.5rem;
}

.msd-popup__dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	transition: all 0.3s ease;
}

.msd-popup__dot.is-active {
	background: #c9a84c;
	width: 18px;
	border-radius: 3px;
	box-shadow: 0 0 8px rgba(201, 168, 76, 0.6);
}

.msd-popup__dot.is-done {
	background: rgba(201, 168, 76, 0.4);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 580px) {
	.msd-popup {
		border-radius: 12px;
	}

	.msd-popup__body {
		padding: 1.5rem 1.5rem 2rem;
	}

	.msd-popup__progress {
		padding: 1.5rem 1.5rem 0;
	}

	.msd-popup__dots {
		padding: 0 1.5rem 1.2rem;
	}

	.msd-popup__step-title {
		font-size: 1.4rem;
	}

	.msd-popup__time-options {
		grid-template-columns: 1fr;
	}

	.msd-popup__nav {
		flex-direction: column-reverse;
	}

	.msd-popup__back {
		width: 100%;
		text-align: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.msd-popup__step { animation: none; }
	.msd-popup { transition: none; }
	.msd-popup-overlay { transition: none; }
}
