/* Cyber Glitch CSS Framework */

:root {
    --primary-cyan: #00f3ff;
    --primary-magenta: #ff00ff;
    --primary-yellow: #ffff00;
    --bg-dark: #050505;
    --window-bg: rgba(10, 15, 20, 0.95);
    --window-border: #333;
    --header-bg: #1a1a1a;
}

/* CRT Overlay */
.crt-overlay {
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9999;
}

/* Glitch Text Animation */
.glitch-text {
    position: relative;
    color: white;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 31px, 0); }
    20% { clip: rect(75px, 9999px, 86px, 0); }
    40% { clip: rect(20px, 9999px, 5px, 0); }
    60% { clip: rect(60px, 9999px, 78px, 0); }
    80% { clip: rect(44px, 9999px, 33px, 0); }
    100% { clip: rect(10px, 9999px, 60px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(65px, 9999px, 100px, 0); }
    20% { clip: rect(32px, 9999px, 5px, 0); }
    40% { clip: rect(88px, 9999px, 40px, 0); }
    60% { clip: rect(10px, 9999px, 80px, 0); }
    80% { clip: rect(20px, 9999px, 55px, 0); }
    100% { clip: rect(95px, 9999px, 10px, 0); }
}

/* CRT Flicker */
.crt-flicker {
    animation: textShadow 1.6s infinite;
}

@keyframes textShadow {
    0% { text-shadow: 0.4389924193300864px 0 1px rgba(0,30,255,0.5), -0.4389924193300864px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    5% { text-shadow: 2.7928974010788217px 0 1px rgba(0,30,255,0.5), -2.7928974010788217px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    /* ... shortened for brevity, just a flicker */
    50% { opacity: 0.9; }
    100% { opacity: 1; text-shadow: 0.4389924193300864px 0 1px rgba(0,30,255,0.5), -0.4389924193300864px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
}

/* Loading Bar */
.loading-bar-container {
    width: 300px;
    height: 4px;
    background: #111;
    border: 1px solid #333;
    position: relative;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: var(--primary-cyan);
    box-shadow: 0 0 10px var(--primary-cyan);
    animation: load 2s ease-in-out forwards;
}

@keyframes load {
    0% { width: 0%; }
    20% { width: 10%; }
    50% { width: 40%; }
    80% { width: 80%; }
    100% { width: 100%; }
}

/* Hover Glitch for Icons */
.hover-glitch:hover {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Window Manager Styles */
.os-window {
    position: absolute;
    background: var(--window-bg);
    border: 1px solid var(--primary-cyan);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 300px;
    min-height: 200px;
    resize: both; /* Allow native resizing if supported or simulated */
}

.window-header {
    height: 32px;
    background: rgba(0, 243, 255, 0.1);
    border-bottom: 1px solid var(--primary-cyan);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    cursor: grab;
    user-select: none;
}
.window-header:active {
    cursor: grabbing;
    background: rgba(0, 243, 255, 0.2);
}

.window-title {
    font-family: 'Share Tech Mono', monospace;
    color: var(--primary-cyan);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.window-btn {
    width: 12px;
    height: 12px;
    border: 1px solid #555;
    cursor: pointer;
    transition: all 0.2s;
}
.window-btn.close { background: #ff4444; border-color: #ff0000; }
.window-btn.max { background: #44ff44; border-color: #00ff00; }
.window-btn.min { background: #ffff44; border-color: #ffff00; }

.window-btn:hover { opacity: 0.8; }

.window-content {
    flex-grow: 1;
    position: relative;
    background: #000;
}

.window-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* Taskbar App Item */
.taskbar-item {
    height: 32px;
    padding: 0 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}
.taskbar-item:hover, .taskbar-item.active {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--primary-cyan);
}
.taskbar-item span {
    font-size: 0.8rem;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
