/**
 * Modal global de login / registro / recuperação (mesmo UI do checkout).
 *
 * @package Woostify_Child
 */

body.ks-auth-open {
	overflow: hidden !important;
	position: fixed !important;
	width: 100% !important;
	height: 100% !important;
}

/* ========================================
   AUTH MODAL — Overlay, Card, Painéis
   ======================================== */
.ks-auth-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}
.ks-auth-overlay--visible {
	opacity: 1;
	visibility: visible;
}
.ks-auth-overlay[hidden] {
	display: none;
}

.ks-auth-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

/* Fechar (fora do checkout visitante) */
.ks-auth-close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	border-radius: 10px;
	background: #f3f4f6;
	color: #6b7280;
	cursor: pointer;
	transition:
		background 0.2s,
		color 0.2s;
}
.ks-auth-close:hover {
	background: #e5e7eb;
	color: #1e1e20;
}
.ks-auth-close svg {
	display: block;
	flex-shrink: 0;
}

.ks-auth-card {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 440px;
	min-height: 0;
	background: #fff;
	border-radius: 24px;
	box-shadow:
		0 24px 64px rgba(0, 0, 0, 0.18),
		0 0 0 1px rgba(0, 0, 0, 0.04);
	padding: 40px 36px 32px;
	padding-bottom: max(32px, env(safe-area-inset-bottom));
	box-sizing: border-box;
	transform: scale(0.95) translateY(10px);
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
	max-height: 90vh;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	touch-action: manipulation;
}
.ks-auth-card button,
.ks-auth-card a[href],
.ks-auth-card [data-goto] {
	touch-action: manipulation;
}
.ks-auth-overlay--visible .ks-auth-card {
	transform: scale(1) translateY(0);
}

/* Painéis */
.ks-auth-panel {
	animation: ksAuthFadeIn 0.25s ease;
}
.ks-auth-panel[hidden] {
	display: none !important;
}
@keyframes ksAuthFadeIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Welcome */
.ks-auth-welcome-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	margin: 0 auto 20px;
	background: linear-gradient(135deg, #ebf0fa 0%, #d6e0f5 100%);
	border-radius: 50%;
	color: #2b59b0;
}
.ks-auth-title {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: 700;
	color: #1e1e20;
	text-align: center;
	line-height: 1.3;
}
.ks-auth-subtitle {
	margin: 0 0 28px;
	font-size: 14px;
	color: #6b7280;
	text-align: center;
	line-height: 1.5;
}

/* Botões principais */
.ks-auth-welcome-actions {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 24px;
}

.ks-auth-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 14px 24px;
	border-radius: 14px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	transition:
		background 0.2s,
		transform 0.15s,
		box-shadow 0.2s;
	text-decoration: none;
	line-height: 1.4;
}
.ks-auth-btn svg {
	flex-shrink: 0;
}

.ks-auth-btn--primary {
	background: #2b59b0;
	color: #fff;
	box-shadow: 0 4px 14px rgba(43, 89, 176, 0.3);
}
.ks-auth-btn--primary:hover {
	background: #1e4285;
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(43, 89, 176, 0.35);
}
.ks-auth-btn--primary:active {
	transform: scale(0.98);
}
.ks-auth-btn--primary:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.ks-auth-btn--secondary {
	background: #f3f4f6;
	color: #1e1e20;
	border: 1.5px solid #e5e7eb;
}
.ks-auth-btn--secondary:hover {
	background: #e5e7eb;
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.ks-auth-btn--secondary:active {
	transform: scale(0.98);
}

.ks-auth-btn--full {
	width: 100%;
}

.ks-auth-btn--loading {
	pointer-events: none;
}
.ks-auth-btn--loading .ks-auth-btn__text {
	display: none;
}
.ks-auth-btn__loading {
	display: none;
	align-items: center;
	gap: 8px;
}
.ks-auth-btn--loading .ks-auth-btn__loading {
	display: inline-flex;
}
.ks-auth-btn__loading::before {
	content: '';
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ksAuthSpin 0.6s linear infinite;
}
@keyframes ksAuthSpin {
	to {
		transform: rotate(360deg);
	}
}
.ks-auth-btn--secondary .ks-auth-btn__loading::before {
	border-color: rgba(0, 0, 0, 0.15);
	border-top-color: #1e1e20;
}

/* Divider */
.ks-auth-divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 20px;
	color: #9ca3af;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.ks-auth-divider::before,
.ks-auth-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: #e5e7eb;
}

/* Social placeholder */
.ks-auth-social-placeholder {
	margin-bottom: 24px;
}
.ks-auth-social-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 12px 16px;
	background: #fff;
	border: 1.5px solid #e5e7eb;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 500;
	color: #6b7280;
	cursor: not-allowed;
	opacity: 0.6;
	transition: opacity 0.2s;
}
.ks-auth-social-btn svg {
	flex-shrink: 0;
}

/* Back link (voltar ao carrinho) */
.ks-auth-back-link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 4px;
	font-size: 13px;
	color: #9ca3af;
	text-decoration: none;
	transition: color 0.2s;
}
.ks-auth-back-link:hover {
	color: #6b7280;
}
.ks-auth-back-link svg {
	flex-shrink: 0;
}

/* Back button (seta voltar nos painéis) */
.ks-auth-back-btn {
	position: absolute;
	top: 20px;
	left: 20px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f3f4f6;
	border: none;
	border-radius: 10px;
	color: #6b7280;
	cursor: pointer;
	transition:
		background 0.2s,
		color 0.2s;
}
.ks-auth-back-btn:hover {
	background: #e5e7eb;
	color: #1e1e20;
}

/* Formulários */
.ks-auth-form {
	margin: 0;
}
.ks-auth-field {
	margin: 0 0 18px;
}
.ks-auth-field label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 600;
	color: #374151;
}
.ks-auth-field input {
	width: 100%;
	padding: 13px 16px;
	border: 1.5px solid #d1d5db;
	border-radius: 12px;
	font-size: 16px;
	color: #1e1e20;
	box-sizing: border-box;
	background: #fafafa;
	transition:
		border-color 0.2s,
		box-shadow 0.2s,
		background 0.2s;
}
.ks-auth-field input::placeholder {
	color: #9ca3af;
}
.ks-auth-field input:focus {
	outline: none;
	border-color: #2b59b0;
	background: #fff;
	box-shadow: 0 0 0 3px rgba(43, 89, 176, 0.12);
}

/* Senha com olho */
.ks-auth-password-wrap {
	position: relative;
}
.ks-auth-password-wrap input {
	padding-right: 46px;
}
.ks-auth-eye {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 34px;
	height: 34px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #9ca3af;
	transition:
		color 0.2s,
		background 0.2s;
}
.ks-auth-eye:hover {
	color: #374151;
	background: rgba(0, 0, 0, 0.04);
}
.ks-auth-eye svg {
	width: 18px;
	height: 18px;
}

/* Esqueceu a senha */
.ks-auth-forgot {
	margin: -8px 0 16px;
	text-align: right;
}
.ks-auth-forgot a {
	font-size: 13px;
	color: #2b59b0;
	text-decoration: none;
	font-weight: 500;
}
.ks-auth-forgot a:hover {
	text-decoration: underline;
}

/* Erro / Mensagem */
.ks-auth-error,
.ks-auth-message {
	margin-bottom: 16px;
	padding: 12px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.4;
}
.ks-auth-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #b91c1c;
}
.ks-auth-message {
	background: #f0f9ff;
	border: 1px solid #bae6fd;
	color: #0369a1;
}
.ks-auth-message--success {
	background: #f0fdf4;
	border-color: #bbf7d0;
	color: #166534;
}

/* Link "Não tem conta?" / "Já tem conta?" */
.ks-auth-switch {
	margin: 20px 0 0;
	text-align: center;
	font-size: 14px;
	color: #6b7280;
}
.ks-auth-switch a {
	color: #2b59b0;
	font-weight: 600;
	text-decoration: none;
}
.ks-auth-switch a:hover {
	text-decoration: underline;
}

/* ---- RESPONSIVO: Mobile ---- */
@media (max-width: 600px) {
	.ks-auth-card {
		max-width: 100%;
		margin: 0 12px;
		border-radius: 20px;
		padding: 32px 24px 24px;
		padding-bottom: max(24px, env(safe-area-inset-bottom));
	}
	.ks-auth-overlay {
		align-items: flex-end;
		min-height: 0;
	}
	.ks-auth-card {
		margin: 0;
		border-radius: 24px 24px 0 0;
		max-height: 92vh;
		min-height: 0;
		transform: translateY(100%);
	}
	.ks-auth-overlay--visible .ks-auth-card {
		transform: translateY(0);
	}
	.ks-auth-title {
		font-size: 20px;
	}
	.ks-auth-welcome-icon {
		width: 60px;
		height: 60px;
		margin-bottom: 16px;
	}
	.ks-auth-welcome-icon svg {
		width: 36px;
		height: 36px;
	}
	.ks-auth-btn {
		padding: 13px 20px;
		font-size: 14px;
	}
	.ks-auth-back-btn {
		top: 16px;
		left: 16px;
	}
	.ks-auth-close {
		top: 12px;
		right: 12px;
	}
}
