/* ============================================
   MAINFRAME Login Screen — Cyberpunk Terminal
   ============================================ */

:root {
    --phosphor: #00ff41;
    --phosphor-dim: #00cc33;
    --phosphor-bright: #33ff66;
    --phosphor-glow: rgba(0, 255, 65, 0.4);
    --crt-bg: #0a0a0a;
    --crt-dark: #050505;
    --scanline-opacity: 0.06;
    --amber: #ff9500;
    --red-alert: #ff3333;
}

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

body.login-page {
    background: var(--crt-bg);
    color: var(--phosphor);
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* === CRT Effects === */

/* Scanlines overlay */
body.login-page::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, var(--scanline-opacity)) 2px,
        rgba(0, 0, 0, var(--scanline-opacity)) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

/* CRT vignette */
body.login-page::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
    pointer-events: none;
    z-index: 999;
}

/* Flicker animation */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.8; }
    94% { opacity: 1; }
    96% { opacity: 0.9; }
    97% { opacity: 1; }
}

/* === Login Container === */

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 520px;
    padding: 2rem;
    animation: flicker 8s infinite;
}

/* === Crest === */

.crest-wrapper {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.crest-wrapper svg,
.crest-wrapper img {
    width: 220px;
    height: auto;
    filter: drop-shadow(0 0 8px var(--phosphor-glow))
            drop-shadow(0 0 20px rgba(0, 255, 65, 0.2));
    animation: crest-pulse 4s ease-in-out infinite;
}

@keyframes crest-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px var(--phosphor-glow))
                drop-shadow(0 0 20px rgba(0, 255, 65, 0.2));
    }
    50% {
        filter: drop-shadow(0 0 12px var(--phosphor-glow))
                drop-shadow(0 0 30px rgba(0, 255, 65, 0.3))
                drop-shadow(0 0 50px rgba(0, 255, 65, 0.1));
    }
}

/* Scan sweep across the crest */
.crest-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--phosphor-glow) 40%,
        var(--phosphor) 50%,
        var(--phosphor-glow) 60%,
        transparent 100%
    );
    animation: scan-sweep 4s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes scan-sweep {
    0% { top: 0; opacity: 0; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { top: 100%; opacity: 0; }
}

/* === Title Block === */

.login-title {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title .school-name {
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.6em;
    color: var(--phosphor-dim);
    text-transform: uppercase;
    margin-bottom: 0.2rem;
    opacity: 0.6;
}

.login-title h1 {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.5em;
    color: var(--phosphor);
    text-shadow: 0 0 10px var(--phosphor-glow),
                 0 0 20px rgba(0, 255, 65, 0.2),
                 0 0 40px rgba(0, 255, 65, 0.1);
    margin-bottom: 0.3rem;
    line-height: 1;
}

.login-title .subtitle {
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--phosphor-dim);
    text-transform: uppercase;
    opacity: 0.7;
}

.login-title .motto {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--phosphor-dim);
    font-style: italic;
    opacity: 0.4;
    margin-top: 0.5rem;
}

/* === Terminal Frame === */

.terminal-frame {
    border: 1px solid var(--phosphor-dim);
    background: rgba(0, 255, 65, 0.02);
    padding: 1.5rem;
    position: relative;
}

.terminal-frame::before {
    content: '┌─ AUTHENTICATION REQUIRED ─┐';
    position: absolute;
    top: -0.7rem;
    left: 1rem;
    background: var(--crt-bg);
    padding: 0 0.5rem;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--amber);
}

/* === System Info Block === */

.sys-info {
    font-size: 0.65rem;
    color: var(--phosphor-dim);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    opacity: 0.6;
}

.sys-info .line {
    display: block;
}

.sys-info .highlight {
    color: var(--phosphor);
}

/* === Auth Error === */

.auth-error {
    background: rgba(255, 60, 60, 0.08);
    border: 1px solid rgba(255, 60, 60, 0.4);
    color: #ff6b6b;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-align: center;
    animation: errorPulse 2s ease infinite;
}

.auth-error .error-icon {
    margin-right: 0.4rem;
}

@keyframes errorPulse {
    0%, 100% { border-color: rgba(255, 60, 60, 0.4); }
    50% { border-color: rgba(255, 60, 60, 0.7); }
}

/* === Login Button === */

.login-btn {
    display: block;
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: transparent;
    border: 1px solid var(--phosphor);
    color: var(--phosphor);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.login-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2),
                inset 0 0 15px rgba(0, 255, 65, 0.05);
    text-shadow: 0 0 8px var(--phosphor-glow);
}

.login-btn:active {
    background: rgba(0, 255, 65, 0.2);
}

/* Sweep effect on hover */
.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 255, 65, 0.15),
        transparent
    );
    transition: left 0.5s ease;
}

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

/* === Status Bar === */

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    font-size: 0.6rem;
    color: var(--phosphor-dim);
    opacity: 0.5;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--phosphor);
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* === Typing cursor === */

.cursor {
    display: inline-block;
    width: 0.55em;
    height: 1.1em;
    background: var(--phosphor);
    vertical-align: text-bottom;
    animation: cursor-blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === Boot Sequence (loading animation) === */

.boot-sequence {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--crt-bg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 3rem;
    font-size: 0.75rem;
    line-height: 1.8;
    transition: opacity 0.5s ease;
}

.boot-sequence.done {
    opacity: 0;
    pointer-events: none;
}

.boot-line {
    opacity: 0;
    animation: boot-appear 0.1s forwards;
}

.boot-line.ok { color: var(--phosphor); }
.boot-line.warn { color: var(--amber); }
.boot-line.info { color: var(--phosphor-dim); }

@keyframes boot-appear {
    to { opacity: 1; }
}

/* === Ambient particles (subtle) === */

.particle-field {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 1px;
    height: 1px;
    background: var(--phosphor);
    opacity: 0;
    animation: float-up linear infinite;
}

@keyframes float-up {
    0% { transform: translateY(100vh); opacity: 0; }
    10% { opacity: 0.4; }
    90% { opacity: 0.4; }
    100% { transform: translateY(-10px); opacity: 0; }
}

/* === Responsive === */

@media (max-width: 600px) {
    .login-container { padding: 1rem; }
    .login-title h1 { font-size: 1.6rem; letter-spacing: 0.2em; }
    .crest-wrapper svg,
    .crest-wrapper img { width: 150px; }
    .boot-sequence { padding: 1rem; font-size: 0.65rem; }
}
