/* ==========================================================================
   FAR Manager - File List Styles
   ========================================================================== */

/* File List Header */
.file-list-header {
    display: grid;
    grid-template-columns: 1fr 100px 100px 80px;
    padding: 6px 16px;
    margin: 0 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.file-list-header span {
    padding: 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
    user-select: none;
}

.file-list-header span:hover {
    color: var(--text-secondary);
}

.file-list-header span.sorted {
    color: var(--text-primary);
}

.file-list-header .sort-icon {
    width: 12px;
    height: 12px;
    opacity: 0;
    transition: var(--transition);
}

.file-list-header span:hover .sort-icon,
.file-list-header span.sorted .sort-icon {
    opacity: 1;
}

.file-list-header span.sorted.desc .sort-icon {
    transform: rotate(180deg);
}

/* File List Container */
.file-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
}

/* File Item */
.file-item {
    display: grid;
    grid-template-columns: 1fr 100px 100px 80px;
    align-items: center;
    padding: 8px 16px;
    margin: 0 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    
    /* Propiedades para mejorar el táctil que agregamos antes */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
}

/* --- SOLUCIÓN AL STICKY HOVER --- */
/* El efecto hover (gris) SOLO se aplicará si el dispositivo soporta hover real (PC) */
@media (hover: hover) {
    .file-item:hover {
        background: var(--bg-hover);
    }
}

/* Mantener el estilo de seleccionado siempre visible */
.file-item.selected {
    background: var(--accent);
}

.file-item.folder {
    color: var(--text-primary);
}

/* File Name Column */
.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    min-width: 0;
}

.file-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* File Icon */
.file-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* File Metadata */
.file-size,
.file-compressed,
.file-type {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item.selected .file-size,
.file-item.selected .file-compressed,
.file-item.selected .file-type {
    color: rgba(255, 255, 255, 0.8);
}

/* Mobile: Responsive File List */
@media (max-width: 768px) {
    .file-list-header {
        grid-template-columns: 1fr 80px;
        padding: 6px 12px;
        margin: 0 4px;
    }
    
    .file-list-header span:nth-child(3),
    .file-list-header span:nth-child(4) {
        display: none;
    }
    
    .file-item {
        grid-template-columns: 1fr 80px;
        padding: 10px 12px;
        margin: 0 4px;
    }
    
    .file-item .file-compressed,
    .file-item .file-type {
        display: none;
    }
    
    .file-name {
        gap: 8px;
    }
    
    .file-icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .file-list-header {
        grid-template-columns: 1fr;
    }
    
    .file-list-header span:not(:first-child) {
        display: none;
    }
    
    .file-item {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    
    .file-item .file-size {
        display: none;
    }
    
    .file-name {
        flex: 1;
    }
    
    /* Show size inline on mobile */
    .file-item::after {
        content: attr(data-size);
        font-size: 11px;
        color: var(--text-tertiary);
        margin-left: auto;
        padding-left: 8px;
    }
    
    .file-item.selected::after {
        color: rgba(255, 255, 255, 0.7);
    }
}

/* Touch optimizations */
@media (hover: none) and (pointer: coarse) {
    .file-item {
        padding: 12px 16px;
        min-height: 48px;
    }
    
    .file-item:active {
        background: var(--bg-active);
    }
}

.file-item > * {
    pointer-events: none;
}