/* Base Styles */
@import url('https://fonts.googleapis.com/css2?family=VT323&family=IBM+Plex+Mono:wght@400;700&display=swap');

:root {
    /* Theme colors - can be customized */
    --theme-desktop: #008080;
    --theme-primary: #000080;
    --theme-secondary: #808080;
    
    /* Fonts */
    --font-system: "MS Sans Serif", "Segoe UI", Tahoma, sans-serif;
    --font-mono: "Fixedsys", "IBM Plex Mono", "Courier New", monospace;
    --font-terminal: "VT323", "Courier New", monospace;
    
    /* Screen dimensions */
    --screen-width: 640px;
    --screen-height: 480px;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-system);
    font-size: 11px;
    background: #000;
    color: var(--win-black);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main screen container - 640x480 letterbox */
#screen-container {
    width: var(--screen-width);
    height: var(--screen-height);
    position: relative;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 80px 20px rgba(0, 128, 128, 0.3),
                0 0 120px 40px rgba(0, 128, 128, 0.15);
    border-radius: 8px;
    transition: box-shadow 0.5s ease;
}

/* Dynamic screen glow - set via JS */
#screen-container.glow-blue {
    box-shadow: 0 0 80px 20px rgba(0, 0, 128, 0.4),
                0 0 120px 40px rgba(0, 0, 128, 0.2);
}

#screen-container.glow-teal {
    box-shadow: 0 0 80px 20px rgba(0, 128, 128, 0.4),
                0 0 120px 40px rgba(0, 128, 128, 0.2);
}

#screen-container.glow-white {
    box-shadow: 0 0 80px 20px rgba(200, 200, 200, 0.3),
                0 0 120px 40px rgba(200, 200, 200, 0.15);
}

#screen-container.glow-dark {
    box-shadow: 0 0 60px 15px rgba(30, 30, 30, 0.4),
                0 0 100px 30px rgba(30, 30, 30, 0.2);
}

#screen-container.glow-off {
    box-shadow: none;
}

/* Prevent text selection on UI elements */
.no-select,
.win-title-bar,
.win-toolbar,
.win-menubar,
button,
.dialog,
.desktop-icon,
.program-window,
.window-content,
.control-panel,
.minesweeper,
.file-manager,
.mail-app,
.print-manager,
.mosaic,
.calendar-app,
.media-player,
.sound-recorder,
.paint-app,
label,
span,
div,
p,
h1, h2, h3, h4, h5, h6,
.cp-category,
.cp-panel,
.sd-page {
    user-select: none;
    -webkit-user-select: none;
}

/* Allow selection in input fields and textareas */
input, textarea, .dos-output {
    user-select: text;
    -webkit-user-select: text;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Common layout helpers */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.gap-4 {
    gap: 4px;
}

.gap-8 {
    gap: 8px;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.text-center {
    text-align: center;
}

/* Icon base */
.icon {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.icon-small {
    width: 16px;
    height: 16px;
}

.icon-large {
    width: 48px;
    height: 48px;
}

/* Dividers */
.divider-h {
    width: 100%;
    height: 2px;
    background: linear-gradient(to bottom, var(--win-shadow) 50%, var(--win-highlight) 50%);
    margin: 8px 0;
}

.divider-v {
    width: 2px;
    height: 100%;
    background: linear-gradient(to right, var(--win-shadow) 50%, var(--win-highlight) 50%);
    margin: 0 8px;
}

/* Custom scrollbar for themed areas */
.themed-scroll::-webkit-scrollbar {
    width: 16px;
}

.themed-scroll::-webkit-scrollbar-track {
    background: var(--win-bg);
}

.themed-scroll::-webkit-scrollbar-thumb {
    background: var(--win-shadow);
}

/* Monitor frame and controls */
#monitor-frame {
    position: relative;
}

#monitor-controls {
    position: absolute;
    bottom: -55px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Floppy disk drive */
.floppy-drive {
    width: 280px;
    height: 12px;
    background: #151515;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
}

.floppy-slot {
    width: 240px;
    height: 3px;
    background: #0a0a0a;
    border-radius: 1px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.8);
}

.floppy-led {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #100;
    transition: all 0.2s ease;
}

.floppy-drive.reading {
    opacity: 0.8;
}

.floppy-drive.reading .floppy-led {
    background: #f80;
    box-shadow: 0 0 4px #f80, 0 0 8px #f80;
    animation: floppy-blink 0.15s infinite;
}

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

.power-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    border-radius: 3px;
    border: 1px solid #222;
    background: linear-gradient(145deg, #3a3a3a, #1a1a1a);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5),
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    aspect-ratio: 1 / 1;
}

.power-button::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #0c0;
    box-shadow: 0 0 8px #0c0, 0 0 16px #0c0;
    transition: all 0.3s ease;
}

.power-button.off {
    background: linear-gradient(145deg, #0a0a0a, #050505);
    border-color: #111;
}

.power-button.off::before {
    background: #200;
    box-shadow: none;
}

.power-button:hover {
    border-color: #333;
}

.power-button:active {
    transform: scale(0.95);
}

.power-icon {
    display: none;
}

/* Screen off state */
#screen-container.screen-off {
    background: #252525;
    animation: screen-turn-off 0.3s ease-out forwards;
}

@keyframes screen-turn-off {
    0% {
        filter: brightness(1);
        transform: scale(1, 1);
    }
    50% {
        filter: brightness(1.5);
        transform: scale(1.01, 0.9);
    }
    100% {
        filter: brightness(0.12);
        transform: scale(1, 1);
    }
}

#screen-container:not(.screen-off) {
    animation: screen-turn-on 0.3s ease-out forwards;
}

@keyframes screen-turn-on {
    0% {
        filter: brightness(0.03);
    }
    50% {
        filter: brightness(1.5);
    }
    100% {
        filter: brightness(1);
        transform: scale(1, 1);
    }
}

#screen-container.screen-off > *:not(#crt-overlay) {
    opacity: 0;
    visibility: hidden;
}

/* Animations */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.blink {
    animation: blink 1s infinite;
}

/* Utility for image rendering */
img {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}
