/* Mindows SM Desktop Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tahoma', 'Segoe UI', sans-serif;
    font-size: 11px;
    overflow: hidden;
    user-select: none;
    cursor: default;
}

/* Mindows SM Shutdown Sequence */
.shutdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #3A6EA5;
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-family: 'Tahoma', sans-serif;
    color: white;
}

.shutdown-overlay.active {
    display: flex;
}

.shutdown-content {
    text-align: center;
    opacity: 0;
    animation: fadeInShutdown 1s ease-in-out forwards;
}

.shutdown-content h2 {
    font-size: 18px;
    font-weight: normal;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.shutdown-content p {
    font-size: 12px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.shutdown-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes fadeInShutdown {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade to black effect */
.fade-to-black {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10001;
    opacity: 0;
    display: none;
    pointer-events: none;
}

.fade-to-black.active {
    display: block;
    animation: fadeToBlack 2s ease-in-out forwards;
}

@keyframes fadeToBlack {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Desktop */
.desktop {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom, #3A6EA5 0%, #C0C0C0 100%);
    position: relative;
    background-image: 
        linear-gradient(to bottom, #3A6EA5 0%, #C0C0C0 100%),
        url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="100" height="100"%3E%3Crect width="100" height="100" fill="%233A6EA5"/%3E%3C/svg%3E');
}

/* Desktop Icons */
.desktop-icons {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.desktop-icon {
    width: 75px;
    text-align: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
}

.desktop-icon:hover {
    background: rgba(0, 0, 255, 0.2);
    border: 1px dotted #fff;
}

.desktop-icon.selected {
    background: rgba(0, 0, 255, 0.3);
    border: 1px solid #0078D7;
}

.desktop-icon img {
    width: 48px;
    height: 48px;
    display: block;
    margin: 0 auto 5px;
}

.desktop-icon span {
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-size: 11px;
    display: block;
    word-wrap: break-word;
}

/* Windows */
.window {
    position: absolute;
    min-width: 300px;
    min-height: 200px;
    background: #ECE9D8;
    border: 2px solid #0054E3;
    border-radius: 8px 8px 0 0;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

#doom-window {
    width: 800px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.window-header {
    background: linear-gradient(to bottom, #0054E3 0%, #0054E3 50%, #0046D5 50%, #0046D5 100%);
    color: white;
    padding: 3px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
    cursor: move;
}

.window-title {
    font-weight: bold;
    font-size: 12px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

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

.window-button {
    width: 21px;
    height: 21px;
    border: 1px solid white;
    background: linear-gradient(to bottom, #fff 0%, #ECE9D8 100%);
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

.window-button:hover {
    background: linear-gradient(to bottom, #fff 0%, #E5F1FB 100%);
}

.window-button:active {
    background: linear-gradient(to bottom, #C8E0F4 0%, #98B9D9 100%);
}

.window-button.close:hover {
    background: #E81123;
    color: white;
    border-color: #E81123;
}

.window-content {
    flex: 1;
    padding: 10px;
    overflow: auto;
    background: #fff;
}

/* DOOM Container */
#doom-container {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    color: #0f0;
    font-family: 'Courier New', monospace;
    position: relative;
    overflow: hidden;
}

#doom-loading {
    text-align: center;
}

.loading-bar {
    width: 300px;
    height: 20px;
    background: #333;
    border: 2px solid #0f0;
    margin: 20px auto;
    position: relative;
}

.loading-progress {
    height: 100%;
    background: #0f0;
    width: 0%;
    transition: width 0.3s;
}

.loading-text {
    margin-top: 10px;
    font-size: 12px;
}

#doom-canvas {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    cursor: crosshair;
    display: none;
    position: relative;
}

/* Constrain js-dos wrapper to container */
#doom-container > div {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    position: relative !important;
}

/* Force js-dos canvas to fit within container */
#doom-container canvas {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    image-rendering: pixelated !important;
    image-rendering: -moz-crisp-edges !important;
    image-rendering: crisp-edges !important;
}

/* Ensure proper aspect ratio scaling */
#doom-container canvas[width="320"] {
    width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
}

#doom-instructions {
    text-align: center;
    padding: 20px;
}

#doom-instructions h3 {
    color: #0f0;
    margin-bottom: 20px;
    font-size: 18px;
}

#doom-instructions ul {
    list-style: none;
    margin-bottom: 30px;
}

#doom-instructions li {
    margin: 10px 0;
    font-size: 14px;
}

#start-doom-btn {
    background: #0f0;
    color: #000;
    border: none;
    padding: 10px 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
}

#start-doom-btn:hover {
    background: #0c0;
}

/* Taskbar */
.taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, #3169C6 0%, #2559B0 50%, #1941A5 50%, #0E3A8E 100%);
    display: flex;
    align-items: center;
    padding: 0 2px;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
}

/* Start Button */
.start-button {
    height: 26px;
    padding: 0 20px 0 5px;
    background: linear-gradient(to bottom, #5EBE4A 0%, #4AA434 50%, #379B1F 50%, #2B8215 100%);
    border: 1px solid #1C5A0E;
    border-radius: 0 15px 15px 0;
    color: white;
    font-weight: bold;
    font-size: 12px;
    font-style: italic;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.start-button img {
    width: 20px;
    height: 20px;
}

.start-button:hover {
    background: linear-gradient(to bottom, #6FD85A 0%, #5AB444 50%, #47AB2F 50%, #3B9225 100%);
}

.start-button:active {
    background: linear-gradient(to bottom, #4AA434 0%, #379B1F 50%, #2B8215 50%, #1F6F0A 100%);
}

/* Start Menu */
.start-menu {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 380px;
    background: white;
    border: 2px solid #0054E3;
    border-radius: 5px 5px 0 0;
    box-shadow: 2px -2px 5px rgba(0, 0, 0, 0.3);
    display: none;
}

.start-menu-header {
    background: linear-gradient(to bottom, #0054E3 0%, #5B9BD1 100%);
    color: white;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 14px;
}

.start-menu-header img {
    width: 48px;
    height: 48px;
    border: 2px solid white;
    border-radius: 3px;
}

.start-menu-content {
    display: flex;
    height: 400px;
}

.start-menu-left {
    flex: 1;
    background: white;
    padding: 5px 0;
}

.start-menu-right {
    flex: 1;
    background: #D4E5F7;
    padding: 5px 0;
    border-left: 1px solid #98B9D9;
}

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

.start-menu-item:hover {
    background: #316AC5;
    color: white;
}

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

.start-menu-separator {
    height: 1px;
    background: #D4D0C8;
    margin: 5px 10px;
}

/* Taskbar Items */
.taskbar-items {
    flex: 1;
    display: flex;
    gap: 2px;
    padding: 0 5px;
}

.taskbar-item {
    height: 24px;
    min-width: 160px;
    max-width: 200px;
    background: linear-gradient(to bottom, #3169C6 0%, #2559B0 50%, #1941A5 50%, #0E3A8E 100%);
    border: 1px solid #0E3A8E;
    color: white;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskbar-item.active {
    background: linear-gradient(to bottom, #1941A5 0%, #0E3A8E 50%, #0A2F7A 50%, #072867 100%);
    border: 1px solid #072867;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.taskbar-item.minimized {
    background: linear-gradient(to bottom, #5B9BD1 0%, #4179D6 50%, #3569C0 50%, #2559B0 100%);
    border: 1px solid #2559B0;
    opacity: 0.7;
    font-style: italic;
}

.taskbar-item:hover {
    background: linear-gradient(to bottom, #4179D6 0%, #3569C0 50%, #2951B5 50%, #1D41A5 100%);
}

/* System Tray */
.system-tray {
    background: linear-gradient(to bottom, #0C8FE9 0%, #0A7FD9 50%, #086FC9 50%, #065FB9 100%);
    padding: 0 10px;
    height: 26px;
    display: flex;
    align-items: center;
    border: 1px solid #065FB9;
    color: white;
    font-size: 11px;
}

/* Dialog Styles */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.dialog-window {
    width: 400px;
    background: #ECE9D8;
    border: 2px solid #0054E3;
    border-radius: 8px 8px 0 0;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.dialog-header {
    background: linear-gradient(to bottom, #0054E3 0%, #0054E3 50%, #0046D5 50%, #0046D5 100%);
    color: white;
    padding: 3px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
}

.dialog-title {
    font-weight: bold;
    font-size: 12px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

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

.dialog-button {
    width: 21px;
    height: 21px;
    border: 1px solid white;
    background: linear-gradient(to bottom, #fff 0%, #ECE9D8 100%);
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

.dialog-button:hover {
    background: linear-gradient(to bottom, #fff 0%, #E5F1FB 100%);
}

.dialog-button.close:hover {
    background: #E81123;
    color: white;
    border-color: #E81123;
}

.dialog-content {
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: #ECE9D8;
}

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

.dialog-text {
    flex: 1;
}

.dialog-text p {
    font-size: 12px;
    color: #000;
    line-height: 1.4;
    margin: 0;
}

.dialog-buttons {
    padding: 10px 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #ECE9D8;
}

.dialog-btn {
    width: 75px;
    height: 23px;
    background: linear-gradient(to bottom, #fff 0%, #ECE9D8 100%);
    border: 1px solid #ACA899;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-btn:hover {
    background: linear-gradient(to bottom, #fff 0%, #E5F1FB 100%);
    border-color: #0078D7;
}

.dialog-btn:active {
    background: linear-gradient(to bottom, #C8E0F4 0%, #98B9D9 100%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #doom-window {
        width: 95vw;
        height: 80vh;
    }
    
    .start-menu {
        width: 100%;
        max-width: 380px;
    }
    
    .dialog-window {
        width: 90%;
        max-width: 400px;
    }
}