/* ============================================
   CARD VAULT — Style System
   cards.dougietools.com
   ============================================ */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #0f0f18;
  --bg-card: #12121e;
  --bg-card-hover: #181828;
  --bg-elevated: #1a1a2e;
  --bg-input: #0e0e1a;
  --border: #1e1e35;
  --border-hover: #2a2a45;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a8;
  --text-muted: #555570;
  --cyan: #00d4ff;
  --cyan-dim: #00d4ff22;
  --cyan-glow: #00d4ff40;
  --purple: #8b5cf6;
  --purple-dim: #8b5cf622;
  --purple-glow: #8b5cf640;
  --green: #22c55e;
  --green-dim: #22c55e20;
  --yellow: #eab308;
  --yellow-dim: #eab30820;
  --red: #ef4444;
  --red-dim: #ef444420;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
  --font-heading: 'JetBrains Mono', monospace;
  --font-body: 'Inter', -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- HEADER ---- */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 36px;
  filter: drop-shadow(0 0 8px var(--cyan-glow));
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.header-stats {
  display: flex;
  gap: 24px;
}

.header-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.header-stat-value {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
}

.header-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---- TAB NAV ---- */
.tab-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 68px;
  z-index: 99;
}

.tab-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-nav-inner::-webkit-scrollbar { display: none; }

.tab-btn {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 14px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.tab-icon {
  margin-right: 6px;
  font-size: 11px;
}

/* ---- MAIN ---- */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 200px);
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

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

/* ---- COLLECTION TAB ---- */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-bar {
  display: flex;
  gap: 8px;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

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

.filter-btn.active {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: var(--cyan);
}

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

.sort-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.sort-select {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--cyan);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: default;
  position: relative;
}

.card-tile:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 212, 255, 0.08), 0 4px 16px rgba(0, 0, 0, 0.4);
}

.card-tile:hover .card-image {
  box-shadow: inset 0 0 30px var(--cyan-dim);
}

.card-image {
  height: 180px;
  background: linear-gradient(145deg, var(--bg-secondary), var(--bg-elevated));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.card-image::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 140px;
  border: 2px solid var(--border);
  border-radius: 8px;
  transform: translate(-50%, -50%);
  opacity: 0.3;
}

.card-image-set {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 600;
  color: var(--purple);
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  margin-bottom: 4px;
}

.card-image-name {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 12px;
}

.card-image-num {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
}

.card-badge.owned {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green);
}

.card-badge.want {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid var(--yellow);
}

.card-info {
  padding: 16px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.card-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-value {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--cyan);
}

.card-condition {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* ---- CHECKLIST TAB ---- */
.checklist-progress {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-bar-track {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

.checklist-group {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.checklist-group-header {
  background: var(--bg-card);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}

.checklist-group-header:hover {
  background: var(--bg-card-hover);
}

.checklist-group-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: 0.5px;
}

.checklist-group-count {
  font-size: 12px;
  color: var(--text-muted);
}

.checklist-group-toggle {
  color: var(--text-muted);
  transition: transform var(--transition);
  font-size: 12px;
}

.checklist-group.collapsed .checklist-group-toggle {
  transform: rotate(-90deg);
}

.checklist-group.collapsed .checklist-items {
  display: none;
}

.checklist-items {
  background: var(--bg-secondary);
}

.checklist-row {
  display: grid;
  grid-template-columns: 40px 1fr 100px 80px 90px;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  transition: background var(--transition);
}

.checklist-row:hover {
  background: var(--bg-card);
}

.checklist-cb {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
  cursor: pointer;
}

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

.checklist-parallel {
  color: var(--text-secondary);
  font-size: 12px;
}

.checklist-value {
  font-family: var(--font-heading);
  color: var(--cyan);
  font-weight: 600;
  font-size: 13px;
}

.checklist-notes {
  color: var(--text-muted);
  font-size: 11px;
}

/* ---- MARKET TAB ---- */
.market-header {
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.market-search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.market-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.market-input:focus {
  border-color: var(--cyan);
}

.market-search-btn {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: none;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff;
  cursor: pointer;
  transition: opacity var(--transition);
  letter-spacing: 0.5px;
}

.market-search-btn:hover {
  opacity: 0.9;
}

.alert-strip {
  background: var(--purple-dim);
  border: 1px solid var(--purple);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-icon {
  font-size: 16px;
}

.market-listing {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 20px;
  transition: border-color var(--transition);
}

.market-listing:hover {
  border-color: var(--border-hover);
}

.listing-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.listing-seller {
  font-size: 11px;
  color: var(--text-muted);
}

.listing-seller .stars {
  color: var(--yellow);
}

.listing-price {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
}

.listing-price.bid {
  color: var(--cyan);
}

.listing-time {
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
  text-align: center;
}

.listing-time-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.listing-alert-btn {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--cyan);
  background: var(--cyan-dim);
  color: var(--cyan);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.listing-alert-btn:hover {
  background: var(--cyan);
  color: var(--bg-primary);
}

.market-footer {
  margin-top: 32px;
  text-align: center;
}

.coming-soon-note {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: inline-block;
}

/* ---- PORTFOLIO TAB ---- */
.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-card-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-card-value.cyan { color: var(--cyan); }
.stat-card-value.purple { color: var(--purple); }
.stat-card-value.green { color: var(--green); }
.stat-card-value.yellow { color: var(--yellow); }

.stat-card-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.portfolio-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.portfolio-chart-section,
.portfolio-recent {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.css-chart {
  margin-top: 20px;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.chart-label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 100px;
  flex-shrink: 0;
  text-align: right;
  font-weight: 500;
}

.chart-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
  position: relative;
}

.chart-bar-fill.cyan { background: linear-gradient(90deg, var(--cyan), #00a8cc); }
.chart-bar-fill.purple { background: linear-gradient(90deg, var(--purple), #6d3fd4); }
.chart-bar-fill.green { background: linear-gradient(90deg, var(--green), #16a34a); }

.chart-bar-value {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.acquisition-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.acq-date {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.acq-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.acq-paid {
  font-family: var(--font-heading);
  font-size: 13px;
  color: var(--text-secondary);
}

.acq-current {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
}

.acq-current.up { color: var(--green); }
.acq-current.down { color: var(--red); }

/* ---- FOOTER ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  margin-top: 48px;
}

.footer-inner {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.footer-sep {
  color: var(--border);
}

.footer-link {
  color: var(--cyan);
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 12px 16px;
  }

  .brand-name {
    font-size: 18px;
  }

  .header-stats {
    gap: 16px;
  }

  .header-stat-value {
    font-size: 15px;
  }

  main {
    padding: 16px;
  }

  .tab-btn {
    padding: 12px 14px;
    font-size: 12px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-image {
    height: 150px;
  }

  .portfolio-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .portfolio-sections {
    grid-template-columns: 1fr;
  }

  .checklist-row {
    grid-template-columns: 36px 1fr 70px 60px;
    font-size: 12px;
  }

  .checklist-notes {
    display: none;
  }

  .market-listing {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .listing-time,
  .listing-alert-btn {
    display: none;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .header-stats {
    display: none;
  }

  .portfolio-stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card-value {
    font-size: 22px;
  }

  .chart-label {
    width: 70px;
    font-size: 10px;
  }

  .acquisition-item {
    grid-template-columns: 1fr auto auto;
    gap: 10px;
  }

  .acq-date {
    display: none;
  }

  .market-search {
    flex-direction: column;
  }
}
