/* ============================================================
   The Adventure Game Database — v2 theme
   Built on Bootstrap 5.3 (native data-bs-theme dark/light)
   ============================================================ */

:root {
  --agdb-accent:        #ff7a18;
  --agdb-accent-2:      #ffae34;
  --agdb-accent-grad:   linear-gradient(135deg, #ff6a00 0%, #ffb020 100%);
  --agdb-radius:        14px;
}

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  letter-spacing: -0.01em;
}

main { flex: 1 0 auto; }

/* ----- Theme surface colors ----- */
[data-bs-theme="dark"] {
  --bs-body-bg: #0e0e16;
  --bs-body-color: #e6e6f0;
  --bs-tertiary-bg: #181826;
  --agdb-surface: #15151f;
  --agdb-surface-2: #1d1d2b;
  --agdb-border: rgba(255,255,255,.08);
}
[data-bs-theme="light"] {
  --bs-body-bg: #f4f4f8;
  --agdb-surface: #ffffff;
  --agdb-surface-2: #f0f0f6;
  --agdb-border: rgba(0,0,0,.08);
}

[data-bs-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255,122,24,.12), transparent 60%),
    radial-gradient(1000px 500px at 0% 0%, rgba(255,174,52,.08), transparent 55%),
    var(--bs-body-bg);
  background-attachment: fixed;
}

/* ----- Brand / accents ----- */
.text-gradient {
  background: var(--agdb-accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-accent {
  background: var(--agdb-accent-grad);
  border: none;
  color: #fff;
  font-weight: 600;
}
.btn-accent:hover, .btn-accent:focus { color: #fff; filter: brightness(1.08); }

a { text-decoration: none; }
a:hover { text-decoration: none; }

/* ----- Navbar ----- */
.agdb-navbar {
  background: color-mix(in srgb, var(--bs-body-bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--agdb-border);
}
.agdb-navbar .navbar-brand { padding-top: 0; padding-bottom: 0; }
.brand-logo { height: 34px; width: auto; display: block; }
.hero-logo { max-width: 620px; width: 100%; height: auto; }
.footer-logo { height: 26px; width: auto; opacity: .9; }
.agdb-navbar .nav-link { font-weight: 500; border-radius: 8px; padding: .4rem .7rem; }
.agdb-navbar .nav-link:hover { background: var(--agdb-surface-2); }

.theme-toggle { cursor: pointer; border: none; background: transparent; color: inherit; }

/* ----- Cards ----- */
.card {
  background: var(--agdb-surface);
  border: 1px solid var(--agdb-border);
  border-radius: var(--agdb-radius);
}
.card-header, .card-footer { background: var(--agdb-surface-2); border-color: var(--agdb-border); }

.agdb-soft {
  background: var(--agdb-surface);
  border: 1px solid var(--agdb-border);
  border-radius: var(--agdb-radius);
}

/* ----- Hero ----- */
.hero {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  padding: clamp(2.5rem, 6vw, 5rem) 1.25rem;
  text-align: center;
  border: 1px solid var(--agdb-border);
  background:
    radial-gradient(900px 380px at 50% -40%, rgba(255,122,24,.28), transparent 70%),
    var(--agdb-surface);
}
.hero h1 { font-weight: 800; letter-spacing: -0.04em; }
.hero .search-wrap { max-width: 640px; margin: 0 auto; }
.hero .form-control { border-radius: 999px; padding: .85rem 1.3rem; }

/* ----- Game grid cards ----- */
.game-card {
  display: block;
  height: 100%;
  background: var(--agdb-surface);
  border: 1px solid var(--agdb-border);
  border-radius: var(--agdb-radius);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  color: inherit;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--agdb-accent) 55%, transparent);
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.game-card .cover {
  aspect-ratio: 3 / 4;
  width: 100%;
  object-fit: cover;
  background: #0c0c14;
  display: block;
}
.game-card .cover.placeholder-cover {
  display: flex; align-items: center; justify-content: center;
  background: var(--agdb-accent-grad);
  color: #fff; font-weight: 700; text-align: center; padding: 1rem;
}
.game-card .body { padding: .7rem .8rem; }
.game-card .title { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.game-card .meta { font-size: .78rem; opacity: .7; }

/* ----- Badges ----- */
.badge.tag { background: var(--agdb-surface-2); color: var(--bs-body-color); border: 1px solid var(--agdb-border); font-weight: 500; }
.badge-accent { background: var(--agdb-accent-grad); color: #fff; }

/* ----- Section headers ----- */
.section-title { font-weight: 700; letter-spacing: -0.02em; }
.section-title .see-all { font-size: .85rem; font-weight: 500; }

/* ----- Tables / DataTables ----- */
table.dataTable thead th { font-weight: 600; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--agdb-accent) !important;
  border-color: var(--agdb-accent) !important;
  color: #fff !important;
}
.page-link { color: var(--agdb-accent); }
.page-item.active .page-link { background: var(--agdb-accent); border-color: var(--agdb-accent); }

/* ----- Game detail hero ----- */
.detail-hero {
  position: relative;
  min-height: 230px;
  background-size: cover;
  background-position: center top;
  border-radius: var(--agdb-radius) var(--agdb-radius) 0 0;
}
.detail-hero .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8,8,14,.94) 0%, rgba(8,8,14,.35) 55%, rgba(8,8,14,.10) 100%);
  border-radius: inherit;
}
.detail-hero .titlebar {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1rem 1.25rem;
  display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem;
}
.detail-hero h1 { color: #fff; font-weight: 800; letter-spacing: -0.03em; }

.screen-thumb { transition: opacity .15s ease, transform .15s ease; cursor: pointer; border-radius: 10px; }
.screen-thumb:hover { opacity: .85; transform: scale(1.01); }

.meta-label { min-width: 120px; flex-shrink: 0; opacity: .7; }

.sticky-side { position: sticky; top: 84px; }

/* ----- Footer ----- */
.agdb-footer {
  border-top: 1px solid var(--agdb-border);
  background: var(--agdb-surface);
  flex-shrink: 0;
}
.agdb-footer a { color: var(--bs-body-color); opacity: .8; }
.agdb-footer a:hover { opacity: 1; color: var(--agdb-accent); }

/* ----- select2 dark fixes ----- */
[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
  background-color: var(--agdb-surface-2);
  border-color: var(--agdb-border);
  color: var(--bs-body-color);
}
[data-bs-theme="dark"] .select2-selection__rendered { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .select2-dropdown { background-color: var(--agdb-surface-2); border-color: var(--agdb-border); }
[data-bs-theme="dark"] .select2-results__option { color: var(--bs-body-color); }
[data-bs-theme="dark"] .select2-search__field { background: var(--agdb-surface); color: var(--bs-body-color); }

/* selected pills in multi-select: keep readable text in both themes */
[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--agdb-accent);
  border-color: transparent;
  color: #fff;
}
[data-bs-theme="dark"] .select2-container--default .select2-selection__choice__remove { color: #fff; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--agdb-accent);
  border-color: transparent;
  color: #fff;
}
.select2-container--default .select2-selection__choice__remove { color: #fff; opacity: .85; }
.select2-container--default .select2-selection__choice__remove:hover { color: #fff; opacity: 1; }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: var(--agdb-accent); }
.select2-container { width: 100% !important; }

/* prevent flash before theme JS */
.no-flash { visibility: hidden; }
