/*
 * Income & Expense app - the authentication screens (sign in, create account,
 * forgot password, new password, success), the developer credit line and the
 * transitions between screens.
 *
 * Loaded after app.css and uses the same custom properties, so re-theming
 * still happens in one place (the :root block in app.css).
 */

/* ---------- Shared auth frame ---------- */
#jie-root .jie-auth {
	position: relative; isolation: isolate; overflow: hidden;
	display: flex; align-items: center; justify-content: center;
	min-height: min(760px, 100vh); min-height: min(760px, 100svh);
	padding: 32px 16px; border-radius: var(--jie-radius-lg);
	background: transparent;
}
#jie-root .jie-auth__bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
#jie-root .jie-blob { position: absolute; display: block; border-radius: 50%; filter: blur(70px); opacity: .3; will-change: transform; }
#jie-root .jie-blob--1 { width: 340px; height: 340px; top: -90px; left: -70px; background: #7c3aed; animation: jie-drift-a 18s ease-in-out infinite alternate; }
#jie-root .jie-blob--2 { width: 300px; height: 300px; bottom: -80px; right: -60px; background: #2563eb; animation: jie-drift-b 22s ease-in-out infinite alternate; }
#jie-root .jie-blob--3 { width: 230px; height: 230px; top: 42%; left: 52%; background: #0ea5e9; opacity: .22; animation: jie-drift-c 26s ease-in-out infinite alternate; }

#jie-root .jie-auth__card {
	position: relative; width: 100%; max-width: 420px; padding: 32px 24px 20px;
	border-radius: var(--jie-radius-lg); border: 1px solid var(--jie-glass-border);
	background: var(--jie-glass);
	-webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
	box-shadow: var(--jie-shadow-lg);
	animation: jie-rise .55s var(--jie-ease) both;
}
#jie-root .jie-auth__card.is-shake { animation: jie-shake .5s cubic-bezier(.36, .07, .19, .97) both; }

#jie-root .jie-auth__title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
#jie-root .jie-auth__sub { margin: 6px 0 22px; text-align: center; color: var(--jie-muted); font-size: 15px; }
#jie-root .jie-auth__notice {
	margin: 0 0 14px; padding: 11px 14px; border-radius: var(--jie-radius-sm);
	background: var(--jie-accent-50); color: var(--jie-accent-700); font-size: 14px; font-weight: 600; text-align: center;
}
#jie-root .jie-auth__error {
	display: flex; align-items: center; gap: 8px; margin: 2px 0 14px; padding: 10px 14px; border-radius: var(--jie-radius-sm);
	background: var(--jie-expense-50); color: var(--jie-expense-700); font-size: 14px; font-weight: 600;
	animation: jie-fade-in .25s ease both;
}
#jie-root .jie-auth__foot {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 8px;
	margin-top: 16px; text-align: center; font-size: 14px; color: var(--jie-muted);
}
#jie-root .jie-authhint { margin: -8px 0 0; font-size: 12.5px; color: var(--jie-muted); }
#jie-root .jie-authrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px; margin-bottom: 8px; }
#jie-root .jie-authrow .jie-linkbtn { margin-left: auto; font-size: 14px; }
#jie-root .jie-linkbtn--quiet { font-weight: 600; }

/* The honeypot: present for bots, invisible and unreachable for people. */
#jie-root .jie-trap {
	position: absolute !important; left: -9999px !important; top: auto !important;
	width: 1px !important; height: 1px !important; overflow: hidden !important;
}

/* ---------- Floating-label fields ---------- */
#jie-root .jie-float { position: relative; margin-bottom: 14px; }
#jie-root .jie-float__input {
	display: block; width: 100%; height: 58px; padding: 22px 16px 6px; font-size: 16px; color: var(--jie-text);
	background: var(--jie-surface); border: 1.5px solid var(--jie-border-2); border-radius: 14px;
	transition: border-color .2s ease, box-shadow .2s ease;
}
#jie-root .jie-float__input::placeholder { color: transparent; }
#jie-root .jie-float__label {
	position: absolute; left: 17px; top: 50%; transform: translateY(-50%); transform-origin: left center;
	font-size: 16px; color: var(--jie-muted); pointer-events: none; white-space: nowrap;
	max-width: calc(100% - 60px); overflow: hidden; text-overflow: ellipsis;
	transition: top .18s ease, transform .18s ease, font-size .18s ease, color .18s ease;
}
#jie-root .jie-float__input:focus + .jie-float__label,
#jie-root .jie-float__input:not(:placeholder-shown) + .jie-float__label,
#jie-root .jie-float__input:-webkit-autofill + .jie-float__label { top: 9px; transform: none; font-size: 12px; font-weight: 650; color: var(--jie-accent-700); }
#jie-root .jie-float__input:focus { outline: 0; border-color: var(--jie-accent); box-shadow: 0 0 0 4px var(--jie-ring); }
#jie-root .jie-float__input.is-invalid { border-color: var(--jie-expense); box-shadow: 0 0 0 4px var(--jie-expense-50); }
#jie-root .jie-float .jie-eye { top: 29px; }
#jie-root .jie-authform .jie-field__err { margin: -8px 0 10px; }

/* ---------- Checkbox ---------- */
#jie-root .jie-check { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; cursor: pointer; font-size: 14.5px; color: var(--jie-text-2); user-select: none; }
#jie-root .jie-check input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; }
#jie-root .jie-check__box {
	display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: 0 0 22px;
	border: 1.5px solid var(--jie-border-2); border-radius: 7px; background: var(--jie-surface); color: #fff;
	transition: background-color .15s ease, border-color .15s ease;
}
#jie-root .jie-check__box svg { width: 15px; height: 15px; stroke-width: 3; fill: none; stroke: currentColor; opacity: 0; transform: scale(.5); transition: opacity .15s ease, transform .2s var(--jie-ease); }
#jie-root .jie-check input:checked + .jie-check__box { background: var(--jie-accent); border-color: var(--jie-accent); }
#jie-root .jie-check input:checked + .jie-check__box svg { opacity: 1; transform: none; }
#jie-root .jie-check input:focus-visible + .jie-check__box { box-shadow: 0 0 0 4px var(--jie-ring); }

/* ---------- Success screen ---------- */
#jie-root .jie-done__card { text-align: center; }
#jie-root .jie-done__mark {
	display: flex; align-items: center; justify-content: center; width: 96px; height: 96px; margin: 0 auto 18px;
	border-radius: 50%; color: var(--jie-income); background: var(--jie-income-50);
	animation: jie-pop-in .5s var(--jie-ease) both;
}
#jie-root .jie-done__mark svg { width: 76px; height: 76px; fill: none; stroke: currentColor; }
#jie-root .jie-done__ring { stroke-dasharray: 145; stroke-dashoffset: 145; animation: jie-draw .6s .1s var(--jie-ease) forwards; }
#jie-root .jie-done__tick { stroke-dasharray: 36; stroke-dashoffset: 36; animation: jie-draw .4s .55s var(--jie-ease) forwards; }
#jie-root .jie-done__actions { display: grid; gap: 10px; margin-top: 20px; }
#jie-root .jie-done .jie-auth__sub { margin-bottom: 0; color: var(--jie-text-2); }

/* ---------- Developer credit ---------- */
#jie-root .jie-credit { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--jie-border); text-align: center; }
#jie-root .jie-dash .jie-credit { margin-top: 24px; border-top: 0; padding-bottom: 6px; }
#jie-root .jie-credit__link {
	display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 4px 8px; border-radius: 999px;
	color: var(--jie-muted); font-size: 11px; font-weight: 600; letter-spacing: 0; text-decoration: none;
	transition: transform .18s var(--jie-ease), color .18s ease, background-color .18s ease;
}
#jie-root .jie-credit__wa { width: 13px; height: 13px; fill: currentColor; stroke: none; opacity: .9; }
@media (hover: hover) {
	#jie-root .jie-credit__link:hover { transform: translateY(-2px); color: var(--jie-income); background: var(--jie-income-50); }
}
#jie-root .jie-credit__link:focus-visible { outline: 3px solid var(--jie-ring); outline-offset: 2px; }

/* ---------- Screen transitions (slide + fade, never a hard swap) ---------- */
#jie-root .jie-auth.is-entering,
#jie-root .jie-dash.is-entering { animation: jie-screen-in .4s var(--jie-ease) both; }
#jie-root .jie-auth.is-entering .jie-auth__card { animation: none; }

/* ---------- Small phones ---------- */
@media (max-width: 479.98px) {
	#jie-root .jie-auth { border-radius: 22px; padding: 24px 12px; }
	#jie-root .jie-auth__card { padding: 28px 18px 18px; }
	#jie-root .jie-auth__title { font-size: 23px; }
}
@media (max-width: 359.98px) {
	#jie-root .jie-auth { padding: 18px 8px; }
	#jie-root .jie-auth__card { padding: 24px 14px 16px; }
	#jie-root .jie-check { font-size: 13.5px; }
}
@media (min-width: 768px) {
	#jie-root .jie-auth__card { max-width: 440px; padding: 38px 32px 24px; }
}

/* ---------- Animations ---------- */
@keyframes jie-screen-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes jie-pop-in { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes jie-shake {
	10%, 90% { transform: translateX(-2px); }
	20%, 80% { transform: translateX(4px); }
	30%, 50%, 70% { transform: translateX(-8px); }
	40%, 60% { transform: translateX(8px); }
}
@keyframes jie-drift-a { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(60px, 40px, 0) scale(1.12); } 100% { transform: translate3d(20px, 90px, 0) scale(.95); } }
@keyframes jie-drift-b { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(-70px, -30px, 0) scale(1.1); } 100% { transform: translate3d(-20px, -80px, 0) scale(.92); } }
@keyframes jie-drift-c { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(-90px, 50px, 0) scale(1.2); } 100% { transform: translate3d(-160px, -40px, 0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
	#jie-root .jie-blob { animation: none !important; }
	#jie-root .jie-auth__card, #jie-root .jie-auth.is-entering, #jie-root .jie-dash.is-entering { animation: none !important; }
	#jie-root .jie-done__mark { animation: none !important; }
	#jie-root .jie-done__ring, #jie-root .jie-done__tick { stroke-dashoffset: 0 !important; animation: none !important; }
	#jie-root .jie-credit__link:hover { transform: none; }
}
