/* CRT Monitor Effect Styles */

/* ===== CRT FRAME (Monitor Bezel) ===== */
#crt-frame {
    width: 100vw;
    height: 100vh;
    background: var(--crt-bezel-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
}

/* Monitor outer bezel with rounded corners */
#crt-frame::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 60px;
    background: linear-gradient(180deg,
            #3a3a3a 0%,
            #2a2a2a 50%,
            #1a1a1a 100%);
    border-radius: 20px;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.5),
        0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ===== CRT SCREEN ===== */
#crt-screen {
    width: 100%;
    height: calc(100% - 40px);
    background: #000;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.8),
        inset 0 0 10px rgba(0, 0, 0, 0.9);
}

/* Slight curvature effect */
#crt-screen::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center,
            transparent 0%,
            transparent 60%,
            rgba(0, 0, 0, 0.1) 80%,
            rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 9998;
}

/* ===== SCANLINES ===== */
#crt-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0) 0px,
            rgba(0, 0, 0, 0) 1px,
            rgba(0, 0, 0, var(--crt-scanline-opacity)) 1px,
            rgba(0, 0, 0, var(--crt-scanline-opacity)) 2px);
    pointer-events: none;
    z-index: 9997;
}

/* ===== FLICKER EFFECT ===== */
#crt-flicker {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(18, 16, 16, 0);
    pointer-events: none;
    z-index: 9996;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% {
        opacity: 0.27861;
    }

    5% {
        opacity: 0.34769;
    }

    10% {
        opacity: 0.23604;
    }

    15% {
        opacity: 0.90626;
    }

    20% {
        opacity: 0.18128;
    }

    25% {
        opacity: 0.83891;
    }

    30% {
        opacity: 0.65583;
    }

    35% {
        opacity: 0.67807;
    }

    40% {
        opacity: 0.26559;
    }

    45% {
        opacity: 0.84693;
    }

    50% {
        opacity: 0.96019;
    }

    55% {
        opacity: 0.08594;
    }

    60% {
        opacity: 0.20313;
    }

    65% {
        opacity: 0.71988;
    }

    70% {
        opacity: 0.53455;
    }

    75% {
        opacity: 0.37288;
    }

    80% {
        opacity: 0.71428;
    }

    85% {
        opacity: 0.70419;
    }

    90% {
        opacity: 0.7003;
    }

    95% {
        opacity: 0.36108;
    }

    100% {
        opacity: 0.24387;
    }
}

/* Reduce flicker intensity */
#crt-flicker {
    animation: none;
    opacity: 0.03;
}

/* ===== CRT CONTROLS ===== */
#crt-controls {
    position: absolute;
    bottom: 10px;
    right: 40px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
}

/* Power LED */
#power-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1a1a1a;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

#power-led.led-on {
    background: #00ff00;
    box-shadow:
        0 0 5px #00ff00,
        0 0 10px #00ff00,
        inset 0 -2px 4px rgba(0, 200, 0, 0.5);
}

#power-led.led-off {
    background: #1a1a1a;
}

/* Power Button */
#power-button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    border: 2px solid #1a1a1a;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    position: relative;
}

#power-button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border: 2px solid #5a5a5a;
    border-radius: 50%;
    border-top-color: transparent;
}

#power-button:hover {
    background: linear-gradient(180deg, #5a5a5a 0%, #3a3a3a 100%);
}

#power-button:active {
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ===== CRT GLOW EFFECT (optional) ===== */
.crt-glow {
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}

/* ===== POWER OFF STATE ===== */
#crt-screen.power-off {
    background: #000;
}

#crt-screen.power-off #desktop,
#crt-screen.power-off #taskbar,
#crt-screen.power-off #start-menu {
    display: none;
}

#crt-screen.power-off::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #fff;
    transform: translate(-50%, -50%);
    animation: powerOff 0.2s ease-out forwards;
}

@keyframes powerOff {
    0% {
        width: 100%;
        height: 100%;
        opacity: 1;
    }

    50% {
        width: 100%;
        height: 2px;
        opacity: 1;
    }

    100% {
        width: 0;
        height: 0;
        opacity: 0;
    }
}

/* ===== BOOT UP ANIMATION ===== */
.crt-boot {
    animation: bootUp 1s ease-out;
}

@keyframes bootUp {
    0% {
        opacity: 0;
        filter: brightness(2);
    }

    50% {
        opacity: 1;
        filter: brightness(1.5);
    }

    100% {
        opacity: 1;
        filter: brightness(1);
    }
}