/* ========================================
   HAL — LOGIN PAGE
   Modern Clean Authentication
   ======================================== */

:root {
    --accent: #F5F5F7;
    --accent-hover: #E0E0E4;
    --bg: #0A0A0C;
    --bg-card: #1C1C22;
    --border: rgba(255, 255, 255, 0.08);
    --text: #F5F5F7;
    --text-2: #A1A1AA;
    --text-3: #6B6B76;
    --red: #F87171;
    --red-light: rgba(248, 113, 113, 0.12);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;
    --r-sm: 12px;
    --r: 16px;
    --r-lg: 24px;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Login container ────────────────────────────────── */

.login-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* ── Login panel ─────────────────────────────────────── */

.login-panel {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* ── Logo ────────────────────────────────────────────── */

.login-panel__logo {
    padding: 36px 36px 28px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #0A0A0C 0%, #1C1C22 100%);
}

.login-logo {
    font-size: 40px;
    font-weight: 800;
    color: white;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ── Body ────────────────────────────────────────────── */

.login-panel__body {
    padding: 28px 32px 24px;
}

/* ── Status label ────────────────────────────────────── */

.login-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 20px;
    padding: 8px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}

/* ── Input groups ────────────────────────────────────── */

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 7px;
}

.input-group input {
    width: 100%;
    font-family: var(--font);
    font-size: 15px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.input-group input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

.input-group input::placeholder {
    color: var(--text-3);
}

/* ── Password toggle ─────────────────────────────────── */

.input-group__password {
    position: relative;
}

.input-group__password input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
    transition: color 0.15s;
}

.password-toggle:hover { color: var(--text); }
.password-toggle--active { color: var(--text); }

/* ── Error message ───────────────────────────────────── */

.login-error {
    font-size: 13px;
    font-weight: 600;
    color: var(--red);
    text-align: center;
    margin-bottom: 14px;
    min-height: 18px;
    background: var(--red-light);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    opacity: 0;
    transition: opacity 0.2s;
    display: none;
}

.login-error--visible {
    opacity: 1;
    display: block;
}

/* ── Login button ────────────────────────────────────── */

.login-btn {
    width: 100%;
    padding: 14px 20px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    color: #0A0A0C;
    background: var(--accent);
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    margin-top: 8px;
    -webkit-tap-highlight-color: transparent;
}

.login-btn:hover { background: var(--accent-hover); }

.login-btn:active { transform: scale(0.99); }

.login-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Footer ──────────────────────────────────────────── */

.login-panel__footer {
    display: flex;
    justify-content: space-between;
    padding: 10px 32px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-3);
    font-weight: 500;
}

/* ── Login panel dissolve (kept for JS compatibility) ── */

.login-panel--dissolve {
    animation: panelDissolve 0.3s ease-in forwards;
}

@keyframes panelDissolve {
    0%   { opacity: 1; transform: scale(1); }
    30%  { opacity: 0.8; transform: scale(1.01) translateY(-4px); }
    100% { opacity: 0; transform: scale(0.96) translateY(-20px); filter: blur(4px); }
}

/* ========================================
   BOOT OVERLAY — kept dark/dramatic
   ======================================== */

.boot-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 5000;
    background: #0a0c0a;
    display: none;
    opacity: 0;
    overflow: hidden;
}

.boot-overlay--active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bootFadeIn 0.15s ease-out forwards;
}

@keyframes bootFadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

.boot-overlay__scanlines {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(141, 204, 85, 0.015) 1px,
        rgba(141, 204, 85, 0.015) 2px
    );
    z-index: 10;
}

/* Particles */
.boot-particles {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
    overflow: hidden;
}

.boot-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: rgba(141, 204, 85, 0.6);
    box-shadow: 0 0 4px rgba(141, 204, 85, 0.4);
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0%   { transform: translateY(100vh) scale(0); opacity: 0; }
    10%  { opacity: 1; transform: translateY(90vh) scale(1); }
    90%  { opacity: 0.6; transform: translateY(10vh) scale(0.5); }
    100% { transform: translateY(-5vh) scale(0); opacity: 0; }
}

/* Boot content */
.boot-content {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 600px;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Boot logo */
.boot-logo {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.boot-logo--active {
    animation: logoReveal 1.2s ease-out forwards;
}

@keyframes logoReveal {
    0%   { opacity: 0; transform: scale(0.3); filter: blur(10px) brightness(3); }
    30%  { opacity: 0.8; transform: scale(1.15); filter: blur(0) brightness(2); }
    50%  { opacity: 1; transform: scale(0.95); filter: brightness(1.5); }
    70%  { opacity: 1; transform: scale(1.05); filter: brightness(1.2); }
    100% { opacity: 1; transform: scale(1); filter: brightness(1); }
}

.boot-logo__text {
    font-family: var(--font);
    font-size: 56px;
    font-weight: 800;
    color: #e0ddd0;
    letter-spacing: -2px;
    text-shadow:
        0 0 20px rgba(141, 204, 85, 0.8),
        0 0 40px rgba(141, 204, 85, 0.4),
        0 0 60px rgba(141, 204, 85, 0.2);
    animation: logoGlow 2s ease-in-out infinite;
    z-index: 2;
}

@keyframes logoGlow {
    0%, 100% {
        text-shadow:
            0 0 20px rgba(141,204,85,0.8),
            0 0 40px rgba(141,204,85,0.4),
            0 0 60px rgba(141,204,85,0.2);
    }
    50% {
        text-shadow:
            0 0 30px rgba(141,204,85,1),
            0 0 60px rgba(141,204,85,0.6),
            0 0 90px rgba(141,204,85,0.3);
    }
}

.boot-logo__ring {
    position: absolute;
    top: 50%; left: 50%;
    width: 140px; height: 140px;
    border: 1px solid rgba(141, 204, 85, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ringPulse 3s ease-in-out infinite;
}

.boot-logo__ring--2 {
    width: 170px; height: 170px;
    border-color: rgba(141, 204, 85, 0.15);
    animation-delay: 0.5s;
    animation-duration: 3.5s;
}

.boot-logo__ring--3 {
    width: 200px; height: 200px;
    border-color: rgba(141, 204, 85, 0.08);
    animation-delay: 1s;
    animation-duration: 4s;
}

@keyframes ringPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50%      { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

/* Boot terminal */
.boot-terminal {
    width: 100%;
    min-height: 200px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.9;
    color: rgba(141, 204, 85, 0.9);
    text-align: left;
    opacity: 0;
}

.boot-terminal--active {
    animation: terminalFadeIn 0.3s ease-out forwards;
}

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

.boot-line {
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-5px);
}

.boot-line--typing {
    animation: lineAppear 0.15s ease-out forwards;
}

@keyframes lineAppear {
    0%   { opacity: 0; transform: translateX(-5px); }
    100% { opacity: 1; transform: translateX(0); }
}

.boot-line__cursor {
    display: inline-block;
    width: 7px;
    height: 13px;
    background: rgba(141, 204, 85, 0.8);
    margin-left: 2px;
    vertical-align: middle;
    animation: cursorBlink 0.6s step-end infinite;
}

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

.boot-line--success { color: #22C55E; }
.boot-line--info    { color: rgba(200, 196, 184, 0.6); }
.boot-line--warning { color: #F0C820; }

.boot-line--highlight {
    color: #e0ddd0;
    font-size: 13px;
    text-shadow: 0 0 8px rgba(141, 204, 85, 0.3);
}

.boot-line--final {
    color: rgba(141, 204, 85, 1);
    font-size: 14px;
    letter-spacing: 3px;
    text-shadow: 0 0 15px rgba(141, 204, 85, 0.6);
    text-align: center;
    margin-top: 8px;
}

.boot-line .ok-tag   { color: #22C55E; font-weight: bold; }
.boot-line .fail-tag { color: #EF4444; }
.boot-line .ip-tag   { color: rgba(200, 196, 184, 0.5); }
.boot-line .dots     { color: rgba(141, 204, 85, 0.3); }

/* Boot progress */
.boot-progress {
    width: 100%;
    opacity: 0;
}

.boot-progress--active {
    animation: progressFadeIn 0.4s ease-out forwards;
}

@keyframes progressFadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

.boot-progress__label {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(141, 204, 85, 0.6);
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.boot-progress__track {
    position: relative;
    width: 100%;
    height: 3px;
    background: rgba(141, 204, 85, 0.1);
    border: 1px solid rgba(141, 204, 85, 0.15);
    overflow: hidden;
}

.boot-progress__fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, rgba(141,204,85,0.4), rgba(141,204,85,0.9));
    transition: width 0.3s ease-out;
}

.boot-progress__glow {
    position: absolute;
    top: -4px; bottom: -4px;
    left: 0;
    width: 0%;
    background: linear-gradient(90deg, transparent 60%, rgba(141,204,85,0.4));
    filter: blur(4px);
    transition: width 0.3s ease-out;
}

/* Warp speed transition */
.boot-warp {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100;
    pointer-events: none;
    display: none;
}

.boot-warp--active { display: block; }

.boot-warp__flash {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center,
        rgba(141, 204, 85, 0) 0%,
        rgba(141, 204, 85, 0) 30%,
        rgba(141, 204, 85, 0.1) 60%,
        rgba(200, 196, 184, 0.05) 100%
    );
    opacity: 0;
}

.boot-warp--active .boot-warp__flash {
    animation: warpFlash 0.7s ease-in forwards;
}

@keyframes warpFlash {
    0%   { opacity: 0; transform: scale(1); }
    40%  { opacity: 0.3; transform: scale(1); }
    70%  { opacity: 0.8; transform: scale(1.05); background: radial-gradient(ellipse at center, rgba(255,255,255,0.9) 0%, rgba(141,204,85,0.6) 40%, rgba(0,0,0,0) 70%); }
    85%  { opacity: 1; transform: scale(1.2); background: radial-gradient(ellipse at center, rgba(255,255,255,1) 0%, rgba(255,255,255,0.8) 30%, rgba(141,204,85,0.4) 60%, rgba(0,0,0,0) 100%); }
    100% { opacity: 1; transform: scale(3); background: rgba(255,255,255,1); }
}

.boot-warp--active::before,
.boot-warp--active::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 2px; height: 2px;
    background: transparent;
    animation: warpLines 0.7s ease-in forwards;
}

@keyframes warpLines {
    0% { box-shadow: 0 0 0 rgba(141,204,85,0); }
    50% {
        box-shadow:
            -80px -40px 0 rgba(141,204,85,0.3),
            120px 60px 0 rgba(200,196,184,0.2),
            -40px 80px 0 rgba(141,204,85,0.25),
            90px -70px 0 rgba(200,196,184,0.3);
    }
    100% {
        box-shadow:
            -300px -150px 2px rgba(141,204,85,0),
            450px 225px 2px rgba(200,196,184,0),
            -150px 300px 2px rgba(141,204,85,0),
            340px -265px 2px rgba(200,196,184,0);
    }
}

.boot-content--warp {
    animation: contentWarp 0.7s ease-in forwards;
}

@keyframes contentWarp {
    0%   { transform: scale(1); opacity: 1; filter: blur(0); }
    50%  { transform: scale(1.05); opacity: 0.8; filter: blur(1px); }
    100% { transform: scale(2); opacity: 0; filter: blur(10px) brightness(3); }
}

/* Boot overlay pseudo elements */
.boot-overlay--active::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    background-image:
        linear-gradient(30deg, rgba(141,204,85,0.02) 12%, transparent 12.5%, transparent 87%, rgba(141,204,85,0.02) 87.5%),
        linear-gradient(150deg, rgba(141,204,85,0.02) 12%, transparent 12.5%, transparent 87%, rgba(141,204,85,0.02) 87.5%),
        linear-gradient(60deg, rgba(141,204,85,0.03) 25%, transparent 25.5%, transparent 75%, rgba(141,204,85,0.03) 75%);
    background-size: 40px 70px;
    opacity: 0.5;
}

/* Data stream */
.boot-datastream {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.boot-datastream__column {
    position: absolute;
    top: -100%;
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
    color: rgba(141, 204, 85, 0.10);
    writing-mode: vertical-rl;
    white-space: nowrap;
    animation: dataFall linear infinite;
    user-select: none;
}

@keyframes dataFall {
    0%   { top: -100%; opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 0.5; }
    100% { top: 100%; opacity: 0; }
}

/* Skip button */
.boot-skip {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 50;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(232, 230, 216, 0.35);
    background: transparent;
    border: 1px solid rgba(232, 230, 216, 0.15);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: none;
}

.boot-skip--visible { display: block; }

.boot-skip:hover {
    color: white;
    border-color: rgba(141, 204, 85, 0.5);
    background: rgba(141, 204, 85, 0.08);
}

/* ── Accessibility ────────────────────────────────────── */

:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.input-group input:focus-visible {
    outline: none;
    border-color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 480px) {
    .login-panel { border-radius: var(--r); }
    .login-panel__logo { padding: 28px 24px 20px; }
    .login-logo { font-size: 32px; }
    .login-panel__body { padding: 24px 24px 20px; }
    .login-panel__footer { padding: 10px 24px; }

    .boot-content { padding: 15px; gap: 20px; }
    .boot-logo { width: 120px; height: 120px; }
    .boot-logo__text { font-size: 40px; }
    .boot-logo__ring { width: 110px; height: 110px; }
    .boot-logo__ring--2 { width: 135px; height: 135px; }
    .boot-logo__ring--3 { width: 160px; height: 160px; }
    .boot-terminal { font-size: 9px; min-height: 150px; }
}
