/* ========================================
   File Container
   ======================================== */

.file-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    min-height: calc(100vh - 300px);
    align-content: start;
}

.file-container.list-view {
    grid-template-columns: 1fr;
}

/* Loading State (also used in other views possibly) */
.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 32px;
    gap: 16px;
    color: var(--text-secondary);
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 32px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: var(--border);
    margin-bottom: 16px;
}

/* ========================================
   File Item
   ======================================== */

.file-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.file-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.file-item.drag-over {
    border-color: #1a73e8;
    border-width: 2px;
    background-color: rgba(26, 115, 232, 0.05);
    box-shadow: inset 0 0 0 1px #1a73e8;
}

.file-item.selected {
    background-color: #e8f0fe;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.file-item.selected:hover {
    background-color: #d2e3fc;
}

.file-item-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.file-item-icon.with-thumbnail {
    display: none;
}

.file-item-thumbnail {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    object-fit: cover;
    border-radius: 4px;
    background-color: #f0f0f0;
    -webkit-user-drag: none;
    user-select: none;
}

.file-item.list-view .file-item-list-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.file-item.is-folder .file-item-icon {
    color: #5f6368;
}

.file-item.is-file .file-item-icon {
    color: #1a73e8;
}

.file-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
}

.file-path-hint {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.file-item.is-folder .file-item-name {
    font-weight: 600;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.file-type-label {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    margin-bottom: 4px;
}

.folder-label {
    background-color: #f1f3f4;
    color: #5f6368;
}

.file-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.file-item-tags {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin-top: 6px;
}

.file-item-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    border-radius: 999px;
    font-size: 11px;
    color: var(--text-secondary);
    max-width: 100%;
}

.file-item-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--border);
    flex-shrink: 0;
}

.file-item-tag-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

.file-item-menu {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-primary);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-secondary);
}

.file-item:hover .file-item-menu {
    display: flex;
}

.file-item-menu:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

/* Selection Box */
.selection-box {
    position: absolute;
    border: 2px solid var(--primary);
    background-color: rgba(26, 115, 232, 0.1);
    pointer-events: none;
    z-index: 1000;
}

/* Drag Preview */
.drag-preview {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
}

/* List View Style */
.file-item.list-view {
    flex-direction: row;
    padding: 12px 16px;
    border-radius: 4px;
    gap: 16px;
    text-align: left;
}

.file-item.list-view .file-item-tags {
    justify-content: flex-start;
    margin-top: 4px;
}

.file-item.list-view .file-item-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.file-item.list-view-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.file-item.list-view-meta {
    display: flex;
    gap: 24px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ========================================
   File Info Table
   ======================================== */

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table th,
.info-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.info-table th {
    width: 175px;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-table td {
    color: var(--text-primary);
    word-break: break-all;
}

.info-table tr:last-child th,
.info-table tr:last-child td {
    border-bottom: none;
}

/* Responsive adjustments for file list */
@media (max-width: 1200px) {
    .file-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 768px) {
    .file-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }

    .file-item {
        padding: 12px;
    }

    .file-item-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 8px;
    }

    .file-item-name {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .file-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .file-item-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 6px;
    }

    .file-item-name {
        font-size: 11px;
    }

    .file-item-meta {
        font-size: 11px;
    }
}
