@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&display=swap');

body.desktop-active {
    --desk-wallpaper: #1A1F2E;
    --desk-taskbar-bg: #0D1117;
    --desk-win-body: #ECE9D8;
    --desk-win-border: #0054E3;
    --desk-accent: #2A7AE4;
    --desk-icon-label: #FFFFFF;
}

/* Base Desktop Styles */
#desktop-mode {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background-color: var(--desk-wallpaper);
    display: flex;
    flex-direction: column;
}

/* --- Desktop Icons --- */
.desktop-icon {
    position: absolute;
    width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    user-select: none;
    touch-action: none; /* Prevent scrolling while dragging icons */
    z-index: 5;
    padding: 8px 0;
    transition: background 0.2s, outline 0.2s;
    border-radius: 3px;
}

.desktop-icon:hover .icon-img {
    transform: translateY(-2px);
}

.desktop-icon.selected .icon-label {
    background-color: rgba(36, 94, 220, 0.7);
    outline: 1px dotted #fff;
}

.icon-img {
    font-size: 40px;
    margin-bottom: 4px;
    transition: transform 0.2s;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.5));
}

.icon-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    color: #FFFFFF;
    text-align: center;
    text-shadow: 1px 1px 2px #000000;
    max-width: 72px;
    word-wrap: break-word;
    padding: 2px 4px;
}

.shortcut-arrow {
    position: absolute;
    bottom: 25px;
    left: 8px;
    background: #fff;
    color: #000;
    font-size: 10px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    border: 1px solid #999;
    font-weight: bold;
    pointer-events: none;
}

.desktop-icon.project-shortcut .icon-img {
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.3));
}

/* --- OS Windows --- */
.os-window {
    position: absolute;
    background: var(--desk-win-body);
    border: 2px solid var(--desk-win-border);
    box-shadow: 4px 4px 10px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    min-width: 300px;
    min-height: 200px;
    overflow: hidden;
    border-radius: 4px 4px 0 0;
}

.os-window.dragging {
    opacity: 0.8;
    cursor: move;
}

.win-titlebar {
    height: 30px;
    background: linear-gradient(to right, #0054E3, #2A7AE4);
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: white;
    cursor: default;
    user-select: none;
}

.win-icon {
    width: 16px;
    height: 16px;
    background: white;
    margin-right: 8px;
    border-radius: 2px;
}

.win-title {
    flex: 1;
    font-family: Tahoma, sans-serif;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.win-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #fff;
    background: #efefef;
    color: #000;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    border-radius: 2px;
}

.win-btn:hover {
    background: #fff;
}

.win-btn.win-close {
    background: #E81123;
    color: white;
    border-color: #E81123;
}

.win-btn.win-close:hover {
    background: #f1707a;
}

.win-body {
    flex: 1;
    background: white;
    overflow: auto;
    position: relative;
    padding: 0;
}

.win-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background: linear-gradient(135deg, transparent 50%, #888 50%);
    cursor: nwse-resize;
    z-index: 10;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* --- Taskbar --- */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--desk-taskbar-bg);
    border-top: 1px solid #2A3444;
    display: flex;
    align-items: center;
    z-index: 9999;
}

#start-btn {
    background: linear-gradient(to bottom, #245EDC, #1A4ABF);
    height: 100%;
    padding: 0 16px;
    color: white;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: filter 0.2s;
    font-weight: bold;
    border-right: 1px solid #1a4abf;
}

#start-btn:hover {
    filter: brightness(1.2);
}

.start-logo {
    font-weight: 800;
}

#taskbar-tray {
    flex: 1;
    display: flex;
    height: 100%;
    padding: 2px 4px;
    gap: 4px;
    overflow-x: auto;
}

.tray-item {
    background: #2A3444;
    color: #FFFFFF;
    border: 1px solid #3A4556;
    padding: 0 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    border-radius: 2px;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.tray-item.active {
    background: #3A4556;
    border-color: var(--desk-accent);
}

#taskbar-sys {
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 1px solid #2A3444;
}

.sys-icon {
    font-size: 14px;
    cursor: default;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.sys-icon:hover {
    opacity: 1;
}

#taskbar-clock {
    color: #FFFFFF;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
}

/* --- Start Menu --- */
#start-menu {
    position: fixed;
    bottom: 40px;
    left: 0;
    width: 240px;
    background: #1A2332;
    border: 1px solid #2A3444;
    border-bottom: none;
    display: none;
    flex-direction: column;
    z-index: 9998;
    transform: translateY(20px);
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
    opacity: 0;
    box-shadow: 5px 0 20px rgba(0,0,0,0.5);
}

#start-menu.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

#start-header {
    background: linear-gradient(to right, #245EDC, #1A4ABF);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    border-bottom: 1px solid #2A3444;
}

.start-user-logo {
    width: 32px;
    height: 32px;
    background: white;
    color: #1A4ABF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 4px;
}

#start-nav {
    padding: 8px 0;
    flex: 1;
}

.start-item {
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: transparent;
    border: none;
    color: #D1D5DB;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.start-item:hover {
    background: var(--desk-accent);
    color: white;
}


#start-footer {
    padding: 8px;
    border-top: 1px solid #2A3444;
}

#exit-to-pro {
    width: 100%;
    padding: 8px;
    background: #2A3444;
    color: #EF4444;
    border: 1px solid #3A4556;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

/* --- App Specific Styles --- */
.win-body {
    font-family: Tahoma, sans-serif;
    color: #000;
}

/* Notepad */
.notepad-textarea {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    padding: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    outline: none;
    white-space: pre;
    overflow: auto;
}

/* Mail */
.mail-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px;
    gap: 8px;
    background: #f1f1f1;
}

.mail-header-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    border-bottom: 1px solid #d1d1d1;
    padding-bottom: 4px;
}

.mail-header-label {
    width: 60px;
    font-weight: bold;
    color: #666;
}

.mail-input {
    flex: 1;
    border: 1px solid #999;
    padding: 4px 8px;
    font-size: 12px;
}

.mail-body-textarea {
    flex: 1;
    border: 1px solid #999;
    padding: 10px;
    font-family: sans-serif;
    font-size: 13px;
    resize: none;
    outline: none;
}

.mail-footer {
    display: flex;
    justify-content: flex-end;
}

.xp-btn {
    padding: 6px 20px;
    background: #e1e1e1;
    border: 1px solid #888;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: inset 1px 1px 0 #fff;
}

.xp-btn:hover { background: #eee; }
.xp-btn:active { box-shadow: inset 1px 1px 2px rgba(0,0,0,0.2); }

/* Folder/List Content */
.folder-container {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.folder-item {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: background 0.2s;
}

.folder-item:hover {
    background: #f0f7ff;
    border-color: #2A7AE4;
}

.folder-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.folder-item-icon { font-size: 20px; }
.folder-item-title {
    font-size: 12px;
    font-weight: bold;
    color: #000;
}

.folder-item-desc {
    font-size: 11px;
    color: #555;
    line-height: 1.3;
}

.folder-item-footer {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.xp-chip {
    font-size: 10px;
    background: #eee;
    padding: 2px 6px;
    border: 1px solid #ccc;
    border-radius: 2px;
}

.xp-link {
    font-size: 11px;
    color: blue;
    text-decoration: underline;
    cursor: pointer;
}

/* --- Context Menu --- */
#context-menu {
    position: fixed;
    background: #1A2332;
    border: 1px solid #2A3444;
    min-width: 180px;
    border-radius: 3px;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.4);
    z-index: 10000;
    display: none;
    padding: 4px 0;
    flex-direction: column;
    animation: ctxAppear 120ms ease-out;
}

@keyframes ctxAppear {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.ctx-item {
    padding: 6px 16px;
    font-family: Tahoma, sans-serif;
    font-size: 12px;
    color: #FFFFFF;
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: space-between;
}

.ctx-item:hover {
    background: #245EDC;
}

.ctx-divider {
    height: 1px;
    background: #2A3444;
    margin: 4px 0;
}

.ctx-submenu {
    position: absolute;
    left: 100%;
    top: -4px;
    background: #1A2332;
    border: 1px solid #2A3444;
    min-width: 150px;
    display: none;
    flex-direction: column;
    padding: 4px 0;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.4);
}

.ctx-has-sub:hover > .ctx-submenu {
    display: flex;
}

/* --- Mobile & Tablet Adjustments --- */
@media (max-width: 768px) {
    .desktop-icon {
        width: 64px;
        padding: 4px 0;
    }
    
    .icon-img {
        font-size: 32px;
    }
    
    .icon-label {
        font-size: 10px;
        max-width: 64px;
    }

    .os-window {
        min-width: 90vw;
        min-height: 50vh;
    }

    .win-titlebar {
        height: 36px; /* Larger tap target */
    }

    .win-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    #taskbar {
        height: 48px; /* Larger tap target */
    }

    #start-btn {
        padding: 0 12px;
        font-size: 12px;
    }

    #taskbar-tray {
        gap: 2px;
    }

    .tray-item {
        padding: 0 8px;
        font-size: 10px;
        max-width: 100px;
    }

    #start-menu {
        bottom: 48px;
        width: 100vw; /* Full width on mobile */
        max-width: 300px;
    }

    /* Hide mobile warning override */
    .desktop-active #mobile-warning {
        display: none !important;
    }
}

#mobile-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
