/* ═══════════════════════════════════════════════════════════════
   ROMs Vault — Design System
   Dark premium retro vault theme
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ──────────────────────────────────────────── */

:root {
  /* Base colors */
  --bg-primary: #06060f;
  --bg-secondary: #0c0c1d;
  --bg-tertiary: #12122a;
  --bg-card: rgba(15, 15, 35, 0.85);
  --bg-glass: rgba(18, 18, 42, 0.6);

  /* Accent colors */
  --red-neon: #ff1a3c;
  --red-glow: #ff1a3c66;
  --red-dim: #991127;
  --gold: #c8a84e;
  --gold-dim: #8a7435;
  --cyan: #00d4ff;
  --cyan-dim: #007a94;
  --purple: #8b5cf6;

  /* Text */
  --text-primary: #e8e6f0;
  --text-secondary: #9896a8;
  --text-muted: #5c5a6e;
  --text-accent: var(--red-neon);

  /* Borders */
  --border-default: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 26, 60, 0.3);
  --border-accent: rgba(255, 26, 60, 0.5);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--red-glow);

  /* Spacing */
  --nav-height: 64px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

/* ─── Reset & Base ───────────────────────────────────────────── */

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

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(255, 26, 60, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.05), transparent),
    radial-gradient(ellipse 50% 50% at 10% 60%, rgba(0, 212, 255, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--red-neon);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #ff4d6a;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ─── Typography ─────────────────────────────────────────────── */

h1, h2, h3 {
  font-family: 'Orbitron', monospace, sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  background: linear-gradient(135deg, var(--red-neon), #ff6b8a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: var(--text-primary);
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Layout ─────────────────────────────────────────────────── */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* ─── Header / Navbar ────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 6, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-default);
  padding: 16px 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--red-neon), var(--purple));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 18px;
  color: white;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.site-logo .logo-text {
  font-family: 'Orbitron', monospace;
  font-weight: 800;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--text-primary), var(--red-neon));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-logo .logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: block;
  margin-top: -2px;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(255, 26, 60, 0.15), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--red-neon);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search-box {
  position: relative;
  flex: 0 1 320px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(255, 26, 60, 0.1);
}

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

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

/* ─── Alphabet Navigation ────────────────────────────────────── */

.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 24px;
}

.alpha-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.alpha-nav a:hover {
  color: var(--red-neon);
  background: rgba(255, 26, 60, 0.08);
  border-color: var(--border-hover);
}

.alpha-nav a.active {
  color: var(--bg-primary);
  background: var(--red-neon);
  border-color: var(--red-neon);
  box-shadow: var(--shadow-glow);
}

.alpha-nav a.disabled {
  color: var(--text-muted);
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ─── Game List ──────────────────────────────────────────────── */

.current-letter {
  text-align: center;
  margin-bottom: 20px;
}

.current-letter span {
  font-family: 'Orbitron', monospace;
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--red-neon), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.game-count {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

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

.game-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.game-row:hover {
  background: rgba(255, 26, 60, 0.06);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.game-row .game-title {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: color var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-row:hover .game-title {
  color: var(--red-neon);
}

.game-row .game-region {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 80px;
  text-align: center;
}

.game-row .game-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--gold);
  min-width: 50px;
  text-align: center;
  background: rgba(200, 168, 78, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.game-row .game-size {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

.game-row .game-rating {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--cyan);
  min-width: 40px;
  text-align: center;
}

/* ─── Preview Tooltip ────────────────────────────────────────── */

.preview-tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  max-width: 280px;
}

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

.preview-tooltip .preview-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.preview-tooltip .preview-image {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: #000;
}

.preview-tooltip .preview-info {
  padding: 12px;
}

.preview-tooltip .preview-title {
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.preview-tooltip .preview-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─── Detail Page ────────────────────────────────────────────── */

.detail-page {
  padding: 32px 0 64px;
}

.detail-header {
  text-align: center;
  margin-bottom: 40px;
}

.detail-header .platform-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.detail-header h1 {
  margin-bottom: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}

/* Glass card */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

/* Metadata table */
.meta-table {
  width: 100%;
  border-collapse: collapse;
}

.meta-table tr {
  border-bottom: 1px solid var(--border-default);
}

.meta-table tr:last-child {
  border-bottom: none;
}

.meta-table th {
  text-align: left;
  padding: 10px 16px 10px 0;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
  width: 120px;
}

.meta-table td {
  padding: 10px 0;
  color: var(--text-primary);
  font-size: 0.9rem;
  word-break: break-word;
}

.meta-table .hash-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--cyan);
  word-break: break-all;
}

.meta-section-title {
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red-neon);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-accent);
}

/* Media gallery */
.media-gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.vimm-media-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  padding: 10px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  width: fit-content;
}

.vimm-media-item img {
  max-width: 280px;
  max-height: 280px;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.vimm-media-label {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Orbitron', monospace;
  letter-spacing: 0.05em;
}

/* Download section */
.download-section {
  margin-top: 32px;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(255, 26, 60, 0.15), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  margin-bottom: 8px;
}

.download-btn:hover {
  background: linear-gradient(135deg, rgba(255, 26, 60, 0.25), rgba(139, 92, 246, 0.2));
  border-color: var(--red-neon);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
  color: white;
}

.download-btn .dl-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.download-btn .dl-size {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Description */
.game-description {
  margin-top: 32px;
}

.game-description p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
}

/* ─── Empty State ────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.1rem;
}

/* ─── Footer ─────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border-default);
  padding: 24px 0;
  margin-top: 64px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  position: relative;
  z-index: 1;
}

/* ─── Loading Spinner ────────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-default);
  border-top-color: var(--red-neon);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── Pagination ─────────────────────────────────────────────── */

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.pagination button {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination button:hover {
  border-color: var(--border-hover);
  color: var(--red-neon);
}

.pagination button.active {
  background: var(--red-neon);
  color: white;
  border-color: var(--red-neon);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ─── Region Flags ───────────────────────────────────────────── */

.region-flag {
  font-size: 1.1rem;
}

/* ─── Responsive ─────────────────────────────────────────────── */

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

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .site-logo {
    justify-content: center;
  }

  .search-box {
    flex: 1 1 100%;
  }

  .alpha-nav a {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .game-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .game-row .game-region,
  .game-row .game-size {
    display: none;
  }

  .game-row .game-title {
    font-size: 0.85rem;
  }

  .container {
    padding: 0 12px;
  }

  .detail-grid {
    gap: 20px;
  }

  .glass-card {
    padding: 16px;
  }

  .preview-tooltip {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .alpha-nav a {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }

  .game-row .game-version {
    display: none;
  }

  h1 {
    font-size: 1.3rem;
  }
}

/* ─── Scrollbar ──────────────────────────────────────────────── */

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

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--red-dim);
}

/* Autocomplete suggestions dropdown */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-top: 8px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-default);
  transition: background var(--transition-fast);
}

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

.suggestion-item:hover,
.suggestion-item.active {
  background: rgba(255, 255, 255, 0.05);
}

.suggestion-thumb {
  width: 32px;
  height: 48px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: #000;
  border: 1px solid var(--border-default);
}

.suggestion-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
}

.suggestion-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.suggestion-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

.suggestion-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ROM Verification / Hash Checker Tool */
.hash-checker-dropzone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.01);
  margin-top: 12px;
}

.hash-checker-dropzone:hover,
.hash-checker-dropzone.dragover {
  border-color: var(--red-neon);
  background: rgba(255, 0, 85, 0.03);
}

.dropzone-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.dropzone-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.dropzone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.hash-checker-results {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.verification-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(0, 255, 136, 0.1);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.badge-danger {
  background: rgba(255, 0, 85, 0.1);
  color: var(--red-neon);
  border: 1px solid rgba(255, 0, 85, 0.2);
}

.hash-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--red-neon);
  transition: width 0.1s linear;
}

/* Vimm-style Media Slider */
.vimm-media-wrapper {
  background: #000;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16/10;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.vimm-media-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.vimm-media-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.vimm-control-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.vimm-control-btn:hover {
  background: var(--red-dim);
  border-color: var(--red-neon);
}

.vimm-control-label {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-family: 'Orbitron', monospace;
  min-width: 120px;
  text-align: center;
}
