/**
 * JBH Modal Engine — Premium modal styles.
 *
 * Integrates with JBH Dark Mode Engine CSS custom properties.
 * Supports solid and glassmorphism card variants, dark/light mode,
 * responsive mobile, reduced-motion, print, and WCAG focus-visible.
 *
 * @package JBH_Platform
 * @since   1.0.0
 *
 * Table of contents
 * ─────────────────
 *  §1  Overlay
 *  §2  Card — base + glass variant
 *  §3  Close button
 *  §4  Icon badge
 *  §5  Title & message
 *  §6  Login form
 *  §7  Form links
 *  §8  Custom HTML area
 *  §9  Light mode overrides
 *  §10 Responsive (≤ 600 px)
 *  §11 Reduced motion
 *  §12 Print
 *  §13 Global focus-visible
 */


/* ================================================================
   §1  OVERLAY
   ================================================================ */

.jbh-me-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;

	/* Glassmorphism backdrop */
	background: rgba(0, 0, 0, 0.50);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);

	/* Transition */
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
	            visibility 0.4s;
}

.jbh-me-overlay.jbh-me-visible {
	opacity: 1;
	visibility: visible;
}

.jbh-me-overlay.jbh-me-out {
	opacity: 0;
	visibility: hidden;
}

.jbh-me-overlay.jbh-me-hidden {
	display: none;
}


/* ================================================================
   §2  CARD — base + glass variant
   ================================================================ */

.jbh-me-card {
	position: relative;
	width: 100%;
	max-width: 440px;
	padding: 40px 32px 32px;
	border-radius: 16px;
	text-align: center;

	/* Solid (default) */
	background: var(--jbh-dm-card, #1A1A1A);
	color: var(--jbh-dm-text, #F0EAD6);
	border: 1px solid var(--jbh-dm-border, rgba(31, 95, 91, 0.20));
	box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.35),
	            0 0 0 1px rgba(255, 255, 255, 0.04) inset;

	/* Entrance animation */
	transform: scale(0.94) translateY(14px);
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.jbh-me-visible .jbh-me-card {
	transform: scale(1) translateY(0);
}

.jbh-me-out .jbh-me-card {
	transform: scale(0.94) translateY(14px);
}

/* Glass variant */
.jbh-me-style-glass .jbh-me-card {
	background: rgba(26, 26, 26, 0.72);
	backdrop-filter: blur(24px) saturate(1.4);
	-webkit-backdrop-filter: blur(24px) saturate(1.4);
	border-color: rgba(255, 255, 255, 0.08);
}


/* ================================================================
   §3  CLOSE BUTTON
   ================================================================ */

.jbh-me-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: rgba(42, 157, 143, 0.10);
	color: var(--jbh-dm-text, #F0EAD6);
	font-size: 0;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s ease, transform 0.2s ease;
}

.jbh-me-close:hover {
	background: rgba(42, 157, 143, 0.22);
	transform: scale(1.08);
}

.jbh-me-close:active {
	transform: scale(0.96);
}


/* ================================================================
   §4  ICON BADGE
   ================================================================ */

.jbh-me-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	border-radius: 50%;
	background: rgba(42, 157, 143, 0.10);
	color: var(--jbh-dm-accent, #2A9D8F);
	margin: 0 auto 20px;
}


/* ================================================================
   §5  TITLE & MESSAGE
   ================================================================ */

.jbh-me-title {
	font-family: 'Playfair Display', serif;
	font-size: 1.4rem;
	font-weight: 700;
	color: var(--jbh-dm-heading, #FFFFFF);
	margin: 0 0 8px;
	line-height: 1.3;
}

.jbh-me-message {
	font-size: 0.88rem;
	color: var(--jbh-dm-muted, #9CA3AF);
	margin: 0 0 24px;
	line-height: 1.65;
}


/* ================================================================
   §6  LOGIN FORM
   ================================================================ */

.jbh-me-login-form {
	text-align: left;
}

.jbh-me-login-form p {
	margin: 0;
}

.jbh-me-login-form label {
	display: block;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--jbh-dm-muted, #9CA3AF);
	margin-bottom: 6px;
	letter-spacing: 0.01em;
}

.jbh-me-login-form input[type="text"],
.jbh-me-login-form input[type="password"] {
	width: 100%;
	padding: 11px 14px;
	font-size: 0.85rem;
	font-family: inherit;
	color: var(--jbh-dm-text, #F0EAD6);
	background: var(--jbh-dm-input-bg, #121212);
	border: 1px solid var(--jbh-dm-border, rgba(31, 95, 91, 0.20));
	border-radius: 8px;
	outline: none;
	margin-bottom: 16px;
	box-sizing: border-box;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.jbh-me-login-form input[type="text"]:focus,
.jbh-me-login-form input[type="password"]:focus {
	border-color: var(--jbh-dm-accent, #2A9D8F);
	box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.15);
}

.jbh-me-login-form input[type="text"]::placeholder,
.jbh-me-login-form input[type="password"]::placeholder {
	color: var(--jbh-dm-muted, #9CA3AF);
	opacity: 0.6;
}

/* Remember me — wp_login_form() uses <p class="login-remember"><label><input> text</label></p> */
.jbh-me-login-form .login-remember {
	margin-bottom: 18px;
}

.jbh-me-login-form .login-remember label {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 0;
	cursor: pointer;
	font-size: 0.8rem;
}

.jbh-me-login-form input[type="checkbox"] {
	accent-color: var(--jbh-dm-accent, #2A9D8F);
	width: 16px;
	height: 16px;
	cursor: pointer;
	margin: 0;
}

/* Submit button */
.jbh-me-login-form input[type="submit"],
.jbh-me-login-form .button {
	width: 100%;
	padding: 12px 28px;
	font-size: 0.88rem;
	font-weight: 600;
	font-family: inherit;
	line-height: 1.4;
	display: block;
	text-align: center;
	background: var(--jbh-dm-btn-bg, #2A9D8F);
	color: var(--jbh-dm-btn-text, #FFFFFF);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.25s ease,
	            color 0.25s ease,
	            transform 0.15s ease,
	            box-shadow 0.25s ease;
}

.jbh-me-login-form input[type="submit"]:hover,
.jbh-me-login-form .button:hover {
	background: var(--jbh-dm-btn-hover-bg, #E76F51);
	color: var(--jbh-dm-btn-hover-text, #FFFFFF);
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(42, 157, 143, 0.25);
}

.jbh-me-login-form input[type="submit"]:active,
.jbh-me-login-form .button:active {
	background: var(--jbh-dm-btn-active-bg, #D64F42);
	color: var(--jbh-dm-btn-active-text, #FFFFFF);
	transform: translateY(0);
	box-shadow: none;
}


/* ================================================================
   §7  FORM LINKS
   ================================================================ */

.jbh-me-form-links {
	display: flex;
	justify-content: center;
	gap: 24px;
	margin-top: 18px;
	font-size: 0.78rem;
}

.jbh-me-form-links a {
	color: var(--jbh-dm-muted, #9CA3AF);
	text-decoration: none;
	transition: color 0.2s ease;
}

.jbh-me-form-links a:hover {
	color: var(--jbh-dm-accent, #2A9D8F);
}


/* ================================================================
   §8  CUSTOM HTML AREA
   ================================================================ */

.jbh-me-custom {
	margin-top: 20px;
	font-size: 0.85rem;
	line-height: 1.6;
	color: var(--jbh-dm-text, #F0EAD6);
}


/* ================================================================
   §9  LIGHT MODE OVERRIDES
   ================================================================ */

html[data-theme="light"] .jbh-me-overlay,
html.light .jbh-me-overlay {
	background: rgba(0, 0, 0, 0.30);
}

html[data-theme="light"] .jbh-me-card,
html.light .jbh-me-card {
	background: var(--jbh-dm-card, #FFFFFF);
	color: var(--jbh-dm-text, #121212);
	border-color: var(--jbh-dm-border, rgba(0, 0, 0, 0.08));
	box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.12),
	            0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

html[data-theme="light"] .jbh-me-style-glass .jbh-me-card,
html.light .jbh-me-style-glass .jbh-me-card {
	background: rgba(255, 255, 255, 0.78);
	backdrop-filter: blur(24px) saturate(1.4);
	-webkit-backdrop-filter: blur(24px) saturate(1.4);
	border-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .jbh-me-close,
html.light .jbh-me-close {
	color: var(--jbh-dm-text, #121212);
	background: rgba(42, 157, 143, 0.08);
}

html[data-theme="light"] .jbh-me-close:hover,
html.light .jbh-me-close:hover {
	background: rgba(42, 157, 143, 0.16);
}

html[data-theme="light"] .jbh-me-login-form input[type="text"],
html[data-theme="light"] .jbh-me-login-form input[type="password"],
html.light .jbh-me-login-form input[type="text"],
html.light .jbh-me-login-form input[type="password"] {
	background: var(--jbh-dm-input-bg, #FFFFFF);
	color: var(--jbh-dm-text, #121212);
	border-color: var(--jbh-dm-border, rgba(0, 0, 0, 0.12));
}


/* ================================================================
   §10  RESPONSIVE (≤ 600 px)
   ================================================================ */

@media ( max-width: 600px ) {
	.jbh-me-overlay {
		padding: 16px;
		align-items: flex-end;
	}

	.jbh-me-card {
		max-width: 100%;
		padding: 32px 20px 24px;
		border-radius: 16px 16px 0 0;
	}

	.jbh-me-icon {
		width: 56px;
		height: 56px;
	}

	.jbh-me-icon svg {
		width: 28px;
		height: 28px;
	}

	.jbh-me-title {
		font-size: 1.2rem;
	}

	.jbh-me-form-links {
		flex-direction: column;
		gap: 10px;
		text-align: center;
	}
}


/* ================================================================
   §10b  SCROLL LOCK (class-based to avoid conflicts)
   ================================================================ */

body.jbh-me-scroll-locked,
html.jbh-me-scroll-locked {
	overflow: hidden !important;
}


/* ================================================================
   §11  REDUCED MOTION
   ================================================================ */

@media ( prefers-reduced-motion: reduce ) {
	.jbh-me-overlay,
	.jbh-me-card,
	.jbh-me-close,
	.jbh-me-login-form input,
	.jbh-me-login-form .button {
		transition-duration: 0.001ms !important;
	}
}


/* ================================================================
   §12  PRINT
   ================================================================ */

@media print {
	.jbh-me-overlay {
		display: none !important;
	}
}


/* ================================================================
   §13  GLOBAL FOCUS-VISIBLE
   ================================================================ */

.jbh-me-card a:focus-visible,
.jbh-me-card button:focus-visible,
.jbh-me-card input:focus-visible,
.jbh-me-card select:focus-visible,
.jbh-me-card textarea:focus-visible,
.jbh-me-close:focus-visible {
	outline: 2px solid var(--jbh-dm-accent, #2A9D8F);
	outline-offset: 2px;
	border-radius: 4px;
}
