/* style.css */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent scrolling on the desktop itself */
    font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
}

#desktop {
    width: 100vw;
    height: 100vh;
    background-color: #008080; /* Classic Windows 98 Teal Desktop Background */
    position: relative;
    overflow: hidden;
}

.taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 28px;
    background-color: #c0c0c0;
    border-top: 1px solid #dfdfdf;
    display: flex;
    align-items: center;
    padding: 2px;
    box-sizing: border-box;
    z-index: 10000;
}

.start-button {
    font-weight: bold;
    display: flex;
    align-items: center;
    height: 20px; /* Shorter height */
    padding: 0 4px;
    width: 60px; /* Make it narrower */
    justify-content: center;
}

.taskbar-divider {
    width: 2px;
    height: 20px;
    background-color: #808080;
    border-right: 1px solid #ffffff;
    margin: 0 4px;
}

.taskbar-window-btn {
    display: flex;
    align-items: center;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: bold;
    max-width: 160px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
}
.taskbar-window-btn img {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    flex-shrink: 0;
}
.taskbar-window-btn.active {
    box-shadow: inset -1px -1px #dfdfdf, inset 1px 1px #0a0a0a, inset -2px -2px #c0c0c0, inset 2px 2px #808080;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEUlEQVQIW2NkYPj/n4EBFAAAbwsD/cMQnCIAAAAASUVORK5CYII=');
    font-weight: bold;
}

/* Base styles for draggable windows */
.draggable-window {
    box-shadow: 1px 1px 0 #000;
}

.draggable-window .title-bar {
    cursor: default; /* We will change this to 'move' via JS later when implementing dragging */
}

/* Resize handles */
.resize-handle {
    position: absolute;
    z-index: 100;
}
.resize-handle.n { top: -4px; left: 0; right: 0; height: 8px; cursor: n-resize; }
.resize-handle.s { bottom: -4px; left: 0; right: 0; height: 8px; cursor: s-resize; }
.resize-handle.e { top: 0; bottom: 0; right: -4px; width: 8px; cursor: e-resize; }
.resize-handle.w { top: 0; bottom: 0; left: -4px; width: 8px; cursor: w-resize; }
.resize-handle.ne { top: -4px; right: -4px; width: 12px; height: 12px; cursor: ne-resize; z-index: 101; }
.resize-handle.nw { top: -4px; left: -4px; width: 12px; height: 12px; cursor: nw-resize; z-index: 101; }
.resize-handle.se { bottom: -4px; right: -4px; width: 12px; height: 12px; cursor: se-resize; z-index: 101; }
.resize-handle.sw { bottom: -4px; left: -4px; width: 12px; height: 12px; cursor: sw-resize; z-index: 101; }

/* MS Paint UI Styles */
.menu-bar {
    padding: 2px 4px;
    display: flex;
    gap: 12px;
    border-bottom: 1px solid #dfdfdf;
    font-size: 11px;
}
.menu-bar span {
    cursor: default;
    padding: 1px 4px;
}
.menu-bar span:hover {
    background-color: #000080;
    color: #fff;
}
.menu-bar span:first-letter {
    text-decoration: underline;
}

.tool-btn {
    width: 25px;
    height: 25px;
    min-width: 25px;
    padding: 0;
    margin: 0;
    background-color: #c0c0c0;
    border: 1px solid #dfdfdf;
    border-bottom-color: #808080;
    border-right-color: #808080;
    box-shadow: inset 1px 1px #fff, inset -1px -1px #0a0a0a;
}
.tool-btn:active, .tool-btn.active {
    border: 1px solid #808080;
    border-bottom-color: #dfdfdf;
    border-right-color: #dfdfdf;
    box-shadow: inset 1px 1px #0a0a0a, inset -1px -1px #fff;
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACAQMAAABIeJ9nAAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjYGBgAAABAAAADA9UTQAAAABJRU5ErkJggg==') repeat;
}

.tool-btn .icon {
    width: 16px;
    height: 16px;
    margin: 3px auto;
    background-image: url('assets/tools.png');
    pointer-events: none; /* Let clicks pass through to the button */
}

/* Offset the icon slightly down and right when the button is active to simulate pressing */
.tool-btn:active .icon, .tool-btn.active .icon {
    transform: translate(1px, 1px);
}

/* Disabled (unimplemented) tool buttons */
.tool-btn.disabled {
    cursor: not-allowed;
    pointer-events: none;
}
.tool-btn.disabled .icon {
    opacity: 0.35;
}

.color-swatch {
    width: 15px;
    height: 15px;
    box-sizing: border-box;
    border: 1px solid #808080;
    border-right-color: #fff;
    border-bottom-color: #fff;
    box-shadow: inset 1px 1px #0a0a0a;
}

/* Desktop Icons */
.desktop-icon {
    position: absolute;
    width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
    margin: 15px;
}
.desktop-icon img {
    width: 40px;
    height: 40px;
    margin-bottom: 2px;
    image-rendering: pixelated;
}
.desktop-icon span {
    color: white;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
    text-align: center;
    background-color: transparent;
    padding: 1px 4px;
}
.desktop-icon.selected span {
    background-color: #000080;
    border: 1px dotted #fff;
    text-shadow: none;
}

/* Taskbar Windows */
.taskbar-window-btn {
    display: flex;
    align-items: center;
    height: 22px;
    padding: 0 4px;
    margin-right: 2px;
    min-width: 150px;
    justify-content: flex-start;
    font-weight: bold;
}

/* Size Option Selectors */
.size-option {
    cursor: pointer;
    opacity: 0.4;
}
.size-option.selected {
    opacity: 1;
    outline: 1px dotted #000;
    outline-offset: 2px;
}

/* Color Swatch interactivity */
.color-swatch {
    cursor: pointer;
}
.color-swatch:hover {
    outline: 1px solid #fff;
    outline-offset: -1px;
}

/* Canvas cursor - set dynamically via JS */
#paint-canvas {
    cursor: crosshair;
}

/* Brush/Eraser outline cursor overlay */
#cursor-outline {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    border: 1px solid #000;
    display: none;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
}
#cursor-outline.circle {
    border-radius: 50%;
}
#cursor-outline.square {
    border-radius: 0;
}

/* Explorer Styles */
.explorer-panel-header {
    background-color: #c0c0c0;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 4px;
    border-bottom: 1px solid #808080;
}
.explorer-tree {
    background-color: #fff;
    box-shadow: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px;
    font-size: 11px;
    user-select: none;
}
.explorer-tree-item {
    display: flex;
    align-items: center;
    padding: 1px 2px;
    cursor: default;
    white-space: nowrap;
}
.explorer-tree-item img {
    width: 16px;
    height: 16px;
    margin-right: 3px;
    image-rendering: pixelated;
    flex-shrink: 0;
}
.explorer-tree-item.disabled {
    color: #808080;
}
.explorer-tree-item.selected {
    background-color: #000080;
    color: #fff;
}
.explorer-tree-item.selected.disabled {
    background-color: transparent;
    color: #808080;
}
.explorer-list-header {
    display: flex;
    background-color: #c0c0c0;
    font-size: 11px;
    font-weight: bold;
    border-bottom: 1px solid #808080;
}
.explorer-list-header span {
    padding: 2px 4px;
    border-right: 1px solid #808080;
    border-left: 1px solid #fff;
}
.explorer-file-list {
    background-color: #fff;
    box-shadow: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 11px;
    user-select: none;
}
.explorer-file-row {
    display: flex;
    align-items: center;
    padding: 1px 2px;
    cursor: default;
}
.explorer-file-row:hover {
    background-color: #e8e8e8;
}
.explorer-file-row.selected {
    background-color: #000080;
    color: #fff;
}
.explorer-file-row img {
    width: 16px;
    height: 16px;
    margin-right: 3px;
    image-rendering: pixelated;
    flex-shrink: 0;
}
.explorer-file-row .file-name {
    flex: 2;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
}
.explorer-file-row .file-size {
    flex: 1;
    padding-left: 4px;
}
.explorer-file-row .file-type {
    flex: 1.5;
    padding-left: 4px;
}
.explorer-status-bar {
    background-color: #c0c0c0;
    font-size: 11px;
    padding: 2px 6px;
    border-top: 1px solid #808080;
    box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a;
    margin: 2px;
}
