/**
 * Pelagia Book Store — Premium Login Modal
 *
 * Apple-style minimalism × editorial bookstore aesthetic.
 * Design language: Verso Books × premium sans-serif calmness.
 *
 * Tokens: inherits from variables.css
 *   --color-primary   : #B3492F (Terracotta)
 *   --color-secondary : Deep Navy
 *   --font-family     : NB Akademie Std (self-hosted)
 *
 * @package Pelagia
 */

/* ── CRITICAL: enforce hidden attribute — overrides browser UA default
   which is lower specificity than our display:flex below ── */
.login-modal[hidden] {
	display:        none !important;
	pointer-events: none !important;
}

.login-modal {
	position:        fixed;
	inset:           0;
	z-index:         9999;
	display:         flex;
	align-items:     center;
	justify-content: center;
	padding:         1rem;
	/* Hidden state: invisible + no interaction until .is-open */
	opacity:         0;
	pointer-events:  none;
	transition:      opacity 250ms ease;
}

.login-modal.is-open {
	opacity:        1;
	pointer-events: auto;
}

.login-modal__overlay {
	position:   absolute;
	inset:      0;
	background: rgba(10, 8, 5, 0.55);
	backdrop-filter:         blur(6px);
	-webkit-backdrop-filter: blur(6px);
	cursor:     pointer;
}

/* ═══════════════════════════════════════════════════════
   MODAL CONTAINER
   ═══════════════════════════════════════════════════════ */
.login-modal__container {
	position:         relative;
	z-index:          1;
	width:            100%;
	max-width:        780px;
	background:       #FFFEF9; /* warm off-white */
	border-radius:    24px;
	box-shadow:
		0 2px  8px  rgba(0, 0, 0, 0.04),
		0 12px 32px rgba(0, 0, 0, 0.06),
		0 24px 80px rgba(0, 0, 0, 0.08);
	overflow:         hidden;
	display:          grid;
	grid-template-columns: 1fr 1fr;
	max-height:       calc(100vh - 2rem);
	overflow-y:       auto;
	-webkit-font-smoothing: antialiased;
}

/* Scrollbar inside modal */
.login-modal__container::-webkit-scrollbar { width: 6px; }
.login-modal__container::-webkit-scrollbar-track { background: transparent; }
.login-modal__container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════
   LEFT PANEL — Editorial atmosphere
   ═══════════════════════════════════════════════════════ */
.login-modal__panel {
	position:   relative;
	background: var(--color-primary, #B3492F);
	padding:    3rem 2.5rem;
	display:    flex;
	flex-direction: column;
	justify-content: space-between;
	min-height: 480px;
	overflow:   hidden;
}

/* Decorative pattern — layered radial gradients */
.login-modal__panel::before {
	content:    '';
	position:   absolute;
	inset:      0;
	background:
		radial-gradient(ellipse 80% 60% at 10% 90%, rgba(255,255,255,0.06) 0%, transparent 60%),
		radial-gradient(ellipse 60% 50% at 90% 10%, rgba(0,0,0,0.12) 0%, transparent 55%),
		repeating-linear-gradient(-48deg, rgba(255,255,255,0.018) 0, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 36px);
	pointer-events: none;
}

.login-modal__panel > * { position: relative; z-index: 1; }

/* Fix 2: Panel logo — flex row, white-filtered image */
.login-modal__panel-logo {
	display:         flex;
	align-items:     center;
	gap:             0.5rem;
	text-decoration: none;
	color:           inherit;
}

.login-modal__panel-logo-img,
.login-modal__panel-logo .custom-logo {
	height:     54px !important;  /* Fix 6: was 36px — larger for visual prominence */
	width:      auto !important;
	max-width:  none !important;
	filter:     brightness(0) invert(1);
	object-fit: contain;
	flex-shrink: 0;
}

.login-modal__panel-logo-name {
	font-family:    var(--font-family);
	font-size:      1.7rem;          /* Fix 6: was 1.2rem */
	font-weight:    800;
	color:          rgba(255,255,255,0.95);
	letter-spacing: -0.03em;
	line-height:    1;
}


.login-modal__panel-body {}

.login-modal__panel-quote {
	font-family:    Georgia, 'Times New Roman', serif;
	font-size:      clamp(1.35rem, 2.4vw, 1.75rem);
	font-weight:    400;
	color:          rgba(255,255,255,0.96);
	line-height:    1.45;
	letter-spacing: -0.01em;
	margin:         0 0 1.25rem;
}

.login-modal__panel-quote em {
	font-style:   italic;
	color:        rgba(255,255,255,0.72);
}

.login-modal__panel-caption {
	font-size:    0.8125rem;
	color:        rgba(255,255,255,0.52);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════
   RIGHT PANEL — Form
   ═══════════════════════════════════════════════════════ */
.login-modal__form-panel {
	padding: 3rem 2.75rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* Close button */
.login-modal__close {
	position:         absolute;
	top:              1.25rem;
	right:            1.25rem;
	width:            36px;
	height:           36px;
	display:          flex;
	align-items:      center;
	justify-content:  center;
	background:       transparent;
	border:           none;
	border-radius:    50%;
	cursor:           pointer;
	color:            rgba(30, 30, 30, 0.45);
	transition:       background 200ms ease, color 200ms ease;
	z-index:          10;
	padding:          0;
}

.login-modal__close:hover {
	background: rgba(0, 0, 0, 0.06);
	color:      rgba(30, 30, 30, 0.85);
}

.login-modal__close svg {
	display:     block;
	flex-shrink: 0;
}

/* ── Header ── */
.login-modal__header {
	margin-bottom: 2rem;
}

.login-modal__eyebrow {
	font-size:      0.6875rem;
	font-weight:    700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color:          var(--color-primary, #B3492F);
	margin-bottom:  0.6rem;
	display:        block;
}

/* Fix 4: Brand name in heading — preserve casing */
.login-modal__heading-brand {
	display:        block;
	line-height:    1;
}

.login-modal__heading {
	font-family:    var(--font-family);
	font-size:      clamp(1.65rem, 3vw, 2.1rem);
	font-weight:    800;
	color:          #1A1310;
	letter-spacing: -0.03em;
	line-height:    1.1;
	margin:         0 0 0.55rem;
}

.login-modal__subtext {
	font-size:   0.9375rem;
	color:       rgba(30, 20, 10, 0.52);
	line-height: 1.6;
	margin:      0;
}

/* ── Form ── */
.login-modal__form {
	display:        flex;
	flex-direction: column;
	gap:            1.25rem;
}

/* Field group */
.login-modal__field {
	display:        flex;
	flex-direction: column;
	gap:            0.4rem;
}

.login-modal__label {
	font-size:      0.8125rem;
	font-weight:    600;
	color:          #1A1310;
	letter-spacing: 0.01em;
}

/* Input wrapper (icon + input) */
.login-modal__input-wrap {
	position:         relative;
	display:          flex;
	align-items:      center;
}

.login-modal__input-icon {
	position:   absolute;
	left:       1rem;
	color:      rgba(30, 20, 10, 0.32);
	display:    flex;
	align-items: center;
	pointer-events: none;
	flex-shrink: 0;
}

.login-modal__input {
	width:          100%;
	height:         56px;
	padding:        0 1rem 0 2.875rem;
	background:     rgba(0, 0, 0, 0.035);
	border:         1.5px solid rgba(0, 0, 0, 0.09);
	border-radius:  var(--radius-sm);
	font-family:    var(--font-family);
	font-size:      0.9375rem;
	color:          #1A1310;
	outline:        none;
	transition:     border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
	box-sizing:     border-box;
	-webkit-appearance: none;
}

.login-modal__input::placeholder {
	color: rgba(30, 20, 10, 0.32);
}

.login-modal__input:focus {
	border-color: var(--color-primary, #B3492F);
	background:   #ffffff;
	box-shadow:   0 0 0 3px rgba(179, 73, 47, 0.12);
}

/* Password toggle button */
.login-modal__pw-toggle {
	position:    absolute;
	right:       0.875rem;
	background:  transparent;
	border:      none;
	cursor:      pointer;
	color:       rgba(30, 20, 10, 0.36);
	display:     flex;
	align-items: center;
	padding:     0.25rem;
	border-radius: 6px;
	transition:  color 200ms ease;
}

.login-modal__pw-toggle:hover {
	color: rgba(30, 20, 10, 0.75);
}

/* ── Remember + Forgot row ── */
.login-modal__meta {
	display:         flex;
	align-items:     center;
	justify-content: space-between;
	gap:             0.75rem;
	flex-wrap:       wrap;
}

.login-modal__remember {
	display:     flex;
	align-items: center;
	gap:         0.45rem;
	cursor:      pointer;
	font-size:   0.8125rem;
	color:       rgba(30, 20, 10, 0.55);
	user-select: none;
}

.login-modal__remember input[type="checkbox"] {
	width:         16px;
	height:        16px;
	border:        1.5px solid rgba(0, 0, 0, 0.18);
	border-radius: 4px;
	accent-color:  var(--color-primary, #B3492F);
	cursor:        pointer;
	flex-shrink:   0;
}

.login-modal__forgot {
	font-size:       0.8125rem;
	color:           rgba(30, 20, 10, 0.45);
	text-decoration: none;
	transition:      color 200ms ease;
}

.login-modal__forgot:hover {
	color: var(--color-primary, #B3492F);
}

/* ── Submit Button ── */
.login-modal__submit {
	width:           100%;
	height:          56px;
	background:      var(--color-primary, #B3492F);
	color:           #ffffff;
	border:          none;
	border-radius:   var(--radius-md);
	font-family:     var(--font-family);
	font-size:       0.9375rem;
	font-weight:     700;
	letter-spacing:  0.04em;
	text-transform:  uppercase;
	cursor:          pointer;
	display:         flex;
	align-items:     center;
	justify-content: center;
	gap:             0.5rem;
	transition:
		background-color 200ms ease,
		box-shadow       200ms ease,
		transform        200ms ease;
	position: relative;
	overflow: hidden;
}

.login-modal__submit::after {
	content:    '';
	position:   absolute;
	inset:      0;
	background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
	pointer-events: none;
}

.login-modal__submit:hover {
	background:  #9a3c25;
	box-shadow:  0 4px 20px rgba(179, 73, 47, 0.38);
	transform:   translateY(-1px);
}

.login-modal__submit:active {
	transform:  translateY(0);
	box-shadow: none;
}

/* Loading state */
.login-modal__submit.is-loading {
	pointer-events: none;
	opacity:        0.78;
}

/* ── Divider ── */
.login-modal__divider {
	display:     flex;
	align-items: center;
	gap:         0.875rem;
}

.login-modal__divider::before,
.login-modal__divider::after {
	content:    '';
	flex:       1;
	height:     1px;
	background: rgba(0, 0, 0, 0.08);
}

.login-modal__divider-text {
	font-size:      0.75rem;
	font-weight:    500;
	color:          rgba(30, 20, 10, 0.38);
	letter-spacing: 0.05em;
	white-space:    nowrap;
}

/* ── Social Buttons ── */
/* Fix 5: Google-only — single full-width button */
.login-modal__socials {
	display: flex;
	flex-direction: column;
	gap:     0.625rem;
}

/* Unavailable state (no social login plugin) */
.login-modal__social-btn--unavailable {
	opacity:        0.55;
	cursor:         not-allowed !important;
	filter:         grayscale(0.4);
	position:       relative;
}

.login-modal__social-btn--unavailable::after {
	content:        'Requires Nextend Social Login plugin';
	position:       absolute;
	bottom:         calc(100% + 6px);
	left:           50%;
	transform:      translateX(-50%);
	background:     rgba(10,8,5,0.82);
	color:          #fff;
	font-size:      0.7rem;
	padding:        4px 8px;
	border-radius:  6px;
	white-space:    nowrap;
	opacity:        0;
	pointer-events: none;
	transition:     opacity 200ms ease;
}

.login-modal__social-btn--unavailable:hover::after {
	opacity: 1;
}


.login-modal__social-btn {
	display:          flex;
	align-items:      center;
	justify-content:  center;
	gap:              0.45rem;
	height:           44px;
	background:       #ffffff;
	border:           1.5px solid rgba(0, 0, 0, 0.1);
	border-radius:    var(--radius-md);
	font-family:      var(--font-family);
	font-size:        0.8rem;
	font-weight:      600;
	color:            rgba(30, 20, 10, 0.72);
	cursor:           pointer;
	text-decoration:  none;
	transition:
		background  200ms ease,
		border-color 200ms ease,
		color        200ms ease,
		transform    200ms ease;
	white-space:      nowrap;
}

.login-modal__social-btn:hover {
	background:   #F8F5F2;
	border-color: rgba(0, 0, 0, 0.18);
	color:        #1A1310;
	transform:    translateY(-1px);
}

.login-modal__social-btn svg {
	flex-shrink: 0;
}

/* ── Register link ── */
.login-modal__register {
	text-align:   center;
	font-size:    0.8375rem;
	color:        rgba(30, 20, 10, 0.45);
}

/* Fix 6: Register link as button */
.login-modal__register-link {
	background:      none;
	border:          none;
	padding:         0;
	margin:          0;
	cursor:          pointer;
	color:           var(--color-primary, #B3492F);
	text-decoration: none;
	font-weight:     600;
	font-size:       inherit;
	font-family:     inherit;
	transition:      color 200ms ease;
}

.login-modal__register-link:hover {
	color: #9a3c25;
}

.login-modal__register-note {
	text-align: center;
	font-size:  0.75rem;
	color:      rgba(30, 20, 10, 0.42);
	margin:     0.25rem 0 0;
	line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Tablet (collapse to single column)
   ═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
	.login-modal__container {
		grid-template-columns: 1fr;
		max-width:            520px;
		border-radius:        20px;
	}

	.login-modal__panel {
		min-height:    0;
		padding:       2rem 2rem 1.75rem;
	}

	.login-modal__panel-quote {
		font-size: 1.2rem;
	}

	.login-modal__form-panel {
		padding: 2rem 2rem 2.5rem;
	}
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Mobile
   ═══════════════════════════════════════════════════════ */
@media (max-width: 600px) {
	.login-modal {
		padding:     0;
		align-items: flex-end;
	}

	.login-modal__container {
		max-width:         100%;
		border-radius:     20px 20px 0 0;
		max-height:        94svh;
	}

	.login-modal__panel {
		padding:    1.5rem 1.5rem 1.25rem;
		min-height: 0;
	}

	.login-modal__panel-quote {
		font-size:     1.05rem;
		margin-bottom: 0.5rem;
	}

	.login-modal__panel-caption { display: none; }

	.login-modal__form-panel {
		padding: 1.5rem 1.25rem 2rem;
	}

	.login-modal__heading {
		font-size: 1.5rem;
	}

	.login-modal__input {
		height: 52px;
	}

	.login-modal__submit {
		height: 52px;
	}

	.login-modal__socials {
		grid-template-columns: 1fr;
	}

	.login-modal__social-btn {
		height: 48px;
	}
}

/* ═══════════════════════════════════════════════════════
   ANIMATION — container slide-in
   ═══════════════════════════════════════════════════════ */
.login-modal__container {
	transform:  translateY(16px) scale(0.985);
	opacity:    0;
	transition: transform 280ms cubic-bezier(0.34, 1.12, 0.64, 1), opacity 250ms ease;
}

.login-modal.is-open .login-modal__container {
	transform: translateY(0) scale(1);
	opacity:   1;
}

@media (max-width: 600px) {
	.login-modal__container {
		transform:  translateY(40px);
	}

	.login-modal.is-open .login-modal__container {
		transform: translateY(0);
	}
}
