/* Lab95 Desktop - Authentic Windows 98 Styling */

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

/* MS Sans Serif font from 98.css */
@font-face {
    font-family: "Pixelated MS Sans Serif";
    font-style: normal;
    font-weight: 400;
    src: url("../_shared/css/ms_sans_serif.woff") format("woff");
    src: url("../_shared/css/ms_sans_serif.woff2") format("woff2");
}

@font-face {
    font-family: "Pixelated MS Sans Serif";
    font-style: normal;
    font-weight: 700;
    src: url("../_shared/css/ms_sans_serif_bold.woff") format("woff");
    src: url("../_shared/css/ms_sans_serif_bold.woff2") format("woff2");
}

body {
    font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
    font-size: 11px;
    -webkit-font-smoothing: none;
    background: #008080;
    height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
}

/* Desktop */
.desktop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 28px;
}

/* Desktop Icons */
.desktop-icons {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 75px;
    padding: 4px;
    cursor: pointer;
}

.icon:hover .icon-label,
.icon:focus .icon-label {
    background: rgba(0,0,128,0.5);
}

.icon.selected .icon-image,
.icon:active .icon-image {
    filter: brightness(0.8);
}

.icon.selected .icon-label,
.icon:active .icon-label {
    background: #000080;
    color: #fff;
}

/* Win95 Pixel Art Icons */
.icon-image {
    width: 32px;
    height: 32px;
    margin-bottom: 2px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.icon-image svg {
    width: 100%;
    height: 100%;
}

.icon-label {
    color: #fff;
    text-align: center;
    padding: 1px 3px;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    font-size: 11px;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 70px;
}

/* Window - 98.css style */
.window {
    position: absolute;
    background: silver;
    border: none;
    box-shadow:
        inset -1px -1px #0a0a0a,
        inset 1px 1px #dfdfdf,
        inset -2px -2px grey,
        inset 2px 2px #fff;
    padding: 3px;
    min-width: 200px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

.window.minimized {
    display: none;
}

.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 28px) !important;
    box-shadow: none;
}

.window.maximized::after {
    display: none;
}

/* Title bar - 98.css style */
.window-titlebar {
    background: linear-gradient(90deg, navy, #1084d0);
    color: #fff;
    padding: 3px 2px 3px 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    cursor: move;
    flex-shrink: 0;
}

.window.inactive .window-titlebar {
    background: linear-gradient(90deg, grey, #b5b5b5);
}

.window-icon {
    width: 14px;
    height: 14px;
    margin-right: 3px;
    image-rendering: pixelated;
}

.window-icon svg {
    width: 100%;
    height: 100%;
}

.window-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    letter-spacing: 0;
    margin-right: 24px;
}

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

/* Window buttons - authentic 98.css style */
.window-btn {
    width: 16px;
    height: 14px;
    background: #c0c0c0;
    border: none;
    box-shadow:
        inset -1px -1px #0a0a0a,
        inset 1px 1px #fff,
        inset -2px -2px grey,
        inset 2px 2px #dfdfdf;
    display: block;
    cursor: pointer;
    padding: 0;
    min-width: 16px;
    min-height: 14px;
    background-repeat: no-repeat;
}

.window-btn:active {
    box-shadow:
        inset -1px -1px #fff,
        inset 1px 1px #0a0a0a,
        inset -2px -2px #dfdfdf,
        inset 2px 2px grey;
}

.window-btn:focus {
    outline: none;
}

/* Minimize button */
.window-btn[data-action="minimize"] {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='6' height='2' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23000' d='M0 0h6v2H0z'/%3E%3C/svg%3E");
    background-position: bottom 3px left 4px;
}

/* Maximize button */
.window-btn[data-action="maximize"] {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='9' height='9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9 0H0v9h9V0zM8 2H1v6h7V2z' fill='%23000'/%3E%3C/svg%3E");
    background-position: top 2px left 3px;
}

/* Close button */
.window-btn[data-action="close"] {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='8' height='7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0 0h2v1h1v1h2V1h1V0h2v1H7v1H6v1H5v1h1v1h1v1h1v1H6V6H5V5H3v1H2v1H0V6h1V5h1V4h1V3H2V2H1V1H0V0z' fill='%23000'/%3E%3C/svg%3E");
    background-position: top 3px left 4px;
    margin-left: 2px;
}

.window-content {
    flex: 1;
    background: #fff;
    margin: 0;
    overflow: hidden;
}

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

/* Folder window content - sunken panel style like 98.css */
.folder-content {
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: auto;
    height: 100%;
    background: #fff;
    box-shadow: inset -1px -1px #fff, inset 1px 1px grey, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}

.folder-content .icon-label {
    color: #000;
    text-shadow: none;
}

.folder-content .icon.selected .icon-label,
.folder-content .icon:active .icon-label {
    background: #000080;
    color: #fff;
}

/* Grouped folder view */
.folder-group {
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.folder-group-header {
    font-size: 11px;
    font-weight: bold;
    color: #808080;
    padding: 2px 4px;
    margin-bottom: 4px;
    border-bottom: 1px solid #dfdfdf;
}

.folder-group-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 4px;
}

/* Resize handle - Win95 style grip */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    cursor: nwse-resize;
    background: linear-gradient(135deg,
        transparent 0%, transparent 30%,
        #808080 30%, #808080 35%,
        #fff 35%, #fff 40%,
        transparent 40%, transparent 50%,
        #808080 50%, #808080 55%,
        #fff 55%, #fff 60%,
        transparent 60%, transparent 70%,
        #808080 70%, #808080 75%,
        #fff 75%, #fff 80%,
        transparent 80%
    );
}

/* Taskbar - authentic Win95 */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: #c0c0c0;
    border-top: 1px solid #fff;
    box-shadow: inset 0 1px 0 #dfdfdf;
    display: flex;
    align-items: center;
    padding: 2px;
    gap: 2px;
}

/* Start button - the iconic look */
.start-button {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 5px;
    background: #c0c0c0;
    box-shadow:
        inset 1px 1px 0 #ffffff,
        inset -1px -1px 0 #000000,
        inset 2px 2px 0 #dfdfdf,
        inset -2px -2px 0 #808080;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    height: 22px;
    border: none;
}

.start-button:active, .start-button.active {
    box-shadow:
        inset 1px 1px 0 #000000,
        inset -1px -1px 0 #ffffff,
        inset 2px 2px 0 #808080,
        inset -2px -2px 0 #dfdfdf;
    padding-left: 6px;
    padding-top: 3px;
}

.start-button .start-logo {
    width: 16px;
    height: 16px;
}

.taskbar-divider {
    width: 2px;
    height: 22px;
    margin: 0 1px;
    box-shadow:
        inset 1px 0 0 #808080,
        inset -1px 0 0 #fff;
}

.taskbar-windows {
    display: flex;
    flex: 1;
    gap: 2px;
    overflow: hidden;
    padding: 0 2px;
}

.taskbar-item {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: #c0c0c0;
    box-shadow:
        inset 1px 1px 0 #ffffff,
        inset -1px -1px 0 #000000,
        inset 2px 2px 0 #dfdfdf,
        inset -2px -2px 0 #808080;
    font-size: 11px;
    cursor: pointer;
    max-width: 160px;
    height: 22px;
    overflow: hidden;
    border: none;
}

.taskbar-item.active {
    box-shadow:
        inset 1px 1px 0 #000000,
        inset -1px -1px 0 #ffffff,
        inset 2px 2px 0 #808080,
        inset -2px -2px 0 #dfdfdf;
    background: repeating-linear-gradient(
        90deg,
        #c0c0c0,
        #c0c0c0 1px,
        #fff 1px,
        #fff 2px
    );
}

.taskbar-item-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.taskbar-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* System tray */
.taskbar-tray {
    display: flex;
    align-items: center;
    padding: 2px 6px;
    height: 22px;
    font-size: 11px;
    box-shadow:
        inset 1px 1px 0 #808080,
        inset -1px -1px 0 #fff;
    gap: 4px;
}

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

/* Start Menu - authentic look */
.start-menu {
    position: fixed;
    bottom: 28px;
    left: 0;
    width: 200px;
    background: #c0c0c0;
    box-shadow:
        inset 1px 1px 0 #ffffff,
        inset -1px -1px 0 #000000,
        2px 2px 0 #000;
    display: none;
    border: none;
}

.start-menu.active {
    display: flex;
}

.start-menu-sidebar {
    background: linear-gradient(180deg, #000080 0%, #1084d0 100%);
    color: #fff;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 8px 3px;
    font-weight: bold;
    font-size: 18px;
    letter-spacing: 2px;
}

.start-menu-items {
    flex: 1;
    padding: 2px 0;
}

.start-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
}

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

.start-menu-item .menu-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
}

.start-menu-item .menu-icon svg {
    width: 100%;
    height: 100%;
}

.start-menu-item .icon-image {
    width: 24px;
    height: 24px;
}

.start-menu-divider {
    height: 2px;
    margin: 2px 6px;
    box-shadow:
        inset 0 1px 0 #808080,
        inset 0 -1px 0 #fff;
}

.loading {
    padding: 20px;
    color: #808080;
}

/* Mobile Adaptations */
@media (max-width: 600px) {
    .desktop-icons {
        display: none;
    }

    .window {
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100vh - 28px) !important;
        box-shadow: none;
    }

    .window::after {
        display: none;
    }

    .window .resize-handle {
        display: none;
    }

    .window-btn:nth-child(1),
    .window-btn:nth-child(2) {
        display: none;
    }

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

    .folder-content .icon {
        width: 85px;
    }

    .folder-content .icon-image {
        width: 40px;
        height: 40px;
    }

    .start-menu {
        width: 100%;
    }

    .context-menu {
        display: none !important;
    }
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #c0c0c0;
    box-shadow:
        inset 1px 1px 0 #ffffff,
        inset -1px -1px 0 #000000,
        2px 2px 0 #000;
    min-width: 150px;
    z-index: 10000;
    display: none;
    padding: 2px 0;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 20px 4px 8px;
    cursor: pointer;
    font-size: 11px;
}

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

.context-menu-item .menu-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
}

.context-menu-item .menu-icon svg {
    width: 100%;
    height: 100%;
}

.context-menu-divider {
    height: 2px;
    margin: 2px 2px;
    box-shadow:
        inset 0 1px 0 #808080,
        inset 0 -1px 0 #fff;
}
