/* ------------------------------------------------------------------
   PandaPOS Design System — panda-auth.css
   Account pages (login, verification, password reset) for every
   PandaPOS app. Requires panda.css. Pages are statically rendered
   (EditForm/InputText), so these rules are global, not CSS-isolated.
------------------------------------------------------------------- */

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 1fr) 2fr;
    background: var(--panda-bg);
}

/* ---------- left: 1/3 panel ---------- */
.auth-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 56px);
    background:
        radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--panda-primary) 10%, transparent), transparent 40%),
        var(--panda-bg);
}

.auth-panel__inner {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Entrance animation lives on the siblings of the dialog, never on its ancestors:
   an animated ancestor (opacity/transform) would create a stacking context and trap the fixed overlay. */
.auth-logo, .auth-heading, .auth-form, .auth-alert, .auth-footer { animation: auth-rise .5s ease-out both; }
.auth-logo { display: inline-block; align-self: flex-start; }
.auth-logo__img { display: block; width: 170px; height: auto; }
.auth-logo__img--dark { display: none; }
[data-theme=dark] .auth-logo__img--light { display: none; }
[data-theme=dark] .auth-logo__img--dark { display: block; }

.auth-card {
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: clamp(28px, 3.5vw, 40px);
    background: var(--panda-surface);
    border: 1px solid var(--panda-border);
    border-radius: var(--panda-radius-xl);
    box-shadow: var(--panda-shadow-md);
}

.auth-heading { display: flex; flex-direction: column; gap: 6px; }
.auth-heading .panda-eyebrow { color: var(--panda-primary); margin-bottom: 4px; }
.auth-heading h1 { margin: 0; font-size: clamp(1.6rem, 2.4vw, 2rem); }
.auth-heading p { margin: 0; color: var(--panda-text-soft); font-size: var(--panda-font-md); }

/* ---------- form ---------- */
.auth-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }

.auth-field { display: flex; flex-direction: column; gap: 8px; }
.auth-field > span {
    font-size: var(--panda-font-sm);
    font-weight: var(--panda-weight-semibold);
    color: var(--panda-text-soft);
    letter-spacing: .01em;
}

.auth-control {
    display: flex;
    align-items: center;
    min-height: 48px;
    border: 1px solid var(--panda-border-strong);
    border-radius: var(--panda-radius-md);
    background: var(--panda-surface);
    transition: border-color var(--panda-duration-fast), box-shadow var(--panda-duration-fast);
}
.auth-control:hover { border-color: color-mix(in srgb, var(--panda-primary) 45%, var(--panda-border-strong)); }
.auth-control:focus-within {
    border-color: var(--panda-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--panda-primary) 15%, transparent);
}
.auth-control__affix {
    display: inline-grid; place-items: center;
    width: 44px; align-self: stretch;
    color: var(--panda-text-muted);
    border-right: 1px solid var(--panda-border);
}
.auth-control__affix svg { width: 18px; height: 18px; }

.auth-control input {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    padding: 0 14px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--panda-text);
    font-size: 15px;
}
.auth-control input::placeholder { color: var(--panda-text-muted); }

/* Edge/IE add their own reveal/clear buttons to password fields; we render our own toggle. */
.auth-control input::-ms-reveal,
.auth-control input::-ms-clear { display: none; }
.auth-control input.invalid { box-shadow: none; }
.auth-control:has(input.invalid) { border-color: var(--panda-danger); }

.auth-eye {
    display: inline-grid; place-items: center;
    width: 44px; align-self: stretch;
    border: 0; background: transparent;
    color: var(--panda-text-muted); cursor: pointer;
    border-radius: 0 var(--panda-radius-md) var(--panda-radius-md) 0;
}
.auth-eye:hover { color: var(--panda-primary); background: var(--panda-surface-2); }
.auth-eye svg { width: 18px; height: 18px; }

.auth-validation, .validation-message {
    display: block;
    color: var(--panda-danger);
    font-size: var(--panda-font-sm);
}
.auth-validation:empty { display: none; }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.auth-check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--panda-font-md); color: var(--panda-text-soft); }
.auth-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--panda-primary); cursor: pointer; }

.auth-link { color: var(--panda-primary); font-weight: var(--panda-weight-semibold); font-size: var(--panda-font-md); }
.auth-link:hover { color: var(--panda-primary-hover); text-decoration: underline; }
.auth-link--button { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
.auth-link--button:disabled { color: var(--panda-text-muted); cursor: default; text-decoration: none; }
.auth-link--center { text-align: center; }

.auth-submit {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    border-radius: var(--panda-radius-md);
    transition: transform var(--panda-duration-fast), box-shadow var(--panda-duration-fast), background var(--panda-duration-fast);
}
.auth-submit:hover { background: var(--panda-primary-hover); transform: translateY(-1px); box-shadow: 0 10px 24px color-mix(in srgb, var(--panda-primary) 30%, transparent); }
.auth-submit:active { transform: none; }

.auth-alert { margin: 0; }

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--panda-text-muted);
    font-size: var(--panda-font-sm);
}

.auth-theme {
    width: 36px; height: 36px;
    border: 1px solid var(--panda-border);
    border-radius: var(--panda-radius-sm);
    background: var(--panda-surface);
    color: var(--panda-text-soft);
    cursor: pointer;
    font-size: 15px;
}
.auth-theme:hover { color: var(--panda-primary); }
.auth-theme__dark { display: none; }
[data-theme=dark] .auth-theme__light { display: none; }
[data-theme=dark] .auth-theme__dark { display: inline; }

/* ---------- verification dialog ---------- */
.auth-overlay {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: color-mix(in srgb, #06110b 62%, transparent);
    backdrop-filter: blur(6px);
    animation: auth-rise .2s ease-out both;
}
.auth-modal {
    width: min(480px, 100%);
    margin: 0;
    background: var(--panda-surface);
    border: 1px solid var(--panda-border);
    border-radius: var(--panda-radius-xl);
    box-shadow: 0 30px 80px rgba(6, 17, 11, .35);
    overflow: hidden;
    animation: auth-modal-in .28s cubic-bezier(.2,.8,.2,1) both;
}
.auth-modal header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 28px 28px 0;
}
.auth-modal header > div { display: flex; flex-direction: column; gap: 4px; }
.auth-modal header h2 { font-size: 1.3rem; margin: 0; letter-spacing: -.02em; }
.auth-modal header .panda-eyebrow { color: var(--panda-primary); }
.auth-modal header .panda-icon-button { display: inline-grid; place-items: center; text-decoration: none; font-size: 18px; line-height: 1; }
.auth-modal__body { padding: 18px 28px 28px; display: flex; flex-direction: column; gap: 20px; }
.auth-modal__text { margin: 0; color: var(--panda-text-soft); line-height: 1.6; }
.auth-modal__text strong { color: var(--panda-text); }

@keyframes auth-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.auth-code {
    width: 100%;
    min-height: 64px;
    border: 1px solid var(--panda-border-strong);
    border-radius: var(--panda-radius-md);
    background: var(--panda-surface-2);
    color: var(--panda-text);
    font-size: 32px; font-weight: var(--panda-weight-bold);
    letter-spacing: .45em; text-align: center; text-indent: .45em;
    outline: none;
}
.auth-code:focus { border-color: var(--panda-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--panda-primary) 15%, transparent); }
.auth-code::placeholder { letter-spacing: .45em; color: var(--panda-border-strong); }

.auth-resend {
    display: flex; justify-content: center; align-items: center; gap: 8px;
    margin: 0;
    border-top: 1px solid var(--panda-border);
    padding-top: 16px;
    font-size: var(--panda-font-md); color: var(--panda-text-muted);
}

/* ---------- right: 2/3 rotating visual ---------- */
.auth-visual { position: relative; z-index: 0; overflow: hidden; background: #0f1512; isolation: isolate; }
.auth-slides { position: absolute; inset: 0; }

.auth-slide {
    position: absolute; inset: 0; margin: 0; opacity: 0;
    animation: auth-fade 28s infinite;
    animation-delay: calc(var(--i) * 7s);
}
.auth-slide img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    transform: scale(1.04);
    animation: auth-zoom 28s infinite;
    animation-delay: calc(var(--i) * 7s);
}
.auth-slide::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(5,8,7,.85) 0%, rgba(5,8,7,.35) 45%, transparent 75%);
}
.auth-slide figcaption {
    position: absolute; z-index: 1;
    left: clamp(28px, 6vw, 88px); right: clamp(28px, 6vw, 88px); bottom: clamp(64px, 11vh, 130px);
    max-width: 640px; color: #fff;
}
.auth-slide__eyebrow {
    display: inline-block; margin-bottom: 16px; padding: 7px 13px; border-radius: 99px;
    background: rgba(255,255,255,.12); backdrop-filter: blur(8px);
    font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #ffd9c9;
}
.auth-slide figcaption strong {
    display: block; margin-bottom: 12px;
    font-size: clamp(1.5rem, 2.6vw, 2.4rem); font-weight: 700; line-height: 1.15; letter-spacing: -.03em;
}
.auth-slide figcaption p { margin: 0; font-size: 15px; color: rgba(255,255,255,.78); max-width: 520px; }

.auth-dots { position: absolute; z-index: 1; left: clamp(28px, 6vw, 88px); bottom: clamp(28px, 5vh, 64px); display: flex; gap: 8px; }
.auth-dots i { position: relative; width: 30px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; }
.auth-dots i::after {
    content: ""; position: absolute; inset: 0; background: var(--panda-primary);
    transform-origin: left; transform: scaleX(0);
    animation: auth-dot 28s infinite; animation-delay: calc(var(--i) * 7s);
}

@keyframes auth-fade { 0% { opacity: 0; } 4% { opacity: 1; } 25% { opacity: 1; } 29% { opacity: 0; } 100% { opacity: 0; } }
@keyframes auth-zoom { 0% { transform: scale(1.04); } 29% { transform: scale(1.12); } 100% { transform: scale(1.12); } }
@keyframes auth-dot { 0% { transform: scaleX(0); } 25% { transform: scaleX(1); } 26%, 100% { transform: scaleX(0); } }
@keyframes auth-rise { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-slide, .auth-slide img, .auth-dots i::after, .auth-panel__inner { animation: none !important; }
    .auth-slide[style="--i:0"] { opacity: 1; }
}

/* The dialog markup is always rendered (its forms must exist for SSR form handling); hide it when idle. */
.auth-overlay[hidden] { display: none; }
