/* Desktop Styles */
.desktop {
    width: 100vw;
    height: 100vh;
    background-image: url('../assets/images/bliss.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

.wallpaper-default {
    background-image: url('../assets/images/bliss.jpg');
}

/* Desktop Icons Container */
.desktop-icons {
    padding: 10px;
    display: grid;
    grid-template-rows: repeat(auto-fill, 90px);
    grid-auto-flow: column;
    gap: 10px;
    position: absolute;
    top: 0;
    left: 0;
    height: calc(100vh - var(--taskbar-height));
    width: 100%;
}

/* Desktop Icon */
.desktop-icon {
    width: 75px;
    height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    padding: 5px;
    border: 1px solid transparent;
    border-radius: 3px;
    position: relative;
    transition: all 0.1s ease;
    -webkit-tap-highlight-color: transparent; /* Eliminar resaltado en Safari */
    -webkit-touch-callout: none; /* Desactivar menú contextual en iOS */
    user-select: none; /* Prevenir selección de texto */
}

.desktop-icon:hover {
    background: rgba(0, 84, 227, 0.2);
    border-color: rgba(0, 84, 227, 0.5);
}

.desktop-icon.selected {
    background: rgba(0, 84, 227, 0.3);
    border-color: rgba(0, 84, 227, 0.8);
}

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

.desktop-icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3));
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.desktop-icon span {
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    font-size: 11px;
    font-family: 'Tahoma', sans-serif;
    display: block;
    word-wrap: break-word;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Icon Scale for different screen sizes */
@media (max-width: 1024px) {
    .desktop-icons {
        --icon-scale: 0.9;
    }
    
    .desktop-icon {
        width: calc(75px * var(--icon-scale));
        height: calc(90px * var(--icon-scale));
    }
    
    .desktop-icon img {
        width: calc(48px * var(--icon-scale));
        height: calc(48px * var(--icon-scale));
    }
}

@media (max-width: 768px) {
    .desktop-icons {
        --icon-scale: 0.8;
        grid-template-rows: repeat(auto-fill, 80px);
    }
    
    .desktop-icon span {
        font-size: 10px;
    }
}

/* Selection Overlay for multi-select */
.selection-overlay {
    position: absolute;
    border: 1px dotted #fff;
    background: rgba(0, 84, 227, 0.2);
    pointer-events: none;
    display: none;
    z-index: 100;
}

/* Context Menu (if needed) */
.context-menu {
    position: absolute;
    background: #ECE9D8;
    border: 1px solid #919B9C;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    padding: 2px;
    z-index: 1000;
    display: none;
}

.context-menu-item {
    padding: 4px 20px;
    cursor: pointer;
    font-size: 11px;
    font-family: 'Tahoma', sans-serif;
}

.context-menu-item:hover {
    background: #316AC5;
    color: white;
}

.context-menu-separator {
    height: 1px;
    background: #D4D0C8;
    margin: 2px 0;
}

/* Desktop Shortcuts Animation */
@keyframes iconAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.desktop-icon {
    animation: iconAppear 0.3s ease-out;
    animation-fill-mode: both;
}

.desktop-icon:nth-child(1) { animation-delay: 0.1s; }
.desktop-icon:nth-child(2) { animation-delay: 0.2s; }
.desktop-icon:nth-child(3) { animation-delay: 0.3s; }
.desktop-icon:nth-child(4) { animation-delay: 0.4s; }
.desktop-icon:nth-child(5) { animation-delay: 0.5s; }
.desktop-icon:nth-child(6) { animation-delay: 0.6s; }
.desktop-icon:nth-child(7) { animation-delay: 0.7s; }
.desktop-icon:nth-child(8) { animation-delay: 0.8s; }

/* Drag and Drop Styles */
.desktop-icon.dragging {
    opacity: 0.5;
    cursor: move;
}

.desktop-icon.drag-over {
    background: rgba(0, 84, 227, 0.4);
    border-color: rgba(0, 84, 227, 1);
}

/* Responsive Desktop */
@media (max-height: 600px) {
    .desktop-icons {
        grid-template-rows: repeat(auto-fill, 70px);
    }
    
    .desktop-icon {
        height: 70px;
    }
    
    .desktop-icon img {
        width: 32px;
        height: 32px;
    }
}

/* High DPI Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .desktop-icon img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .desktop {
        display: none;
    }
}