/**
 * 移动端文件卡片样式 - 全新设计
 * LAN Transfer - Mobile File Card Design
 * 仅在 < 768px 时生效，不影响PC端布局
 */

/* ========== 移动端文件卡片容器 ========== */
@media (max-width: 768px) {
    /* 表格行作为卡片容器 */
    table tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

    /* 隐藏桌面端的表头 */
    table thead {
        display: none;
    }

    /* 所有单元格重置为块级 */
    table tbody td {
        display: block;
        width: 100% !important;
        padding: 0;
        border: none;
        background: transparent;
    }

    /* ========== 文件标题行（图标+文件名+标签） ========== */
    table tbody td.filename {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        text-align: left !important;
        gap: 12px;
        padding: 0 0 12px 0 !important;
        margin-bottom: 12px;
        border-bottom: 1px solid var(--border-color);
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.4;
    }
    
    /* 确保文件名行内容左对齐 */
    table tbody td.filename > * {
        text-align: left !important;
    }

    /* 文件卡片头部容器 */
    .file-card-header {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        justify-content: flex-start !important;
    }
    
    /* 文件信息区域 */
    .file-card-info {
        display: flex;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 6px;
        flex: 1;
        min-width: 0;
        text-align: left !important;
    }
    
    /* 文件名称 */
    .file-card-name {
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.4;
        word-break: break-word;
        text-align: left !important;
        width: 100%;
    }
    
    /* 文件图标样式 */
    table tbody td.filename .file-icon {
        width: 40px;
        height: 48px;
        font-size: 13px;
        border-radius: 8px;
        margin: 0;
        flex-shrink: 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    }

    /* 文件名包装器 */
    .file-name-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        flex: 1;
        min-width: 0;
        padding-top: 2px;
    }

    /* 文件名文本 */
    .file-name-text {
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.4;
        word-break: break-word;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    /* 文件类型标签（公开/私密） */
    .file-name-wrapper .public-badge,
    .file-name-wrapper .private-badge {
        display: inline-flex;
        align-items: center;
        padding: 3px 10px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 500;
        margin: 0;
    }

    .file-name-wrapper .public-badge {
        background: rgba(63, 185, 80, 0.15);
        color: var(--accent-success);
        border: 1px solid rgba(63, 185, 80, 0.3);
    }

    .file-name-wrapper .private-badge {
        background: rgba(163, 113, 247, 0.15);
        color: var(--accent-purple);
        border: 1px solid rgba(163, 113, 247, 0.3);
    }

    /* ========== 文件元信息网格 ========== */
    .file-meta-grid {
        display: grid;
        grid-template-columns: 60px 1fr;
        gap: 8px 12px;
        padding: 0;
        margin-bottom: 12px;
    }

    /* 元信息标签 */
    .file-meta-label {
        font-size: 12px;
        color: var(--text-secondary);
        font-weight: 500;
        text-align: left;
    }

    /* 元信息值 */
    .file-meta-value {
        font-size: 13px;
        color: var(--text-primary);
        font-weight: 500;
        text-align: left;
    }

    .file-meta-value.size {
        color: var(--accent-primary);
        font-weight: 600;
    }

    /* ========== 操作按钮区域 ========== */
    .file-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 12px 0 0 0;
        border-top: 1px solid var(--border-color);
        margin-top: 4px;
    }

    .file-actions .btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 13px;
        font-weight: 600;
        border-radius: 8px;
        min-height: 40px;
    }

    /* 批量模式下的选中标记 */
    .batch-selected td.filename::before {
        content: '✓';
        position: absolute;
        left: -8px;
        top: -8px;
        width: 24px;
        height: 24px;
        background: var(--accent-primary);
        color: #000;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 700;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
}

/* ========== 超小屏幕适配 ========== */
@media (max-width: 480px) {
    table tbody tr {
        padding: 14px;
        border-radius: 10px;
    }

    table tbody td.filename .file-icon {
        width: 36px;
        height: 44px;
        font-size: 12px;
    }

    .folder-icon {
        width: 36px;
        height: 44px;
        font-size: 22px;
    }

    .file-name-text {
        font-size: 14px;
    }

    .file-meta-grid {
        grid-template-columns: 50px 1fr;
        gap: 6px 10px;
    }

    .file-meta-grid.folder-meta {
        grid-template-columns: 50px 1fr;
    }

    .file-meta-label {
        font-size: 11px;
    }

    .file-meta-value {
        font-size: 12px;
    }

    .file-actions .btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }
}
