/* ========================================
   MAIN DESKTOP STYLES
   Extends Themesberg Windows 95 UI Kit
   ======================================== */

/* Desktop Container */
.desktop-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #5B9BD5 0%, #7DB9E8 50%, #9CCFEF 100%);
    overflow: hidden;
}

.desktop-container.hidden {
    display: none;
}

.desktop-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

/* Desktop Icons */
.desktop-icons {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 1;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    padding: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 2px;
    transition: background 0.1s;
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.desktop-icon.selected {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.icon-image {
    font-size: 48px;
    margin-bottom: 4px;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}

.icon-label {
    font-size: 11px;
    color: #FFFFFF;
    text-align: center;
    text-shadow:
        1px 1px 2px rgba(0, 0, 0, 0.8),
        -1px -1px 2px rgba(0, 0, 0, 0.8);
    word-wrap: break-word;
    max-width: 100%;
}

/* Windows Container */
.windows-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 40px);
    pointer-events: none;
    z-index: 10;
}

/* Taskbar */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(180deg, #245EDC 0%, #3F8CF3 10%, #245EDC 90%, #1941A5 100%);
    border-top: 2px solid #5B9BD5;
    display: flex;
    align-items: center;
    padding: 0 4px;
    gap: 8px;
    z-index: 9999;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.start-button {
    height: 32px;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}

.start-button.active {
    box-shadow: inset 2px 2px 3px rgba(0, 0, 0, 0.3);
}

.start-logo {
    font-size: 16px;
}

.taskbar-separator {
    width: 2px;
    height: 32px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, transparent 50%, rgba(255, 255, 255, 0.2) 100%);
}

.taskbar-windows {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
}

.taskbar-windows::-webkit-scrollbar {
    height: 0;
}

.taskbar-window-btn {
    background: linear-gradient(180deg, #4A90E2 0%, #2D6CB8 100%);
    border: 2px solid #7DB9E8;
    color: #FFFFFF;
    font-size: 11px;
    padding: 4px 8px;
    height: 32px;
    min-width: 120px;
    max-width: 180px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.taskbar-window-btn:hover {
    background: linear-gradient(180deg, #5AA0F2 0%, #3D7CC8 100%);
}

.taskbar-window-btn.active {
    border-color: #1941A5;
    box-shadow: inset 2px 2px 3px rgba(0, 0, 0, 0.3);
}

.system-tray {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    height: 32px;
    background: rgba(0, 0, 0, 0.1);
    border-left: 2px solid rgba(0, 0, 0, 0.2);
}

.tray-icon {
    font-size: 16px;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.5));
}

.tray-clock {
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 600;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    min-width: 50px;
    text-align: center;
}

/* ========================================
   TWO-COLUMN START MENU
   ======================================== */

.start-menu {
    position: fixed;
    bottom: 44px;
    left: 4px;
    width: 480px;
    background: #BFBFBF;
    border: 2px solid;
    border-color: #FFFFFF #808080 #808080 #FFFFFF;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.start-menu.hidden {
    display: none;
}

/* Header with User Info */
.start-menu-header {
    background: linear-gradient(90deg, #0054E3 0%, #4A90E2 100%);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid #808080;
}

.start-user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.start-user-info {
    flex: 1;
}

.start-user-name {
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.start-user-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
}

/* Two-Column Body */
.start-menu-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 4px;
}

.start-menu-left,
.start-menu-right {
    display: flex;
    flex-direction: column;
    padding: 4px;
}

.start-menu-left {
    border-right: 1px solid #808080;
}

/* Menu Items */
.start-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.1s;
}

.start-menu-item:hover {
    background: #0054E3;
    color: #FFFFFF;
}

.start-menu-item:hover .item-desc {
    color: rgba(255, 255, 255, 0.9);
}

.item-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.item-text {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-desc {
    font-size: 10px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer with Buttons */
.start-menu-footer {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-top: 2px solid #808080;
    background: #C0C0C0;
}

.start-menu-footer .btn {
    flex: 1;
    font-size: 11px;
    padding: 6px 12px;
}

/* ========================================
   WINDOW SYSTEM (Using UI Kit)
   ======================================== */

.window {
    position: absolute;
    background: #BFBFBF;
    border: 2px solid;
    border-color: #FFFFFF #808080 #808080 #FFFFFF;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);
    min-width: 320px;
    min-height: 200px;
    max-width: 90vw;
    max-height: calc(90vh - 40px);
    display: flex;
    flex-direction: column;
    pointer-events: all;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.2s, transform 0.2s;
}

.window:not(.hidden) {
    opacity: 1;
    transform: scale(1);
}

.window.hidden {
    display: none;
}

.window.maximized {
    max-width: 100vw !important;
    max-height: calc(100vh - 40px) !important;
    border-radius: 0;
    transition: all 0.2s ease;
}

.window.maximized .window-content {
    flex: 1;
    overflow: auto;
}

.window.maximized iframe {
    width: 100% !important;
    height: 100% !important;
}

.window-titlebar {
    background: linear-gradient(180deg, #0997FF 0%, #0053EE 100%);
    padding: 4px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    border-bottom: 2px solid #FFFFFF;
}

.window-titlebar.inactive {
    background: linear-gradient(180deg, #7A96DF 0%, #5477D5 100%);
}

.window-title {
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.win-btn {
    width: 21px;
    height: 21px;
    background: #BFBFBF;
    border: 1px solid;
    border-color: #FFFFFF #808080 #808080 #FFFFFF;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #000;
}

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

.win-btn:active {
    border-color: #808080 #FFFFFF #FFFFFF #808080;
}

.win-close {
    background: linear-gradient(180deg, #FF6B6B 0%, #E63946 100%);
    color: #FFFFFF;
}

.window-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #FFFFFF;
}

/* ========================================
   MOBILE VIEW (hidden - desktop used on all devices)
   ======================================== */

.mobile-view {
    display: none !important;
}

/* ========================================
   RESPONSIVE - MOBILE (max-width: 768px)
   Desktop XP experience adapted for small screens
   ======================================== */

@media only screen and (max-width: 768px) {
    /* Prevent horizontal overflow */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    /* Desktop Container - keep full screen */
    .desktop-container {
        width: 100vw;
        height: 100vh;
        overflow: hidden;
    }

    /* Desktop Icons - smaller, tighter grid */
    .desktop-icons {
        top: 12px !important;
        left: 10px !important;
        gap: 12px !important;
    }

    .desktop-icon {
        width: 72px !important;
        padding: 6px !important;
    }

    .icon-image {
        width: 48px !important;
        height: 48px !important;
    }

    .icon-label {
        font-size: 10px !important;
    }

    /* Taskbar - mobile friendly */
    .taskbar {
        height: 36px;
        padding: 0 4px;
        gap: 4px;
    }

    .start-button {
        height: 28px;
        padding: 3px 8px;
        font-size: 11px;
        gap: 4px;
    }

    .start-logo {
        font-size: 14px;
    }

    .taskbar-separator {
        height: 28px;
    }

    .taskbar-window-btn {
        height: 28px;
        min-width: 80px;
        max-width: 120px;
        font-size: 10px;
        padding: 3px 6px;
    }

    .system-tray {
        height: 28px;
        padding: 0 6px;
        gap: 6px;
    }

    .tray-icon {
        font-size: 13px;
    }

    .tray-clock {
        font-size: 10px;
        min-width: 40px;
    }

    /* Windows - full width on mobile */
    .window {
        min-width: unset !important;
        width: calc(100vw - 8px) !important;
        max-width: 100vw !important;
        left: 4px !important;
        max-height: calc(100vh - 48px) !important;
    }

    .window-content {
        padding: 12px;
        overflow-x: hidden;
    }

    .window-content img {
        max-width: 100%;
        height: auto;
    }

    /* Window titlebar - touch friendly */
    .window-titlebar {
        padding: 6px 8px;
    }

    .window-title {
        font-size: 12px;
    }

    .win-btn {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }

    /* Start Menu - full width on mobile */
    .start-menu {
        width: calc(100vw - 8px) !important;
        left: 4px !important;
        bottom: 40px !important;
        max-height: 70vh;
        overflow-y: auto;
    }

    .start-menu-body {
        grid-template-columns: 1fr !important;
    }

    .start-menu-left {
        border-right: none !important;
        border-bottom: 1px solid #808080;
    }

    .start-menu-item {
        padding: 10px 12px;
    }

    .item-title {
        font-size: 13px;
    }

    .item-desc {
        font-size: 11px;
    }

    .start-menu-footer {
        flex-direction: column;
        gap: 6px;
    }

    .start-menu-footer .btn {
        height: 36px;
        font-size: 12px;
    }

    /* All Programs Submenu - below instead of right */
    .all-programs-submenu {
        position: static !important;
        width: 100% !important;
        border: none !important;
        border-top: 1px solid #5A7EDD !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .all-programs-item {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* Start menu header */
    .start-user-avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .start-user-name {
        font-size: 15px;
    }

    /* Windows container */
    .windows-container {
        height: calc(100% - 36px);
    }

    /* Boot container responsive */
    #boot-container video {
        max-width: 100%;
    }

    /* Login screen responsive */
    .login-container img {
        max-width: 100%;
        height: auto;
    }
}

/* ========================================
   RESPONSIVE - SMALL MOBILE (max-width: 380px)
   Extra adjustments for very small screens
   ======================================== */

@media only screen and (max-width: 380px) {
    .desktop-icons {
        gap: 8px !important;
    }

    .desktop-icon {
        width: 60px !important;
        padding: 4px !important;
    }

    .icon-image {
        width: 40px !important;
        height: 40px !important;
    }

    .icon-label {
        font-size: 9px !important;
    }

    .taskbar-window-btn {
        min-width: 60px;
        max-width: 90px;
    }

    .start-button {
        padding: 3px 6px;
        font-size: 10px;
    }
}