/* ═══════════════════════════════════════════════════════════════════
   AUTH — login and forgot-password pages
   Standalone pages (no admin shell). They link the theme with
   theme_css_links() plus this file, so tokens, buttons and motion are
   the same as inside the app — and the theme is already cached by the
   time the user lands on the dashboard.
   ═══════════════════════════════════════════════════════════════════ */

.auth-page {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	display: grid;
	grid-template-columns: minmax(360px, 44%) 1fr;
	background: var(--surface);
	color: var(--ink);
	font-family: var(--font-sans);
	/* estilos.css is not loaded here; base.css sets the body font. These
	   two keep the old body rules (absolute, overflow hidden) from any
	   cached shell out of the way. */
	position: static;
	overflow-x: hidden;
}


/* ── Brand panel ────────────────────────────────────────────────────── */

.auth-brand {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 32px;
	padding: 44px 48px;
	background: var(--nav-900);
	color: var(--nav-ink);
	isolation: isolate;
}

/* Two soft pools of teal light drifting slowly behind the content. They
   are blurred shapes, not a fill: the panel itself is solid navy. */
.auth-brand::before,
.auth-brand::after {
	content: '';
	position: absolute;
	z-index: -1;
	border-radius: 50%;
	filter: blur(70px);
	opacity: .55;
	pointer-events: none;
}

.auth-brand::before {
	width: 420px;
	height: 420px;
	top: -120px;
	right: -140px;
	background: var(--brand-500);
	animation: auth-drift-a 22s var(--ease-in-out) infinite alternate;
}

.auth-brand::after {
	width: 340px;
	height: 340px;
	bottom: -110px;
	left: -100px;
	background: var(--accent-mint);
	opacity: .22;
	animation: auth-drift-b 26s var(--ease-in-out) infinite alternate;
}

@keyframes auth-drift-a {
	from { transform: translate(0, 0) scale(1); }
	to   { transform: translate(-90px, 70px) scale(1.12); }
}

@keyframes auth-drift-b {
	from { transform: translate(0, 0) scale(1); }
	to   { transform: translate(80px, -60px) scale(1.08); }
}

/* The client's logo is the panel's only identity (no title repeating its
   name): large, centred vertically between the panel's top and the footer. */
.auth-brand__body {
	max-width: 380px;
	margin-block: auto;
}

/* Fixed height, proportional width: each app's logo.png has its own size
   (cocoupa's is 150x69); object-fit keeps a very wide one inside the cap. */
.auth-brand__logo {
	display: block;
	height: 84px;
	width: auto;
	max-width: min(280px, 100%);
	object-fit: contain;
	object-position: left center;
	margin-bottom: 28px;
	animation: ui-enter var(--dur-4) var(--ease-out) backwards;
}

.auth-brand__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 14px;
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--accent-mint);
	animation: ui-enter var(--dur-4) var(--ease-out) 80ms backwards;
}

.auth-brand__eyebrow::before {
	content: '';
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--accent-mint);
	animation: ui-pulse-ring 2.4s infinite;
}

.auth-brand__lead {
	margin: 0;
	font-size: var(--fs-base);
	line-height: 1.6;
	color: var(--nav-ink-soft);
	animation: ui-enter var(--dur-4) var(--ease-out) 200ms backwards;
}

.auth-brand__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: var(--fs-sm);
	color: var(--nav-ink-mute);
}

.auth-brand__foot img {
	max-height: 26px;
	width: auto;
	opacity: .7;
}

/* SaaS iso linked to the brand's website (brand_url()) */
.auth-brand__iso {
	display: inline-flex;
	border-radius: var(--r-xs);
	transition: opacity var(--dur-1) var(--ease-out);
}
.auth-brand__iso:hover img,
.auth-brand__iso:focus-visible img { opacity: 1; }
.auth-brand__iso:focus-visible { outline: 2px solid var(--accent-mint); outline-offset: 3px; }


/* ── Form side ──────────────────────────────────────────────────────── */

.auth-main {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 24px;
}

.auth-card {
	width: 100%;
	max-width: 380px;
	animation: ui-enter var(--dur-4) var(--ease-out) 60ms backwards;
}

/* Failed attempt: one short shake so the error registers. Read from the
   error box itself with :has(), since the view that renders the box is a
   partial and can't hand a flag back to the page. */
.auth-card:has(.auth-alert--error) { animation: ui-shake .45s var(--ease-in-out) 1; }

.auth-title {
	margin: 0 0 6px;
	font-size: var(--fs-2xl);
	font-weight: 700;
	letter-spacing: -.02em;
	color: var(--ink);
}

.auth-sub {
	margin: 0 0 26px;
	font-size: var(--fs-base);
	color: var(--ink-soft);
	line-height: 1.5;
}

/* Message box. ion_auth wraps both errors and notices ("sesión
   finalizada") in the same <p>, so the view picks the variant. */
.auth-alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 18px;
	padding: 11px 14px;
	border: 1px solid;
	border-radius: var(--r-md);
	font-size: var(--fs-md);
	line-height: 1.45;
	animation: ui-pop var(--dur-2) var(--ease-spring);
}

.auth-alert .fa { margin-top: 2px; font-size: var(--icon-md); }
.auth-alert p { margin: 0; }
.auth-alert p + p { margin-top: 4px; }

.auth-alert--error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.auth-alert--ok    { background: var(--ok-soft);     border-color: var(--ok-border);     color: var(--ok); }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

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

.auth-label {
	font-size: var(--fs-sm);
	font-weight: 600;
	color: var(--ink-soft);
}

.auth-input { position: relative; display: flex; align-items: center; }

.auth-input > .fa {
	position: absolute;
	left: 13px;
	font-size: var(--icon-sm);
	color: var(--ink-faint);
	pointer-events: none;
	transition: color var(--dur-1) var(--ease-out);
}

.auth-input input[type="text"],
.auth-input input[type="email"],
.auth-input input[type="password"] {
	width: 100%;
	height: 46px;
	margin: 0;
	padding: 0 14px 0 38px;
	border: 1px solid var(--line-strong);
	border-radius: var(--r-md);
	background: var(--surface);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: max(16px, var(--fs-base));            /* 16px+ keeps iOS from zooming on focus */
	font-weight: 500;
	box-shadow: none;
	transition: border-color var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out);
}

.auth-input input:hover { border-color: var(--brand-300); }

.auth-input input:focus {
	outline: none;
	border-color: var(--brand-500);
	box-shadow: var(--focus-ring);
}

.auth-input:focus-within > .fa { color: var(--brand-500); }

.auth-input--password input { padding-right: 46px; }

/* Show/hide password */
.auth-reveal {
	position: absolute;
	right: 6px;
	display: grid;
	place-items: center;
	width: var(--hit);
	height: var(--hit);
	padding: 0;
	border: 0;
	border-radius: var(--r-sm);
	background: transparent;
	color: var(--ink-mute);
	font-size: var(--icon-md);
	cursor: pointer;
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out);
}

.auth-reveal:hover { background: var(--bg-sunken); color: var(--ink); }
.auth-reveal:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.auth-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px 16px;
	font-size: var(--fs-md);
}

.auth-check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--ink-soft);
	cursor: pointer;
	user-select: none;
}

.auth-check input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--brand-500);
	cursor: pointer;
}

.auth-link {
	color: var(--brand-600);
	font-weight: 600;
	text-decoration: none;
	border-radius: var(--r-xs);
	transition: color var(--dur-1) var(--ease-out);
}

.auth-link:hover { color: var(--brand-700); text-decoration: underline; text-underline-offset: 3px; }

.auth-submit {
	width: 100%;
	height: 48px;
	margin: 6px 0 0;
	font-size: var(--fs-base);
}

.auth-submit .fa { font-size: var(--icon-sm); transition: transform var(--dur-2) var(--ease-spring); }
.auth-submit:hover .fa { transform: translateX(3px); }

.auth-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 18px;
}

.auth-legal {
	margin-top: 32px;
	font-size: var(--fs-xs);
	color: var(--ink-mute);
	text-align: center;
}


/* ── Small screens: brand becomes a header strip ────────────────────── */

@media (max-width: 860px) {
	.auth-page {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr;
	}

	.auth-brand {
		padding: 22px 22px 26px;
		gap: 14px;
	}

	.auth-brand::before { width: 260px; height: 260px; top: -110px; right: -90px; }
	.auth-brand::after  { width: 200px; height: 200px; bottom: -120px; left: -70px; }

	.auth-brand__body { margin-block: 0; }
	.auth-brand__logo { height: 52px; margin-bottom: 10px; }
	.auth-brand__eyebrow { margin-bottom: 0; }
	.auth-brand__lead,
	.auth-brand__foot { display: none; }

	.auth-main { align-items: flex-start; padding: 28px 20px 36px; }
}
