/*
 * Auth Modal Styles
 * Reusable login/register modal for H2N tools
 */

/* ===== Overlay ===== */
.h2n-auth-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(15, 23, 42, 0);
	backdrop-filter: blur(0px);
	-webkit-backdrop-filter: blur(0px);
	transition: background 0.25s ease, backdrop-filter 0.25s ease, -webkit-backdrop-filter 0.25s ease;
}

.h2n-auth-overlay.is-visible {
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

/* ===== Modal ===== */
.h2n-auth-modal {
	position: relative;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
	padding: 32px;
	width: 100%;
	max-width: 400px;
	margin: 16px;
	opacity: 0;
	transform: translateY(12px) scale(0.97);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.h2n-auth-overlay.is-visible .h2n-auth-modal {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.h2n-auth-modal::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.58);
	backdrop-filter: blur(0.5px);
	-webkit-backdrop-filter: blur(0.5px);
	border-radius: inherit;
	opacity: 0;
	pointer-events: none;
	z-index: 1;
	transition: opacity 0.15s ease;
}

.h2n-auth-modal.is-submitting::after {
	opacity: 1;
}

.h2n-auth-pending {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 2;
	display: none;
	padding: 8px 14px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.92);
	color: #0f172a;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	white-space: nowrap;
}

.h2n-auth-pending.is-visible {
	display: inline-block;
}

/* ===== Close ===== */
.h2n-auth-close,
.h2n-auth-close:hover,
.h2n-auth-close:active {
	all: unset;
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	box-sizing: border-box;
	background: none;
	font-size: 1.5rem;
	color: #94a3b8;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: color 0.15s, background 0.15s;
	line-height: 1;
}

.h2n-auth-close:hover {
	color: #334155;
	background: #f1f5f9;
}

/* ===== Tabs ===== */
.h2n-auth-tabs {
	display: flex;
	gap: 0;
	margin-bottom: 24px;
	border-bottom: 2px solid #e2e8f0;
}

.h2n-auth-tab,
.h2n-auth-tab:hover,
.h2n-auth-tab:active {
	all: unset;
	flex: 1;
	box-sizing: border-box;
	padding: 10px 0;
	background: none;
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	color: #94a3b8;
	cursor: pointer;
	text-align: center;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	transition: color 0.15s, border-color 0.15s;
}

.h2n-auth-tab:hover {
	color: #475569;
}

.h2n-auth-tab.is-active,
.h2n-auth-tab.is-active:hover {
	color: var(--primary-color, #0D9488);
	border-bottom-color: var(--primary-color, #0D9488);
}

/* ===== Context message ===== */
.h2n-auth-context {
	margin: -8px 0 16px;
	padding: 10px 12px;
	border: 1px solid #fed7aa;
	border-left: 3px solid #f59e0b;
	border-radius: 10px;
	background: #fff7ed;
	color: #7c2d12;
	font-size: 0.84rem;
	font-weight: 600;
	line-height: 1.45;
	box-shadow: none;
}

/* ===== Social Auth ===== */
.h2n-auth-social {
	margin: 0 0 16px;
}

.h2n-google-btn-wrap {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 42px;
}

.h2n-google-btn-wrap > div {
	border-radius: 5px;
	overflow: hidden;
}

.h2n-google-btn-wrap iframe {
	display: block;
}

.h2n-auth-divider {
	position: relative;
	margin: 14px 0 6px;
	text-align: center;
}

.h2n-auth-divider::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 1px;
	background: #e2e8f0;
}

.h2n-auth-divider span {
	position: relative;
	display: inline-block;
	padding: 0 10px;
	background: #fff;
	color: #94a3b8;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* ===== Form ===== */
.h2n-auth-form {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.h2n-auth-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.h2n-auth-field label {
	font-size: 0.78rem;
	font-weight: 600;
	color: #475569;
	letter-spacing: 0.01em;
}

.h2n-auth-field input {
	padding: 10px 12px;
	font-size: 0.9rem;
	font-family: inherit;
	border: 1.5px solid #e2e8f0;
	border-radius: 8px;
	background: #f8fafc;
	color: #0f172a;
	transition: border-color 0.15s, box-shadow 0.15s;
	outline: none;
}

.h2n-auth-field input:focus {
	border-color: var(--primary-color, #0D9488);
	box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.h2n-auth-consent {
	margin-top: -4px;
}

.h2n-auth-consent-label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 0.76rem;
	color: #64748b;
	line-height: 1.45;
}

.h2n-auth-consent-label input[type="checkbox"] {
	margin-top: 2px;
	width: 14px;
	height: 14px;
	accent-color: var(--primary-color, #0D9488);
	flex-shrink: 0;
}

.h2n-auth-consent-label a {
	color: #64748b;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.h2n-auth-consent-label a:hover {
	color: #475569;
}

/* ===== Error ===== */
.h2n-auth-error {
	display: none;
	padding: 8px 12px;
	font-size: 0.8rem;
	font-weight: 500;
	color: #b91c1c;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	line-height: 1.4;
}

/* ===== Submit ===== */
.h2n-auth-submit {
	padding: 12px;
	font-size: 0.82rem;
	font-weight: 650;
	font-family: inherit;
	color: #fff;
	background: var(--primary-color, #0D9488);
	border: 1px solid transparent;
	border-radius: 10px;
	cursor: pointer;
	box-shadow: none;
	transition: background 0.15s ease, border-color 0.15s ease;
	margin-top: 4px;
}

.h2n-auth-submit:hover:not(:disabled) {
	background: var(--primary-dark, #0F766E);
	border-color: rgba(15, 118, 110, 0.45);
}

.h2n-auth-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
	.h2n-auth-modal {
		padding: 24px 20px;
		border-radius: 12px;
		max-width: 100%;
		margin: 12px;
	}

	.h2n-auth-tab {
		font-size: 0.85rem;
	}

	.h2n-auth-field input {
		font-size: 1rem;
		padding: 12px;
	}

	.h2n-auth-submit {
		padding: 14px;
		font-size: 0.95rem;
	}
}

/* Dark theme ownership */
:root[data-theme="dark"] .h2n-auth-modal {
	background: var(--bg-light) !important;
	border: 1px solid var(--border-color) !important;
	color: var(--text-dark);
}

:root[data-theme="dark"] .h2n-auth-modal::after {
	background: rgba(2, 6, 23, 0.52);
}

:root[data-theme="dark"] .h2n-auth-pending {
	background: rgba(15, 23, 42, 0.9);
	color: #e2e8f0;
	border: 1px solid rgba(148, 163, 184, 0.35);
}

:root[data-theme="dark"] .h2n-auth-tabs {
	border-bottom-color: var(--border-color) !important;
}

:root[data-theme="dark"] .h2n-auth-tab {
	color: var(--text-light) !important;
}

:root[data-theme="dark"] .h2n-auth-tab:hover {
	color: var(--text-gray) !important;
}

:root[data-theme="dark"] .h2n-auth-field label {
	color: var(--text-gray) !important;
}

:root[data-theme="dark"] .h2n-auth-field input {
	background: var(--bg-lighter) !important;
	border-color: var(--border-color) !important;
	color: var(--text-dark) !important;
}

:root[data-theme="dark"] .h2n-auth-field input::placeholder {
	color: var(--text-light) !important;
	opacity: 0.9;
}

:root[data-theme="dark"] .h2n-auth-field input:focus {
	border-color: var(--primary-color, #0D9488) !important;
	box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2) !important;
}

:root[data-theme="dark"] .h2n-auth-consent-label {
	color: var(--text-light) !important;
}

:root[data-theme="dark"] .h2n-auth-consent-label a {
	color: #94a3b8 !important;
}

:root[data-theme="dark"] .h2n-auth-consent-label a:hover {
	color: #cbd5e1 !important;
}

:root[data-theme="dark"] .h2n-auth-submit {
	background: #0f766e !important;
	border: 1px solid #0f8a81 !important;
	color: #ffffff !important;
	box-shadow: none !important;
}

:root[data-theme="dark"] .h2n-auth-submit:hover:not(:disabled) {
	background: #0d665f !important;
	border-color: #14b8a6 !important;
	box-shadow: none !important;
}

:root[data-theme="dark"] .h2n-auth-close:hover {
	background: var(--bg-lighter) !important;
}

:root[data-theme="dark"] .h2n-auth-context {
	background: rgba(245, 158, 11, 0.14) !important;
	border-color: rgba(245, 158, 11, 0.45) !important;
	border-left-color: #fbbf24 !important;
	color: #fde68a !important;
	box-shadow: none !important;
}

:root[data-theme="dark"] .h2n-auth-error {
	background: rgba(127, 29, 29, 0.35) !important;
	border-color: rgba(248, 113, 113, 0.45) !important;
	color: #fecaca !important;
}

:root[data-theme="dark"] .h2n-auth-divider::before {
	background: var(--border-color) !important;
}

:root[data-theme="dark"] .h2n-auth-divider span {
	background: var(--bg-light) !important;
	color: var(--text-light) !important;
}
