/* ==========================================================================
   GEN2DIECAST — ULTRA-PREMIUM AUTOMOTIVE DARK STYLING & THEMES
   ========================================================================== */

/* DEFAULT CARBON OBSIDIAN THEME */
:root, body.theme-carbon {
  --bg-dark: #090b10;
  --bg-card: #121622;
  --bg-card-hover: #181d2d;
  --bg-input: #1a2030;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.2);

  --accent-red: #ff2e4d;
  --accent-red-glow: rgba(255, 46, 77, 0.3);
  --accent-cyan: #00f0ff;
  --accent-cyan-glow: rgba(0, 240, 255, 0.25);
  --accent-gold: #ffd700;
  --accent-gold-glow: rgba(255, 215, 0, 0.3);
  --accent-purple: #a855f7;
  --accent-green: #00e676;
  --accent-green-glow: rgba(0, 230, 118, 0.2);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(255, 46, 77, 0.15);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* CYBERPUNK NEON THEME */
body.theme-cyberpunk {
  --bg-dark: #070714;
  --bg-card: #0e0e24;
  --bg-card-hover: #161638;
  --bg-input: #1a1a40;
  --border-color: rgba(0, 240, 255, 0.2);
  --accent-red: #ff007f;
  --accent-cyan: #00f0ff;
  --accent-gold: #00ffaa;
}

/* RACING RED THEME */
body.theme-racing {
  --bg-dark: #120507;
  --bg-card: #200a0d;
  --bg-card-hover: #2e0e12;
  --bg-input: #3a1217;
  --border-color: rgba(255, 46, 77, 0.25);
  --accent-red: #ff1e27;
  --accent-cyan: #ff9900;
  --accent-gold: #ffd700;
}

/* GOLD TREASURE HUNT THEME */
body.theme-gold {
  --bg-dark: #0f0d06;
  --bg-card: #1f1b0c;
  --bg-card-hover: #2e2812;
  --bg-input: #383015;
  --border-color: rgba(255, 215, 0, 0.25);
  --accent-red: #ff8c00;
  --accent-cyan: #ffd700;
  --accent-gold: #ffee55;
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(255, 46, 77, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(0, 240, 255, 0.05) 0%, transparent 40%),
    linear-gradient(to bottom, rgba(9, 11, 16, 0.9), rgba(9, 11, 16, 0.95));
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* SITE ANNOUNCEMENT BANNER */
.site-banner {
  background: linear-gradient(90deg, #b30024, var(--accent-red), #90001a);
  color: #fff;
  padding: 0.5rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(255, 46, 77, 0.3);
  position: relative;
  z-index: 100;
}

.banner-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1540px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ================= TOP NAVBAR ================= */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-color);
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-red), #b30024);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-red-glow);
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1;
}

.logo-text h1 span {
  color: var(--accent-red);
}

.badge-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.2);
}

/* TABS */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-red), #c80026);
  box-shadow: 0 4px 15px var(--accent-red-glow);
}

.nav-admin-btn {
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--accent-gold);
}

.nav-admin-btn:hover {
  background: rgba(255, 215, 0, 0.15);
  box-shadow: 0 0 12px var(--accent-gold-glow);
}

.nav-admin-btn.active {
  background: linear-gradient(135deg, #ffd700, #b8860b);
  color: #000;
  font-weight: 800;
  box-shadow: 0 0 20px var(--accent-gold-glow);
}

.tab-count {
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  padding: 1px 7px;
  border-radius: 10px;
}

/* NAV ACTIONS */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

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

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
}

.search-box input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.55rem 2.2rem 0.55rem 2.3rem;
  color: var(--text-main);
  font-size: 0.85rem;
  width: 260px;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
  width: 300px;
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
}

.clear-search-btn.visible {
  display: block;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-red), #c80026);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-red-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-red-glow);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color-hover);
}

.btn-danger {
  background: rgba(255, 46, 77, 0.15);
  border-color: rgba(255, 46, 77, 0.3);
  color: var(--accent-red);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
}

/* ================= MAIN CONTENT & TABS ================= */
.main-content {
  flex: 1;
  padding: 1.5rem 0 3rem;
}

.tab-view {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

/* ================= TOOLBAR & FILTERS ================= */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.scale-filters {
  display: flex;
  gap: 0.4rem;
}

.pill-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.pill-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.pill-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.filter-dropdowns {
  display: flex;
  gap: 0.6rem;
}

.select-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-family: var(--font-main);
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sort-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.view-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 2px;
  border: 1px solid var(--border-color);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.toggle-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* SUMMARY STRIP */
.garage-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  background: linear-gradient(135deg, rgba(255, 46, 77, 0.05), rgba(0, 240, 255, 0.03));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
}

.strip-item {
  display: flex;
  flex-direction: column;
}

.strip-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 700;
}

.strip-val {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ================= GARAGE GRID & CARDS ================= */
.garage-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.5rem;
}

.car-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-card);
}

.car-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-color-hover);
  box-shadow: 0 15px 35px -10px rgba(0,0,0,0.7), 0 0 20px rgba(255, 46, 77, 0.1);
}

.card-media {
  position: relative;
  width: 100%;
  height: 200px;
  background: #0d101a;
  overflow: hidden;
  cursor: pointer;
}

.card-media img {
  width: 100%;
  height: 100%;
  /* Catalog photos are portrait card shots — cover would crop the car out of frame. */
  object-fit: contain;
  transition: transform 0.4s ease;
}

.car-card:hover .card-media img {
  transform: scale(1.05);
}

.badge-scale {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.badge-rarity {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-sth {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
  font-weight: 900;
  box-shadow: 0 0 12px var(--accent-gold-glow);
}

.badge-th {
  background: rgba(255, 215, 0, 0.2);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
}

.badge-rlc {
  background: linear-gradient(135deg, var(--accent-red), #900);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-red-glow);
}

.badge-chase {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-purple);
  border: 1px solid var(--accent-purple);
}

.badge-mainline {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-brand {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.card-title:hover {
  color: var(--accent-red);
}

.card-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.meta-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-family: inherit;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 4px;
}

/* Clickable tags filter the garage — they need to read as interactive */
.meta-pill-link {
  cursor: pointer;
  border-style: dashed;
  transition: var(--transition);
}

.meta-pill-link:hover,
.meta-pill-link:focus-visible {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  border-style: solid;
  background: rgba(0, 240, 255, 0.1);
  outline: none;
}

/* ACTIVE TAG FILTER CHIPS */
.active-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.active-filters-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-main);
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.35rem 0.25rem 0.7rem;
}

.filter-chip strong {
  color: var(--accent-cyan);
}

.filter-chip-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.filter-chip-x:hover {
  color: #fff;
  background: var(--accent-red);
}

.card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.card-actions button {
  flex: 1;
  padding: 0.45rem;
  font-size: 0.78rem;
}

/* ================= TABLE VIEW ================= */
.garage-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.85rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover {
  background: var(--bg-card-hover);
}

.table-thumb {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
}

/* ================= ANALYTICS DASHBOARD ================= */
.analytics-header {
  margin-bottom: 1.5rem;
}

.analytics-header h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
}

.analytics-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.kpi-card.glow-cyan { border-color: rgba(0, 240, 255, 0.3); }
.kpi-card.glow-gold { border-color: rgba(255, 215, 0, 0.3); }
.kpi-card.glow-green { border-color: rgba(0, 230, 118, 0.3); }
.kpi-card.glow-purple { border-color: rgba(168, 85, 247, 0.3); }

.kpi-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 700;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.chart-card.full-width {
  grid-column: span 2;
}

.chart-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: block;
  margin-bottom: 1rem;
}

.chart-body {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-body.height-lg {
  height: 320px;
}

/* ================= WISHLIST RADAR ================= */
.wishlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.wishlist-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.wish-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

.wish-priority {
  font-size: 0.85rem;
  color: var(--accent-gold);
  margin-bottom: 0.4rem;
}

.wish-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* ================= ADMIN HUB ================= */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 46, 77, 0.05));
  border: 1px solid rgba(255, 215, 0, 0.3);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.admin-badge-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-shield-icon {
  font-size: 2.2rem;
  width: 54px;
  height: 54px;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.admin-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.glow-admin {
  background: rgba(255, 215, 0, 0.15);
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold-glow);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.admin-card.full-width {
  grid-column: span 2;
}

.admin-card-header h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.admin-card-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: block;
  margin-bottom: 1rem;
}

.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-group-vertical button {
  justify-content: flex-start;
  text-align: left;
}

.storage-metrics {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.metric-tag {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-tag strong {
  color: var(--accent-cyan);
}

/* ================= MODALS ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-box.modal-lg {
  max-width: 820px;
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

/* FORM GRID */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.col-full {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.input-with-preset {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.input-with-preset textarea {
  flex: 1;
  resize: vertical;
  min-height: 42px;
  font-family: inherit;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.preset-images-picker {
  margin-top: 0.5rem;
}

.preset-title {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.4rem;
}

.preset-thumbs {
  display: flex;
  gap: 0.5rem;
}

.preset-thumbs img {
  width: 50px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.preset-thumbs img:hover,
.preset-thumbs img.selected {
  border-color: var(--accent-cyan);
  transform: scale(1.05);
}

/* DETAIL MODAL LAYOUT */
.detail-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}

.detail-media {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gallery-stage {
  position: relative;
}

.detail-media img {
  width: 100%;
  height: 340px;
  /* Portrait card shots need the full frame, not a centre crop. */
  object-fit: contain;
  background: #0d101a;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: block;
}

/* Video layers share the stage box with the still image */
#detail-embed,
#detail-video {
  display: block;
  width: 100%;
  height: 340px;
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

#detail-embed.hidden,
#detail-video.hidden {
  display: none;
}

.gallery-thumb.is-video {
  position: relative;
}

.gallery-thumb-play {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 0.6rem;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 3px;
  padding: 2px 3px;
  pointer-events: none;
}

.gallery-thumb-blank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1rem;
  color: var(--accent-cyan);
  background: #0d101a;
}

.gallery-counter {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.gallery-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.gallery-thumb {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  padding: 0;
  background: #0d101a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  overflow: hidden;
  opacity: 0.6;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gallery-thumb:hover { opacity: 1; }

.gallery-thumb.is-active {
  opacity: 1;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}

.fin-val.gold { color: var(--accent-gold); }
.fin-val.gain { color: var(--accent-green); }

.detail-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.spec-cell {
  background: rgba(255, 255, 255, 0.02);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.spec-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: block;
}

.spec-val {
  font-weight: 600;
  font-size: 0.85rem;
}

.detail-notes-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* CATALOG RECORD (scraped source fields) */
.detail-source-box {
  margin-top: 0.85rem;
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  background: rgba(0, 240, 255, 0.04);
}

.detail-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.detail-source-head h4 {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.source-site {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.source-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-decoration: none;
  white-space: nowrap;
}

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

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem 1rem;
  margin: 0;
}

.source-cell dt {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}

.source-cell dd {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.source-cell.is-empty dd {
  color: var(--text-dim);
  font-weight: 500;
}

/* BACKUP & UTILS */
.backup-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.backup-section h4 {
  margin-bottom: 0.25rem;
}

.backup-section p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
}

.danger-zone {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin: 2rem 0;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--accent-cyan);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-weight: 600;
  font-size: 0.88rem;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

.hidden {
  display: none !important;
}

.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-shadow: none;
  text-overflow: ellipsis;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .charts-grid, .admin-grid { grid-template-columns: 1fr; }
  .chart-card.full-width, .admin-card.full-width { grid-column: span 1; }
  .detail-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .col-full { grid-column: span 1; }
}

/* LOAD MORE (catalog paging) */
.load-more-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.load-more-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* file:// fallback for blocked YouTube/Vimeo embeds */
.embed-fallback {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  height: 340px;
  overflow: hidden;
  text-align: center;
  text-decoration: none;
  color: var(--text-main);
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.embed-fallback.hidden { display: none; }

.embed-fallback img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}

.embed-fallback-play,
.embed-fallback-note { position: relative; }

.embed-fallback-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  font-size: 1.2rem;
  color: #fff;
  background: var(--accent-red);
  border-radius: 50%;
  box-shadow: 0 4px 20px var(--accent-red-glow);
}

.embed-fallback-note {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.5;
  padding: 0 1rem;
}

.embed-fallback-note small {
  font-weight: 400;
  color: var(--text-muted);
}

.embed-fallback:hover .embed-fallback-play { transform: scale(1.08); }
