/* ==========================================================================
   TrackerPro - Login / authentication

   Modern Executive Split-Screen design.
   Self-contained styling consuming tokens.css without requiring AdminLTE.
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body.tp-login {
    margin: 0;
    font-family: var(--tp-font-sans);
    font-size: var(--tp-fs-14);
    line-height: var(--tp-lh-base);
    color: var(--tp-n-900);
    background: #070D18;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tp-login__layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ==========================================================================
   Left Brand Stage (52%)
   ========================================================================== */

.tp-login__brand {
    flex: 0 0 52%;
    position: relative;
    background: radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.35) 0%, transparent 45%),
                radial-gradient(circle at 85% 75%, rgba(0, 210, 255, 0.2) 0%, transparent 40%),
                linear-gradient(145deg, #070E1B 0%, #0B192E 50%, #07101E 100%);
    color: #fff;
    padding: 56px 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* Micro dot-matrix texture overlay */
.tp-login__brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.45;
    pointer-events: none;
}

.tp-login__brand > * {
    position: relative;
    z-index: 2;
}

/* Brand Top Header Bar */
.tp-login__brand-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tp-login__tenant-lockup {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.tp-login__logo-badge {
    background: rgba(255, 255, 255, 0.98);
    padding: 6px 14px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    flex-shrink: 0;
}

.tp-login__logo-badge img {
    height: 32px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    display: block;
}

.tp-login__tenant-names {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tp-login__tenant-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-login__tenant-tag {
    font-size: 12px;
    color: #94A3B8;
}

/* Systems Online Status Chip */
.tp-login__status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34D399;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.tp-login__pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

/* Center Hero Copy */
.tp-login__hero {
    margin: 36px 0;
}

.tp-login__portal-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tp-cyan-400);
    margin-bottom: 12px;
}

.tp-login__headline {
    font-size: 38px;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: #FFFFFF;
    margin: 0 0 16px 0;
}

.tp-login__headline span {
    background: linear-gradient(135deg, #FFFFFF 30%, #93C5FD 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tp-login__tagline {
    font-size: 15px;
    line-height: 1.6;
    color: #94A3B8;
    max-width: 520px;
    margin: 0 0 32px 0;
}

/* Live Glassmorphic Preview Cards */
.tp-login__preview-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 520px;
}

.tp-login__glass-card {
    background: rgba(15, 30, 51, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.tp-login__glass-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 210, 255, 0.35);
}

.tp-login__glass-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.tp-login__bubble-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.3) 0%, rgba(0, 210, 255, 0.2) 100%);
    border: 1px solid rgba(0, 210, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38BDF8;
    font-size: 17px;
    flex-shrink: 0;
}

.tp-login__glass-info h4 {
    font-size: 13.5px;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0 0 3px 0;
}

.tp-login__glass-info p {
    font-size: 12px;
    color: #94A3B8;
    margin: 0;
}

.tp-login__status-chip {
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tp-login__status-chip--success {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.tp-login__status-chip--info {
    background: rgba(56, 189, 248, 0.15);
    color: #38BDF8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Bottom Trust Strip */
.tp-login__brand-footer {
    display: flex;
    align-items: center;
    gap: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tp-login__trust-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #94A3B8;
    white-space: nowrap;
}

.tp-login__trust-badge i {
    color: var(--tp-cyan-400);
    font-size: 13px;
}

/* ==========================================================================
   Right Form Stage (48%)
   ========================================================================= */

.tp-login__panel {
    flex: 0 0 48%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: #FAFBFC;
    position: relative;
}

.tp-login__wrapper {
    width: 100%;
    max-width: 440px;
}

.tp-login__card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 20px;
    padding: 42px 38px;
    box-shadow: 0 12px 36px -4px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.03);
}

.tp-login__header {
    margin-bottom: 28px;
}

.tp-login__title {
    font-size: 26px;
    font-weight: 700;
    color: #0F172A;
    letter-spacing: -0.02em;
    margin: 0 0 6px 0;
}

.tp-login__subtitle {
    font-size: 14px;
    color: #64748B;
    margin: 0;
    line-height: 1.5;
}

/* Fields & Modern Inputs */
.tp-login__field {
    margin-bottom: 20px;
}

.tp-login__field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.tp-login__inputwrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tp-login__icon {
    position: absolute;
    left: 15px;
    color: #94A3B8;
    font-size: 14px;
    pointer-events: none;
    transition: color 0.15s ease;
    z-index: 1;
}

.tp-login__input {
    width: 100%;
    height: 46px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 14px;
    color: #0F172A;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tp-login__input--hasicon {
    padding-left: 44px;
}

.tp-login__input--haspeek {
    padding-right: 44px;
}

.tp-login__input::placeholder {
    color: #94A3B8;
}

.tp-login__input:focus {
    background: #FFFFFF;
    border-color: var(--tp-blue-600);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.tp-login__inputwrap:focus-within .tp-login__icon {
    color: var(--tp-blue-600);
}

.tp-login__input.is-invalid {
    border-color: var(--tp-danger);
    background: #FFF5F5;
}

.tp-login__input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.15);
}

.tp-login__peek {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #94A3B8;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.tp-login__peek:hover {
    color: #475569;
}

.tp-login__peek:focus-visible {
    outline: 2px solid var(--tp-blue-600);
}

.tp-login__error {
    display: none;
    margin-top: 6px;
    font-size: var(--tp-fs-12);
    color: var(--tp-danger);
}

.tp-login__error.is-shown {
    display: block;
}

/* Auxiliary Row: Remember & Forgot */
.tp-login__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 13px;
    gap: 12px;
    flex-wrap: wrap;
}

.tp-login__remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #475569;
    user-select: none;
    margin: 0;
    font-weight: 500;
}

.tp-login__remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    accent-color: var(--tp-blue-600);
    cursor: pointer;
    margin: 0;
}

.tp-login__link {
    color: var(--tp-blue-600);
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    transition: color 0.15s ease;
}

.tp-login__link:hover {
    color: var(--tp-blue-700);
    text-decoration: underline;
}

/* Submit CTA Button */
.tp-login__submit {
    width: 100%;
    height: 48px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #1D4ED8 0%, #2563EB 100%);
    color: #FFFFFF;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tp-login__submit:hover {
    background: linear-gradient(135deg, #1E40AF 0%, #1D4ED8 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
}

.tp-login__submit:active {
    transform: translateY(0);
}

.tp-login__submit:disabled {
    background: #94A3B8;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Alert Banners — hidden by default; .is-shown turns them on.
   (display:flex would otherwise override the native [hidden] attribute.) */
.tp-login__alert {
    display: none;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.tp-login__alert.is-shown {
    display: flex;
}

.tp-login__alert[hidden] {
    display: none !important;
}

.tp-login__alert--danger {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #991B1B;
}

.tp-login__alert--success {
    background: #ECFDF5;
    border-color: #A7F3D0;
    color: #065F46;
}

.tp-login__alert--success i {
    color: #059669;
    margin-top: 2px;
}

/* Form Footer */
.tp-login__support {
    margin-top: 26px;
    text-align: center;
    font-size: 12.5px;
    color: #64748B;
    line-height: 1.5;
}

.tp-login__support p {
    margin: 0 0 16px 0;
}

.tp-login__support a {
    color: var(--tp-blue-600);
    text-decoration: none;
    font-weight: 500;
}

.tp-login__support a:hover {
    text-decoration: underline;
}

.tp-login__seal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #94A3B8;
}

.tp-login__seal i {
    color: #10B981;
}

/* ==========================================================================
   Password reset - in-page steps, not a modal stack
   ========================================================================== */

.tp-login__step {
    display: none;
}

.tp-login__step.is-active {
    display: block;
}

.tp-login__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tp-blue-600);
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 18px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.tp-login__back:hover {
    color: var(--tp-blue-700);
    text-decoration: underline;
}

.tp-login__steps {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
}

.tp-login__stepdot {
    height: 4px;
    flex: 1 1 0;
    border-radius: 999px;
    background: #E2E8F0;
}

.tp-login__stepdot.is-done {
    background: var(--tp-blue-600);
}

/* Account chooser (multi-customer email match) */
.tp-login__back-form {
    margin: 0;
}

.tp-login__accounts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.tp-login__accounts > form {
    margin: 0;
}

.tp-login__account {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.tp-login__account:hover,
.tp-login__account:focus {
    border-color: var(--tp-blue-600);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.tp-login__account-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #EFF6FF;
    color: var(--tp-blue-600);
}

.tp-login__account-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tp-login__account-name {
    font-size: 15px;
    font-weight: 650;
    color: #0F172A;
    line-height: 1.3;
}

.tp-login__account-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748B;
}

.tp-login__account-ref {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.tp-login__account-source {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: #F1F5F9;
    color: #475569;
    font-weight: 600;
}

.tp-login__account-address {
    font-size: 12px;
    color: #94A3B8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-login__account-chevron {
    flex: 0 0 auto;
    color: #CBD5E1;
    font-size: 12px;
}

.tp-login__account:hover .tp-login__account-chevron {
    color: var(--tp-blue-600);
}

/* Password strength meter */
.tp-login__strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.tp-login__strengthbar {
    height: 4px;
    flex: 1 1 0;
    border-radius: 999px;
    background: #E2E8F0;
    transition: background-color var(--tp-dur-fast) var(--tp-ease);
}

.tp-login__strengthbar.is-weak { background: var(--tp-danger); }
.tp-login__strengthbar.is-fair { background: var(--tp-warning); }
.tp-login__strengthbar.is-strong { background: var(--tp-success); }

.tp-login__strengthtext {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #64748B;
}

/* ==========================================================================
   Dark Theme Adaptation
   ========================================================================== */

html.tp-theme-dark body.tp-login .tp-login__panel {
    background: #0A101D;
}

html.tp-theme-dark body.tp-login .tp-login__card {
    background: #10192A;
    border-color: #1E293B;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

html.tp-theme-dark body.tp-login .tp-login__title {
    color: #F8FAFC;
}

html.tp-theme-dark body.tp-login .tp-login__subtitle {
    color: #94A3B8;
}

html.tp-theme-dark body.tp-login .tp-login__field label {
    color: #CBD5E1;
}

html.tp-theme-dark body.tp-login .tp-login__input {
    background: #0F172A;
    border-color: #1E293B;
    color: #F8FAFC;
}

html.tp-theme-dark body.tp-login .tp-login__input:focus {
    background: #141E33;
    border-color: var(--tp-cyan-400);
    box-shadow: 0 0 0 4px rgba(0, 210, 255, 0.15);
}

html.tp-theme-dark body.tp-login .tp-login__remember {
    color: #94A3B8;
}

html.tp-theme-dark body.tp-login .tp-login__support {
    color: #64748B;
}

html.tp-theme-dark body.tp-login .tp-login__account {
    background: #0F172A;
    border-color: #1E293B;
}

html.tp-theme-dark body.tp-login .tp-login__account:hover,
html.tp-theme-dark body.tp-login .tp-login__account:focus {
    border-color: var(--tp-cyan-400);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.15);
}

html.tp-theme-dark body.tp-login .tp-login__account-name {
    color: #F8FAFC;
}

html.tp-theme-dark body.tp-login .tp-login__account-meta,
html.tp-theme-dark body.tp-login .tp-login__account-address {
    color: #94A3B8;
}

html.tp-theme-dark body.tp-login .tp-login__account-source {
    background: #1E293B;
    color: #CBD5E1;
}

html.tp-theme-dark body.tp-login .tp-login__account-icon {
    background: rgba(0, 210, 255, 0.12);
    color: var(--tp-cyan-400);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1023.98px) {
    .tp-login__layout {
        flex-direction: column;
    }

    .tp-login__brand {
        flex: 0 0 auto;
        padding: 40px 32px 32px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .tp-login__headline {
        font-size: 28px;
    }

    .tp-login__preview-stack,
    .tp-login__brand-footer {
        display: none;
    }

    .tp-login__hero {
        margin: 24px 0 0 0;
    }

    .tp-login__tagline {
        margin-bottom: 0;
    }

    .tp-login__panel {
        flex: 1 1 auto;
        padding: 40px 24px;
        align-items: flex-start;
    }

    .tp-login__wrapper {
        max-width: 440px;
        margin: 0 auto;
    }
}

@media (max-width: 767.98px) {
    .tp-login__brand {
        padding: 24px 18px 20px;
    }

    .tp-login__logo-badge {
        height: 38px;
        padding: 4px 8px;
    }

    .tp-login__logo-badge img {
        height: 22px;
    }

    .tp-login__tenant-name {
        font-size: 13.5px;
    }

    .tp-login__status-badge {
        padding: 4px 9px;
        font-size: 11px;
    }

    .tp-login__hero {
        margin: 18px 0 0 0;
    }

    .tp-login__headline {
        font-size: 20px;
        line-height: 1.25;
        margin-bottom: 0;
    }

    .tp-login__portal-tag,
    .tp-login__tagline {
        display: none;
    }

    .tp-login__panel {
        padding: 20px 14px 32px;
    }

    .tp-login__card {
        padding: 28px 18px;
        border-radius: 16px;
    }

    .tp-login__title {
        font-size: 22px;
    }

    /* 16px prevents iOS Safari from zooming viewport on input focus */
    .tp-login__input {
        font-size: 16px;
        height: 48px;
    }

    .tp-login__submit {
        height: 48px;
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tp-login__input,
    .tp-login__submit,
    .tp-login__strengthbar,
    .tp-login__glass-card {
        transition: none;
    }
}
