/* ===================================
   MTG Deck Builder - Design System
   Clean Flat Light Theme
   =================================== */

/* CSS Custom Properties (Design Tokens) */
:root {
  /* Color Palette - Modern Contemporary */
  --color-bg-primary: #f9fafb;
  --color-bg-secondary: #ffffff;
  --color-bg-tertiary: #f3f4f6;
  --color-bg-card: #ffffff;
  --color-bg-card-elevated: #ffffff;
  --color-bg-hover: #f3f4f6;
  --color-bg-active: #e5e7eb;

  /* Accent Colors - SpellSector Gold */
  --color-accent: #dcac48;
  --color-accent-light: #e5c276;
  --color-accent-dark: #b3882f;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-gold: #dcac48;

  /* MTG Colors - Clean & Modern */
  --mana-white: #fef3c7;
  --mana-blue: #3b82f6;
  --mana-black: #1f2937;
  --mana-red: #ef4444;
  --mana-green: #22c55e;

  /* Text Colors */
  --color-text-primary: #111827;
  --color-text-secondary: #4b5563;
  --color-text-muted: #9ca3af;
  --color-text-accent: var(--color-accent);

  /* Border & UI */
  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;
  --color-border-focus: var(--color-accent);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography - Modern Stack */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;

  /* Font Weights */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Border Radius - Subtle */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-base: 150ms ease;

  /* Shadows - Minimal */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.08);

  /* Z-index layers */
  --z-dropdown: 100;
  --z-modal: 200;
  --z-preview: 300;
  --z-toast: 400;
}

/* Import better fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===================================
   Base Styles
   =================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background: linear-gradient(135deg, var(--color-bg-primary) 0%, var(--color-bg-tertiary) 100%);
  color: var(--color-text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ===================================
   Typography
   =================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-primary);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

h4 {
  font-size: var(--text-base);
}

.text-accent {
  color: var(--color-accent);
}

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

.text-secondary {
  color: var(--color-text-secondary);
}

/* ===================================
   Layout
   =================================== */

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg);
}

.app-footer {
  text-align: center;
  padding: var(--space-lg) 0;
  margin-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.app-footer a {
  color: var(--color-accent);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-lg);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.app-logo h1 {
  color: var(--color-text-primary);
  font-size: var(--text-xl);
}

.app-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.search-shortcut-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 240px;
}

.search-shortcut-btn:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-focus);
  color: var(--color-text-secondary);
}

.search-shortcut-btn span {
  flex: 1;
  text-align: left;
}

.search-shortcut-btn kbd {
  padding: 2px 6px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 11px;
  color: var(--color-text-muted);
}

.main-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-xl);
}

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   Cards & Panels
   =================================== */

.panel {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
}

.panel-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-body {
  padding: var(--space-md);
}

/* ===================================
   Buttons
   =================================== */

/* ===================================
   Buttons
   =================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(88, 101, 242, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

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

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

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

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

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

.btn-lg {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-base);
}

/* Specific Action Buttons */
#btn-new-deck {
  background: #10b981;
  color: white;
}

#btn-new-deck:hover {
  background: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

#btn-save-deck {
  background: #3b82f6;
  color: white;
}

#btn-save-deck:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

#btn-import-deck {
  background: #6366f1;
  color: white;
}

#btn-import-deck:hover {
  background: #4f46e5;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* ===================================
   Form Elements
   =================================== */

.input-group {
  position: relative;
}

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

.input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

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

.input-lg {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-lg);
}

/* ===================================
   Card Search Component
   =================================== */

.search-container {
  position: relative;
  margin-bottom: var(--space-lg);
}

.search-input {
  padding-left: 44px;
}

.search-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 400px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  display: none;
}

.search-dropdown.active {
  display: block;
}

.search-result {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.search-result:hover,
.search-result.highlighted {
  background: var(--color-bg-hover);
}

.search-result-name {
  flex: 1;
}

.search-result-type {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.search-result-mana {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ===================================
   Deck List Component
   =================================== */

.deck-section {
  margin-bottom: var(--space-lg);
}

.deck-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

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

.deck-section-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.deck-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.deck-card:hover {
  background: var(--color-bg-hover);
}

.deck-card-quantity {
  min-width: 24px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-gold);
  text-align: center;
}

.deck-card-name {
  flex: 1;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-card-mana {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.deck-card-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.deck-card:hover .deck-card-actions {
  opacity: 1;
}

.deck-card-btn {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: var(--text-xs);
  transition: all var(--transition-fast);
}

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

.deck-card-btn.remove:hover {
  border-color: var(--color-error);
  color: var(--color-error);
}

/* ===================================
   Card Preview Component
   =================================== */

.card-preview {
  position: fixed;
  pointer-events: none;
  z-index: var(--z-preview);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.card-preview.visible {
  opacity: 1;
  transform: scale(1);
}

.card-preview img {
  width: 250px;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 0, 0, 0.6);
}

/* ===================================
   Deck Stats
   =================================== */

.deck-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-gold);
}

.stat-lands-other {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
}

/* ===================================
   Deck Gallery
   =================================== */

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

.deck-tile {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
}

.deck-tile:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.deck-tile-name {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.deck-tile-format {
  font-size: var(--text-sm);
  color: var(--color-gold);
  margin-bottom: var(--space-md);
}

.deck-tile-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ===================================
   Modal
   =================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: var(--text-xl);
  color: var(--color-gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--text-xl);
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

/* ===================================
   Toast Notifications
   =================================== */

.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-lg);
  animation: slideIn var(--transition-base) ease-out;
}

.toast.success {
  border-left: 3px solid var(--color-success);
}

.toast.warning {
  border-left: 3px solid var(--color-warning);
}

.toast.error {
  border-left: 3px solid var(--color-error);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===================================
   Tabs
   =================================== */

.tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--color-bg-secondary);
  padding: var(--space-xs);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.tab.active {
  background: var(--color-bg-tertiary);
  color: var(--color-gold);
}

/* ===================================
   Empty State
   =================================== */

.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state-text {
  font-size: var(--text-sm);
}

/* ===================================
   Loading
   =================================== */

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===================================
   Utilities
   =================================== */

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.mt-md {
  margin-top: var(--space-md);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.hidden {
  display: none !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

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

/* ===================================
   MTGGoldfish-Style Layout
   =================================== */

.deck-info-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
}

.deck-info-bar .deck-name-input {
  flex: 1;
  max-width: 300px;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}

.deck-info-bar select {
  width: auto;
}

.goldfish-layout {
  display: grid;
  grid-template-columns: 320px 1fr 200px;
  gap: var(--space-md);
  min-height: calc(100vh - 200px);
}

@media (max-width: 1200px) {
  .goldfish-layout {
    grid-template-columns: 280px 1fr 180px;
  }
}

@media (max-width: 1024px) {
  .goldfish-layout {
    grid-template-columns: 260px 1fr;
  }

  .stats-panel {
    display: none;
  }
}

@media (max-width: 768px) {
  .goldfish-layout {
    grid-template-columns: 1fr;
  }
}

/* Deck Input Panel */
.deck-input-panel {
  display: flex;
  flex-direction: column;
  height: fit-content;
  max-height: calc(100vh - 220px);
}

.deck-input-panel .panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-md);
}

.deck-textarea {
  flex: 1;
  min-height: 400px;
  width: 100%;
  padding: var(--space-md);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: var(--weight-normal);
  line-height: 1.7;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-fast);
}

.deck-textarea:focus {
  border-color: var(--color-accent);
}

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

.deck-input-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.deck-input-actions .btn {
  flex: 1;
}

/* Visual Deck Panel - Seamless design (not iframe-like) */
.deck-visual-panel {
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  box-shadow: none;
  /* No max-height or overflow - content flows naturally with page */
}

.deck-visual-panel .panel-header {
  background: transparent;
  border-bottom: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.06));
  padding: var(--space-sm) 0;
}

.deck-visual-body {
  padding: var(--space-md) 0 !important;
  background: transparent;
  /* No overflow - content expands naturally */
}

.deck-count-badge {
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.deck-count-badge span {
  color: var(--color-gold);
  font-weight: 600;
}

/* Deck View Header Layout */
.deck-view-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.deck-colors-display {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Deck header color mana symbols */
.deck-color-mana {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.deck-color-mana:hover {
  transform: scale(1.15);
}

/* Color distribution panel mana symbols */
.color-mana-symbol {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.deck-theme-badge {
  padding: 2px 8px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: default;
}

/* Top Cards Display (MTGGoldfish style) */
.deck-top-cards {
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) 0;
}

.deck-top-cards.hidden {
  display: none;
}

.top-cards-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.top-cards-row {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
}

.top-card-item {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.top-card-item:hover {
  transform: translateY(-4px) scale(1.02);
  z-index: 10;
}

.top-card-image {
  width: 80px;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: box-shadow var(--transition-fast);
}

.top-card-item:hover .top-card-image {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.top-card-quantity {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

/* Visual Grid by Type - 2 columns, masonry-style */
.deck-visual-grid {
  column-count: 2;
  column-gap: var(--space-lg);
  min-width: 0;
}

.type-column {
  background: transparent;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  overflow: hidden;
  break-inside: avoid;
  margin-bottom: var(--space-lg);
}

.type-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-xs);
}

.type-column-title {
  font-size: 12px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.type-column-count {
  font-size: 12px;
  color: var(--color-accent);
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: var(--weight-semibold);
}

.type-column-count-other {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.type-card-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.type-card-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  background: var(--color-bg-card);
  min-width: 0;
  overflow: hidden;
}

.type-card-item:hover {
  background: var(--color-bg-hover);
}

/* Legality indicators */
.type-card-item--illegal {
  background: rgba(237, 66, 69, 0.08);
  border-left: 3px solid var(--color-warning);
}

.type-card-item--banned {
  background: rgba(237, 66, 69, 0.12);
  border-left: 3px solid var(--color-error);
}

.type-card-item--restricted {
  background: rgba(250, 166, 26, 0.08);
  border-left: 3px solid var(--color-warning);
}

.legality-badge {
  font-size: 12px;
  line-height: 1;
}

.legality-badge--illegal {
  color: var(--color-warning);
}

.legality-badge--banned {
  color: var(--color-error);
}

.legality-badge--restricted {
  color: var(--color-warning);
}

.type-card-qty {
  min-width: 22px;
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.type-card-name {
  flex: 1;
  font-size: 14px;
  font-weight: var(--weight-normal);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.type-card-mana {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.type-card-price {
  font-size: 10px;
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  min-width: 50px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.type-card-price--na {
  opacity: 0.4;
}

/* Unknown Cards Container */
.unknown-cards-container {
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 171, 0, 0.1);
  border: 1px solid rgba(255, 171, 0, 0.3);
  border-radius: var(--radius-md);
  color: #ffab00;
  font-size: var(--text-sm);
}

.unknown-cards-container.hidden {
  display: none;
}

.unknown-cards-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.unknown-cards-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-xs);
}

.unknown-card-item {
  display: flex;
  gap: var(--space-xs);
  color: var(--color-text-description);
}

.unknown-card-qty {
  color: #ffab00;
  font-weight: 600;
  min-width: 24px;
}

.unknown-card-name {
  color: var(--color-text);
  font-weight: 500;
}

.unknown-card-board {
  color: var(--color-text-muted);
  font-style: italic;
}

.unknown-cards-help {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Mana Symbol Icons */
.mana-symbol {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

/* Sideboard Visual */
.sideboard-visual {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.sideboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.sideboard-header .panel-title {
  font-size: var(--text-base);
}

.sideboard-cards {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Stats Panel */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.stats-panel .panel {
  height: fit-content;
}

.stats-panel .search-container {
  margin-bottom: var(--space-md);
}

/* Add Target Toggle */
.add-target-toggle {
  display: flex;
  gap: var(--space-xs);
  background: var(--color-bg-secondary);
  padding: var(--space-xs);
  border-radius: var(--radius-md);
}

.toggle-btn {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-family: var(--font-primary);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn:hover {
  color: var(--color-text-secondary);
}

.toggle-btn.active {
  background: var(--color-bg-tertiary);
  color: var(--color-gold);
}

/* Compact Stats */
.deck-stats-compact {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) 0;
}

.stat-row .stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-transform: none;
}

.stat-row .stat-value {
  font-size: var(--text-sm);
  color: var(--color-gold);
}

.stat-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-xs) 0;
}

/* ===================================
   Command Palette (Cmd+K)
   =================================== */

.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.command-palette-overlay.active {
  opacity: 1;
  visibility: visible;
}

.command-palette {
  width: 90vw;
  max-width: 1400px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: translateY(-10px);
  transition: transform var(--transition-base);
}

.command-palette-overlay.active .command-palette {
  transform: translateY(0);
}

.command-palette-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.command-palette-icon {
  font-size: 22px;
  opacity: 0.6;
}

.command-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-primary);
  font-size: 18px;
  color: var(--color-text-primary);
}

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

.command-palette-shortcut {
  padding: 6px 10px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-primary);
  color: var(--color-text-muted);
}

.command-palette-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  padding: var(--space-lg);
  flex: 1;
  overflow-y: auto;
}

.command-palette-empty,
.command-palette-loading {
  grid-column: 1 / -1;
  padding: var(--space-2xl);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

.command-palette-result {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.command-palette-result:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.command-palette-result.selected {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.result-image-container {
  position: relative;
  width: 100%;
}

.result-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.result-add-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(67, 160, 71, 0.85);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  color: white;
  opacity: 0;
  transition: all var(--transition-base);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.command-palette-result:hover .result-add-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.result-info {
  display: none;
}

.result-mana {
  display: none;
}

.command-palette-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  flex-shrink: 0;
}

.command-palette-hint {
  font-size: 13px;
  color: var(--color-text-muted);
}

.command-palette-hint kbd {
  display: inline-block;
  padding: 3px 8px;
  background: var(--color-bg-card);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-primary);
}

/* Pagination */
.command-palette-pagination {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.pagination-info {
  font-size: 14px;
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

.pagination-controls {
  display: flex;
  gap: var(--space-sm);
}

.pagination-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-family: var(--font-primary);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

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

/* Mana Curve Chart - Horizontal Bars */
.mana-curve-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mana-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mana-bar-label {
  width: 24px;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-align: right;
}

.mana-bar-track {
  flex: 1;
  height: 16px;
  background: var(--color-bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.mana-bar {
  height: 100%;
  background: linear-gradient(to right, #374151, #1f2937);
  border-radius: 4px;
  min-width: 2px;
  transition: width 0.3s ease;
}

.mana-bar-value {
  width: 24px;
  font-size: 11px;
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
  text-align: left;
}

/* Pricing in Stats Panel */
.stat-row-price {
  margin-top: var(--space-xs);
}

.stat-value-price {
  font-size: 16px;
  font-weight: var(--weight-bold);
  color: var(--color-accent);
}

.currency-toggle {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 4px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

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

.input-sm {
  padding: 4px 8px;
  font-size: 12px;
  min-width: auto;
  width: auto;
}

/* Tooltip triggers - JS handles the actual tooltip */
.tooltip-trigger {
  cursor: help;
}

/* Color Distribution */
.color-distribution {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.color-bar-container {
  width: 100%;
}

.color-bar {
  display: flex;
  height: 24px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg-elevated);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.color-bar-segment {
  min-width: 6px;
  transition: all 0.2s ease;
  position: relative;
}

.color-bar-segment::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%, rgba(0, 0, 0, 0.1) 100%);
}

.color-bar-segment:hover {
  filter: brightness(1.1);
  transform: scaleY(1.1);
}

.color-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.color-breakdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.color-breakdown-item:hover {
  background: var(--color-bg-hover);
}

.color-pip {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-name {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

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

.color-pct {
  color: var(--color-accent);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  min-width: 32px;
  text-align: right;
}

.color-empty {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--space-lg);
  font-style: italic;
}