/* File Browser */
.file-browser {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.file-browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.file-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.file-actions button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Sort Controls */
.sort-controls {
    display: none;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background);
}

/* File List */
.file-list {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.file-list-header {
    display: grid;
    grid-template-columns: 40px minmax(200px, 1fr) 160px 100px 60px;
    gap: 16px;
    padding: 12px 16px;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-secondary);
}

.file-list-header .column.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.file-list-header .column.sortable:hover {
    color: var(--primary);
}

/* File Row */
.file-row {
    display: grid;
    grid-template-columns: 40px minmax(200px, 1fr) 160px 100px 60px;
    gap: 16px;
    padding: 8px 16px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface);
    transition: background-color 0.2s;
}

.file-row:last-child {
    border-bottom: none;
}

.file-row:hover {
    background: var(--background);
}

.file-row.selected {
    background: var(--primary-light);
}

.file-selector {
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-checkbox, .select-all-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.file-name:hover .name-text {
    color: var(--primary);
}

.name-info {
    flex: 1;
    min-width: 0;
}

.name-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-indicator {
    margin-top: 2px;
}

.file-icon {
    font-size: 1.2em;
    opacity: 0.7;
}

/* Special styling for upload status icons */
.file-row.upload-status-pending .file-icon,
.file-row.upload-status-missing .file-icon,
.file-row.upload-status-error .file-icon {
    opacity: 1;
}

.file-row.upload-status-pending .file-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.actions {
    display: flex;
    justify-content: flex-end;
}

.action-trigger {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.file-row:hover .action-trigger {
    opacity: 1;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 4px 0;
    min-width: 160px;
    z-index: 1000;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background: var(--background);
}

.context-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.context-menu-item.disabled:hover {
    background: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 48px 16px;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--error);
}

/* Breadcrumb */
.breadcrumb {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    color: var(--text-secondary);
}

/* Upload Status Indicators */
.upload-status {
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-status.pending {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.upload-status.missing {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.upload-status.error {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* Row styling for different upload states */
.file-row.upload-status-pending {
    background: rgba(255, 193, 7, 0.03);
}

.file-row.upload-status-missing {
    background: rgba(220, 53, 69, 0.03);
}

.file-row.upload-status-error {
    background: rgba(220, 53, 69, 0.03);
}

.file-row.upload-status-pending:hover,
.file-row.upload-status-missing:hover,
.file-row.upload-status-error:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Sort Dropdown */
.sort-dropdown-container {
    display: none;
    align-items: center;
    gap: 8px;
}

.sort-dropdown-label {
    font-size: var(--font-size-small);
    color: var(--text-secondary);
    white-space: nowrap;
}

.sort-dropdown {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: var(--font-size-small);
    cursor: pointer;
    min-width: 140px;
}

.sort-dropdown:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .file-list-header,
    .file-row {
        grid-template-columns: 40px minmax(150px, 1fr) 100px 60px;
    }
    
    .modified {
        display: none;
    }

    .sort-controls {
        display: block;
    }

    .sort-dropdown-container {
        display: flex;
    }
}

@media (max-width: 480px) {
    .file-list-header,
    .file-row {
        grid-template-columns: 40px minmax(100px, 1fr) 60px;
    }
    
    .size {
        display: none;
    }

    .file-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .file-actions .btn {
        width: 100%;
        margin: 2px 0;
    }
}
