/* ========================================
   Desktop — Icons Grid, Taskbar
   ======================================== */

/* Desktop Icons Grid */
#desktop-icons {
    position: absolute;
    top: 24px;
    left: 24px;
    display: grid;
    grid-template-columns: repeat(2, 110px);
    gap: 10px;
    z-index: 10;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 110px;
    height: 105px;
    padding: 10px 6px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    user-select: none;
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transform: translateY(-2px);
}

.desktop-icon:hover .icon-glow {
    opacity: 1;
}

.desktop-icon.selected {
    background: rgba(255, 107, 53, 0.1);
    border-color: rgba(255, 107, 53, 0.3);
    backdrop-filter: blur(8px);
}

.desktop-icon:active {
    transform: scale(0.95);
}

.icon-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
}

.desktop-icon .icon-img {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    filter: drop-shadow(0 2px 6px rgba(204, 74, 26, 0.15));
    transition: var(--transition);
}

.desktop-icon:hover .icon-img {
    transform: scale(1.12);
    filter: drop-shadow(0 4px 12px rgba(255, 107, 53, 0.3));
}

.desktop-icon .icon-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.9);
    line-height: 1.3;
    max-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ========================================
   Taskbar
   ======================================== */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(255, 248, 240, 0.78);
    backdrop-filter: blur(40px) saturate(1.8);
    -webkit-backdrop-filter: blur(40px) saturate(1.8);
    border-top: 1px solid rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    box-shadow: 0 -2px 20px rgba(204, 74, 26, 0.05);
}

.taskbar-center {
    display: flex;
    align-items: center;
    gap: 4px;
}

.taskbar-btn {
    width: 44px;
    height: 40px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 20px;
    position: relative;
}

.taskbar-btn:hover {
    background: rgba(255, 107, 53, 0.1);
}

.taskbar-btn:active {
    background: rgba(255, 107, 53, 0.18);
    transform: scale(0.93);
}

.taskbar-btn.has-window::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 3px;
    background: var(--orange-500);
    border-radius: 2px;
    transition: var(--transition);
}

.taskbar-btn.has-window.active-window::after {
    width: 18px;
    background: linear-gradient(90deg, var(--orange-500), var(--orange-400));
}

/* Start Button */
#start-btn {
    width: 44px;
    height: 40px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-right: 8px;
}

#start-btn:hover {
    background: rgba(255, 107, 53, 0.1);
}

#start-btn:active {
    background: rgba(255, 107, 53, 0.18);
}

#start-btn .start-logo {
    width: 22px;
    height: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#start-btn .start-logo span {
    background: linear-gradient(135deg, var(--orange-500), var(--orange-700));
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* On hover: container rotates slightly, squares morph into a circle and glow */
#start-btn:hover .start-logo {
    transform: rotate(90deg);
}

#start-btn:hover .start-logo span {
    background: linear-gradient(135deg, var(--orange-400), var(--orange-600));
    border-radius: 50%;
    transform: scale(1.15);
    box-shadow: 0 0 6px rgba(255, 107, 53, 0.6);
}

#start-btn:hover .start-logo .sq1 {
    transform: scale(1.15) translate(2px, 2px);
}
#start-btn:hover .start-logo .sq2 {
    transform: scale(1.15) translate(-2px, 2px);
}
#start-btn:hover .start-logo .sq3 {
    transform: scale(1.15) translate(2px, -2px);
}
#start-btn:hover .start-logo .sq4 {
    transform: scale(1.15) translate(-2px, -2px);
}

/* Taskbar Right */
.taskbar-right {
    position: absolute;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tray-icons {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tray-icon {
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.tray-img {
    height: 22px;
    width: auto;
    max-width: 26px;
    object-fit: contain;
    margin: 0 6px;
    padding: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.5));
}

.tray-img:hover {
    background: rgba(255, 107, 53, 0.08);
    transform: scale(1.1);
}

#taskbar-clock {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
}

#taskbar-clock:hover {
    background: rgba(255, 107, 53, 0.08);
}

/* ========================================
   Context Menu
   ======================================== */
#context-menu {
    position: fixed;
    min-width: 220px;
    background: rgba(255, 248, 240, 0.9);
    backdrop-filter: blur(30px) saturate(1.6);
    -webkit-backdrop-filter: blur(30px) saturate(1.6);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-lg);
    z-index: 99998;
    display: none;
    padding: 6px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

#context-menu.show {
    display: block;
    opacity: 1;
    transform: scale(1);
}

.ctx-item {
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease;
}

.ctx-item:hover {
    background: rgba(255, 107, 53, 0.08);
}

.ctx-divider {
    height: 1px;
    background: rgba(255, 107, 53, 0.1);
    margin: 4px 6px;
}

/* ========================================
   Desktop Watermark
   ======================================== */
#desktop-watermark {
    position: absolute;
    right: 24px;
    bottom: 64px; /* Just above taskbar */
    text-align: right;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.45);
    user-select: none;
    pointer-events: none;
    z-index: 10;
    line-height: 1.4;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Boot Overlay
   ======================================== */
#boot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--orange-700), var(--orange-500), var(--orange-300));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.8s ease, visibility 0.8s;
}

#boot-overlay.hide {
    opacity: 0;
    visibility: hidden;
}

.boot-logo {
    font-size: 60px;
    color: white;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 8px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.boot-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
    letter-spacing: 3px;
    margin-bottom: 40px;
    text-transform: uppercase;
}

.boot-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    #desktop-icons {
        grid-template-columns: repeat(3, 85px);
        gap: 8px;
        top: 16px;
        left: 12px;
    }

    .desktop-icon {
        width: 85px;
        height: auto;
        min-height: 95px;
        padding: 8px 4px;
    }

    .desktop-icon .icon-img {
        font-size: 30px;
        width: 38px;
        height: 38px;
    }

    .desktop-icon .icon-label {
        font-size: 10.5px;
        line-height: 1.2;
        max-width: 100%;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }

    .tray-icons {
        display: none;
    }
}