/* ==========================================================================
   COMPONENT STYLES
   Uses design tokens from tokens.css
   ========================================================================== */

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-subtle), 0 0 0 1px var(--accent);
}

.btn-primary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-primary:hover {
  border-color: var(--text-secondary);
  background: var(--bg-raised);
}

.btn-primary:active {
  background: var(--bg-pressed);
}

.btn-secondary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-base);
}

.btn-secondary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary:active {
  background: var(--accent-pressed);
  border-color: var(--accent-pressed);
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   TEXT INPUTS
   ========================================================================== */

.input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--text-primary);
  background: var(--bg-inset);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:hover {
  border-color: var(--border-strong);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-base);
}

.input-error {
  border-color: var(--error);
}

/* ==========================================================================
   CARDS / SURFACES
   ========================================================================== */

.surface-base {
  background: var(--bg-base);
}

.surface-raised {
  background: var(--bg-raised);
  box-shadow: var(--shadow-low);
}

.surface-inset {
  background: var(--bg-inset);
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

/* ==========================================================================
   BADGES
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-accent {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

/* ==========================================================================
   DROPDOWN / AUTOCOMPLETE
   ========================================================================== */

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-xs);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-mid);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}

.dropdown-item {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  color: var(--text-primary);
}

.dropdown-item:hover,
.dropdown-item.active {
  background: var(--accent-subtle);
}

.dropdown-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ==========================================================================
   SEARCH FILTER
   ========================================================================== */

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-spinner {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 1;
}

.search-spinner.hidden {
  display: none;
}

.search-input-wrapper .search-input {
  flex: 1;
  padding-right: 120px;
  transition: padding-left 0.15s ease;
}

.search-input-wrapper .search-input.loading {
  padding-left: 34px;
}

.search-filters {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-filter-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-filter-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search-filter-toggle.active {
  background: var(--accent-subtle);
  color: var(--accent);
}

.search-filter-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

.search-filter-icon {
  width: 16px;
  height: 16px;
}

.search-filter-colors {
  display: flex;
  align-items: center;
  gap: 2px;
}

.search-filter-colors .mana-symbol {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.search-filter-toggle.active + .search-filter-colors .mana-symbol {
  opacity: 1;
}

.search-filters.hidden {
  display: none;
}

/* ==========================================================================
   RICH SEARCH DROPDOWN
   ========================================================================== */

.search-result-item {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background-color var(--transition-fast);
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--bg-hover);
}

.search-result-item.color-mismatch {
  border-left-color: var(--error);
  opacity: 0.7;
}

.search-result-item.color-mismatch:hover {
  opacity: 0.85;
}

.search-result-item-art {
  width: 40px;
  height: 30px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.search-result-item-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.search-result-item-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item-type {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item-mana {
  display: flex;
  gap: 1px;
}

.search-result-item-mana .mana-symbol {
  width: 14px;
  height: 14px;
}

.search-result-item-price {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  min-width: 45px;
  text-align: right;
}

/* Search result shimmer loading states */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.search-result-item .shimmer {
  width: 40px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--bg-inset) 25%,
    var(--bg-hover) 50%,
    var(--bg-inset) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.search-result-item .shimmer-text {
  height: 12px;
  width: 60px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--bg-inset) 25%,
    var(--bg-hover) 50%,
    var(--bg-inset) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.search-result-item .shimmer-mana {
  width: 42px;
  height: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--bg-inset) 25%,
    var(--bg-hover) 50%,
    var(--bg-inset) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ==========================================================================
   LIST ITEMS
   ========================================================================== */

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.list-item:hover {
  background: var(--bg-raised);
}

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

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-inset);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   DECK SELECTOR (Rich Dropdown)
   ============================================ */

.deck-selector {
  position: relative;
  min-width: 280px;
}

.deck-selector-button {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--bg-inset);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.deck-selector-button:hover {
  border-color: var(--border-strong);
}

.deck-selector-button:focus {
  outline: none;
  border-color: var(--accent);
}

.deck-selector-button::after {
  content: '▼';
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
}

.deck-selector.open .deck-selector-button::after {
  content: '▲';
}

.deck-selector-placeholder {
  color: var(--text-muted);
}

/* Selected deck preview in button */
.deck-selector-selected {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.deck-selector-selected-art {
  width: 32px;
  height: 24px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.deck-selector-selected-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-selector-selected-completion {
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* Dropdown menu */
.deck-selector-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-xs);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-high);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
}

/* Import action in dropdown */
.deck-selector-action {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-default);
  color: var(--accent);
  font-weight: 500;
}

.deck-selector-action:hover {
  background: var(--accent-subtle);
}

.deck-selector-action-icon {
  width: 20px;
  height: 20px;
}

/* Deck item in dropdown */
.deck-selector-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
}

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

.deck-selector-item:hover {
  background: var(--accent-subtle);
}

.deck-selector-item.selected {
  background: var(--accent-subtle);
}

.deck-selector-item-art-container {
  width: 48px;
  height: 36px;
  flex-shrink: 0;
}

.deck-selector-item-art {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}

.deck-selector-item-art-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg-inset);
  border-radius: var(--radius-sm);
  animation: pulse 1.5s ease-in-out infinite;
}

.deck-selector-selected-art-placeholder {
  width: 32px;
  height: 24px;
  background: var(--bg-inset);
  border-radius: var(--radius-sm);
  animation: pulse 1.5s ease-in-out infinite;
}

.deck-selector-loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}

.deck-selector-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.deck-selector-item-name {
  font-weight: 500;
  font-size: var(--font-size-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-selector-item-type {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-selector-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.deck-selector-item-mana {
  display: flex;
  gap: 2px;
}

.deck-selector-item-mana .mana-symbol {
  width: 14px;
  height: 14px;
}

/* Completion indicator */
.deck-completion {
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.deck-completion-incomplete {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.deck-completion-partial {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.deck-completion-complete {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

/* Saved deck item with delete button */
.deck-selector-item--saved {
  position: relative;
  grid-template-columns: 48px 1fr auto auto;
}

.deck-selector-item-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0;
}

.deck-selector-item--saved:hover .deck-selector-item-delete {
  opacity: 1;
}

.deck-selector-item-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.deck-selector-item-delete svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   STATS PANEL
   ========================================================================== */

/* Stats Panel */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-raised);
  border-radius: var(--radius-md);
}

.stats-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.stats-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Mana Curve */
.mana-curve {
  display: flex;
  gap: 4px;
  align-items: flex-start;
}

.mana-bar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mana-bar {
  width: 100%;
  height: 50px;
  background: var(--bg-inset);
  border-radius: var(--radius-sm);
  position: relative;
}

.mana-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  border-radius: var(--radius-sm);
  transition: height 0.2s ease;
}

.mana-bar-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.mana-bar-count {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.mana-bar-percent {
  font-size: 9px;
  color: var(--text-muted);
}

.mana-bar-icon {
  width: 18px;
  height: 18px;
}

/* Color Bar */
.color-pie {
  display: flex;
  height: 32px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-inset);
}

.color-bar-empty {
  width: 100%;
  height: 100%;
  background: var(--bg-inset);
}

.color-bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  transition: width 0.2s ease;
}

.color-bar-segment--W { background: #e9e5dc; }
.color-bar-segment--U { background: #6b9bc3; }
.color-bar-segment--B { background: #5d5a58; }
.color-bar-segment--R { background: #db8664; }
.color-bar-segment--G { background: #7bbd7a; }
.color-bar-segment--C { background: #a8a49e; }

.color-bar-icon {
  width: 20px;
  height: 20px;
}


/* ==========================================================================
   ZONE TABS
   ========================================================================== */

.zone-tabs {
  display: flex;
  gap: var(--space-xs);
}

.zone-tab {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.zone-tab:hover {
  background: var(--bg-pressed);
  color: var(--text-primary);
}

.zone-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-base);
}

/* ==========================================================================
   MOVE BUTTONS
   ========================================================================== */

.move-controls {
  display: flex;
  gap: 2px;
}

.btn-move {
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-move:hover {
  background: var(--bg-raised);
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   MODAL
   ========================================================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-textarea {
  width: 100%;
  height: 300px;
  padding: var(--space-sm);
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: monospace;
  font-size: var(--font-size-sm);
  resize: vertical;
}

.modal-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-textarea::placeholder {
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ==========================================================================
   TOAST
   ========================================================================== */

.toast {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg-base);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast.visible {
  opacity: 1;
}

.toast-message {
  flex: 1;
}

.toast-action {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   FILTER BAR
   ========================================================================== */

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-inset);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding-left: 2px;
}

.color-filters {
  display: flex;
  gap: var(--space-sm);
}

.color-filter {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.color-filter img {
  width: 28px;
  height: 28px;
}

.color-filter:not(.active) {
  opacity: 0.35;
  filter: grayscale(0.5);
}

.color-filter.active {
  opacity: 1;
}

/* Scryfall SVGs have built-in colors, no background needed */

.filter-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
  margin: 0 var(--space-xs);
}

.type-filters {
  display: flex;
  gap: 4px;
}

.type-filter-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0.7;
}

.type-filter-btn .ms {
  font-size: 16px;
}

.type-filter-btn .type-count {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.type-filter-btn.active {
  opacity: 1;
  color: var(--text-primary);
  background: var(--bg-raised);
  border-color: var(--accent);
}

.type-filter-btn:hover {
  opacity: 1;
  background: var(--bg-raised);
}

/* Board filters (SB/MB toggles) */
.board-filters {
  display: flex;
  gap: 4px;
}

.board-filter-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0.7;
}

.board-filter-btn .board-count {
  font-weight: 600;
}

.board-filter-btn.active {
  opacity: 1;
  color: var(--text-primary);
  background: var(--bg-raised);
  border-color: var(--accent);
}

.board-filter-btn:hover {
  opacity: 1;
  background: var(--bg-raised);
}

.view-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.view-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--font-size-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-btn:hover {
  color: var(--text-primary);
}

.view-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-base);
}

/* ==========================================================================
   GRID VIEW
   ========================================================================== */

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: var(--space-sm);
}

.grid-card {
  position: relative;
  aspect-ratio: 488 / 680;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.grid-card:hover {
  transform: scale(1.05);
  z-index: 1;
}

.grid-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grid-card-qty {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   CARD PREVIEW MODAL (Mobile)
   ========================================================================== */

.card-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.card-modal-backdrop.visible {
  opacity: 1;
}

.card-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-raised);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  z-index: 201;
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  max-height: 85vh;
  overflow-y: auto;
}

.card-modal.visible {
  transform: translateY(0);
}

.card-modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border-default);
  border-radius: 2px;
  margin: 0 auto var(--space-md);
}

.card-modal-image {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.card-modal-image img {
  max-width: 250px;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-mid);
}

.card-modal-info {
  text-align: center;
  margin-bottom: var(--space-md);
}

.card-modal-name {
  font-size: var(--font-size-lg);
  font-weight: bold;
  margin-bottom: var(--space-xs);
}

.card-modal-type {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.card-modal-price {
  font-size: var(--font-size-md);
  color: var(--accent);
  font-weight: 500;
}

.card-modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
}

.card-modal-actions .btn {
  min-height: 44px;
  min-width: 44px;
}
