/* 批量操作樣式 */
.batch-operations-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px;
    max-height: 80vh;
    background: var(--bs-body-bg, #ffffff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    overflow: hidden;
    transition: all 0.3s ease;
}

.batch-operations-panel.show {
    transform: translateX(0);
}

.batch-header {
    background: var(--bs-primary, #0d6efd);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.batch-header h6 {
    margin: 0;
    font-weight: 600;
}

.batch-header button {
    background: none;
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.batch-header button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.batch-content {
    padding: 16px;
    max-height: calc(80vh - 60px);
    overflow-y: auto;
}

.selection-summary {
    background: var(--bs-light, #f8f9fa);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.operation-group {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 6px;
    padding: 12px;
    background: var(--bs-body-bg, #ffffff);
}

.operation-group .form-label {
    font-weight: 600;
    color: var(--bs-primary, #0d6efd);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.operation-group .btn {
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.operation-group .btn:last-child {
    margin-bottom: 0;
}

.operation-history {
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    padding-top: 12px;
}

.operation-history h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bs-secondary, #6c757d);
    margin-bottom: 8px;
}

.history-list {
    max-height: 120px;
    overflow-y: auto;
    background: var(--bs-light, #f8f9fa);
    border-radius: 4px;
    padding: 8px;
}

.history-item {
    padding: 4px 0;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.1));
}

.history-item:last-child {
    border-bottom: none;
}

/* 批量選擇模式樣式 */
.batch-mode-active .batch-selectable {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.batch-mode-active .batch-selectable:hover {
    border-color: var(--bs-primary, #0d6efd);
    background-color: rgba(13, 110, 253, 0.1);
}

.batch-mode-active .batch-selectable.selected {
    border-color: var(--bs-success, #198754);
    background-color: rgba(25, 135, 84, 0.1);
}

.batch-checkbox {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.batch-mode-active .batch-checkbox {
    opacity: 1;
}

.batch-selectable.selected .batch-checkbox {
    opacity: 1;
}

/* 批量操作按鈕 */
.batch-mode-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bs-primary, #0d6efd);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 1.2rem;
    z-index: 1040;
    transition: all 0.3s ease;
}

.batch-mode-toggle:hover:not(:disabled) {
    background: var(--bs-primary-dark, #0b5ed7);
    transform: scale(1.1);
}

.batch-mode-toggle.active {
    background: var(--bs-success, #198754);
}

.batch-mode-toggle:disabled,
.batch-mode-toggle.disabled {
    background: #6c757d !important;
    color: #adb5bd !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    transform: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .batch-operations-panel {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
    }
    
    .batch-mode-toggle {
        bottom: 80px;
        right: 20px;
    }
}

/* 深色模式支援 */
[data-bs-theme="dark"] .batch-operations-panel {
    background: var(--bs-dark, #212529);
    border-color: var(--bs-border-color, #495057);
}

[data-bs-theme="dark"] .batch-header {
    background: var(--bs-primary-dark, #0b5ed7);
}

[data-bs-theme="dark"] .operation-group {
    background: var(--bs-dark, #212529);
    border-color: var(--bs-border-color, #495057);
}

[data-bs-theme="dark"] .selection-summary {
    background: var(--bs-gray-800, #343a40);
}

[data-bs-theme="dark"] .history-list {
    background: var(--bs-gray-800, #343a40);
}

[data-bs-theme="dark"] .batch-mode-active .batch-selectable:hover {
    background-color: rgba(13, 110, 253, 0.2);
}

[data-bs-theme="dark"] .batch-mode-active .batch-selectable.selected {
    background-color: rgba(25, 135, 84, 0.2);
}

/* 動畫效果 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.batch-operations-panel.show {
    animation: slideInRight 0.3s ease;
}

.batch-operations-panel.hide {
    animation: slideOutRight 0.3s ease;
}

/* 選擇框樣式 */
.batch-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--bs-success, #198754);
    cursor: pointer;
}

.batch-checkbox:checked {
    background-color: var(--bs-success, #198754);
    border-color: var(--bs-success, #198754);
}

/* 操作按鈕組樣式 */
.btn-group-vertical .btn {
    border-radius: 0;
}

.btn-group-vertical .btn:first-child {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

.btn-group-vertical .btn:last-child {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* 輸入組樣式 */
.input-group .form-control {
    border-right: none;
}

.input-group .btn {
    border-left: none;
}

/* 滾動條樣式 */
.batch-content::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
    width: 6px;
}

.batch-content::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
    background: var(--bs-light, #f8f9fa);
    border-radius: 3px;
}

.batch-content::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
    background: var(--bs-secondary, #6c757d);
    border-radius: 3px;
}

.batch-content::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--bs-dark, #212529);
}

/* 深色模式滾動條 */
[data-bs-theme="dark"] .batch-content::-webkit-scrollbar-track,
[data-bs-theme="dark"] .history-list::-webkit-scrollbar-track {
    background: var(--bs-gray-800, #343a40);
}

[data-bs-theme="dark"] .batch-content::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] .history-list::-webkit-scrollbar-thumb {
    background: var(--bs-gray-600, #6c757d);
}

[data-bs-theme="dark"] .batch-content::-webkit-scrollbar-thumb:hover,
[data-bs-theme="dark"] .history-list::-webkit-scrollbar-thumb:hover {
    background: var(--bs-light, #f8f9fa);
}