/* ==================================================================
 * Popup đăng ký / đăng nhập (inc/auth-modal.php, assets/js/auth-modal.js)
 * ================================================================== */

html.cv-auth-open {
	overflow: hidden;
}

.cv-auth {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.cv-auth[hidden] {
	display: none;
}

.cv-auth__overlay {
	position: absolute;
	inset: 0;
	background: rgba(11, 32, 31, .55);
	backdrop-filter: blur(2px);
	animation: cv-auth-fade .2s ease;
}

.cv-auth__dialog {
	position: relative;
	width: 100%;
	max-width: 440px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 56px 40px 32px;
	border-radius: var(--cv-radius-lg);
	background: #fff;
	box-shadow: 0 24px 60px rgba(11, 32, 31, .25);
	text-align: center;
	animation: cv-auth-pop .22s var(--cv-ease);
}

.cv-auth__dialog:focus {
	outline: none;
}

/* ---- đầu popup ---- */

.cv-auth__back,
.cv-auth__close {
	position: absolute;
	top: 14px;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 0;
	margin: 0;
	padding: 6px 8px;
	border: 0;
	border-radius: var(--cv-radius-sm);
	background: transparent;
	color: var(--cv-text-muted);
	font-family: var(--cv-font-body);
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}

.cv-auth__back {
	left: 14px;
	color: var(--cv-primary);
}

.cv-auth__close {
	right: 14px;
}

.cv-auth__back:hover,
.cv-auth__close:hover {
	background: var(--cv-surface-alt);
}

.cv-auth__back[hidden] {
	display: none;
}

.cv-auth__logo {
	display: block;
	width: auto;
	max-width: 170px;
	height: 56px;
	margin: 0 auto 22px;
	object-fit: contain;
}

.cv-auth__title {
	margin: 0 0 8px;
	font-family: var(--cv-font-heading);
	font-size: 24px;
	font-weight: 600;
	color: var(--cv-text);
}

.cv-auth__intro {
	margin: 0 0 4px;
	font-size: 14px;
	color: var(--cv-text-muted);
}

/* ---- danh sách lựa chọn ---- */

.cv-auth__view {
	margin-top: 24px;
	text-align: left;
}

.cv-auth__view[hidden] {
	display: none;
}

.cv-auth__option {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	margin: 0 0 10px;
	padding: 0 16px;
	border: 1px solid var(--cv-border);
	border-radius: var(--cv-radius-sm);
	background: #fff;
	color: var(--cv-text);
	font-family: var(--cv-font-body);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease;
}

.cv-auth__option:hover {
	border-color: var(--cv-text-subtle);
	background: var(--cv-surface-alt);
	color: var(--cv-text);
}

.cv-auth__option svg {
	flex-shrink: 0;
}

/* ---- form email ---- */

.cv-auth__label {
	display: block;
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--cv-text);
}

.cv-auth__input,
.cv-auth .cv-auth__input {
	width: 100%;
	height: 46px;
	margin: 0 0 16px;
	padding: 0 14px;
	border: 1px solid var(--cv-border);
	border-radius: var(--cv-radius-sm);
	background: #fff;
	box-shadow: none;
	font-size: 15px;
}

.cv-auth__input:focus {
	border-color: var(--cv-primary);
	box-shadow: 0 0 0 3px rgba(26, 167, 156, .15);
}

.cv-auth__password {
	position: relative;
}

.cv-auth__password .cv-auth__input {
	padding-right: 46px;
}

.cv-auth__eye {
	position: absolute;
	top: 0;
	right: 4px;
	width: 40px;
	height: 46px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--cv-text-subtle);
	cursor: pointer;
}

.cv-auth__eye:before {
	content: "";
	display: block;
	width: 20px;
	height: 20px;
	margin: 0 auto;
	background: currentColor;
	/* mắt gạch chéo = đang ẩn */
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.cv-auth__eye.is-visible:before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
	color: var(--cv-primary);
}

.cv-auth__hint {
	margin: -10px 0 16px;
	font-size: 12px;
	color: var(--cv-text-subtle);
}

.cv-auth__forgot {
	display: inline-block;
	margin: -6px 0 16px;
	font-size: 13px;
	font-weight: 500;
}

.cv-auth__hint[hidden],
.cv-auth__forgot[hidden],
.cv-auth__terms[hidden],
.cv-auth__switch[hidden] {
	display: none;
}

.cv-auth__submit,
.cv-auth button.cv-auth__submit {
	position: relative;
	display: block;
	width: 100%;
	min-height: 48px;
	margin: 4px 0 0;
	padding: 0 16px;
	border: 0;
	border-radius: var(--cv-radius-sm);
	background: var(--cv-primary);
	color: #fff;
	font-family: var(--cv-font-heading);
	font-size: 16px;
	font-weight: 600;
	line-height: 48px;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background-color .15s ease, opacity .15s ease;
}

.cv-auth__submit:hover {
	background: var(--cv-primary-dark);
}

.cv-auth__submit:disabled {
	background: #a9d9d4;
	cursor: not-allowed;
}

.cv-auth__submit.is-loading {
	color: transparent;
}

.cv-auth__submit.is-loading:after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 2px solid rgba(255, 255, 255, .5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: cv-auth-spin .7s linear infinite;
}

.cv-auth__error {
	margin: 0 0 14px;
	padding: 10px 12px;
	border-radius: var(--cv-radius-sm);
	background: #fdecec;
	color: #b42318;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.45;
}

.cv-auth__error[hidden] {
	display: none;
}

/* ---- chân popup ---- */

.cv-auth__terms {
	margin: 22px 0 0;
	font-size: 13px;
	line-height: 1.6;
	color: var(--cv-text-subtle);
}

.cv-auth__terms a {
	font-weight: 600;
	color: var(--cv-text-muted);
}

.cv-auth__switch {
	margin: 18px 0 0;
	font-size: 14px;
	color: var(--cv-text);
}

.cv-auth__switch button {
	min-height: 0;
	margin: 0 0 0 2px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--cv-primary);
	font-family: var(--cv-font-body);
	font-size: 14px;
	font-weight: 700;
	line-height: inherit;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}

.cv-auth__switch button:hover {
	text-decoration: underline;
}

@keyframes cv-auth-fade {
	from { opacity: 0; }
}

@keyframes cv-auth-pop {
	from { opacity: 0; transform: translateY(12px) scale(.98); }
}

@keyframes cv-auth-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 549px) {
	.cv-auth {
		align-items: flex-end;
		padding: 0;
	}

	.cv-auth__dialog {
		max-width: none;
		max-height: 92vh;
		padding: 52px 20px 28px;
		border-radius: var(--cv-radius-lg) var(--cv-radius-lg) 0 0;
	}

	@keyframes cv-auth-pop {
		from { transform: translateY(40px); }
	}
}

@media (prefers-reduced-motion: reduce) {
	.cv-auth__overlay,
	.cv-auth__dialog {
		animation: none;
	}
}
