/* desktop.css */

/* Desktop Area */
#desktop-area {
    position: relative;
    width: 100%;
    height: calc(100% - 30px);
    overflow: hidden;
}

/* Desktop Icons Container */
#desktop-icons {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 100px);
    grid-auto-rows: 100px;
    gap: 20px;
    align-content: start;
    justify-content: start;
    grid-auto-flow: unset; /* Prevent automatic space filling */
}

/* Shortcut Overlay */

.shortcut-overlay {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--purple-dark);
    color: var(--text-light);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--text-light);
}

.file-icon {
    position: relative;
}

/* Desktop Icon */
.desktop-icon {
    width: 80px;
    height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    user-select: none;
    position: relative; /* Added to maintain grid position */
}

.desktop-icon.dragging {
    position: fixed;  /* Change to fixed while dragging */
    opacity: 0.7;
    z-index: 1000;
    pointer-events: none;
}

.desktop-icon:hover {
    background-color: var(--bg-mid-transparent);
}

.desktop-icon.selected {
    background-color: var(--bg-mid-selected);
}

/* Icon placeholder */
.icon-placeholder {
    width: 80px;
    height: 90px;
    opacity: 0.3;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 5px;
    pointer-events: none;
}

/* Icon Image */
.system-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.desktop-icon:hover .system-icon {
    transform: scale(1.05);
}

.desktop-icon:active .system-icon {
    transform: scale(0.95);
}

/* Icon Label */
.icon-label {
    color: var(--text-light);
    text-align: center;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    word-wrap: break-word;
    max-width: 100%;
    margin-top: 4px;
    line-height: 1.2;
}

/* Desktop Context Menu */
.context-menu {
    position: fixed;
    background-color: var(--bg-lightest);
    border: 1px solid var(--border-light);
    border-radius: 2px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 180px;
    padding: 2px;
    animation: fadeIn 0.1s ease-out;
}

.context-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--purple-dark);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    font-family: var(--system-font);
}

.context-menu button:hover {
    background-color: var(--border-light);
    color: var(--text-light);
}

.context-menu hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 2px 0;
}

/* Selection Box */
.selection-box {
    position: absolute;
    pointer-events: none;
    border: 1px solid var(--border-light);
    background-color: rgba(213, 189, 230, 0.2);
    z-index: 999;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}