/* ════════════════════════════════════════════════════════
   LOGIN — Glass card over background image
   ════════════════════════════════════════════════════════
   Centred glassmorphism card over a full-viewport photo.
   Warehouse-token-aware: --login-body-bg sets the overlay
   colour when no background image is configured.
   ════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --teal:        #09B794;
    --teal-dark:   #07997c;
    --teal-deeper: #066d58;
    --teal-glow:   rgba(9,183,148,.18);
    --ink:         #0f172a;
    --ink-mid:     #334155;
    --ink-light:   #64748b;
    --border:      #e2e8f0;
    --surface:     #f8fafc;
    --white:       #ffffff;
    /* Same background as the home page glass theme */
    --login-body-bg: linear-gradient(135deg, #cfe5e0 0%, #b6d8e8 35%, #f2dec0 100%);
    /* Background image — set via admin settings or override here.
       Falls back to gradient when no image is configured. */
    --login-bg-image: none;
}

/* ── Full-viewport background ── */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--login-body-bg, linear-gradient(135deg, #cfe5e0 0%, #b6d8e8 35%, #f2dec0 100%));
    background-attachment: fixed;
    overflow-x: hidden;
    position: relative;
}

/* Subtle texture overlay — adds depth without darkening the pastel bg */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.25) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(255,255,255,.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ── Glass card ── */
.login-glass {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin: 2rem 1rem;
    padding: 2rem 2.25rem 1.75rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, .45);
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, .55);
    box-shadow:
        0 32px 80px rgba(15, 23, 42, .08),
        0  8px 24px rgba(15, 23, 42, .06),
        inset 0 1px 0 rgba(255, 255, 255, .5);
}

/* ── Emblem / logo ── */
.login-glass__emblem {
    display: flex;
    justify-content: center;
    margin-bottom: .6rem;
}

.login-glass__emblem img {
    height: 64px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.10));
    /* Reset any theme overrides */
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    background: none !important;
    padding: 0 !important;
}

/* ── Card header ── */
.login-glass__header {
    text-align: center;
    margin-bottom: 1.6rem;
}

.login-glass__title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin-bottom: .15rem;
}

.login-glass__sub {
    font-size: .74rem;
    font-weight: 500;
    color: #475569;
}

/* ── Alert messages ── */
.login-alert {
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 500;
    padding: .55rem .85rem;
    margin-bottom: .9rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    border: none;
}
.login-alert i { flex-shrink: 0; font-size: .72rem; }
.alert-warning { background: rgba(255,251,235,.88); color: #92400e; border: 1px solid rgba(253,230,138,.4); }
.alert-success { background: rgba(240,253,244,.88); color: #166534; border: 1px solid rgba(187,247,208,.4); }
.alert-danger  { background: rgba(254,242,242,.88); color: #991b1b; border: 1px solid rgba(254,202,202,.4); }

/* ── Form fields ── */
.field-group {
    position: relative;
    margin-bottom: 1.1rem;
}

.input-shell {
    display: flex;
    align-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .50);
    border: 1px solid rgba(255, 255, 255, .60);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: border-color .18s, box-shadow .18s, background .18s;
    overflow: hidden;
}

.input-shell:focus-within {
    border-color: rgba(9, 183, 148, .40);
    background: rgba(255, 255, 255, .65);
    box-shadow: 0 0 0 3px rgba(9, 183, 148, .08);
}

.input-shell .prefix-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    color: #94a3b8;
    font-size: .82rem;
    flex-shrink: 0;
    transition: color .18s;
}

.input-shell:focus-within .prefix-icon {
    color: #475569;
}

.input-shell input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: .88rem;
    font-weight: 500;
    color: #0f172a;
    padding: .82rem .5rem .82rem 0;
}

.input-shell input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

/* Autofill override */
.input-shell input:-webkit-autofill,
.input-shell input:-webkit-autofill:hover,
.input-shell input:-webkit-autofill:focus {
    -webkit-text-fill-color: #0f172a;
    -webkit-box-shadow: 0 0 0 40px rgba(255,255,255,.50) inset;
    transition: background-color 5000s ease-in-out 0s;
}

.input-shell .suffix-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 100%;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: .82rem;
    flex-shrink: 0;
    transition: color .15s;
    padding: 0;
}
.input-shell .suffix-btn:hover { color: #475569; }

/* ── Field tooltip error ── */
.field-group.has-tooltip {
    margin-bottom: 2.6rem;
}

.field-tooltip {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    background: rgba(254,242,242,.95);
    border: 1.5px solid #fca5a5;
    border-radius: 10px;
    padding: .42rem .8rem;
    font-size: .76rem;
    font-weight: 600;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: .45rem;
    z-index: 20;
    box-shadow: 0 4px 14px rgba(220,38,38,.18);
    animation: tooltipIn .18s cubic-bezier(.34,1.56,.64,1);
    white-space: nowrap;
}

.field-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 20px;
    border: 6px solid transparent;
    border-bottom-color: #fca5a5;
}
.field-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 21.5px;
    border: 4.5px solid transparent;
    border-bottom-color: rgba(254,242,242,.95);
}
.field-tooltip i { font-size: .72rem; flex-shrink: 0; }

.input-shell.has-error {
    border-color: rgba(248,113,113,.7);
    background: rgba(255,100,100,.12);
}
.input-shell.has-error .prefix-icon { color: #fca5a5; }

@keyframes inputShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-5px); }
    40%     { transform: translateX( 5px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX( 3px); }
}
.input-shell.shake { animation: inputShake .38s ease; }

@keyframes tooltipIn {
    from { opacity: 0; transform: translateY(-5px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ── Remember + Forgot row ── */
.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: .25rem 0 1.4rem;
}

.remember-row .remember-left {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.remember-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--teal);
    cursor: pointer;
    flex-shrink: 0;
}

.remember-row label {
    font-size: .78rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    user-select: none;
}

.remember-row .forgot-link {
    font-size: .76rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    transition: color .15s;
}
.remember-row .forgot-link:hover { color: #0f172a; }

/* ── Login button — warm gold/amber ── */
.btn-login {
    width: 100%;
    padding: .88rem 2rem;
    border: none;
    border-radius: 12px;
    background: var(--brand-btn-bg, linear-gradient(135deg, #d4a855 0%, #c49340 55%, #b07e2c 100%));
    color: #fff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    box-shadow:
        0 6px 20px rgba(180,130,50,.35),
        0 2px  6px rgba(180,130,50,.20);
    transition: transform .12s, box-shadow .18s, filter .18s;
    position: relative;
    overflow: hidden;
}

.btn-login i {
    font-size: .82rem;
}

.btn-login:hover {
    filter: brightness(1.08);
    box-shadow:
        0 10px 28px rgba(180,130,50,.42),
        0  3px 10px rgba(180,130,50,.25);
    transform: translateY(-1px);
}

.btn-login:active {
    transform: translateY(0) scale(.98);
    filter: brightness(.95);
}

.btn-login:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

/* ── Divider ── */
.login-glass__divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.2rem 0 .6rem;
    color: rgba(15, 23, 42, .15);
    font-size: .7rem;
}

.login-glass__divider::before,
.login-glass__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(15, 23, 42, .08);
}

.login-glass__divider::before { margin-right: .7rem; }
.login-glass__divider::after  { margin-left: .7rem; }

/* ── Footer inside card ── */
.login-glass__footer {
    text-align: center;
}

.login-glass__footer-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    margin-bottom: .35rem;
}

.login-glass__footer-logos img {
    height: 24px;
    width: 24px;
    object-fit: contain;
    opacity: .40;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    background: none !important;
    padding: 0 !important;
}

.login-glass__footer-sep {
    width: 1px;
    height: 14px;
    background: rgba(15, 23, 42, .10);
}

.login-glass__footer-copy {
    font-size: .62rem;
    font-weight: 500;
    color: #94a3b8;
    line-height: 1.5;
}

/* ── Security notice ── */
.security-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin-top: .8rem;
    font-size: .66rem;
    font-weight: 500;
    color: #94a3b8;
}
.security-notice i { font-size: .62rem; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .login-glass {
        margin: 1rem .75rem;
        padding: 1.75rem 1.5rem 1.5rem;
        border-radius: 18px;
    }

    .login-glass__emblem img { height: 52px; }
    .login-glass__title { font-size: 1.5rem; }

    .input-shell input {
        font-size: 16px;
        padding: .9rem .5rem .9rem 0;
    }
    .input-shell .prefix-icon { width: 44px; }

    .btn-login {
        padding: .95rem 2rem;
        font-size: .9rem;
    }
}

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

/* ════════════════════════════════════════════════════════
   LAN WIDGET (localhost only)
   ════════════════════════════════════════════════════════ */
.tfms-lan-widget {
    position: fixed; bottom: 16px; right: 16px; z-index: 9999;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px; backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .2s, border-color .2s;
}
.tfms-lan-widget:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.30); }
.tfms-lan-widget .icon { font-size: 22px; color: #fff; }
.tfms-lan-widget .count-badge {
    position: absolute; top: -6px; right: -6px;
    background: #0d9488; color: #fff;
    border: 2px solid rgba(0,119,112,.6);
    border-radius: 999px; font-size: 11px; font-weight: 700;
    min-width: 22px; height: 22px; line-height: 18px;
    padding: 0 5px; text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.tfms-lan-widget .count-badge.zero { background: rgba(148,163,184,.5); }
.tfms-lan-panel {
    position: fixed; bottom: 76px; right: 16px; z-index: 9999;
    background: rgba(255,255,255,.92); backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,.5); border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    padding: 14px 16px; width: 340px; max-width: 90vw;
    display: none; font-family: system-ui, -apple-system, sans-serif;
}
.tfms-lan-panel.open { display: block; }
.tfms-lan-panel h3 { margin:0 0 4px; font-size:.95rem; color:#0f172a; }
.tfms-lan-panel .sub { font-size:.7rem; color:#64748b; margin-bottom: 10px; }
.tfms-lan-panel .url-box {
    background: #f8fafc; border:1px dashed #cbd5e1; border-radius:8px;
    padding:.5rem .6rem; font-family:'Consolas', monospace;
    font-size:.85rem; color:#0f172a; word-break: break-all; margin-bottom: 8px;
}
.tfms-lan-panel .actions { display:flex; gap:6px; margin-top: 8px; }
.tfms-lan-panel .lan-btn {
    flex:1; padding:.4rem .6rem; border-radius:8px; border:1px solid #0d9488;
    background:#0d9488; color:#fff; font-size:.75rem; font-weight:600; cursor:pointer;
}
.tfms-lan-panel .lan-btn.secondary { background:#fff; color:#0d9488; }
.tfms-lan-panel .ago { font-size:.65rem; color:#94a3b8; margin-top: 6px; }
.tfms-lan-panel .copied { color:#15803d; font-size:.7rem; margin-top: 6px; display:none; }
.tfms-lan-panel .never-run {
    background:#fef3c7; border:1px solid #fde68a; border-radius:8px;
    padding:.5rem; font-size:.75rem; color:#92400e; margin-bottom: 8px;
}
