/**
 * 百度网盘文件浏览器样式
 * 专注于数据展示和浏览体验
 */

/* 主容器 */
.baidu-netdisk-file-browser {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.browser-title {
    margin: 0;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

/* 工具栏 */
.browser-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    flex-wrap: wrap;
}

.navigation-controls {
    display: flex;
    gap: 4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.nav-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.address-bar {
    flex: 1;
    display: flex;
    gap: 8px;
    min-width: 200px;
}

.path-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease;
}

.path-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.go-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #3b82f6;
    background: #3b82f6;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.go-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* 浏览器内容 */
.browser-content {
    position: relative;
    min-height: 300px;
}

.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* 文件列表容器 */
.file-list-container {
    padding: 16px;
}

/* 工具栏 */
.file-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
}

.search-input {
    padding: 8px 12px 8px 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
    background: #fff;
}

.search-box svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.sort-controls {
    display: flex;
    gap: 4px;
}

.sort-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.sort-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.sort-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.view-controls {
    display: flex;
    gap: 4px;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.view-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.view-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* 面包屑导航 */
.breadcrumb {
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.breadcrumb-items {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    color: #6b7280;
    font-size: 14px;
    transition: all 0.2s ease;
}

.breadcrumb-item:hover {
    background: #e5e7eb;
    color: #374151;
}

.breadcrumb-separator {
    color: #9ca3af;
    font-size: 12px;
}

/* 网格视图 */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.file-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.file-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.file-icon-wrapper {
    margin-bottom: 12px;
    color: #6b7280;
}

.file-icon-wrapper svg {
    display: block;
    margin: 0 auto;
}

.file-info {
    margin-bottom: 12px;
}

.file-name {
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.file-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
}

.file-type-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #e5e7eb;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    color: #374151;
    text-transform: uppercase;
}

.file-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.action-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.folder-open-btn:hover {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #d97706;
}

.download-btn:hover {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #2563eb;
}

/* 列表视图 */
.file-list {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.file-list-header {
    display: grid;
    grid-template-columns: 1fr 100px 100px 150px 80px;
    gap: 16px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.header-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.header-cell:hover {
    color: #3b82f6;
}

.header-cell.sortable::after {
    content: '↕';
    opacity: 0.5;
    font-size: 12px;
}

.header-cell.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #3b82f6;
}

.header-cell.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #3b82f6;
}

.file-list-body .file-item {
    display: grid;
    grid-template-columns: 1fr 100px 100px 150px 80px;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    align-items: center;
    text-align: left;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    background: #fff;
    transition: background-color 0.2s ease;
}

.file-list-body .file-item:hover {
    background: #f8f9fa;
    border-color: #f3f4f6;
    transform: none;
    box-shadow: none;
}

.file-list-body .file-item:last-child {
    border-bottom: none;
}

.file-list-body .file-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-list-body .file-icon-wrapper {
    margin: 0;
    flex-shrink: 0;
}

.file-list-body .file-name {
    margin: 0;
    font-size: 14px;
    word-break: break-word;
}

.file-list-body .file-type-badge {
    font-size: 11px;
}

.file-list-body .file-actions {
    justify-content: flex-start;
}

/* 空状态 */
.no-files-message {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}

.no-files-message svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-files-message p {
    margin: 0;
    font-size: 16px;
}

/* 错误消息 */
.error-message {
    text-align: center;
    padding: 24px;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    margin: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .browser-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .navigation-controls {
        justify-content: center;
    }
    
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .file-list-header,
    .file-list-body .file-item {
        grid-template-columns: 1fr 60px;
        gap: 8px;
    }
    
    .file-list-header .header-cell:nth-child(n+3),
    .file-list-body .file-item > *:nth-child(n+3) {
        display: none;
    }
    
    .toolbar-left,
    .toolbar-right {
        justify-content: center;
    }
    
    .search-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .file-item {
        padding: 12px;
    }
    
    .browser-toolbar {
        padding: 8px 12px;
    }
    
    .file-list-container {
        padding: 12px;
    }
}