@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --accent: #0ea5e9;
    --accent-light: #38bdf8;
    --bg-light: #f8fafc;
    --bg-lighter: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: rgba(15, 23, 42, 0.08);
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: var(--bg-light);
    color: var(--text-main);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding: 20px 0;
}

/* --- Animated Background --- */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #ffffff;
    z-index: 0;
}

#codeCanvas {
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0.5; /* Increased opacity from 0.15 to make it visible */
}

.light-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(248, 250, 252, 0.4) 100%);
    pointer-events: none;
}

/* --- Login UI --- */
.login-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    margin: auto;
    animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(40px); }
    100% { opacity: 1; transform: translateY(0); }
}

.animated-erp-logo {
    width: 100%;
    max-width: 320px;
    margin: 0 auto 30px;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.05));
}

.animated-erp-logo svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Animations for the Infinity Paths */
.infinity-main {
    animation: pulseStroke 4s ease-in-out infinite alternate;
}

@keyframes pulseStroke {
    from { filter: brightness(1) drop-shadow(0 0 0px rgba(139, 92, 246, 0)); }
    to { filter: brightness(1.2) drop-shadow(0 0 10px rgba(139, 92, 246, 0.4)); }
}

/* Flowing Orbits around the logo */
.flow-line {
    animation: flowDash 15s linear infinite;
}

.flow-line-reverse {
    animation: flowDashRev 20s linear infinite;
}

@keyframes flowDash {
    to { stroke-dashoffset: -1000; }
}

@keyframes flowDashRev {
    to { stroke-dashoffset: 1000; }
}

/* Spinning Node Groups (planets/icons) */
.orbit-spin-slow {
    animation: spinNodes 35s linear infinite;
}
.spin-counter-slow {
    animation: spinNodesRev 35s linear infinite;
}

.orbit-spin-med {
    animation: spinNodesRev 25s linear infinite;
}
.spin-counter-med {
    animation: spinNodes 25s linear infinite;
}

.orbit-spin-fast {
    animation: spinNodes 15s linear infinite;
}
.spin-counter-fast {
    animation: spinNodesRev 15s linear infinite;
}

@keyframes spinNodes {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spinNodesRev {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Typography styles for Pergelog Branding */
.brand-header-new {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-top: -20px; /* Pull closer to the logo */
    margin-bottom: 4px;
    color: #0f172a;
    display: flex;
    align-items: baseline;
}

.brand-dot {
    color: #0ea5e9;
    font-size: 42px;
    line-height: 0;
}

.brand-subtitle {
    font-size: 14px;
    color: #64748b;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    box-shadow: 0 25px 50px -12px var(--glass-shadow);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
}

.card-header {
    text-align: center;
    margin-bottom: 30px;
}

.card-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.card-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color 0.3s ease;
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

.input-group input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

.input-group input::placeholder {
    color: #cbd5e1;
}

.input-group input:focus {
    border-color: var(--primary-light);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.input-group input:focus + .input-icon,
.input-group input:not(:placeholder-shown) + .input-icon {
    color: var(--primary-light);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    font-size: 13px;
}

.remember-me {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    padding-left: 26px;
    user-select: none;
}

.remember-me input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.remember-me:hover input ~ .checkmark {
    border-color: var(--primary-light);
}

.remember-me input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.remember-me input:checked ~ .checkmark:after {
    display: block;
}

.forgot-password {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-password:hover {
    color: white;
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(79, 70, 229, 0.4);
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:active {
    transform: translateY(1px);
}

.login-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.login-btn:hover svg {
    transform: translateX(4px);
}

.system-status {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    background: rgba(0,0,0,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@media (max-width: 480px) {
    .login-wrapper {
        padding: 15px;
    }
    .login-card {
        padding: 30px 20px;
    }
    .brand-header h1 {
        font-size: 24px;
    }
}
