body {
    margin: 0;
    font-family: 'Amiga Topaz', monospace;
    /* Placeholder for Amiga-like font */
    background-color: #555;
    /* Darker gray background */
    color: #000;
}

/* Custom Amiga Font (if available, otherwise fallback) */
@font-face {
    font-family: 'Amiga Topaz';
    src: local('Courier New'), local('Courier'), monospace;
    font-weight: normal;
    font-style: normal;
}


.workbench {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: linear-gradient(to bottom, #808080, #A0A0A0);
    /* Workbench gray background */
    overflow: hidden;
}

/* Top Menu Bar */
.top-menu-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 18px;
    /* Amiga menu bar height */
    background-color: #808080;
    /* Gray */
    border-bottom: 1px solid #000;
    display: flex;
    align-items: center;
    padding: 0 2px;
    box-sizing: border-box;
    font-size: 0.8em;
    color: #000;
}

.top-menu-bar .menu-item {
    padding: 0 8px;
    cursor: pointer;
    line-height: 18px;
}

.top-menu-bar .menu-item.active,
.top-menu-bar .menu-item:hover {
    background-color: #004080;
    /* Amiga blue highlight */
    color: #fff;
}

/* Window Styles */
.window {
    position: absolute;
    background-color: #C0C0C0;
    /* Light gray window body */
    border: 1px solid #000;
    /* Black border */
    box-shadow: 2px 2px 0 #404040;
    /* Drop shadow for depth */
    overflow: hidden;
    resize: both;
    /* Allow resizing */
    min-width: 150px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

.window.active {
    z-index: 100;
}

.title-bar {
    background-color: #004080;
    /* Amiga blue title bar */
    height: 12px;
    /* Amiga title bar height */
    padding: 0 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    border-bottom: 1px solid #000;
}

.window.active .title-bar {
    background-color: #004080;
    /* Active state is blue */
}

.title-bar-text {
    color: #fff;
    font-weight: normal;
    font-size: 0.7em;
}

.title-bar-controls {
    display: flex;
    gap: 1px;
}

.title-bar-controls button {
    width: 8px;
    height: 8px;
    border: 1px solid #000;
    background-color: #C0C0C0;
    /* Gadget background */
    cursor: pointer;
    box-shadow: inset 1px 1px 0 #FFF, inset -1px -1px 0 #808080;
    /* 3D effect */
    position: relative;
}

.title-bar-controls button:active {
    box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #FFF;
    /* Pressed effect */
}

.title-bar-controls button[aria-label="Maximize"]::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: #004080;
    /* Blue dot */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.title-bar-controls button[aria-label="Close"]::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: #FF0000;
    /* Red dot */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.window-body {
    flex-grow: 1;
    background-color: #C0C0C0;
    padding: 8px;
    overflow: auto;
    font-size: 0.8em;
    color: #000;
}

/* Generic Button Support */
button {
    background-color: #C0C0C0;
    border: 1px solid #000;
    box-shadow: 1px 1px 0 #FFF, -1px -1px 0 #808080;
    color: #000;
    padding: 2px 8px;
    font-size: 0.9em;
    cursor: pointer;
    font-family: inherit;
    margin: 2px;
}

button:active {
    box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #FFF;
    background-color: #A0A0A0;
}

button.default {
    border-width: 2px;
    outline: 1px solid #000;
}

button:disabled {
    color: #808080;
    cursor: default;
    box-shadow: none;
    border-color: #808080;
}

/* Fieldset and Legend */
fieldset {
    border: 1px solid #000;
    margin: 10px 0;
    padding: 10px;
    box-shadow: 1px 1px 0 #FFF;
}

legend {
    font-size: 0.9em;
    padding: 0 5px;
    background-color: #C0C0C0;
    border: 1px solid #000;
}

/* Inputs */
input[type="text"] {
    border: 1px solid #000;
    background-color: #fff;
    color: #000;
    padding: 2px 5px;
    font-family: inherit;
    font-size: 0.9em;
    box-shadow: inset 1px 1px 0 #808080;
}

label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    margin-bottom: 5px;
}

/* Checkbox and Radio */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    width: 12px;
    height: 12px;
    border: 1px solid #000;
    background-color: #C0C0C0;
    box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #FFF;
    position: relative;
    cursor: pointer;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #004080;
    top: 2px;
    left: 2px;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #004080;
    top: 2px;
    left: 2px;
    border-radius: 50%;
}

.window-resize-gadget {
    width: 8px;
    height: 8px;
    background-color: #C0C0C0;
    border: 1px solid #000;
    box-shadow: inset 1px 1px 0 #FFF, inset -1px -1px 0 #808080;
    position: absolute;
    bottom: 0;
    right: 0;
    cursor: se-resize;
}

/* Amiga Icons */
.icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.amiga-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    width: 60px;
    /* Adjust as needed */
    padding: 2px;
}

.amiga-icon img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    /* For pixel art icons */
    border: none;
    background: none;
}

.amiga-icon span {
    font-size: 0.7em;
    color: #000;
    background-color: #C0C0C0;
    /* Icon text background */
    padding: 0 2px;
    border: 1px solid #808080;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.amiga-icon:hover {
    background-color: #004080;
    /* Blue highlight on hover */
    color: #fff;
}

.amiga-icon:hover span {
    color: #fff;
    background-color: #004080;
    border-color: #000;
}

/* Submenu Styles */
.menu-item.has-submenu {
    position: relative;
}

.submenu {
    position: absolute;
    top: 100%;
    /* Position below the parent menu item */
    left: 0;
    background-color: #C0C0C0;
    border: 1px solid #000;
    box-shadow: 2px 2px 0 #404040;
    min-width: 150px;
    display: none;
    /* Hidden by default */
    z-index: 200;
    /* Ensure submenu is above other elements */
    font-size: 0.9em;
}

.menu-item.has-submenu:hover>.submenu {
    display: block;
    /* Show submenu on hover of parent */
}

.submenu-item {
    padding: 3px 10px;
    color: #000;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.submenu-item:hover {
    background-color: #004080;
    color: #fff;
}

.submenu-item.checked::before {
    content: '✓';
    margin-right: 5px;
    color: #004080;
    /* Blue checkmark */
    font-weight: bold;
}

.submenu-item:hover.checked::before {
    color: #fff;
}

.submenu-separator {
    height: 1px;
    background-color: #808080;
    margin: 3px 0;
}

/* File Selector Dialog Styles */
.file-selector-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    /* Semi-transparent overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    /* Above regular windows, below top menu bar */
}

.file-selector-dialog .window {
    /* Inherits window styles, but can override */
    min-width: 400px;
    min-height: 250px;
}

.file-selector-dialog .title-bar .title-bar-text {
    color: #fff;
}

.amiga-panel {
    border: 1px solid #000;
    background-color: #A0A0A0;
    /* Panel background */
    display: flex;
    flex-direction: column;
}

.amiga-panel-header {
    background-color: #808080;
    /* Panel header background */
    border-bottom: 1px solid #000;
    padding: 2px 5px;
    font-size: 0.7em;
    font-weight: bold;
    color: #000;
}

.amiga-panel-content {
    flex-grow: 1;
    background-color: #C0C0C0;
    /* Content background */
    padding: 2px;
    overflow-y: auto;
    border: 1px inset #808080;
    /* Inset border for list look */
}

.amiga-list-item {
    padding: 1px 3px;
    font-size: 0.7em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    color: #000;
}

.amiga-list-item.active,
.amiga-list-item:hover {
    background-color: #004080;
    color: #fff;
}

.amiga-input-text {
    border: 1px solid #000;
    background-color: #fff;
    color: #000;
    padding: 2px 3px;
    font-family: monospace;
    font-size: 0.7em;
}

.window-footer {
    background-color: #C0C0C0;
    border-top: 1px solid #808080;
    padding: 5px;
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

/* Keep for backward compatibility if needed, but uses generic button styles now */
/* .amiga-button is no longer needed as we use generic tags */

.amiga-icon.small {
    width: 50px;
    /* Adjust for smaller icons */
    padding: 1px;
}

.amiga-icon.small img {
    width: 32px;
    height: 32px;
}

.amiga-icon.small span {
    font-size: 0.6em;
}

/* Toggle Button Styles */
.amiga-button-toggle {
    position: relative;
}

.amiga-button-toggle[data-toggled="true"] {
    box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #FFF;
    /* Pressed effect */
    background-color: #808080;
    color: #fff;
}

/* Progress Bar Styles */
.amiga-progress-bar-container {
    border: 1px solid #000;
    background-color: #C0C0C0;
    padding: 2px;
    box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #FFF;
    /* Inset effect */
    display: flex;
    align-items: center;
    height: 16px;
    /* Typical Amiga gadget height */
    position: relative;
}

.amiga-progress-bar {
    background-color: #808080;
    /* Gray background for the bar track */
    height: 100%;
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    border: 1px inset #000;
}

.amiga-progress-fill {
    background-color: #004080;
    /* Amiga blue fill */
    height: 100%;
    width: 0%;
    /* Will be controlled by JS or inline style */
    position: absolute;
    left: 0;
    top: 0;
}

.amiga-progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    color: #fff;
    font-size: 0.7em;
    font-weight: bold;
    text-shadow: 1px 1px #000;
    /* For readability */
}

/* Scrollbar Styles (for Webkit browsers) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background-color: #C0C0C0;
    /* Light gray track */
    border: 1px solid #000;
    box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #FFF;
    /* Inset effect */
}

::-webkit-scrollbar-thumb {
    background-color: #808080;
    /* Gray thumb */
    border: 1px solid #000;
    box-shadow: 1px 1px 0 #FFF, -1px -1px 0 #808080;
    /* 3D effect */
}

::-webkit-scrollbar-thumb:hover {
    background-color: #A0A0A0;
    /* Lighter gray on hover */
}

::-webkit-scrollbar-corner {
    background-color: #C0C0C0;
    /* Corner area */
    border: 1px solid #000;
    box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #FFF;
}