/* ═══════════════════════════════════════════════════════════════
   JMD JEWELLERS — UNIFIED LOGIN / REGISTER (AJAX + TRANSITIONS)
   Ivory & Gold — Luxurious step flow
   ═══════════════════════════════════════════════════════════════ */

/* Hide default "My account" page title on this page */
.woocommerce-account .page-header,
.woocommerce-account .entry-title {
	display: none !important;
}
.woocommerce-account .page-content {
	padding-top: 0;
}

.jmd-auth {
	--jmd-ivory: #FBF8F3;
	--jmd-ivory-warm: #F5F0E8;
	--jmd-cream: #EDE7DB;
	--jmd-cream-dark: #DDD5C5;
	--jmd-gold-rich: #B8860B;
	--jmd-gold-deep: #9A7209;
	--jmd-gold-home: #C9A04A;
	--jmd-gold-bright: #D4A843;
	--jmd-gold-glow: #E8C96D;
	--jmd-text-dark: #2A2118;
	--jmd-text-body: #5C4F3D;
	--jmd-text-muted: #8A7D6B;
	--jmd-white: #FFFFFF;
	--jmd-border: rgba(185, 134, 11, 0.18);
	--jmd-border-soft: rgba(185, 134, 11, 0.08);
	--jmd-shadow-soft: 0 4px 24px rgba(42, 33, 24, 0.06);
	--jmd-shadow-lift: 0 24px 64px rgba(42, 33, 24, 0.1);
	--jmd-shadow-gold: 0 8px 32px rgba(185, 134, 11, 0.12);
	--jmd-ease: cubic-bezier(0.23, 1, 0.32, 1);
	--jmd-ease-out: cubic-bezier(0.33, 1, 0.68, 1);
	--jmd-step-duration: 0.45s;
	font-family: 'Poppins', sans-serif;
	min-height: 72vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3rem 1.5rem;
	position: relative;
	overflow: hidden;
	background:
		radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201, 160, 74, 0.06) 0%, transparent 55%),
		radial-gradient(ellipse 60% 40% at 100% 100%, rgba(201, 160, 74, 0.04) 0%, transparent 50%),
		linear-gradient(180deg, var(--jmd-ivory) 0%, var(--jmd-ivory-warm) 100%);
}
.jmd-auth::before {
	content: '';
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0.35;
	background-image:
		url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 15 L30 25 L25 15Z' fill='none' stroke='%23C9A04A' stroke-width='0.35' opacity='0.25'/%3E%3C/svg%3E"),
		url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='50' cy='50' r='1' fill='%23C9A04A' opacity='0.12'/%3E%3C/svg%3E");
	background-size: 56px 56px, 36px 36px;
}

.jmd-auth__inner {
	width: 100%;
	max-width: 440px;
	position: relative;
	z-index: 1;
}

/* Brand block */
.jmd-auth__brand {
	text-align: center;
	margin-bottom: 2.5rem;
}
.jmd-auth__ornament {
	display: block;
	color: var(--jmd-gold-home);
	font-size: 1.5rem;
	letter-spacing: 0.25em;
	margin-bottom: 0.6rem;
	opacity: 0;
	transform: translateY(10px);
	animation: jmdAuthFadeIn 0.6s var(--jmd-ease) forwards;
}
.jmd-auth__title {
	font-size: 2rem;
	font-weight: 600;
	color: var(--jmd-text-dark);
	margin: 0 0 0.35rem;
	letter-spacing: 0.02em;
	opacity: 0;
	transform: translateY(10px);
	animation: jmdAuthFadeIn 0.6s var(--jmd-ease) 0.08s forwards;
}
.jmd-auth__subtitle {
	font-size: 0.9375rem;
	color: var(--jmd-text-muted);
	margin: 0;
	opacity: 0;
	transform: translateY(10px);
	animation: jmdAuthFadeIn 0.6s var(--jmd-ease) 0.16s forwards;
}
/* Decorative divider under brand */
.jmd-auth__brand::after {
	content: '';
	display: block;
	width: 64px;
	height: 1px;
	margin: 1.5rem auto 0;
	background: linear-gradient(90deg, transparent, var(--jmd-gold-home), transparent);
	opacity: 0.4;
}

@keyframes jmdAuthFadeIn {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Steps container – only one step visible; others off-screen with transition */
.jmd-auth__steps {
	position: relative;
	min-height: 300px;
	overflow: hidden;
}

.jmd-auth__step {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	opacity: 0;
	visibility: hidden;
	transform: translateX(24px);
	transition: opacity var(--jmd-step-duration) var(--jmd-ease),
	            visibility 0s linear var(--jmd-step-duration),
	            transform var(--jmd-step-duration) var(--jmd-ease);
	pointer-events: none;
}

.jmd-auth__step--active {
	position: relative;
	opacity: 1;
	visibility: visible;
	transform: translateX(0);
	pointer-events: auto;
	transition: opacity var(--jmd-step-duration) var(--jmd-ease),
	            visibility 0s linear 0s,
	            transform var(--jmd-step-duration) var(--jmd-ease);
}

/* Exiting step: slide left and fade */
.jmd-auth__step--exit {
	position: absolute;
	opacity: 0;
	visibility: visible;
	transform: translateX(-24px);
	pointer-events: none;
	transition: opacity var(--jmd-step-duration) var(--jmd-ease),
	            transform var(--jmd-step-duration) var(--jmd-ease);
}

/* Form card – elevated, with subtle gold accent */
.jmd-auth__form {
	background: var(--jmd-white);
	border-radius: 16px;
	padding: 2rem 1.75rem;
	box-shadow: var(--jmd-shadow-soft), var(--jmd-shadow-gold);
	border: 1px solid var(--jmd-border);
	position: relative;
	overflow: hidden;
}
.jmd-auth__form::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--jmd-gold-deep), var(--jmd-gold-bright), var(--jmd-gold-deep));
	opacity: 0.9;
}

.jmd-auth__field {
	margin-bottom: 1.35rem;
}
.jmd-auth__field--login-otp {
	margin-top: 1rem;
}
.jmd-auth__label {
	display: block;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--jmd-text-dark);
	margin-bottom: 0.5rem;
	letter-spacing: 0.01em;
}
.jmd-auth__input {
	width: 100%;
	padding: 0.85rem 1.1rem;
	font-size: 1rem;
	font-family: inherit;
	color: var(--jmd-text-dark);
	background: var(--jmd-ivory-warm);
	border: 1px solid var(--jmd-border);
	border-radius: 10px;
	transition: border-color 0.25s var(--jmd-ease), box-shadow 0.25s var(--jmd-ease), background 0.2s var(--jmd-ease);
	box-sizing: border-box;
}
.jmd-auth__input::placeholder {
	color: var(--jmd-text-muted);
}
.jmd-auth__input:hover {
	border-color: var(--jmd-gold-home);
	background: var(--jmd-white);
}
.jmd-auth__input:focus {
	outline: none;
	border-color: var(--jmd-gold-rich);
	box-shadow: 0 0 0 3px rgba(185, 134, 11, 0.12);
	background: var(--jmd-white);
}
.jmd-auth__input--otp {
	text-align: center;
	letter-spacing: 0.4em;
	font-size: 1.25rem;
	font-weight: 500;
}

/* ═══════════════════════════════════════════
   OTP SCREEN ENHANCEMENTS
   ═══════════════════════════════════════════ */
.jmd-auth__step--otp .jmd-auth__form {
	padding: 2rem 1.75rem;
}

.jmd-auth-otp__sent {
	text-align: center;
	margin-bottom: 1.5rem;
	padding: 1rem 0.75rem;
	background: linear-gradient(135deg, rgba(201, 160, 74, 0.08) 0%, rgba(185, 134, 11, 0.04) 100%);
	border-radius: 12px;
	border: 1px solid var(--jmd-border-soft);
}

.jmd-auth-otp__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-bottom: 0.75rem;
	color: var(--jmd-gold-rich);
	background: var(--jmd-white);
	border-radius: 50%;
	box-shadow: 0 2px 12px rgba(185, 134, 11, 0.15);
	animation: jmdAuthOtpIconIn 0.5s var(--jmd-ease) backwards;
}

@keyframes jmdAuthOtpIconIn {
	from {
		opacity: 0;
		transform: scale(0.8) translateY(6px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.jmd-auth-otp__hint {
	margin: 0 0 0.25rem !important;
	font-size: 0.9375rem !important;
	font-weight: 500;
	color: var(--jmd-text-dark) !important;
	line-height: 1.4;
}

.jmd-auth-otp__sub {
	font-size: 0.8125rem;
	color: var(--jmd-text-muted);
	margin: 0;
}

.jmd-auth__field--otp {
	margin-bottom: 1rem;
}

.jmd-auth-otp__slots {
	position: relative;
}

.jmd-auth__step--otp .jmd-auth__input--otp {
	font-size: 1.5rem;
	letter-spacing: 0.5em;
	padding: 1rem 1rem;
	border: 2px solid var(--jmd-border);
	border-radius: 12px;
	background: var(--jmd-white);
}
.jmd-auth__step--otp .jmd-auth__input--otp:focus {
	border-color: var(--jmd-gold-rich);
	box-shadow: 0 0 0 4px rgba(185, 134, 11, 0.12);
}
.jmd-auth__step--otp .jmd-auth__input--otp::placeholder {
	color: var(--jmd-cream-dark);
	letter-spacing: 0.5em;
}

.jmd-auth-otp__resend {
	text-align: center;
	margin: 1rem 0 1.25rem;
	font-size: 0.875rem;
	color: var(--jmd-text-muted);
}
.jmd-auth-otp__resend-text {
	display: block;
	margin-bottom: 0.35rem;
}
/* Resend button – gold only, no theme pink border */
.jmd-auth .jmd-auth-otp__resend-btn,
.jmd-auth button.jmd-auth-otp__resend-btn,
.woocommerce .jmd-auth .jmd-auth-otp__resend-btn {
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	padding: 0.25rem 0.5rem;
	font-size: 0.875rem;
	font-family: inherit;
	font-weight: 500;
	color: var(--jmd-gold-rich) !important;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
	transition: color 0.2s var(--jmd-ease);
}
.jmd-auth .jmd-auth-otp__resend-btn:hover:not(:disabled),
.jmd-auth button.jmd-auth-otp__resend-btn:hover:not(:disabled) {
	color: var(--jmd-gold-deep) !important;
	background: transparent !important;
	border: none !important;
}
.jmd-auth .jmd-auth-otp__resend-btn:focus,
.jmd-auth .jmd-auth-otp__resend-btn:active {
	background: transparent !important;
	border: none !important;
	outline: none;
}
.jmd-auth-otp__resend-btn:disabled {
	cursor: not-allowed;
	opacity: 0.6;
	text-decoration: none;
}
.jmd-auth-otp__resend-timer {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.8125rem;
	color: var(--jmd-text-muted);
}

/* Error state – shake + red border */
.jmd-auth__field.is-error .jmd-auth__input {
	border-color: #c0392b;
	animation: jmdAuthShake 0.5s var(--jmd-ease);
}
.jmd-auth__error {
	display: block;
	font-size: 0.8125rem;
	color: #c0392b;
	margin-top: 0.35rem;
	min-height: 1.2em;
}
.jmd-auth__error:empty {
	display: none;
}

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

/* Success flash on input */
.jmd-auth__field.is-success .jmd-auth__input {
	border-color: #27ae60;
	box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}

.jmd-auth__hint {
	font-size: 0.875rem;
	color: var(--jmd-text-muted);
	margin: 0 0 1.1rem;
	line-height: 1.45;
}
.jmd-auth__divider {
	text-align: center;
	font-size: 0.8125rem;
	color: var(--jmd-text-muted);
	margin: 0.85rem 0;
	letter-spacing: 0.05em;
	text-transform: lowercase;
}

/* Primary button + loading – override any theme/WooCommerce pink accent */
.jmd-auth .jmd-auth__btn,
.jmd-auth button.jmd-auth__btn,
.woocommerce .jmd-auth .jmd-auth__btn {
	width: 100%;
	padding: 1rem 1.25rem;
	font-size: 1rem;
	font-weight: 600;
	font-family: inherit;
	color: #ffffff !important;
	background: linear-gradient(135deg, var(--jmd-gold-rich) 0%, var(--jmd-gold-deep) 100%) !important;
	border: none !important;
	border-radius: 10px;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	transition: transform 0.25s var(--jmd-ease), box-shadow 0.25s var(--jmd-ease), opacity 0.2s;
	margin-top: 0.6rem;
	letter-spacing: 0.02em;
	box-shadow: 0 4px 14px rgba(185, 134, 11, 0.25);
}
.jmd-auth .jmd-auth__btn:hover:not(:disabled),
.jmd-auth button.jmd-auth__btn:hover:not(:disabled) {
	color: #ffffff !important;
	border: none !important;
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(185, 134, 11, 0.35);
}
.jmd-auth .jmd-auth__btn:active:not(:disabled),
.jmd-auth .jmd-auth__btn:focus {
	color: #ffffff !important;
	border: none !important;
	outline: none;
}
.jmd-auth .jmd-auth__btn:disabled {
	cursor: not-allowed;
	opacity: 0.9;
	color: #ffffff !important;
	border: none !important;
}

.jmd-auth__btn-text {
	display: inline-block;
	transition: opacity 0.2s;
	color: inherit !important;
}
.jmd-auth__btn-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s;
}
.jmd-auth__btn.is-loading .jmd-auth__btn-text {
	opacity: 0;
}
.jmd-auth__btn.is-loading .jmd-auth__btn-loading {
	opacity: 1;
}

.jmd-auth__spinner {
	width: 22px;
	height: 22px;
	border: 2px solid rgba(255,255,255,0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: jmdAuthSpin 0.7s linear infinite;
}

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

/* Link (back, send OTP) – gold to match design, override theme pink */
.jmd-auth .jmd-auth__link,
.jmd-auth button.jmd-auth__link,
.woocommerce .jmd-auth .jmd-auth__link {
	display: block;
	width: 100%;
	margin-top: 1.15rem;
	padding: 0.55rem 0;
	font-size: 0.875rem;
	font-family: inherit;
	color: var(--jmd-gold-rich) !important;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: color 0.2s var(--jmd-ease), opacity 0.2s;
	text-align: center;
	text-decoration: none;
}
.jmd-auth .jmd-auth__link:hover,
.jmd-auth button.jmd-auth__link:hover {
	color: var(--jmd-gold-deep) !important;
	background: transparent !important;
	border: none !important;
	text-decoration: none;
}
.jmd-auth .jmd-auth__link:focus,
.jmd-auth .jmd-auth__link:active {
	color: var(--jmd-gold-deep) !important;
	background: transparent !important;
	border: none !important;
	outline: none;
}

/* Toast / success message */
.jmd-auth__toast {
	position: fixed;
	bottom: 2rem;
	left: 50%;
	transform: translateX(-50%) translateY(80px);
	background: var(--jmd-text-dark);
	color: var(--jmd-white);
	padding: 0.85rem 1.5rem;
	border-radius: 10px;
	font-size: 0.875rem;
	box-shadow: var(--jmd-shadow-lift);
	opacity: 0;
	visibility: hidden;
	transition: transform 0.4s var(--jmd-ease), opacity 0.35s, visibility 0.35s;
	z-index: 1000;
	max-width: 90vw;
}
.jmd-auth__toast.is-visible {
	transform: translateX(-50%) translateY(0);
	opacity: 1;
	visibility: visible;
}

/* Step content entrance – subtle stagger for fields */
.jmd-auth__step--active .jmd-auth__field {
	animation: jmdAuthFieldIn 0.4s var(--jmd-ease) backwards;
}
.jmd-auth__step--active .jmd-auth__field:nth-child(1) { animation-delay: 0.05s; }
.jmd-auth__step--active .jmd-auth__field:nth-child(2) { animation-delay: 0.1s; }
.jmd-auth__step--active .jmd-auth__field:nth-child(3) { animation-delay: 0.15s; }
.jmd-auth__step--active .jmd-auth__btn { animation: jmdAuthFieldIn 0.4s var(--jmd-ease) 0.2s backwards; }
.jmd-auth__step--active .jmd-auth__link { animation: jmdAuthFieldIn 0.4s var(--jmd-ease) 0.25s backwards; }
.jmd-auth__step--active .jmd-auth__hint { animation: jmdAuthFieldIn 0.4s var(--jmd-ease) 0s backwards; }
.jmd-auth__step--active .jmd-auth__divider { animation: jmdAuthFieldIn 0.4s var(--jmd-ease) 0.18s backwards; }

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

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
	.jmd-auth__step,
	.jmd-auth__step--exit,
	.jmd-auth__input,
	.jmd-auth__btn,
	.jmd-auth__toast {
		transition-duration: 0.01ms !important;
	}
	.jmd-auth__step--active .jmd-auth__field,
	.jmd-auth__step--active .jmd-auth__btn,
	.jmd-auth__step--active .jmd-auth__link,
	.jmd-auth__step--active .jmd-auth__hint,
	.jmd-auth__step--active .jmd-auth__divider {
		animation: none;
	}
	.jmd-auth__ornament,
	.jmd-auth__title,
	.jmd-auth__subtitle {
		animation: none;
		opacity: 1;
		transform: none;
	}
	.jmd-auth-otp__icon {
		animation: none;
	}
}
