:root {
  --bg-dark: #09090b;       
  --bg-panel: #141417;      
  --bg-hover: #1f1f24;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 229, 255, 0.4);
  
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  
  --accent: #00e5ff;        
  --accent-glow: rgba(0, 229, 255, 0.15);
  --gold: #f5d76e;          
  --gold-glow: rgba(245, 215, 110, 0.15);
  
  --radius: 8px;
  --radius-lg: 16px;
  --font: 'Inter', sans-serif; 
}

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

body {
  font-family: var(--font);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* --- Top Navigation --- */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--text-main);
}

.brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #007bb5, var(--accent));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #000; font-weight: 800;
}

.dev-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.2s;
}
.dev-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* --- Layout Shell --- */
.app-shell {
  display: flex;
  flex: 1;
}

/* --- Sidebar --- */
.sidebar {
  width: 240px;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar.hidden {
  width: 0;
  padding: 0;
  overflow: hidden;
  transform: translateX(-100%);
  border-right: none;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-btn.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 2rem;
  overflow-y: auto;
}

.view { display: none; width: 100%; max-width: 1000px; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- Hero Search Component --- */
.hero-container {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-container h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: -webkit-linear-gradient(0deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-wrapper {
  display: flex;
  gap: 12px;
  max-width: 700px;
  margin: 0 auto;
}

.hero-input {
  flex: 1;
  padding: 16px 24px;
  font-size: 1.1rem;
  font-family: var(--font);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 30px;
  color: var(--text-main);
  outline: none;
  transition: 0.2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.hero-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 20px rgba(0,0,0,0.4);
}

.hero-select {
  padding: 0 20px;
  font-size: 1rem;
  font-family: var(--font);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 30px;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.hero-select:focus {
  border-color: var(--accent);
}

/* --- Data Table --- */
.table-container {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
th {
  padding: 14px 20px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover { background: var(--bg-hover); }

.col-card { font-weight: 500; font-size: 1rem; }
.col-set { color: var(--text-muted); font-size: 0.8rem; font-family: monospace; }
.col-price { color: var(--text-main); font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 4px;
}
.tag.holo { background: var(--gold-glow); color: var(--gold); border: 1px solid rgba(245, 215, 110, 0.3); }
.tag.owner { background: var(--border); color: var(--text-main); }
.tag.owner-library { background: rgba(90, 143, 173, 0.15); color: #5a8fad; border: 1px solid rgba(90, 143, 173, 0.3); }

/* --- My Collection View --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}
.stat-card h3 { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; margin-bottom: 8px; }
.stat-card .value { font-size: 2.5rem; font-weight: 700; color: var(--accent); }

.import-card {
  background: var(--bg-panel);
  border: 1px dashed var(--border-focus);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* =========================================
   MOBILE RESPONSIVENESS (< 768px)
   ========================================= */
@media (max-width: 768px) {
  .topbar { padding: 0 1.2rem; }
  .app-shell { flex-direction: column; }

  .sidebar {
    width: 100%;
    flex-direction: row;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    transition: none;
  }
  .sidebar.hidden { display: none; }
  .sidebar > div:first-child { display: none; }
  
  .nav-btn {
    flex: 1;
    justify-content: center;
    border-radius: 0;
    border-left: none !important;
    border-bottom: 2px solid transparent;
    padding: 14px 8px;
    margin: 0;
  }
  .nav-btn.active {
    background: transparent;
    border-bottom: 2px solid var(--accent);
  }

  .main-content {
    padding: 1.5rem 0; 
  }
  
  .hero-container {
    padding: 0 1rem; 
  }
  .hero-container h1 { font-size: 2rem; }
  .search-wrapper { flex-direction: column; }
  .hero-input, .hero-select { width: 100%; border-radius: 12px; }
  .hero-select { padding: 14px 20px; }

  .table-container {
    border-radius: 0;
    border-left: none;
    border-right: none;
    overflow-x: hidden; 
  }

  table {
    table-layout: fixed; 
    width: 100%;
  }
  
  th, td {
    padding: 10px 4px; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  th {
    font-size: 0.7rem; 
  }

  th:nth-child(1) { width: 38%; } 
  th:nth-child(2) { width: 15%; } 
  th:nth-child(3) { width: 22%; } 
  th:nth-child(4) { width: 8%;  } 
  th:nth-child(5) { width: 17%; } 

  .col-card, .col-set {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}