/* =============================================
   FTTH Insight Hub - Login Page
   ============================================= */

body {
    font-family: 'Prompt', 'Nunito', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #04332E;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.login-card h1, .login-card h2, .login-card h3, .login-card h4,
.app-brand-text .fs-5,
.illustration-text h2 {
    font-family: 'Poppins', 'Nunito', sans-serif;
}

.auth-wrapper {
    min-height: 100vh;
    position: relative;
}

/* Background Animation */
.auth-background {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #04332E 0%, #0A6A5F 50%, #0E8579 100%);
    z-index: 0;
}

.network-nodes .node {
    position: absolute;
    width: 6px; height: 6px;
    background: #5BCEC3;
    border-radius: 50%;
    animation: pulse 3s infinite;
}

.node:nth-child(1) { top: 15%; left: 10%; animation-delay: 0s; }
.node:nth-child(2) { top: 25%; left: 85%; animation-delay: 0.5s; }
.node:nth-child(3) { top: 60%; left: 20%; animation-delay: 1s; }
.node:nth-child(4) { top: 75%; left: 75%; animation-delay: 1.5s; }
.node:nth-child(5) { top: 40%; left: 50%; animation-delay: 2s; }
.node:nth-child(6) { top: 85%; left: 40%; animation-delay: 0.3s; }
.node:nth-child(7) { top: 10%; left: 60%; animation-delay: 0.8s; }
.node:nth-child(8) { top: 50%; left: 90%; animation-delay: 1.3s; }

.floating-shapes .shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.05;
    animation: float 20s infinite linear;
}

.shape-1 { width: 300px; height: 300px; background: #15A697; top: -100px; right: -100px; }
.shape-2 { width: 200px; height: 200px; background: #5BCEC3; bottom: -50px; left: -50px; animation-delay: 7s; }
.shape-3 { width: 150px; height: 150px; background: #8FDFD7; top: 50%; left: 30%; animation-delay: 14s; }

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.8); }
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(180deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

/* =================================================================
   FTTH fiber-optic animated mesh (data pulses along fiber strands)
   Represents fiber routes, ONT junctions, and live data flow.
   ================================================================= */
.fiber-mesh {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Fiber strands gently breathing */
.fiber-mesh .fiber-lines path {
    stroke-dasharray: 6 10;
    animation: fiberFlow 9s linear infinite;
}
.fiber-mesh .fiber-lines path:nth-child(2) { animation-duration: 12s; }
.fiber-mesh .fiber-lines path:nth-child(3) { animation-duration: 14s; }
.fiber-mesh .fiber-lines path:nth-child(4) { animation-duration: 11s; }
.fiber-mesh .fiber-lines path:nth-child(5) { animation-duration: 13s; }

@keyframes fiberFlow {
    to { stroke-dashoffset: -160; }
}

/* ONT / junction nodes glowing */
.fiber-mesh .fiber-junctions circle {
    fill: #5BCEC3;
    opacity: 0.7;
    animation: junctionBlink 3.5s ease-in-out infinite;
}
.fiber-mesh .fiber-junctions circle:nth-child(2) { animation-delay: 0.6s; }
.fiber-mesh .fiber-junctions circle:nth-child(3) { animation-delay: 1.2s; }
.fiber-mesh .fiber-junctions circle:nth-child(4) { animation-delay: 1.8s; }
.fiber-mesh .fiber-junctions circle:nth-child(5) { animation-delay: 2.4s; }
.fiber-mesh .fiber-junctions circle:nth-child(6) { animation-delay: 3s; }

@keyframes junctionBlink {
    0%, 100% { opacity: 0.35; r: 3; }
    50% { opacity: 1; r: 5; }
}

/* Light pulse glow softly throbbing as it travels (filter-free for perf) */
.fiber-mesh .pulse-glow {
    animation: pulseThrob 2.2s ease-in-out infinite;
}
@keyframes pulseThrob {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

/* Signal ripples broadcasting from ONT nodes */
.fiber-mesh .signal-ripples .ripple {
    stroke-width: 1.5;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: signalRipple 4s ease-out infinite;
}
@keyframes signalRipple {
    0%   { opacity: 0.7; transform: scale(0.4); }
    70%  { opacity: 0; transform: scale(6); }
    100% { opacity: 0; transform: scale(6); }
}

/* Content Layout */
.auth-content-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Illustration */
.auth-illustration {
    display: none;
}

@media (min-width: 992px) {
    .auth-content-wrapper {
        justify-content: space-between;
        max-width: 1100px;
        margin: 0 auto;
    }

    .auth-illustration {
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: center;
        padding: 2rem;
    }

    .illustration-content {
        text-align: center;
        max-width: 420px;
    }

    .hero-svg {
        width: 100%;
        max-width: 380px;
        margin-bottom: 2rem;
    }

    .illustration-text h2 {
        color: #fff;
        font-weight: 800;
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }

    .illustration-text p {
        color: #8FDFD7;
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* Login Card */
.auth-floating-box {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.app-brand-logo img {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.app-brand-text .fs-5 {
    color: #0F1F1D;
    letter-spacing: 0.03em;
}

/* Form */
.form-control {
    border: 2px solid #E1E9E7;
    border-radius: 0.625rem;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: #15A697;
    box-shadow: 0 0 0 3px rgba(21,166,151,0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #2E3F3C;
}

/* Login Button */
.btn-login {
    background: linear-gradient(135deg, #15A697 0%, #0E8579 100%);
    border: none;
    padding: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    transition: all 0.3s;
}

.btn-login:hover {
    background: linear-gradient(135deg, #0E8579 0%, #0A6A5F 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(21,166,151,0.35);
}

.text-brand {
    color: #15A697;
}

/* SVG Animations */
.pulse-dot { animation: svgPulse 2s infinite; }
@keyframes svgPulse {
    0%, 100% { r: 8; opacity: 1; }
    50% { r: 12; opacity: 0.7; }
}

.wave { animation: waveAnim 2s infinite ease-in-out; }
.wave-2 { animation-delay: 0.3s; }
.wave-3 { animation-delay: 0.6s; }
@keyframes waveAnim {
    0%, 100% { opacity: 0.2; transform: translateX(0); }
    50% { opacity: 0.8; transform: translateX(5px); }
}

.device { animation: deviceFloat 4s infinite ease-in-out; }
.device-2 { animation-delay: 1.3s; }
.device-3 { animation-delay: 2.6s; }
@keyframes deviceFloat {
    0%, 100% { transform: translate(var(--tx, 0), var(--ty, 0)); }
    50% { transform: translate(var(--tx, 0), calc(var(--ty, 0) - 10px)); }
}

.particle { animation: particleFloat 5s infinite ease-in-out; }
.p2 { animation-delay: 1s; } .p3 { animation-delay: 2s; }
.p4 { animation-delay: 3s; } .p5 { animation-delay: 4s; }
@keyframes particleFloat {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-15px); }
}

.blink { animation: blinkAnim 1.5s infinite; }
@keyframes blinkAnim {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

.conn-line { animation: connPulse 3s infinite; }
@keyframes connPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(245,249,248,0.94);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}

/* =================================================================
   LOGIN REWORK — Design System (DESIGN.md): Teal + Poppins/Prompt
   ================================================================= */

/* Card: softer, roomier, design-system radius + soft shadow */
.login-card {
    border-radius: 24px;
    padding: 2.75rem 2.5rem;
    box-shadow: 0 24px 60px rgba(4, 51, 46, 0.28);
    border: 1px solid rgba(255,255,255,0.5);
}

@media (max-width: 575.98px) {
    .login-card { padding: 2rem 1.5rem; border-radius: 20px; }
}

/* Brand */
.app-brand-logo img {
    filter: drop-shadow(0 6px 14px rgba(21, 166, 151, 0.25));
}
.app-brand-title {
    font-family: 'Poppins', sans-serif;
    color: #0F1F1D;
    letter-spacing: -0.01em;
}
.badge-circle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: #0A6A5F;
    background: #E6F7F5;
    padding: 3px 12px 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.badge-circle .ti { font-size: 0.9rem; color: #15A697; }

/* Welcome heading */
.login-welcome { margin-top: 0.25rem; }
.login-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #0F1F1D;
    letter-spacing: -0.015em;
    margin: 0 0 0.25rem;
}
.login-subtitle {
    font-family: 'Prompt', sans-serif;
    font-size: 0.9rem;
    color: #5A6B68;
    margin: 0;
}

/* Labels */
.login-card .form-label {
    font-family: 'Prompt', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: #2E3F3C;
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

/* Input with leading icon + optional trailing toggle */
.input-icon-group { position: relative; }
.input-icon-group .input-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    font-size: 1.15rem;
    color: #8A9996;
    pointer-events: none;
    transition: color var(--dur, 220ms) ease;
    z-index: 2;
}
.login-card .form-control {
    height: 48px;
    border: 1.5px solid #E1E9E7;
    border-radius: 12px;
    padding-left: 44px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.95rem;
    color: #0F1F1D;
    background: #FBFDFC;
    transition: border-color var(--dur, 220ms) ease, box-shadow var(--dur, 220ms) ease, background var(--dur, 220ms) ease;
}
.login-card .form-control.has-toggle { padding-right: 46px; }
.login-card .form-control::placeholder { color: #B6C2BF; }
.login-card .form-control:focus {
    border-color: #15A697;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(21, 166, 151, 0.12);
}
.input-icon-group:focus-within .input-icon { color: #15A697; }

/* Password show/hide toggle */
.pw-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #8A9996;
    cursor: pointer;
    z-index: 3;
    transition: color .15s ease, background .15s ease;
}
.pw-toggle:hover { color: #0E8579; background: #E6F7F5; }
.pw-toggle .ti { font-size: 1.15rem; }

/* Caps lock hint */
.caps-hint {
    display: none;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    color: #B5740F;
}
.caps-hint.show { display: inline-flex; }
.caps-hint .ti { font-size: 0.9rem; }

/* Forgot link */
.forgot-link {
    font-family: 'Prompt', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: #5A6B68;
    text-decoration: none;
    transition: color .15s ease;
}
.forgot-link:hover { color: #0E8579; }

/* Login button — pill, teal, loading state */
.btn-login {
    height: 50px;
    border-radius: 999px;
    font-family: 'Prompt', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}
.btn-login .btn-login-spinner { display: none; align-items: center; gap: 8px; }
.btn-login.is-loading .btn-login-label { display: none; }
.btn-login.is-loading .btn-login-spinner { display: inline-flex; }
.btn-login:disabled { opacity: 0.85; cursor: default; }

/* Footer */
.login-foot {
    font-family: 'Prompt', sans-serif;
    font-size: 0.78rem;
    color: #8A9996;
    margin-top: 1.5rem !important;
}

/* Illustration side enhancements */
.auth-eyebrow {
    display: inline-block;
    font-family: 'Prompt', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8FDFD7;
    margin-bottom: 0.6rem;
}
@media (min-width: 992px) {
    .illustration-text h2 {
        font-family: 'Poppins', sans-serif;
        font-size: 2rem;
        letter-spacing: -0.02em;
    }
    .illustration-text p strong { color: #C0EDE8; font-weight: 600; }
}
.auth-feature-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
    text-align: left;
    display: inline-block;
}
.auth-feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.9rem;
    color: #C0EDE8;
    margin-bottom: 0.7rem;
}
.auth-feature-list li .ti {
    font-size: 1.2rem;
    color: #5BCEC3;
    flex-shrink: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .node, .shape, .pulse-dot, .wave, .device, .particle, .conn-line { animation: none !important; }
    .fiber-mesh .fiber-lines path,
    .fiber-mesh .fiber-junctions circle,
    .fiber-mesh .pulse-glow,
    .fiber-mesh .signal-ripples .ripple { animation: none !important; }
    .fiber-mesh .signal-ripples .ripple { opacity: 0 !important; }
}
