/* Retro Windows 95 Styling for Paint Studio */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.win95-theme {
    background-color: #55aaaa; /* Nostalgic teal desktop wallpaper */
    font-family: 'MS Sans Serif', Tahoma, Arial, sans-serif;
    font-size: 11px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

/* Classic Win95 Bevel helper borders */
.win95-outset {
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
}

.win95-inset {
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
}

/* Windows 95 Menu bar style */
.menu-bar {
    background: #c0c0c0;
    border-bottom: 2px solid #808080;
    display: flex;
    padding: 3px;
    font-family: inherit;
    z-index: 100;
}

.menu-item {
    padding: 3px 8px;
    cursor: pointer;
    border-radius: 0;
    color: #000000;
}

.menu-item:hover {
    background: #000080;
    color: #ffffff;
}

/* Win95 dropdown menus */
.dropdown-menu {
    display: none;
    position: absolute;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
    z-index: 1000;
    min-width: 150px;
    padding: 2px;
}

.dropdown-menu.show {
    display: block;
}

.menu-option {
    padding: 5px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-option:hover {
    background: #000080;
    color: #ffffff;
}

.menu-option .shortcut {
    color: #808080;
    font-size: 10px;
    margin-left: 20px;
}

.menu-option:hover .shortcut {
    color: #c0c0c0;
}

/* Grid layout for Toolbox & Canvas viewport */
.workspace {
    flex: 1;
    display: flex;
    background: #808080;
    padding: 4px;
    gap: 4px;
    overflow: hidden;
}

/* Nostalgic 2-Column Toolbox */
.toolbox {
    background: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    width: 60px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 25px;
    gap: 2px;
    padding: 2px;
    height: fit-content;
}

.tool {
    background: #c0c0c0;
    border: 1.5px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.tool:active {
    border-color: #808080 #ffffff #ffffff #808080;
    background: #e0e0e0;
}

.tool.active {
    border-color: #808080 #ffffff #ffffff #808080;
    background: #e0e0e0;
    /* Dotted background pattern */
    background-image: radial-gradient(#808080 20%, transparent 20%);
    background-size: 4px 4px;
}

/* Tool modifier styling (size slider etc) */
.tool-modifier-box {
    grid-column: 1 / span 2;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    margin-top: 6px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: auto;
}

.mod-title {
    font-size: 8px;
    font-weight: 700;
    text-align: center;
    color: #808080;
}

/* Canvas Scroll Viewport */
.canvas-viewport {
    flex: 1;
    background: #808080;
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 10px;
}

/* Floating centered canvas box */
.canvas-container {
    position: relative;
    border: 2px solid;
    border-color: #000000 #ffffff #ffffff #000000;
    background: #808080;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.3);
    margin: auto;
    transition: transform 0.1s ease;
}

#main-canvas {
    display: block;
    background: #ffffff;
    image-rendering: pixelated; /* Essential for pixel drawing and zoom crispness */
}

#temp-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    image-rendering: pixelated;
}

/* Grid overlay for pixel levels zooming */
.grid-overlay-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
    /* Repeating grid lines using linear gradients */
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.15) 1px, transparent 1px);
    background-size: 8px 8px; /* Should update dynamically in JS */
}

/* Bottom Palette Panel (Win95 gray board) */
.palette-bar {
    background: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-bottom: 2px solid #808080;
    height: 48px;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    gap: 8px;
    z-index: 100;
    flex-shrink: 0;
}

/* Double Overlapping Colors Preview */
.color-preview-box {
    position: relative;
    width: 32px;
    height: 32px;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    flex-shrink: 0;
}

.bg-color-preview {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border: 1.5px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 1px 1px 0 #000000;
    z-index: 1;
}

.fg-color-preview {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border: 1.5px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 1px 1px 0 #000000;
    z-index: 2;
}

/* 2x14 Grid classic Colors */
.colors-grid {
    display: grid;
    grid-template-columns: repeat(14, 15px);
    grid-template-rows: 15px 15px;
    gap: 2px;
}

.color-swatch {
    width: 15px;
    height: 15px;
    border: 1.5px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    cursor: pointer;
}

.color-swatch:hover {
    border-color: #000000;
}

/* Manual picker swatch */
.custom-picker-swatch {
    position: relative;
    width: 36px;
    height: 32px;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    background: #e0e0e0;
    cursor: pointer;
    flex-shrink: 0;
}

/* Dialog Box */
.win95-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.6);
    z-index: 2000;
    width: 250px;
    padding: 3px;
}

.dialog-title-bar {
    background: #000080;
    color: #ffffff;
    font-weight: bold;
    padding: 3px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-close {
    background: #c0c0c0;
    border: 1px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    width: 14px;
    height: 14px;
    font-size: 8px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dialog-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.dialog-btn {
    background: #c0c0c0;
    border: 1.5px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    padding: 4px 12px;
    font-family: inherit;
    cursor: pointer;
}
.dialog-btn:active {
    border-color: #808080 #ffffff #ffffff #808080;
}

/* Status Bar bottom */
.status-bar {
    background: #c0c0c0;
    border-top: 2px solid #808080;
    padding: 3px 8px;
    font-size: 10px;
    display: flex;
    gap: 20px;
    font-family: monospace;
    z-index: 100;
}

.status-section {
    border-right: 1.5px solid #ffffff;
    padding-right: 12px;
    height: 14px;
    display: inline-flex;
    align-items: center;
}

.status-section:last-child {
    border-right: none;
    margin-left: auto;
}
