/* 批量操作样式 */

/* ==================== 批量操作栏 ==================== */

.batch-action-bar {
    position: fixed;
    bottom: -80px;
    left: 0;
    right: 0;
    height: 70px;
    background: white;
    border-top: 2px solid var(--primary-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    transition: bottom 0.3s ease-out;
}

.batch-action-bar.active {
    bottom: 0;
}

.batch-selection-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.batch-selection-info i {
    font-size: 24px;
    color: var(--primary-color);
}

.batch-selection-text {
    font-size: 16px;
    color: var(--text-primary);
}

.batch-selection-text strong {
    color: var(--primary-color);
    font-size: 20px;
}

.batch-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.batch-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
    white-space: nowrap;
}

/* ==================== 复选框样式 ==================== */

.batch-checkbox-wrapper {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.batch-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.batch-checkbox:checked {
    background: var(--primary-color);
}

/* 全选复选框 */
.select-all-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
    margin-bottom: 16px;
}

.select-all-wrapper label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ==================== 批量操作卡片 ==================== */

.batch-item {
    position: relative;
    transition: all 0.2s ease;
}

.batch-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: 12px;
    pointer-events: none;
    transition: all 0.2s ease;
}

.batch-item.selected::before {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.batch-item.selected {
    transform: scale(0.98);
}

.batch-item-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
}

.batch-item-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

/* 为卡片添加左边距,避免与复选框重叠 */
.batch-item .card-content {
    padding-left: 48px;
}

/* ==================== 批量操作模态框 ==================== */

.batch-modal-content {
    max-width: 600px;
}

.batch-modal-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    margin-bottom: 16px;
}

.batch-modal-warning i {
    font-size: 24px;
    color: #f59e0b;
}

.batch-modal-warning-text {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
}

.batch-selected-count {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
}

/* ==================== 批量操作按钮组 ==================== */

.batch-operation-btns {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.batch-operation-btns .btn {
    flex: 1;
    min-width: 120px;
}

/* ==================== 批量进度指示 ==================== */

.batch-progress-modal {
    text-align: center;
    padding: 40px 20px;
}

.batch-progress-spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    border: 5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.batch-progress-text {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.batch-progress-detail {
    font-size: 14px;
    color: var(--text-secondary);
}

.batch-progress-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 20px;
}

.batch-progress-stat {
    text-align: center;
}

.batch-progress-stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.batch-progress-stat-value.success {
    color: var(--success-color);
}

.batch-progress-stat-value.error {
    color: var(--danger-color);
}

.batch-progress-stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ==================== 批量结果展示 ==================== */

.batch-result-summary {
    padding: 24px;
    text-align: center;
}

.batch-result-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.batch-result-icon.success {
    color: var(--success-color);
}

.batch-result-icon.warning {
    color: #f59e0b;
}

.batch-result-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.batch-result-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.batch-result-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 16px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
}

.batch-result-stat {
    text-align: center;
}

.batch-result-stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.batch-result-stat-value.success {
    color: var(--success-color);
}

.batch-result-stat-value.failed {
    color: var(--danger-color);
}

.batch-result-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== 响应式设计 ==================== */

@media (max-width: 768px) {
    .batch-action-bar {
        height: auto;
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
        bottom: -150px;
    }

    .batch-action-bar.active {
        bottom: 60px; /* 移动端底部导航栏高度 */
    }

    .batch-selection-info {
        width: 100%;
        justify-content: center;
    }

    .batch-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .batch-actions .btn {
        flex: 1;
        min-width: 100px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .batch-operation-btns {
        flex-direction: column;
    }

    .batch-operation-btns .btn {
        width: 100%;
    }

    .batch-progress-stats {
        flex-direction: column;
        gap: 12px;
    }

    .batch-result-stats {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .batch-action-bar {
        padding: 10px 12px;
    }

    .batch-selection-text {
        font-size: 14px;
    }

    .batch-selection-text strong {
        font-size: 18px;
    }

    .batch-actions .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ==================== 深色模式 ==================== */

@media (prefers-color-scheme: dark) {
    .batch-action-bar {
        background: rgba(30, 30, 30, 0.98);
        border-top-color: var(--primary-color);
    }

    .select-all-wrapper {
        background: rgba(255, 255, 255, 0.05);
    }

    .batch-item.selected::before {
        background: rgba(79, 70, 229, 0.1);
    }

    .batch-modal-warning {
        background: rgba(245, 158, 11, 0.15);
    }

    .batch-result-stats,
    .batch-progress-stats {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* ==================== 动画效果 ==================== */

.batch-item {
    animation: fadeInUp 0.3s ease-out backwards;
}

.batch-item:nth-child(1) { animation-delay: 0.05s; }
.batch-item:nth-child(2) { animation-delay: 0.1s; }
.batch-item:nth-child(3) { animation-delay: 0.15s; }
.batch-item:nth-child(4) { animation-delay: 0.2s; }
.batch-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.batch-action-bar {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ==================== 辅助类 ==================== */

.batch-enabled .card {
    cursor: pointer;
}

.batch-enabled .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 减少动画(辅助功能) */
@media (prefers-reduced-motion: reduce) {
    .batch-item,
    .batch-action-bar {
        animation: none;
    }

    .batch-item.selected {
        transform: none;
    }
}
