/* Custom CSS overrides for 98.css retro desktop */

/* Desktop background */
html, body {
    margin: 0;
    padding: 0;
    /* Use a gradient background for faster loading, with fallback image */
    background: linear-gradient(135deg, #008080 0%, #20b2aa 25%, #4682b4 50%, #6495ed 75%, #87ceeb 100%);
    /* Optional: Keep the image as a backup but load it after the page */
    /* background-image: url('https://i.redd.it/02dw11nuqf681.jpg'); */
    background-size: cover;
    height: 100vh;
    overflow: hidden;
}

/* Desktop Icons */
.desktop-icon {
    position: absolute;
    width: 64px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    color: white;
}

.desktop-icon:nth-child(1) {
    top: 20px;
    right: 20px;
}

.desktop-icon:nth-child(2) {
    top: 20px;
    right: 100px;
}

.desktop-icon:nth-child(3) {
    top: 20px;
    right: 180px;
}

.desktop-icon:nth-child(4) {
    top: 110px;
    right: 20px;
}

.desktop-icon:nth-child(5) {
    top: 110px;
    right: 100px;
}

.desktop-icon:hover {
    background-color: rgba(0, 0, 128, 0.3);
    border: 1px dotted #000080;
}

.desktop-icon.selected {
    background-color: rgba(0, 0, 128, 0.5);
    border: 1px dotted #000080;
}

/* Fix for Final Project icon hover/selection */
.desktop-icon.final-project-icon {
    width: 64px !important;
    height: 80px !important;
}

.desktop-icon.final-project-icon:hover {
    background-color: rgba(0, 0, 128, 0.3);
    border: 1px dotted #000080;
    border-radius: 3px;
}

.desktop-icon.final-project-icon.selected {
    background-color: rgba(0, 0, 128, 0.5);
    border: 1px dotted #000080;
    border-radius: 3px;
}

.app-icon {
    width: 32px;
    height: 32px;
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    margin: 0 auto 4px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 1px 1px 2px #808080;
}

.desktop-icon:active .app-icon {
    border: 2px inset #c0c0c0;
}

/* Folder icon using CSS */
.icon-image.folder {
    width: 16px;
    height: 16px;
    background: #ffff00;
    border: 1px solid #000;
    position: relative;
}

.icon-image.folder::before {
    content: "";
    width: 12px;
    height: 10px;
    background: #ffff00;
    border: 1px solid #000;
    border-bottom: 2px solid #000;
    position: absolute;
    top: 2px;
    left: 2px;
}

.icon-image.folder::after {
    content: "";
    width: 4px;
    height: 2px;
    background: #ffff00;
    border: 1px solid #000;
    border-bottom: none;
    position: absolute;
    top: 0px;
    left: 2px;
}

.icon-label {
    font-size: 11px;
    color: white;
    text-shadow: 1px 1px 1px #000;
    word-wrap: break-word;
    line-height: 1.2;
}

/* Window positioning */
.window1 {
    top: 50px;
    left: 50px;
}

.window2 {
    top: 200px;
    left: 300px;
    width: 300px;
}

.window3 {
    top: 300px;
    left: 800px;
    width: 300px;
}

/* Music player positioning */
.music-player {
    position: fixed;
    bottom: 10px;
    left: 10px;
    width: 600px;
    z-index: 1001;
}

.music-player .controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.music-player .controls button {
    min-width: 20px;
}

.music-player .status-bar {
    flex: 1;
    margin: 5px 0;
}

.music-player .field-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.music-player input[type="range"] {
    width: 60px;
}

/* Modal windows - limit text content width dynamically based on actual window width */
.modal-window .window-body p {
    max-width: 100%; /* Default full width */
}

/* Large windows (600px+) get limited text width for better readability */
.modal-window .window.large-window .window-body p {
    max-width: 75%;
}

/* Medium and small windows keep full width text */
.modal-window .window.medium-window .window-body p,
.modal-window .window.small-window .window-body p {
    max-width: 100%;
}

/* All other elements should use full width always */
.modal-window .window-body h1,
.modal-window .window-body h2,
.modal-window .window-body h3,
.modal-window .window-body h4,
.modal-window .window-body h5,
.modal-window .window-body h6,
.modal-window .window-body img,
.modal-window .window-body video,
.modal-window .window-body div,
.modal-window .window-body ul,
.modal-window .window-body ol,
.modal-window .window-body pre,
.modal-window .window-body code {
    max-width: 100%;
}
.modal-window {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    pointer-events: none;
}

.modal-window .window {
    pointer-events: all;
    z-index: 1000;
}

/* Resize handles */
.resize-handle {
    position: absolute;
    background: transparent;
}

.resize-handle.se {
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    cursor: se-resize;
}

.resize-handle.s {
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 5px;
    cursor: s-resize;
}

.resize-handle.e {
    top: 10px;
    right: 0;
    bottom: 10px;
    width: 5px;
    cursor: e-resize;
}

/* Ensure windows can be moved */
.window {
    cursor: move;
    position: absolute;
}

.window.maximized {
    box-shadow: none;
    z-index: 1002;
}

/* Title bar controls styling */
.title-bar-controls {
    display: flex;
    gap: 2px;
}

.title-bar-controls button {
    min-width: 16px;
    height: 14px;
    padding: 0;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Better text styling for markdown content */
.window-body h1 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    font-size: 24px;
    font-weight: 600;
    margin: 20px 0 16px 0;
    padding-bottom: 8px;
}

.window-body h2 {
    color: #34495e;
    font-size: 20px;
    font-weight: 600;
    margin: 18px 0 12px 0;
}

.window-body h3 {
    color: #34495e;
    font-size: 18px;
    font-weight: 600;
    margin: 16px 0 10px 0;
}

.window-body h4 {
    color: #34495e;
    font-size: 16px;
    font-weight: 600;
    margin: 14px 0 8px 0;
}

.window-body p {
    font-family: inherit;
    font-size: 15px;
    line-height: 1.7;
    margin: 16px 0;
    color: #2c3e50;
}

.window-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: #2c3e50;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    font-display: swap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Apply Host Grotesk after it loads */
.fonts-loaded .window-body {
    font-family: 'Host Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.window-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 16px 0;
    display: block;
}

.window-body img[width] {
    max-width: min(100%, attr(width) * 1px);
}

.window-body pre {
    background: #f0f0f0;
    border: 1px inset #c0c0c0;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    overflow-x: auto;
}

/* Prism.js syntax highlighting overrides for retro theme */
.window-body pre[class*="language-"] {
    background: #2d2d2d !important;
    color: #f8f8f2 !important;
    border: 1px inset #c0c0c0;
    text-decoration: none;
}

.window-body code[class*="language-"] {
    background: transparent !important;
    color: inherit !important;
    border: none;
    padding: 0;
}

.window-body code {
    background: #f0f0f0;
    border: 1px inset #c0c0c0;
    padding: 2px 4px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
}

.window-body ul, .window-body ol {
    font-family: inherit;
    font-size: 14px;
    margin: 12px 0 12px 24px;
    line-height: 1.6;
}

.window-body li {
    margin: 6px 0;
    color: #333;
}

.window-body ul li {
    list-style-type: disc;
}

.window-body ol li {
    list-style-type: decimal;
}

.window-body pre, .window-body code {
    text-shadow: none !important;
    font-weight: 400;
}

/* Modern link styling */
.window-body a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.window-body a:hover {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

/* Better blockquote styling */
.window-body blockquote {
    border-left: 4px solid #3498db;
    margin: 16px 0;
    padding: 8px 16px;
    background: #f8f9fa;
    font-style: italic;
    color: #555;
}

/* Enhanced code blocks */
.window-body pre {
    background: #2d3748;
    color: #e2e8f0;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.window-body code {
    background: #f1f3f4;
    color: #d63384;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    border: none;
}

/* Better table styling */
.window-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}

.window-body th, .window-body td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.window-body th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Responsive padding for wide windows - exclude static windows */
@media (min-width: 1200px) {
    .window-body:not(.static-window) {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (min-width: 1600px) {
    .window-body:not(.static-window) {
        padding-left: 40px;
        padding-right: 40px;
    }
}

@media (min-width: 2000px) {
    .window-body:not(.static-window) {
        padding-left: 60px;
        padding-right: 60px;
    }
}
