/* ------------------------------------------------------------------
 * Login page — Tianneng brand, dark panel theme.
 * Loaded only by auth/login.blade.php, after admin-custom.css.
 *
 *   >= 992px  split screen: white brand panel | dark sign-in panel
 *   576–991   centred card on the dark background, logo in the card
 *   <  576    full-width card with a 16px gutter, compact spacing
 * ------------------------------------------------------------------ */

:root {
    --tn-red: #d61317;
    --tn-blue: #006dbf;
    --tn-blue-hover: #005a9e;
    --tn-bg: #070d1c;
    --tn-surface: #0f1a33;
    --tn-surface-border: rgba(255, 255, 255, 0.08);
    --tn-input-border: #1f2d4d;
    --tn-text: #e9ecef;
    --tn-muted: #8a94a6;
    --tn-danger: #ff5c6c;
    --tn-warning: #fbbc06;
    --tn-radius: 14px;
}

html, body.auth-body {
    min-height: 100%;
}

body.auth-body {
    margin: 0;
    background: var(--tn-bg);
    color: var(--tn-text);
    -webkit-font-smoothing: antialiased;
}

.auth-body svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Shell ------------------------------------------------------------------ */
.auth-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Brand panel (desktop) -------------------------------------------------- */
.auth-brand {
    display: none;
    position: relative;
    overflow: hidden;
    background: #fff;
    color: #111827;
}

.auth-brand__inner {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: auto;
    padding: 48px;
}

.auth-brand__logo {
    display: block;
    width: 260px;
    max-width: 100%;
    height: auto;
    margin-bottom: 48px;
}

.auth-brand__eyebrow {
    margin: 0 0 12px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tn-blue);
}

.auth-brand__headline {
    margin: 0 0 32px;
    font-size: 2rem;
    line-height: 1.25;
    font-weight: 700;
    color: #0b1220;
}

.auth-brand__features {
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-brand__features li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    font-size: 0.95rem;
    color: #374151;
    border-top: 1px solid #eef0f4;
}

.auth-brand__features li:last-child {
    border-bottom: 1px solid #eef0f4;
}

.auth-dot {
    flex: none;
    width: 8px;
    height: 8px;
    margin-right: 14px;
    border-radius: 2px;
    transform: rotate(45deg);
}
.auth-dot--red { background: var(--tn-red); }
.auth-dot--blue { background: var(--tn-blue); }

/* Slanted red/blue bands echoing the mark. */
.auth-brand__stripes {
    position: absolute;
    right: -120px;
    bottom: -140px;
    width: 360px;
    height: 360px;
    pointer-events: none;
    background:
        linear-gradient(115deg, transparent 0 38%, rgba(214, 19, 23, 0.10) 38% 52%, transparent 52% 60%, rgba(0, 109, 191, 0.12) 60% 74%, transparent 74%);
}

/* Sign-in panel ---------------------------------------------------------- */
.auth-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    padding-top: max(32px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    background:
        radial-gradient(900px 500px at 100% 0%, rgba(0, 109, 191, 0.16), transparent 60%),
        radial-gradient(700px 400px at 0% 100%, rgba(214, 19, 23, 0.10), transparent 60%),
        var(--tn-bg);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 32px;
    background: var(--tn-surface);
    border: 1px solid var(--tn-surface-border);
    border-radius: var(--tn-radius);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* Logo sits on a white chip — the artwork has a white background and the
 * black 天能 wordmark would disappear on the dark card. */
.auth-card__logo {
    display: flex;
    justify-content: center;
    margin: -8px -8px 28px;
    padding: 18px 16px;
    background: #fff;
    border-radius: 10px;
}

.auth-card__logo img {
    display: block;
    width: 180px;
    max-width: 70%;
    height: auto;
}

.auth-card__header {
    margin-bottom: 24px;
}

.auth-card__title {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.auth-card__subtitle {
    margin: 0;
    color: var(--tn-muted);
    font-size: 0.925rem;
}

/* Alert ------------------------------------------------------------------ */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #ffd7db;
    background: rgba(255, 92, 108, 0.10);
    border: 1px solid rgba(255, 92, 108, 0.35);
    border-radius: 10px;
}

.auth-alert svg {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    color: var(--tn-danger);
}

/* Fields ----------------------------------------------------------------- */
.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #c7cfdc;
}

.auth-field {
    position: relative;
}

.auth-field__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--tn-muted);
    pointer-events: none;
    transition: color 0.15s ease;
}

.auth-form .auth-input {
    height: 48px;
    padding-left: 44px;
    font-size: 0.95rem;
    border: 1px solid var(--tn-input-border);
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-form .auth-input--toggle {
    padding-right: 48px;
}

.auth-form .auth-input:focus {
    border-color: var(--tn-blue);
    box-shadow: 0 0 0 3px rgba(0, 109, 191, 0.30);
}

.auth-field:focus-within .auth-field__icon {
    color: #4ea3e8;
}

.auth-form .auth-input.is-invalid {
    border-color: var(--tn-danger);
    background-image: none;
}

.auth-form .auth-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(255, 92, 108, 0.25);
}

/* Browser autofill would otherwise paint a pale yellow/blue box. */
.auth-form .auth-input:-webkit-autofill,
.auth-form .auth-input:-webkit-autofill:hover,
.auth-form .auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--tn-text);
    -webkit-box-shadow: 0 0 0 1000px #0c1427 inset;
    caret-color: var(--tn-text);
    transition: background-color 9999s ease-out;
}

.auth-field__toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--tn-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    transform: translateY(-50%);
    cursor: pointer;
}

.auth-field__toggle:hover { color: var(--tn-text); }
.auth-field__toggle:focus-visible {
    outline: 2px solid var(--tn-blue);
    outline-offset: -2px;
}

.auth-field__toggle svg { width: 18px; height: 18px; }
.auth-field__toggle .icon-eye-off { display: none; }
.auth-field__toggle[aria-pressed="true"] .icon-eye { display: none; }
.auth-field__toggle[aria-pressed="true"] .icon-eye-off { display: block; }

.auth-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--tn-warning);
}
.auth-hint[hidden] { display: none; }
.auth-hint svg { width: 14px; height: 14px; }

/* Remember me ------------------------------------------------------------ */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 24px;
}

.auth-check {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 0.875rem;
    color: #c7cfdc;
    cursor: pointer;
    user-select: none;
    min-height: 44px;
}

.auth-check input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.auth-check__box {
    position: relative;
    flex: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid #3a4a6b;
    border-radius: 5px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.auth-check input:checked + .auth-check__box {
    background: var(--tn-blue);
    border-color: var(--tn-blue);
}

.auth-check input:checked + .auth-check__box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.auth-check input:focus-visible + .auth-check__box {
    box-shadow: 0 0 0 3px rgba(0, 109, 191, 0.40);
}

/* Submit ----------------------------------------------------------------- */
.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    font-size: 0.975rem;
    font-weight: 600;
    color: #fff;
    background: var(--tn-blue);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 109, 191, 0.30);
    transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.auth-submit:hover { background: var(--tn-blue-hover); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--tn-surface), 0 0 0 5px var(--tn-blue);
}

.auth-submit:disabled {
    cursor: progress;
    opacity: 0.85;
}

.auth-submit__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

.auth-submit.is-busy .auth-submit__spinner { display: inline-block; }

@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Footer ----------------------------------------------------------------- */
.auth-card__footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--tn-surface-border);
}

.auth-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 0 16px;
    font-size: 0.78rem;
    color: var(--tn-muted);
    text-align: center;
}
.auth-secure svg { flex: none; width: 14px; height: 14px; color: #4caf82; }

.auth-lang {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-lang__icon {
    width: 16px;
    height: 16px;
    color: var(--tn-muted);
}

.auth-lang__options {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--tn-surface-border);
    border-radius: 999px;
}

.auth-lang__option {
    padding: 6px 12px;
    font-size: 0.8rem;
    line-height: 1.2;
    color: var(--tn-muted);
    border-radius: 999px;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.auth-lang__option:hover,
.auth-lang__option:focus-visible {
    color: var(--tn-text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
}

.auth-lang__option.is-active {
    color: #fff;
    background: var(--tn-blue);
}

.auth-copyright {
    margin: 20px 0 0;
    font-size: 0.75rem;
    color: #5d6880;
    text-align: center;
}

/* Phones ----------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .auth-panel {
        justify-content: flex-start;
        padding-top: max(20px, env(safe-area-inset-top));
    }

    .auth-card {
        padding: 24px 20px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    }

    .auth-card__logo {
        margin: -4px -4px 22px;
        padding: 14px 12px;
    }

    .auth-card__title { font-size: 1.3rem; }

    /* 16px stops iOS Safari zooming the page when an input gets focus. */
    .auth-form .auth-input { font-size: 16px; }
}

/* Tablets ---------------------------------------------------------------- */
@media (min-width: 576px) and (max-width: 991.98px) {
    .auth-card {
        max-width: 460px;
        padding: 40px;
    }
}

/* Desktop: split screen -------------------------------------------------- */
@media (min-width: 992px) {
    .auth-brand {
        display: flex;
        flex: 0 0 52%;
    }

    .auth-panel {
        flex: 0 0 48%;
        padding: 48px;
    }

    /* The brand panel already shows the logo. */
    .auth-card__logo { display: none; }

    .auth-card {
        padding: 40px;
    }
}

@media (min-width: 1400px) {
    .auth-brand__headline { font-size: 2.35rem; }
    .auth-brand__logo { width: 300px; }
}

/* Short landscape screens (phones rotated): don't vertically centre into a clip. */
@media (max-height: 560px) {
    .auth-panel { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-body *,
    .auth-body *::before,
    .auth-body *::after {
        transition: none !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
