/* ==========================================================================
   EBPHTB - Login page  (resources/views/auth/login.blade.php)
   --------------------------------------------------------------------------
   Direction: public-sector / trust-first. Mode "Operate" - the visitor has a
   task (sign in), so clarity outranks expression.

   Palette (localguide-DESIGN.md) - brand hues win over the skill's default
   navy/slate palette, but every text use stays on the AA-safe variant.

   Shape lock:  surfaces 24px · controls 12px · pill only for status chips
   Spacing:     4/8px scale via --space-* tokens
   ========================================================================== */

/* --------------------------------------------------------- 1. primitives */
.btg-auth {
    /* colour */
    --p-orange-600: #ea580c;
    --p-orange-700: #c2410c;
    --p-orange-800: #9a3412;
    --p-orange-950: #431407;
    --p-orange-50: #fff1e7;
    --p-orange-100: #ffedd5;
    --p-teal-600: #0d9488;
    --p-teal-700: #0f766e;
    --p-teal-50: #f0fdfa;
    --p-yellow-400: #eab308;
    --p-amber-100: #dcfce7;
    --p-green-700: #15803d;
    --p-stone-25: #fafaf9;
    --p-stone-50: #f5f5f4;
    --p-stone-100: #f2f2f1;
    --p-stone-200: #e7e5e4;
    --p-stone-300: #d6d3d1;
    --p-stone-400: #a8a29e;
    --p-stone-500: #78716c;
    --p-stone-600: #57534e;
    --p-stone-700: #44403c;
    --p-stone-900: #1c1917;
    --p-red-50: #fef2f2;
    --p-red-200: #fecaca;
    --p-red-600: #dc2626;
    --p-red-700: #b91c1c;
    --p-red-800: #991b1b;
    --p-white: #fff;

    /* space (4/8 rhythm) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    /* radius */
    --radius-control: 12px;
    --radius-surface: 24px;
    --radius-pill: 999px;

    /* motion */
    --ease-out: cubic-bezier(.22, 1, .36, 1);
    --dur-fast: 140ms;
    --dur-base: 220ms;

    /* 2. semantic */
    --surface-page: var(--p-white);
    --surface-card: var(--p-white);
    --surface-brand: linear-gradient(150deg, var(--p-orange-950) 0%, #431407 46%, var(--p-stone-900) 100%);
    --text-strong: var(--p-stone-900);
    --text-muted: var(--p-stone-600);
    --text-on-brand: var(--p-white);
    --text-on-brand-soft: rgba(255, 255, 255, .82);
    --accent: var(--p-orange-700);
    --accent-hover: var(--p-orange-800);
    --accent-tint: var(--p-orange-50);
    --accent-tint-hover: var(--p-orange-100);
    --link: var(--p-teal-700);
    --border: var(--p-stone-200);
    --border-strong: var(--p-stone-300);
    --danger: var(--p-red-700);
    --focus-ring: 0 0 0 4px rgba(234, 88, 12, .18);
    --focus-ring-danger: 0 0 0 4px rgba(220, 38, 38, .18);

    /* 3. component */
    --c-field-height: 52px;
    --c-control-font: 1rem;

    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    background: var(--surface-page);
    color: var(--text-strong);
    font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

.btg-auth *,
.btg-auth *::before,
.btg-auth *::after { box-sizing: border-box; }

/* Browser surfaces belong to the palette, not to the OS. */
.btg-auth ::selection { background: var(--p-orange-100); color: var(--p-orange-950); }
.btg-auth input,
.btg-auth textarea { caret-color: var(--accent); }
.btg-auth *:focus-visible { outline: 2px solid var(--p-orange-600); outline-offset: 2px; }
.btg-auth *::-webkit-scrollbar { width: 10px; height: 10px; }
.btg-auth *::-webkit-scrollbar-thumb { background: var(--p-stone-300); border-radius: var(--radius-pill); }
.btg-auth *::-webkit-scrollbar-thumb:hover { background: var(--p-stone-400); }
.btg-auth a { text-underline-offset: 3px; }

/* Neutralise the shared Cuba shell for this one surface. */
body:has(.btg-auth) { background: var(--surface-page); overflow-x: hidden; }
body:has(.btg-auth) #app,
body:has(.btg-auth) .page-wrapper { padding: 0; margin: 0; min-height: 0; background: none; }
body:has(.btg-auth) .tap-top { display: none !important; }

/* ------------------------------------------------------------- 2. layout */
.btg-auth__grid {
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    display: grid;
    gap: var(--space-5);
    padding: clamp(var(--space-3), 3vw, var(--space-6));
    align-items: center;
}
@media (min-width: 960px) {
    .btg-auth__grid {
        grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
        gap: clamp(var(--space-5), 4vw, var(--space-7));
        min-height: 100vh;
        min-height: 100dvh;
    }
}

/* --------------------------------------------------- brand panel (Operate) */
.btg-auth__brand {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(var(--space-5), 3.5vw, var(--space-6));
    border-radius: var(--radius-surface);
    background: var(--surface-brand);
    color: var(--text-on-brand);
}
/* Panel brand: satu gradient + satu cahaya. Tanpa garis-garis dekoratif. */
.btg-auth__brand::after {
    content: '';
    position: absolute;
    z-index: -1;
    top: -18%;
    right: -12%;
    width: 58%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(234, 88, 12, .34) 0%, rgba(13, 148, 136, .12) 45%, transparent 70%);
    pointer-events: none;
}
.btg-auth__logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: inherit;
}
.btg-auth__logo img { max-height: 44px; width: auto; }
.btg-auth__wordmark { display: flex; flex-direction: column; line-height: 1.15; }
.btg-auth__wordmark b {
    font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
    font-size: 1.1875rem;
    font-weight: 600;
    letter-spacing: .01em;
}
.btg-auth__wordmark span { font-size: .75rem; color: rgba(255, 255, 255, .7); }

.btg-auth__title {
    margin: var(--space-6) 0 0;
    max-width: 15ch;
    font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 600;
    font-size: clamp(2rem, 1.15rem + 2.6vw, 2.875rem);
    line-height: 1.1;
    letter-spacing: -.015em;
    color: var(--text-on-brand);
    text-wrap: balance;
}
.btg-auth__lede {
    margin: var(--space-4) 0 0;
    max-width: 46ch;
    font-size: 1.0313rem;
    line-height: 1.6;
    color: var(--text-on-brand-soft);
    text-wrap: pretty;
}

.btg-auth__points {
    margin: var(--space-5) 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: var(--space-3);
}
.btg-auth__point {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: .9375rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, .92);
}
.btg-auth__point svg {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 2px;
    color: var(--p-yellow-400);
}

.btg-auth__art {
    position: relative;
    margin-top: var(--space-5);
    display: flex;
    justify-content: flex-start;
    min-height: clamp(200px, 26vw, 280px);
    align-items: center;
    --mx: 0px;
    --my: 0px;
    --ms: 1;
    --lift: 0;
    transform: translate3d(var(--mx), var(--my), 0) scale(var(--ms));
    transition: transform 320ms var(--ease-out);
}
.btg-auth__glow {
    position: absolute;
    z-index: -1;
    inset: 4% 8% 4% 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(234, 88, 12, .3) 0%, transparent 66%);
    filter: blur(6px);
    pointer-events: none;
}
.btg-auth__ring {
    position: absolute;
    z-index: -1;
    left: -6%;
    top: 50%;
    width: clamp(240px, 34vw, 330px);
    height: auto;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, .38);
    pointer-events: none;
}
.btg-auth__ring-path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 5 11; }
.btg-auth__art img {
    position: relative;
    width: min(100%, 300px);
    height: auto;
    opacity: .9;
    mix-blend-mode: luminosity;
    filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .35));
    will-change: transform;
}
.btg-auth__chip {
    position: absolute;
    left: 0;
    bottom: 8%;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--p-white);
    color: var(--text-strong);
    font-size: .75rem;
    font-weight: 700;
    box-shadow: 0 18px 36px -18px rgba(0, 0, 0, .65);
    will-change: transform;
}
.btg-auth__chip svg { width: 14px; height: 14px; color: var(--p-green-700); }

/* ------------------------------------------------------------- 4. motion */
/* Satu bahasa gerak: ease-out untuk masuk, spring untuk pop,
   linear untuk orbit, dan semua mati di prefers-reduced-motion. */
@keyframes btg-auth-breathe {
    0%, 100% { transform: translate3d(0, -7px, 0) scale(1); }
    50% { transform: translate3d(0, 7px, 0) scale(1.015); }
}
@keyframes btg-auth-pulse {
    0%, 100% { opacity: .55; transform: scale(.94); }
    50% { opacity: .9; transform: scale(1.06); }
}
@keyframes btg-auth-orbit-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}
@keyframes btg-auth-float {
    0%, 100% { transform: translateY(-6px); }
    50% { transform: translateY(6px); }
}
@keyframes btg-auth-march {
    to { stroke-dashoffset: -48; }
}
@media (prefers-reduced-motion: no-preference) {
    .btg-auth__glow { animation: btg-auth-pulse 6.5s ease-in-out infinite; }
    .btg-auth__ring { animation: btg-auth-orbit-spin 46s linear infinite; }
    .btg-auth__ring-path { animation: btg-auth-march 12s linear infinite; }
    .btg-auth__art img { animation: btg-auth-breathe 9s ease-in-out infinite; }
    .btg-auth__chip { animation: btg-auth-float 4.5s ease-in-out infinite; }
}
@media (prefers-reduced-motion: reduce) {
    .btg-auth__glow,
    .btg-auth__ring,
    .btg-auth__ring-path,
    .btg-auth__art img,
    .btg-auth__chip { animation: none !important; transform: none !important; }
    .btg-auth__art { transform: none !important; transition: none !important; }
}

/* ----------------------------------------------------------- 3. the form */
.btg-auth__panel { width: 100%; max-width: 26rem; margin-inline: auto; }
.btg-auth__back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 44px;
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--accent);
}
.btg-auth__back:hover { color: var(--accent-hover); }
.btg-auth__back svg { width: 16px; height: 16px; }

.btg-auth__card {
    margin-top: var(--space-2);
    padding: clamp(var(--space-5), 3.5vw, var(--space-6));
    border: 1px solid var(--border);
    border-radius: var(--radius-surface);
    background: var(--surface-card);
    box-shadow: 0 28px 56px -32px rgba(28, 25, 23, .38);
}
.btg-auth__card h2 {
    margin: 0;
    font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -.01em;
    text-wrap: balance;
}
.btg-auth__hint { margin: var(--space-1) 0 0; font-size: .9375rem; color: var(--text-muted); }

.btg-auth__field { margin-top: var(--space-4); }
.btg-auth__label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--text-strong);
}
.btg-auth__control { position: relative; display: flex; align-items: center; }
.btg-auth__control > svg {
    position: absolute;
    left: var(--space-3);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}
.btg-auth__input {
    width: 100%;
    min-height: var(--c-field-height);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--p-white);
    font: inherit;
    font-size: var(--c-control-font);
    color: var(--text-strong);
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.btg-auth__input::placeholder { color: var(--p-stone-600); opacity: 1; }
.btg-auth__input:hover { border-color: var(--border-strong); }
.btg-auth__input:focus { outline: none; border-color: var(--p-orange-600); box-shadow: var(--focus-ring); }
.btg-auth__input[aria-invalid='true'] { border-color: var(--p-red-600); }
.btg-auth__input[aria-invalid='true']:focus { box-shadow: var(--focus-ring-danger); }
/* Autofill must not repaint the field yellow-blue. */
.btg-auth__input:-webkit-autofill {
    -webkit-text-fill-color: var(--text-strong);
    box-shadow: 0 0 0 1000px var(--p-white) inset;
    caret-color: var(--accent);
}
.btg-auth__input--icon { padding-left: 44px; }
.btg-auth__input--action { padding-right: 56px; }
.btg-auth__input--bare { padding-left: var(--space-4); }

.btg-auth__action {
    position: absolute;
    right: var(--space-1);
    display: inline-grid;
    place-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.btg-auth__action:hover { color: var(--accent); background: var(--accent-tint); }
.btg-auth__action svg { width: 18px; height: 18px; }
.btg-auth__action.is-loading svg { animation: btg-auth-spin .9s linear infinite; }
@keyframes btg-auth-spin { to { transform: rotate(360deg); } }

.btg-auth__error {
    display: block;
    margin-top: var(--space-1);
    font-size: .8125rem;
    font-weight: 700;
    color: var(--danger);
}

/* Error summary: 1px border, tinted field, focusable, links to the field. */
.btg-auth__summary {
    margin: 0 0 var(--space-5);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--p-red-200);
    border-radius: var(--radius-control);
    background: var(--p-red-50);
}
.btg-auth__summary h3 {
    margin: 0 0 var(--space-1);
    font-size: .875rem;
    font-weight: 700;
    color: var(--p-red-800);
}
.btg-auth__summary ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.btg-auth__summary a { color: var(--p-red-800); font-size: .8125rem; font-weight: 700; }
.btg-auth__summary a:hover { color: var(--p-red-600); }
.btg-auth__summary:focus-visible { outline: 2px solid var(--p-red-600); outline-offset: 2px; }

.btg-auth__captcha {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.btg-auth__captcha img { height: 52px; border: 1px solid var(--border); border-radius: 10px; }
.btg-auth__captcha .btg-auth__action {
    position: static;
    background: var(--accent-tint);
    color: var(--accent);
}
.btg-auth__captcha .btg-auth__action:hover { background: var(--accent-tint-hover); }

.btg-auth__row {
    margin-top: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}
.btg-auth__check {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    font-size: .875rem;
    color: var(--text-muted);
    cursor: pointer;
}
.btg-auth__check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--p-orange-600);
    cursor: pointer;
}
.btg-auth__link { font-size: .875rem; font-weight: 700; text-decoration: none; color: var(--link); }
.btg-auth__link:hover { text-decoration: underline; }

.btg-auth__submit {
    width: 100%;
    margin-top: var(--space-5);
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    border: 0;
    border-radius: var(--radius-control);
    background-image: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: var(--p-white);
    font: inherit;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 16px 30px -16px rgba(154, 52, 18, .8);
    transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) ease, filter var(--dur-fast) ease;
}
.btg-auth__submit:hover { transform: translateY(-2px); box-shadow: 0 22px 36px -16px rgba(154, 52, 18, .85); }
.btg-auth__submit:active { transform: translateY(0); }
.btg-auth__submit[disabled] { cursor: progress; filter: saturate(.9) opacity(.9); }
.btg-auth__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: var(--p-white);
    border-radius: 50%;
    animation: btg-auth-spin .8s linear infinite;
    display: none;
}
.btg-auth__submit.is-busy .btg-auth__spinner { display: inline-block; }

.btg-auth__foot {
    margin: var(--space-5) 0 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    font-size: .8125rem;
    line-height: 1.55;
    color: var(--text-muted);
    text-align: center;
}

/* ------------------------------------------------------- 4. one entrance */
@media (prefers-reduced-motion: no-preference) {
    @keyframes btg-auth-rise {
        from { opacity: 0; transform: translate3d(0, 14px, 0); }
    }
    .btg-auth__card { animation: btg-auth-rise .6s var(--ease-out) .06s backwards; }
    .btg-auth__brand > * { animation: btg-auth-rise .6s var(--ease-out) backwards; }
    .btg-auth__brand > *:nth-child(1) { animation-delay: 0s; }
    .btg-auth__brand > *:nth-child(2) { animation-delay: .07s; }
    .btg-auth__brand > *:nth-child(3) { animation-delay: .14s; }
    .btg-auth__brand > *:nth-child(4) { animation-delay: .21s; }
    .btg-auth__brand > *:nth-child(5) { animation-delay: .28s; }
}

@media (prefers-reduced-motion: reduce) {
    .btg-auth__card,
    .btg-auth__brand > * { animation: none !important; }
    .btg-auth__spinner,
    .btg-auth__action.is-loading svg { animation-duration: 2.4s !important; }
    .btg-auth__submit,
    .btg-auth__input,
    .btg-auth__action { transition: none !important; }
}

@media (max-width: 959px) {
    .btg-auth__grid { align-items: start; }
    .btg-auth__art { justify-content: center; }
    .btg-auth__art img { width: min(100%, 240px); }
    /* Pakai properti `translate` supaya tidak bentrok dengan animasi float. */
    .btg-auth__chip { left: 50%; translate: -120% 0; }
    .btg-auth__ring { left: 50%; translate: -50% -50%; }
}
