/* ========================================
   BATCH SELECTION MODE (v4.0)
   ======================================== */

.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 13px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #764ba2 100%);
  border-radius: 8px;
  margin-bottom: 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 8px;
  z-index: 50;
}

/* Subtle elevation + tighter corners while stuck so it reads as a pinned bar */
.batch-toolbar.batch-toolbar--stuck {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.batch-toolbar-left,
.batch-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.batch-selection-count {
  color: white;
  font-weight: 600;
  font-size: 14px;
  padding: 0 10px;
}

.batch-selection-count #batchSelectionCount {
  font-size: 18px;
  font-weight: 700;
}

.batch-toolbar .btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.batch-toolbar .btn-danger {
  background: #ef4444;
}

.batch-toolbar .btn-danger:hover {
  background: #dc2626;
}

/* Select All / Deselect All buttons */
.batch-select-all-btn,
.batch-deselect-all-btn {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.batch-select-all-btn:hover,
.batch-deselect-all-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.8);
}

/* Card selection checkbox */
.card-selection-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 24px;
  height: 24px;
  border: 2px solid white;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  z-index: var(--z-badge);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.card-selection-checkbox:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.card-selection-checkbox.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.card-selection-checkbox.selected::after {
  content: '✓';
  color: white;
  font-size: 16px;
  font-weight: bold;
}

/* Card in selection mode */
.card.selection-mode {
  cursor: pointer;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

/* Dim unselected cards when at least one card is selected */
.cards-grid.has-selection .card.selection-mode:not(.selected) {
  opacity: 0.8;
  filter: grayscale(0.3);
}

.cards-grid.has-selection .card.selection-mode:not(.selected):hover {
  opacity: 0.95;
  filter: none;
}

.card.selection-mode.selected {
  box-shadow: 0 0 0 3px var(--color-primary);
  transform: translateY(-2px);
  opacity: 1;
}

.card.selection-mode .card-image-container {
  position: relative;
}

/* Responsive batch toolbar */
@media (max-width: 768px) {
  .batch-toolbar {
    flex-direction: column;
    gap: 10px;
  }

  .batch-toolbar-left,
  .batch-toolbar-right {
    width: 100%;
    justify-content: center;
  }

  .batch-toolbar-right {
    flex-wrap: wrap;
  }
}

/* Dark mode support */
body.dark-mode .batch-toolbar {
  background: linear-gradient(135deg, #4c5fd5 0%, #5c3d8c 100%);
}

body.dark-mode .batch-selection-count {
  color: #e5e7eb;
}

/* ========================================
   SET COMPLETION TRACKER (v4.0 - Phase 7)
   ======================================== */

.set-completion-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.set-completion-item {
  background: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.set-completion-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.set-completion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.set-completion-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  flex: 1;
}

.set-completion-stats {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 14px;
}

.set-completion-count {
  color: var(--color-primary);
  font-weight: 600;
}

.set-completion-percentage {
  color: #10b981;
  font-weight: 700;
  font-size: 16px;
}

.set-completion-percentage.complete {
  color: #059669;
}

.set-completion-percentage.incomplete {
  color: #f59e0b;
}

.set-completion-bar-container {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.set-completion-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, #764ba2 100%);
  transition: width 0.3s ease;
  border-radius: 4px;
}

.set-completion-bar.complete {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.set-completion-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.set-completion-actions .btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.set-missing-badge {
  background: #fef3c7;
  color: #92400e;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.set-complete-badge {
  background: #d1fae5;
  color: #065f46;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Dark mode support */
body.dark-mode .set-completion-item {
  background: var(--surface2);
}

body.dark-mode .set-completion-name {
  color: #e5e7eb;
}

body.dark-mode .set-completion-bar-container {
  background: var(--border-hi);
}

body.dark-mode .set-missing-badge {
  background: #78350f;
  color: #fef3c7;
}

body.dark-mode .set-complete-badge {
  background: #065f46;
  color: #d1fae5;
}

/* ========================================
   BINDER SEARCH & FILTER (v4.0 - Phase 8)
   ======================================== */

.binder-search-filter {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.binder-search-highlight {
  box-shadow: 0 0 0 3px #f59e0b !important;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px #f59e0b;
  }
  50% {
    box-shadow: 0 0 0 6px #fbbf24;
  }
}

/* Dark mode support */
body.dark-mode .binder-search-filter {
  background: var(--surface2);
}

/* ========================================
   BATCH ADD OWNED CARD LIST
   ======================================== */

.batch-add-card-item {
  display: grid;
  grid-template-columns: 80px 1fr 120px 150px 120px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.batch-add-card-item:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.batch-add-card-image {
  width: 80px;
  height: auto;
  border-radius: 4px;
  object-fit: cover;
}

.batch-add-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.batch-add-card-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.batch-add-card-details {
  font-size: 12px;
  color: #666;
}

.batch-add-card-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 13px;
}

.batch-add-card-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.batch-add-card-input--static {
  background: transparent;
  border: none;
  padding: 4px 0;
}

/* Dark mode */
body.dark-mode .batch-add-card-item {
  background: var(--surface2);
  border-color: var(--border-hi);
}

body.dark-mode .batch-add-card-name {
  color: #e5e7eb;
}

body.dark-mode .batch-add-card-details {
  color: #9ca3af;
}

body.dark-mode .batch-add-card-input {
  background: var(--bg);
  border-color: var(--border-hi);
  color: #e5e7eb;
}

body.dark-mode .batch-add-card-input--static {
  background: transparent;
  border: none;
}

/* Responsive */
@media (max-width: 768px) {
  .batch-add-card-item {
    grid-template-columns: 60px 1fr;
    gap: 8px;
  }

  .batch-add-card-image {
    width: 60px;
  }

  .batch-add-card-item > div:nth-child(n + 3) {
    grid-column: 1 / -1;
  }
}

/* ========================================
   BATCH ORDER CARDS LIST
   ======================================== */

.batch-order-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Batch update owned: extra lang column for multi-lang cards */
.batch-add-card-item.has-lang-select {
  grid-template-columns: 80px 1fr auto 120px 150px 120px;
}

/* Edit order modal: extra lang column */
#editOrderCardsList .batch-add-card-item {
  grid-template-columns: 80px 1fr auto 100px 140px 100px;
}

.lang-static {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  font-size: 13px;
  white-space: nowrap;
}

.batch-order-total-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-top: 16px;
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 8px;
  font-size: 16px;
}

.batch-order-total-row strong {
  font-size: 20px;
  color: var(--color-primary);
}

/* Dark mode */
body.dark-mode .batch-order-total-row {
  background: rgba(0, 0, 0, 0.3);
}
