/* PowerPulse login motion layer */
.login-page-live .showcase-grid {
    animation: pulse-grid 8s ease-in-out infinite;
}

.login-page-live .live-preview {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.login-page-live .live-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent);
    transform: translateX(-120%);
    animation: scan-energy 4s linear infinite;
}

.login-system-map {
    position: relative;
    display: grid;
    grid-template-columns: minmax(76px,1fr) minmax(52px,.7fr) minmax(76px,1fr) minmax(52px,.7fr) minmax(76px,1fr);
    align-items: center;
    gap: 8px;
    margin: 20px 0 16px;
    min-height: 150px;
}

.login-energy-node {
    min-width: 0;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(4,17,30,.48);
    border-radius: 18px;
    padding: 14px 10px;
    text-align: center;
    backdrop-filter: blur(8px);
}

.login-energy-node span {
    display: block;
    font-size: 11px;
    letter-spacing: .12em;
    opacity: .62;
    margin-bottom: 5px;
}

.login-energy-node strong {
    display: block;
    white-space: nowrap;
    font-size: 14px;
}

.login-energy-node.inverter {
    border-color: rgba(89,196,255,.32);
    box-shadow: inset 0 0 24px rgba(50,154,224,.06);
}

.login-energy-node.battery {
    min-width: 88px;
}

.login-energy-track {
    position: relative;
    height: 2px;
    background: rgba(255,255,255,.11);
    overflow: visible;
}

.login-energy-track i,
.login-branch-line i {
    position: absolute;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 12px currentColor;
    transform: translate(-50%, -50%);
    animation: packet-flow 2.4s linear infinite;
}

.login-energy-track i:nth-child(2) { animation-delay: -.8s; }
.login-energy-track i:nth-child(3) { animation-delay: -1.6s; }

.login-battery-branch {
    position: absolute;
    inset-inline-start: 50%;
    top: 92px;
    transform: translateX(50%);
    display: grid;
    justify-items: center;
    gap: 8px;
}

.login-branch-line {
    position: relative;
    width: 2px;
    height: 32px;
    background: rgba(255,255,255,.11);
    overflow: visible;
}

.login-branch-line i {
    left: 50%;
    top: 0;
    animation: packet-flow-vertical 1.9s linear infinite;
}

.login-live-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.09);
    font-size: 12px;
    opacity: .72;
}

.login-live-footer span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3bd69f;
    box-shadow: 0 0 10px rgba(59,214,159,.55);
    animation: status-pulse 2s ease-in-out infinite;
}

.login-connection-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 24px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--muted, #7f8ea3);
}

.login-connection-state i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.login-connection-state.is-checking {
    color: var(--primary, #2596d1);
}

.login-submit {
    position: relative;
}

.login-submit-loader {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-inline-start-color: transparent;
    border-radius: 50%;
    animation: login-spin .7s linear infinite;
}

.login-submit.is-loading .login-submit-loader {
    display: inline-block;
}

.login-submit.is-loading {
    pointer-events: none;
    opacity: .88;
}

.preview-metrics b,
.live-preview strong {
    transition: opacity .18s ease, transform .18s ease;
}

.metric-tick {
    opacity: .62;
    transform: translateY(-2px);
}

.status-dot.online {
    animation: status-pulse 2s ease-in-out infinite;
}

/* Light mode must theme the whole login experience, not only the form panel. */
html[data-theme="light"] .login-showcase {
    background:
        radial-gradient(circle at 18% 0%, rgba(22,119,200,.12), transparent 34%),
        radial-gradient(circle at 84% 12%, rgba(15,165,138,.11), transparent 30%),
        linear-gradient(150deg, #eef5fa, #e6eef5 72%);
    color: #102238;
}

html[data-theme="light"] .login-showcase .showcase-grid {
    opacity: .42;
    background-image:
        linear-gradient(rgba(31,76,112,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31,76,112,.08) 1px, transparent 1px);
}

html[data-theme="light"] .login-showcase .brand strong,
html[data-theme="light"] .login-copy h1,
html[data-theme="light"] .preview-top,
html[data-theme="light"] .preview-metrics {
    color: #102238;
}

html[data-theme="light"] .login-showcase .brand small,
html[data-theme="light"] .login-copy p,
html[data-theme="light"] .preview-metrics small {
    color: #63788e;
}

html[data-theme="light"] .login-showcase .brand-mark {
    background: rgba(15,165,138,.08);
    border-color: rgba(15,165,138,.28);
}

html[data-theme="light"] .login-showcase .eyebrow,
html[data-theme="light"] .preview-top strong,
html[data-theme="light"] .login-live-footer,
html[data-theme="light"] .login-energy-node strong {
    color: #0b9079;
}

html[data-theme="light"] .login-showcase .live-preview {
    background: rgba(255,255,255,.68);
    border-color: rgba(24,48,75,.13);
    box-shadow: 0 22px 60px rgba(38,70,99,.10);
    backdrop-filter: blur(16px);
}

html[data-theme="light"] .login-showcase .live-preview::after {
    background: linear-gradient(90deg, transparent, rgba(15,165,138,.08), transparent);
}

html[data-theme="light"] .login-energy-node {
    background: rgba(255,255,255,.76);
    border-color: rgba(24,48,75,.15);
    color: #0b9079;
    box-shadow: inset 0 1px rgba(255,255,255,.85);
}

html[data-theme="light"] .login-energy-node.inverter {
    border-color: rgba(22,119,200,.30);
    box-shadow: inset 0 0 24px rgba(22,119,200,.06);
}

html[data-theme="light"] .login-energy-node span {
    color: #5f768c;
    opacity: 1;
}

html[data-theme="light"] .login-energy-track,
html[data-theme="light"] .login-branch-line {
    background: rgba(24,48,75,.15);
    color: #0fa58a;
}

html[data-theme="light"] .login-live-footer {
    border-top-color: rgba(24,48,75,.10);
    opacity: .9;
}

html[data-theme="light"] .status-dot.online,
html[data-theme="light"] .live-dot {
    background: #0fa58a;
    box-shadow: 0 0 0 5px rgba(15,165,138,.10), 0 0 12px rgba(15,165,138,.32);
}

@keyframes scan-energy {
    to { transform: translateX(120%); }
}

@keyframes status-pulse {
    50% { opacity: .45; transform: scale(1.25); }
}

@keyframes packet-flow {
    0% { inset-inline-start: 0; opacity: 0; }
    12% { opacity: 1; }
    88% { opacity: 1; }
    100% { inset-inline-start: 100%; opacity: 0; }
}

@keyframes packet-flow-vertical {
    0% { top: 0; opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

@keyframes pulse-grid {
    50% { opacity: .65; transform: scale(1.02); }
}

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

@media (max-width: 720px) {
    .login-system-map {
        grid-template-columns: 1fr 34px 1fr 34px 1fr;
        gap: 5px;
        min-height: 140px;
    }

    .login-energy-node {
        padding: 12px 7px;
        border-radius: 14px;
    }

    .login-energy-node strong {
        font-size: 12px;
    }

    .login-battery-branch {
        top: 84px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-page-live *,
    .login-page-live *::before,
    .login-page-live *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
    }
}
