/*
 * Authentication pages (login, logged_out, inactivity_logout, csrf_failure)
 * use Tailwind + theme tokens in templates.
 * This file enforces card max-width (so it works even if Tailwind purge omits arbitrary values)
 * and theme-aware overrides (print, reduced motion).
 */

/* Card frame: all auth pages share the same 480-wide card, height adapts to content */
body.auth-page .auth-card {
    max-width: 480px;
    min-height: 27.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Login card: footer pinned to bottom, content centered via flex-1 wrapper */
body.auth-page .auth-card.auth-card--login {
    justify-content: flex-start;
}


/* ==========================================================================
   Auth page transitions — smooth slide between login ↔ quick-login ↔ logout
   Direction stored in sessionStorage by JS; CSS handles entrance/exit.
   ========================================================================== */
@keyframes auth-enter-from-right {
    from { opacity: 0; transform: translateX(40px) scale(0.97); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes auth-enter-from-left {
    from { opacity: 0; transform: translateX(-40px) scale(0.97); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes auth-enter-from-bottom {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes auth-exit-to-left {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(-40px) scale(0.97); }
}
@keyframes auth-exit-to-right {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(40px) scale(0.97); }
}

/* Entrance classes (applied on page load based on sessionStorage direction) */
body.auth-page .auth-card.auth-enter-right {
    animation: auth-enter-from-right 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.auth-page .auth-card.auth-enter-left {
    animation: auth-enter-from-left 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.auth-page .auth-card.auth-enter-bottom {
    animation: auth-enter-from-bottom 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Exit classes (applied on link click before navigation) */
body.auth-page .auth-card.auth-exit-left {
    animation: auth-exit-to-left 0.25s cubic-bezier(0.55, 0, 1, 0.45) both;
    pointer-events: none;
}
body.auth-page .auth-card.auth-exit-right {
    animation: auth-exit-to-right 0.25s cubic-bezier(0.55, 0, 1, 0.45) both;
    pointer-events: none;
}

/* Print: theme-aware background and minimal styling */
@media print {
    body.auth-page {
        background: var(--color-base-100);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.auth-page .d-btn,
    body.auth-page .d-input {
        transition: none;
    }
    body.auth-page .auth-card {
        animation: none;
    }
}

/* Auth page: theme drawer (right side). No navbar, so overlay and panel use full viewport. */
body.auth-page .d-drawer.d-drawer-end > .d-drawer-side {
    pointer-events: none;
    overflow: visible;
    z-index: 25;
}
body.auth-page .d-drawer.d-drawer-end:has(#theme-drawer-toggle:checked) > .d-drawer-side {
    pointer-events: auto;
}
body.auth-page .d-drawer.d-drawer-end > .d-drawer-side > .d-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    transition: background-color 0.2s ease;
    pointer-events: none;
}
body.auth-page .d-drawer.d-drawer-end:has(#theme-drawer-toggle:checked) > .d-drawer-side > .d-drawer-overlay {
    background-color: rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}
body.auth-page .d-drawer.d-drawer-end > .d-drawer-side > div:not(.d-drawer-overlay) {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 14rem;
    min-width: 14rem;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    translate: none; /* DaisyUI v5 sets translate:100% which compounds with transform */
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0, 0, 0.2, 1);
}
body.auth-page .d-drawer.d-drawer-end:has(#theme-drawer-toggle:checked) > .d-drawer-side > div:not(.d-drawer-overlay) {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

/* ==========================================================================
   Font family and text size (data attributes on html, same as dashboards)
   Ensures login, logged_out, inactivity_logout, csrf_failure are font- and text-size aware.
   ========================================================================== */

/* Text size: scale root so rem-based layout follows (small / medium / large / xtra-large) */
html[data-text-size="small"] {
    font-size: 14px;
}
html[data-text-size="medium"],
html:not([data-text-size]) {
    font-size: 16px;
}
html[data-text-size="large"] {
    font-size: 18px;
}
html[data-text-size="xtra-large"] {
    font-size: 20px;
}

/* Font family: applied to body.auth-page so auth pages use the chosen font */
html[data-font-family="dm-sans"] body.auth-page {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
html[data-font-family="inter"] body.auth-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
html[data-font-family="open-sans"] body.auth-page {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
html[data-font-family="inclusive"] body.auth-page {
    font-family: 'Inclusive Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
