/* ========== files.css ========== */
/**
 * 文件管理模块样式 - Nebula 设计语言
 * 玻璃拟态 · 紫靛渐变 · 微光发光 · 高级质感
 */

/* ==================== 页面容器 ==================== */
.files-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ==================== 头部 Hero ==================== */
.files-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 28px 32px;
    background: linear-gradient(135deg, var(--bg-hover) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
}

.files-page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 200%;
    background: radial-gradient(ellipse at center, var(--bg-hover) 0%, transparent 60%);
    pointer-events: none;
}

.header-title {
    position: relative;
    z-index: 1;
}

.header-title h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.header-title .header-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 配额进度条 */
.quota-mini {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 320px;
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 1;
}

.quota-mini-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.quota-mini-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.quota-mini-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-glow);
}

.quota-mini-fill.warning {
    background: linear-gradient(90deg, var(--warning), #f59e0b);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.quota-mini-fill.danger {
    background: linear-gradient(90deg, var(--error), #dc2626);
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.5);
}

.quota-mini-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-light);
    white-space: nowrap;
}

/* 头部操作按钮 */
.header-actions {
    display: flex;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-glow);
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), 0 8px 28px var(--border-glow);
}

.btn-new-folder {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
}

.btn-new-folder:hover {
    background: var(--bg-hover);
    border-color: var(--border-glow);
    color: var(--primary-light);
    transform: translateY(-2px);
}

/* ==================== 工具栏 ==================== */
.files-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
}

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

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.breadcrumb-item:hover {
    color: var(--primary-light);
    background: var(--bg-hover);
}

.breadcrumb-sep {
    color: var(--text-muted);
    font-size: 12px;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

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

.view-toggle {
    display: flex;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
}

.view-btn {
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 16px;
}

.view-btn.active {
    background: linear-gradient(135deg, var(--bg-hover) 0%, rgba(99, 102, 241, 0.15) 100%);
    color: var(--text-primary);
    box-shadow: var(--shadow-glow);
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 10px 16px 10px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    width: 220px;
    transition: all var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    width: 280px;
    background: var(--bg-hover);
    box-shadow: 0 0 0 3px var(--bg-hover);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

/* ==================== 文件网格 ==================== */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.file-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 20px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
}

.file-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-glow), transparent);
    transform: scaleX(0);
    transition: transform var(--transition);
}

.file-card:hover {
    transform: translateY(-6px);
    background: var(--bg-hover);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.file-card:hover::before {
    transform: scaleX(1);
}

.file-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    background: linear-gradient(135deg, var(--bg-hover) 0%, rgba(99, 102, 241, 0.06) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    border: 1px solid var(--border-glow);
    transition: all var(--transition);
}

.file-card:hover .file-icon {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 6px;
}

.file-size {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.file-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 文件操作按钮 */
.file-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
}

.file-card:hover .file-actions {
    opacity: 1;
    transform: translateY(0);
}

.file-action-btn {
    width: 30px;
    height: 30px;
    background: var(--bg-input);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-action-btn:hover {
    background: var(--border-glow);
    border-color: var(--border-glow);
    color: var(--text-primary);
}

/* ==================== 列表视图 ==================== */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}

.file-row:hover {
    background: var(--bg-hover);
    border-color: var(--border-glow);
    transform: translateX(4px);
    box-shadow: var(--shadow-glow);
}

.file-row-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, var(--bg-hover) 0%, rgba(99, 102, 241, 0.06) 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glow);
}

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

.file-row-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-row-meta {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

.file-row-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.file-row-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.file-row:hover .file-row-actions {
    opacity: 1;
}

/* ==================== 空状态 ==================== */
.files-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    text-align: center;
}

.files-empty-icon {
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    background: linear-gradient(135deg, var(--bg-hover) 0%, rgba(99, 102, 241, 0.06) 100%);
    border-radius: var(--radius-xl);
    margin-bottom: 28px;
    opacity: 0.6;
    border: 1px solid var(--border-glow);
}

.files-empty h3 {
    font-size: 22px;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    font-weight: 600;
}

.files-empty p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 24px 0;
}

/* ==================== 加载状态 ==================== */
.files-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid var(--border-glow);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.files-loading p {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==================== 右键菜单 ==================== */
.files-context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 8px 0;
    min-width: 200px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.context-menu-item {
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
}

.context-menu-item:hover {
    background: var(--bg-hover);
    color: var(--primary-light);
}

.context-menu-item.danger {
    color: #f87171;
}

.context-menu-item.danger:hover {
    background: rgba(244, 63, 94, 0.18);
    color: #fca5a5;
}

.context-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .files-page {
        padding: 16px;
    }

    .files-page-header {
        padding: 20px;
    }

    .header-title h2 {
        font-size: 22px;
    }

    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .file-card {
        padding: 20px 14px 16px;
    }

    .file-icon {
        width: 56px;
        height: 56px;
        font-size: 32px;
    }
}


/* ============================================================
   files.css 触控修正 + search-box 宽度稳定
   ============================================================ */
.file-action-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
.search-box input { transition: width var(--transition); }
