/* =========================================================================
   MK Auth — Página de acceso estilo Utoon (login / registro / reset).
   Consume los tokens --mc-* del panel. Archivo estático cacheable.
   ========================================================================= */

.mk-auth {
	position: relative;
	min-height: calc(100vh - 160px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px 16px;
	overflow: hidden;
	isolation: isolate;
	background: var(--mc-bg, #0a0a0a);
}

/* ── Fondo aurora ──────────────────────────────────────────────────────── */
.mk-auth__aurora {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
}
.mk-auth__blob {
	position: absolute;
	width: 46vw;
	height: 46vw;
	max-width: 620px;
	max-height: 620px;
	border-radius: 50%;
	filter: blur(90px);
	opacity: .55;
	will-change: transform;
}
.mk-auth__blob--1 {
	top: -12%;
	left: -8%;
	background: radial-gradient(circle at 30% 30%, var(--mc-primary, #7c3aed), transparent 70%);
	animation: mkAuthFloat1 18s ease-in-out infinite;
}
.mk-auth__blob--2 {
	bottom: -16%;
	right: -10%;
	background: radial-gradient(circle at 60% 40%, var(--mc-secondary, #a855f7), transparent 70%);
	animation: mkAuthFloat2 22s ease-in-out infinite;
}
.mk-auth__blob--3 {
	top: 30%;
	right: 22%;
	width: 30vw;
	height: 30vw;
	background: radial-gradient(circle at 50% 50%, var(--mc-accent, #c084fc), transparent 70%);
	opacity: .35;
	animation: mkAuthFloat1 26s ease-in-out infinite reverse;
}

@keyframes mkAuthFloat1 {
	0%, 100% { transform: translate(0, 0) scale(1); }
	50%      { transform: translate(4%, 6%) scale(1.08); }
}
@keyframes mkAuthFloat2 {
	0%, 100% { transform: translate(0, 0) scale(1); }
	50%      { transform: translate(-5%, -4%) scale(1.1); }
}

/* ── Tarjeta ───────────────────────────────────────────────────────────── */
.mk-auth__card {
	width: min(440px, 100%);
	background: rgba(var(--mc-surface-rgb, 22, 22, 22), .72);
	-webkit-backdrop-filter: blur(26px) saturate(180%);
	backdrop-filter: blur(26px) saturate(180%);
	border: 1px solid rgba(var(--mc-border-rgb, 42, 42, 42), .7);
	border-radius: 22px;
	box-shadow: 0 30px 80px -16px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .05);
	padding: 32px 30px 30px;
	color: var(--mc-text, #fff);
}

.mk-auth__brand {
	display: flex;
	justify-content: center;
	margin-bottom: 18px;
	text-decoration: none;
}
.mk-auth__logo { max-height: 46px; width: auto; }
.mk-auth__brandtext {
	font-size: 22px;
	font-weight: 850;
	letter-spacing: .01em;
	color: var(--mc-text, #fff);
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.mk-auth__tabs {
	position: relative;
	display: flex;
	gap: 4px;
	background: rgba(var(--mc-text-rgb, 255, 255, 255), .05);
	border: 1px solid rgba(var(--mc-border-rgb, 42, 42, 42), .6);
	border-radius: 14px;
	padding: 5px;
	margin-bottom: 24px;
}
.mk-auth__tab {
	flex: 1 1 0;
	position: relative;
	z-index: 1;
	background: none;
	border: 0;
	cursor: pointer;
	padding: 11px 10px;
	border-radius: 10px;
	font-size: 14.5px;
	font-weight: 750;
	color: var(--mc-text-muted, #9a9a9a);
	transition: color .2s ease;
}
.mk-auth__tab.is-active { color: var(--mc-on-primary, #fff); }
.mk-auth__tab-ind {
	position: absolute;
	z-index: 0;
	top: 5px;
	left: 0;
	height: calc(100% - 10px);
	width: 0;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--mc-primary, #7c3aed), var(--mc-secondary, #a855f7));
	box-shadow: 0 6px 18px -6px rgba(var(--mc-primary-rgb, 124, 58, 237), .8);
	transition: transform .28s cubic-bezier(.2, .8, .2, 1), width .28s cubic-bezier(.2, .8, .2, 1);
}

/* ── Paneles ───────────────────────────────────────────────────────────── */
.mk-auth__panel { display: none; }
.mk-auth__panel.is-active { display: block; animation: mkAuthFade .35s ease; }
@keyframes mkAuthFade {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

/* El wrapper hereda .modal-content para que el spinner del JS nativo encaje;
   neutralizamos cualquier caja/borde heredado para no duplicar la tarjeta. */
.mk-auth__formwrap {
	position: relative;
	background: none !important;
	border: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	overflow: visible !important;
}

.mk-auth__title {
	margin: 0 0 4px;
	font-size: 24px;
	font-weight: 850;
	line-height: 1.2;
	color: var(--mc-text, #fff);
}
.mk-auth__sub {
	margin: 0 0 20px;
	font-size: 14px;
	color: var(--mc-text-muted, #9a9a9a);
}

/* Mensajes del AJAX nativo */
.mk-auth__msg {
	margin: 0 0 14px;
	min-height: 0;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--mc-danger, #ef4444);
}
.mk-auth__msg:empty { display: none; }
.mk-auth__msg.is-ok { color: var(--mc-success, #22c55e); }

/* ── Campos ────────────────────────────────────────────────────────────── */
.mk-auth__form { display: flex; flex-direction: column; gap: 13px; }

.mk-auth__field {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(var(--mc-text-rgb, 255, 255, 255), .04);
	border: 1px solid rgba(var(--mc-border-rgb, 42, 42, 42), .8);
	border-radius: 12px;
	padding: 0 14px;
	transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.mk-auth__field:focus-within {
	border-color: rgba(var(--mc-primary-rgb, 124, 58, 237), .8);
	box-shadow: 0 0 0 3px rgba(var(--mc-primary-rgb, 124, 58, 237), .18);
	background: rgba(var(--mc-text-rgb, 255, 255, 255), .06);
}
.mk-auth__ic { color: var(--mc-text-muted, #9a9a9a); display: inline-flex; flex: 0 0 auto; }
.mk-auth__field input {
	flex: 1 1 auto;
	width: 100%;
	background: none !important;
	border: 0 !important;
	outline: none;
	box-shadow: none !important;
	color: var(--mc-text, #fff);
	font-size: 15px;
	padding: 14px 0;
	margin: 0;
	height: auto;
}
.mk-auth__field input::placeholder { color: var(--mc-text-muted, #9a9a9a); }
/* Anula el fondo amarillo del autofill de Chrome sobre fondo oscuro */
.mk-auth__field input:-webkit-autofill,
.mk-auth__field input:-webkit-autofill:focus {
	-webkit-text-fill-color: var(--mc-text, #fff);
	transition: background-color 9999s ease-in-out 0s;
}

.mk-auth__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 2px 0;
}
.mk-auth__remember {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 13px;
	color: var(--mc-text-muted, #9a9a9a);
	cursor: pointer;
}
.mk-auth__remember input { accent-color: var(--mc-primary, #7c3aed); }
.mk-auth__link { font-size: 13px; color: var(--mc-accent, #c084fc); text-decoration: none; }
.mk-auth__link:hover { color: var(--mc-primary, #7c3aed); }

.mk-auth__action:empty { display: none; }
.mk-auth__action { margin: 0; }

/* ── Botones ───────────────────────────────────────────────────────────── */
.mk-auth__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 14px 18px;
	border: 1px solid transparent;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 800;
	text-decoration: none;
	cursor: pointer;
	transition: filter .18s ease, transform .12s ease, background .18s ease, color .18s ease;
}
.mk-auth__btn--primary {
	margin-top: 4px;
	background: linear-gradient(135deg, var(--mc-primary, #7c3aed), var(--mc-secondary, #a855f7));
	color: var(--mc-on-primary, #fff);
	box-shadow: 0 12px 30px -10px rgba(var(--mc-primary-rgb, 124, 58, 237), .8);
}
.mk-auth__btn--primary:hover { filter: brightness(1.08); transform: translateY(-1px); color: var(--mc-on-primary, #fff); }
.mk-auth__btn--ghost {
	background: rgba(var(--mc-text-rgb, 255, 255, 255), .06);
	border-color: rgba(var(--mc-border-rgb, 42, 42, 42), .8);
	color: var(--mc-text, #fff);
	width: auto;
}
.mk-auth__btn--ghost:hover { background: rgba(var(--mc-text-rgb, 255, 255, 255), .12); color: var(--mc-text, #fff); }

.mk-auth__switch {
	margin: 18px 0 0;
	text-align: center;
	font-size: 13.5px;
	color: var(--mc-text-muted, #9a9a9a);
}
.mk-auth__switch a { color: var(--mc-accent, #c084fc); font-weight: 700; text-decoration: none; }
.mk-auth__switch a:hover { color: var(--mc-primary, #7c3aed); }

/* ── Estado "ya logueado" ──────────────────────────────────────────────── */
.mk-auth__done { text-align: center; }
.mk-auth__avatar { display: flex; justify-content: center; margin-bottom: 14px; }
.mk-auth__avatar img {
	width: 96px;
	height: 96px;
	border-radius: 50%;
	border: 3px solid rgba(var(--mc-primary-rgb, 124, 58, 237), .6);
}
.mk-auth__doneacts {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin-top: 22px;
}

/* Spinner del AJAX nativo (login.js) sobre la tarjeta */
.mk-auth .modal-loading-screen {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: grid;
	place-items: center;
	background: rgba(var(--mc-surface-rgb, 22, 22, 22), .6);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	border-radius: 16px;
	color: var(--mc-primary, #7c3aed);
}

@media (max-width: 520px) {
	.mk-auth__card { padding: 26px 20px 24px; }
	.mk-auth__title { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
	.mk-auth__blob { animation: none; }
	.mk-auth__panel.is-active { animation: none; }
}
