/* =====================================================
   TERMINAL LOGIN UI (DESKTOP + MOBILE + SAFARI)
   Production-ready rewrite
===================================================== */

/* ===========================
   GLOBAL RESET
=========================== */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

/* ===========================
   FULLSCREEN TERMINAL BG
=========================== */
body {
    font-family: Consolas, "Courier New", monospace;
    background:
        radial-gradient(circle at center,
            #0e3b2a 0%,
            #061912 45%,
            #020806 100%);
    color: #6affc8;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    /* Mobile viewport correctness */
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;

    /* Boot animation */
    animation: screenOn 1.2s ease-out forwards;
}

/* ===========================
   CRT SCANLINES
=========================== */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,0.035),
        rgba(255,255,255,0.035) 1px,
        transparent 1px,
        transparent 4px
    );
    opacity: 0.35;
    z-index: 1;
}

/* ===========================
   CRT NOISE
=========================== */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    z-index: 2;
}

/* Ensure UI is above effects */
body > * {
    position: relative;
    z-index: 3;
}

/* ===========================
   LOGIN PANEL
=========================== */
.login-box {
    width: 100%;
    max-width: 360px;

    padding: 34px 28px;

    background: rgba(2,18,12,0.9);
    border: 1px solid rgba(106,255,200,0.4);
    border-radius: 4px;

    box-shadow:
        0 0 25px rgba(0,255,170,0.25),
        inset 0 0 25px rgba(0,255,170,0.1);

    animation:
        panelFlicker 0.15s ease-in-out 4,
        panelAppear 1.2s ease-out forwards;
}

/* Neon dashed outline */
.login-box::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 1px dashed rgba(106,255,200,0.35);
    border-radius: 4px;
    pointer-events: none;
}

/* ===========================
   HEADER
=========================== */
.login-box h2 {
    margin: 0 0 22px;
    text-align: center;
    font-size: 16px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #89ffe0;
}

/* ===========================
   INPUTS
=========================== */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 16px;

    background: transparent;
    color: #caffec;

    border: 1px solid rgba(106,255,200,0.55);
    outline: none;

    font-size: 13px;
    letter-spacing: 1px;
}

input::placeholder {
    color: rgba(106,255,200,0.55);
}

input:focus {
    border-color: #9affe6;
    box-shadow: 0 0 12px rgba(106,255,200,0.45);
}

/* ===========================
   REMEMBER ME
=========================== */
label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 12px;
    color: rgba(106,255,200,0.8);
}

/* ===========================
   BUTTON
=========================== */
button {
    width: 100%;
    padding: 10px;

    background: transparent;
    border: 1px solid #6affc8;
    color: #6affc8;

    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 12px;

    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background: rgba(106,255,200,0.12);
    box-shadow: 0 0 14px rgba(106,255,200,0.6);
}

/* ===========================
   ERROR MESSAGE
=========================== */
.error {
    margin-top: 16px;
    padding: 8px;
    text-align: center;
    font-size: 12px;
    color: #ff9e9e;

    border: 1px solid rgba(255,100,100,0.6);
    background: rgba(255,60,60,0.12);
}

/* ===========================
   MOBILE LAYOUT FIX
=========================== */
@media (max-width: 768px) {
    body {
        justify-content: center;
        align-items: flex-start;
        padding: 24px 16px;
    }

    .login-box {
        margin-top: 10vh;
        padding: 28px 20px;
    }

    body::before,
    body::after {
        opacity: 0.18;
    }
}

/* ===========================
   LANDSCAPE PHONE FIX
=========================== */
@media (max-height: 480px) and (orientation: landscape) {
    .login-box {
        margin-top: 4vh;
        padding: 20px;
    }
}

/* ===========================
   SAFARI / iOS ONLY ADJUSTMENTS
=========================== */
@supports (-webkit-touch-callout: none) {

    body {
        -webkit-text-size-adjust: 100%;
    }

    .login-box {
        max-width: 420px;
        padding: 40px 34px;
        transform: scale(1.08);
        transform-origin: center;
    }

    .login-box h2 {
        font-size: 18px;
        letter-spacing: 4px;
    }

    input[type="text"],
    input[type="password"] {
        font-size: 16px;
        padding: 14px 12px;
    }

    button {
        font-size: 14px;
        padding: 14px;
    }

    body::before {
        opacity: 0.2;
    }
}

/* ===========================
   iOS SMALL SCREEN BOOST
=========================== */
@media (max-width: 480px) and (orientation: portrait) {
    @supports (-webkit-touch-callout: none) {
        .login-box {
            transform: scale(1.15);
            max-width: 100%;
            margin-top: 12vh;
        }
    }
}

/* ===========================
   ANIMATIONS
=========================== */
@keyframes screenOn {
    0%   { filter: brightness(0); transform: scaleY(0.02); }
    50%  { filter: brightness(2); transform: scaleY(1); }
    100% { filter: brightness(1); transform: scaleY(1); }
}

@keyframes panelAppear {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes panelFlicker {
    0%   { opacity: 0.85; }
    20%  { opacity: 0.4; }
    40%  { opacity: 1; }
    60%  { opacity: 0.6; }
    80%  { opacity: 1; }
    100% { opacity: 0.95; }
}
