/* ============================================================
   NexusPlay — Main Stylesheet
   Dark gaming aesthetic: deep navy + electric violet accent
   ============================================================ */

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

/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-900:   #0a0d14;
  --bg-800:   #10141f;
  --bg-700:   #161b2e;
  --bg-600:   #1e2540;
  --bg-500:   #252d4a;
  --accent:   #7c3aed;
  --accent-h: #6d28d9;
  --accent-l: #a78bfa;
  --neon:     #06b6d4;
  --neon-h:   #0891b2;
  --gold:     #f59e0b;
  --green:    #10b981;
  --red:      #ef4444;
  --text-100: #f1f5f9;
  --text-200: #cbd5e1;
  --text-400: #64748b;
  --radius:   10px;
  --shadow:   0 4px 24px rgba(0,0,0,.5);
  --trans:    .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-900);
  color: var(--text-100);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Typography ── */
h1,h2,h3,h4,h5 { font-family: 'Rajdhani', sans-serif; letter-spacing: .5px; }
a { color: var(--accent-l); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--neon); }
img { max-width: 100%; display: block; }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(10,13,20,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(124,58,237,.25);
  padding: 0 1.5rem;
}
.nav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 1.5rem;
  height: 64px;
}
.nav-logo {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.6rem; font-weight: 700;
  color: var(--text-100); flex-shrink: 0;
  display: flex; align-items: center; gap: .4rem;
}
.nav-logo span { color: var(--accent-l); }
.nav-links { display: flex; align-items: center; gap: .25rem; flex: 1; }
.nav-links a {
  color: var(--text-200); font-size: .875rem; font-weight: 500;
  padding: .5rem .85rem; border-radius: 6px;
  transition: all var(--trans);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text-100); background: rgba(124,58,237,.15);
}
.nav-right { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.nav-search {
  display: flex; align-items: center;
  background: var(--bg-700); border: 1px solid var(--bg-500);
  border-radius: 8px; padding: .4rem .85rem; gap: .5rem;
  transition: border-color var(--trans);
}
.nav-search:focus-within { border-color: var(--accent); }
.nav-search input {
  background: none; border: none; outline: none;
  color: var(--text-100); font-size: .85rem; width: 200px;
}
.nav-search input::placeholder { color: var(--text-400); }
.cart-btn {
  position: relative; color: var(--text-200);
  background: var(--bg-700); border: 1px solid var(--bg-500);
  border-radius: 8px; padding: .5rem .75rem;
  font-size: 1.1rem; cursor: pointer; transition: all var(--trans);
  display: flex; align-items: center; gap: .4rem;
  text-decoration: none;
}
.cart-btn:hover { border-color: var(--accent); color: var(--text-100); }
.cart-count {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: #fff;
  font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.25rem; border-radius: 8px;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  border: none; transition: all var(--trans); text-decoration: none;
  font-family: 'Inter', sans-serif;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); color: #fff; transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--text-200);
  border: 1px solid var(--bg-500);
}
.btn-outline:hover { border-color: var(--accent); color: var(--text-100); }
.btn-neon { background: var(--neon); color: var(--bg-900); }
.btn-neon:hover { background: var(--neon-h); color: var(--bg-900); transform: translateY(-1px); }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.75rem; font-size: 1rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.user-menu { position: relative; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--neon));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1rem;
  cursor: pointer; border: 2px solid var(--bg-500); transition: border-color var(--trans);
}
.user-avatar:hover { border-color: var(--accent-l); }
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--bg-700); border: 1px solid var(--bg-500);
  border-radius: var(--radius); padding: .5rem;
  min-width: 180px; box-shadow: var(--shadow);
  display: none; z-index: 999;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .85rem; border-radius: 6px;
  color: var(--text-200); font-size: .875rem;
  cursor: pointer; background: none; border: none; width: 100%; text-align: left;
  transition: all var(--trans); text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover {
  background: rgba(124,58,237,.15); color: var(--text-100);
}
.dropdown-divider { border-top: 1px solid var(--bg-500); margin: .4rem 0; }

/* Hamburger */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-200); font-size: 1.4rem; }

/* ── Layout ── */
.container { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; }
.page-wrapper { padding: 2rem 0 4rem; }

/* ── Hero ── */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--bg-800) 0%, var(--bg-700) 100%);
  border-bottom: 1px solid var(--bg-600);
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(124,58,237,.15) 0%, transparent 60%);
}
.hero-inner {
  max-width: 1400px; margin: 0 auto; padding: 3.5rem 1.5rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center;
  position: relative;
}
.hero-tag {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(124,58,237,.15); border: 1px solid rgba(124,58,237,.3);
  color: var(--accent-l); font-size: .78rem; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; padding: .3rem .85rem; border-radius: 20px;
  margin-bottom: .85rem;
}
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; margin-bottom: .75rem; }
.hero h1 span { color: var(--accent-l); }
.hero p { color: var(--text-200); font-size: .975rem; margin-bottom: 1.5rem; max-width: 420px; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.hero-img {
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  border: 1px solid rgba(124,58,237,.2);
}
.hero-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }

/* ── Section ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.section-title { font-size: 1.5rem; font-weight: 700; }
.section-title span { color: var(--accent-l); }

/* ── Game Cards ── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.game-card {
  background: var(--bg-800); border: 1px solid var(--bg-600);
  border-radius: var(--radius); overflow: hidden;
  transition: all var(--trans); cursor: pointer;
  display: flex; flex-direction: column;
}
.game-card:hover {
  border-color: rgba(124,58,237,.4);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(124,58,237,.2);
}
.game-card-img { position: relative; overflow: hidden; }
.game-card-img img {
  width: 100%; aspect-ratio: 460/215; object-fit: cover;
  transition: transform .4s ease;
}
.game-card:hover .game-card-img img { transform: scale(1.05); }
.game-badge {
  position: absolute; top: .5rem; left: .5rem;
  background: var(--accent); color: #fff;
  font-size: .7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 4px;
}
.game-badge.free { background: var(--green); }
.game-card-body { padding: .9rem; flex: 1; display: flex; flex-direction: column; }
.game-title { font-size: 1rem; font-weight: 700; margin-bottom: .3rem; color: var(--text-100); }
.game-dev { font-size: .78rem; color: var(--text-400); margin-bottom: .5rem; }
.game-rating { display: flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--gold); margin-bottom: .6rem; }
.game-rating span { color: var(--text-400); }
.game-genres { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .75rem; }
.genre-tag {
  background: rgba(124,58,237,.12); border: 1px solid rgba(124,58,237,.2);
  color: var(--accent-l); font-size: .7rem; padding: .15rem .5rem; border-radius: 4px;
}
.game-price-row { display: flex; align-items: center; gap: .5rem; margin-top: auto; }
.price-original { text-decoration: line-through; color: var(--text-400); font-size: .82rem; }
.price-current { font-size: 1.05rem; font-weight: 700; color: var(--neon); }
.price-free { font-size: 1.05rem; font-weight: 700; color: var(--green); }

/* ── Filters ── */
.filters-bar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: 1rem 0; margin-bottom: .5rem;
}
.filter-chip {
  padding: .35rem 1rem; border-radius: 20px;
  border: 1px solid var(--bg-500); background: var(--bg-800);
  color: var(--text-200); font-size: .82rem; cursor: pointer;
  transition: all var(--trans);
}
.filter-chip:hover, .filter-chip.active {
  background: rgba(124,58,237,.15); border-color: var(--accent); color: var(--text-100);
}
.sort-select {
  background: var(--bg-700); border: 1px solid var(--bg-500);
  color: var(--text-100); border-radius: 8px; padding: .4rem .85rem;
  font-size: .85rem; margin-left: auto; cursor: pointer;
}

/* ── Game Detail ── */
.detail-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(to bottom, var(--bg-700), var(--bg-900));
}
.detail-banner {
  width: 100%; aspect-ratio: 21/6; object-fit: cover; opacity: .35;
}
.detail-content { position: relative; }
.detail-main {
  display: grid; grid-template-columns: 1fr 320px; gap: 2rem; align-items: start;
}
.detail-cover {
  border-radius: 10px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--bg-500);
}
.detail-cover img { width: 100%; }
.detail-sidebar {
  background: var(--bg-800); border: 1px solid var(--bg-600);
  border-radius: var(--radius); padding: 1.5rem; position: sticky; top: 80px;
}
.detail-sidebar .price-block { text-align: center; margin-bottom: 1.25rem; }
.detail-sidebar .price-big { font-size: 1.8rem; font-weight: 700; color: var(--neon); }
.sidebar-actions { display: flex; flex-direction: column; gap: .6rem; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1.25rem; }
.meta-item label { font-size: .72rem; color: var(--text-400); text-transform: uppercase; letter-spacing: .8px; }
.meta-item span { font-size: .9rem; color: var(--text-100); display: block; }

/* Screenshots */
.screenshots { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.screenshots img { height: 120px; border-radius: 6px; border: 1px solid var(--bg-500); cursor: pointer; flex-shrink: 0; }

/* Reviews */
.review-card {
  background: var(--bg-800); border: 1px solid var(--bg-600);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: .85rem;
}
.review-header { display: flex; align-items: center; gap: .85rem; margin-bottom: .75rem; }
.reviewer-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--neon));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.rating-stars { color: var(--gold); font-size: .9rem; }
.verified-badge {
  background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3);
  color: var(--green); font-size: .72rem; padding: .15rem .5rem; border-radius: 4px;
}

/* ── Cart ── */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; }
.cart-item {
  display: flex; gap: 1rem; align-items: center;
  background: var(--bg-800); border: 1px solid var(--bg-600);
  border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem;
}
.cart-item img { width: 120px; border-radius: 6px; flex-shrink: 0; }
.cart-item-info { flex: 1; }
.cart-summary {
  background: var(--bg-800); border: 1px solid var(--bg-600);
  border-radius: var(--radius); padding: 1.5rem; position: sticky; top: 80px;
}
.summary-row {
  display: flex; justify-content: space-between;
  padding: .5rem 0; border-bottom: 1px solid var(--bg-600);
  font-size: .9rem; color: var(--text-200);
}
.summary-row.total {
  border-bottom: none; font-size: 1.1rem; font-weight: 700; color: var(--text-100);
  padding-top: .85rem; margin-top: .25rem;
}
.summary-row.discount { color: var(--green); }

/* ── Library ── */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.library-card {
  background: var(--bg-800); border: 1px solid var(--bg-600);
  border-radius: var(--radius); overflow: hidden;
  transition: all var(--trans);
}
.library-card:hover { border-color: rgba(6,182,212,.3); }
.library-card img { width: 100%; aspect-ratio: 460/215; object-fit: cover; }
.library-card-body { padding: .85rem; }

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(124,58,237,.08) 0%, var(--bg-900) 70%);
  padding: 2rem;
}
.auth-card {
  background: var(--bg-800); border: 1px solid var(--bg-600);
  border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo h2 { font-family: 'Rajdhani'; font-size: 1.8rem; }
.auth-logo h2 span { color: var(--accent-l); }

/* ── Form ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .4rem; color: var(--text-200); }
.form-control {
  width: 100%; padding: .6rem .9rem;
  background: var(--bg-700); border: 1px solid var(--bg-500);
  border-radius: 8px; color: var(--text-100); font-size: .9rem;
  transition: border-color var(--trans); outline: none;
  font-family: 'Inter', sans-serif;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: .78rem; color: var(--text-400); margin-top: .3rem; }
.form-error { font-size: .78rem; color: var(--red); margin-top: .3rem; }

/* ── Flash alerts ── */
.alert {
  padding: .85rem 1.1rem; border-radius: var(--radius);
  font-size: .9rem; margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .6rem;
}
.alert-success { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.3); color: var(--green); }
.alert-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: var(--red); }
.alert-info    { background: rgba(124,58,237,.12); border: 1px solid rgba(124,58,237,.3); color: var(--accent-l); }

/* ── Tables (admin) ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-700); padding: .75rem 1rem;
  font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-400); text-align: left; border-bottom: 1px solid var(--bg-500);
}
tbody td { padding: .75rem 1rem; border-bottom: 1px solid var(--bg-700); font-size: .9rem; color: var(--text-200); vertical-align: middle; }
tbody tr:hover td { background: rgba(124,58,237,.04); }
.status-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 600; padding: .25rem .65rem; border-radius: 20px;
}
.status-paid     { background: rgba(16,185,129,.15); color: var(--green); }
.status-pending  { background: rgba(245,158,11,.15);  color: var(--gold); }
.status-cancelled{ background: rgba(239,68,68,.15);   color: var(--red); }
.status-refunded { background: rgba(124,58,237,.15);  color: var(--accent-l); }

/* ── Pagination ── */
.pagination { display: flex; gap: .4rem; justify-content: center; padding: 2rem 0; }
.page-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--bg-500);
  background: var(--bg-800); color: var(--text-200); font-size: .875rem; cursor: pointer;
  transition: all var(--trans); text-decoration: none;
}
.page-btn:hover, .page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Star rating input ── */
.star-rating { display: flex; gap: .2rem; flex-direction: row-reverse; justify-content: flex-end; }
.star-rating input { display: none; }
.star-rating label { font-size: 1.5rem; color: var(--bg-500); cursor: pointer; transition: color var(--trans); }
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: var(--gold); }

/* ── Toast notification ── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  background: var(--bg-700); border: 1px solid var(--bg-500);
  border-radius: var(--radius); padding: .85rem 1.25rem;
  font-size: .875rem; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: .6rem;
  animation: slideIn .3s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ── Footer ── */
footer {
  background: var(--bg-800); border-top: 1px solid var(--bg-600);
  padding: 2rem 1.5rem; text-align: center;
  color: var(--text-400); font-size: .85rem;
}
footer a { color: var(--accent-l); }

/* ── Admin sidebar ── */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-sidebar {
  background: var(--bg-800); border-right: 1px solid var(--bg-600);
  padding: 1.5rem 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-sidebar-logo { padding: 0 1.25rem 1.5rem; font-family: 'Rajdhani'; font-size: 1.4rem; font-weight: 700; }
.admin-sidebar-logo span { color: var(--accent-l); }
.admin-nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem; color: var(--text-200); font-size: .9rem;
  transition: all var(--trans); cursor: pointer; text-decoration: none;
}
.admin-nav-item:hover, .admin-nav-item.active {
  background: rgba(124,58,237,.12); color: var(--text-100);
  border-right: 2px solid var(--accent);
}
.admin-content { padding: 2rem; overflow-y: auto; }
.stats-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg-800); border: 1px solid var(--bg-600);
  border-radius: var(--radius); padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.stat-icon.purple { background: rgba(124,58,237,.15); }
.stat-icon.cyan   { background: rgba(6,182,212,.15); }
.stat-icon.gold   { background: rgba(245,158,11,.15); }
.stat-icon.green  { background: rgba(16,185,129,.15); }
.stat-value { font-family: 'Rajdhani'; font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: .8rem; color: var(--text-400); }

/* Empty state */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-400);
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: .5; }
.empty-state h3 { font-size: 1.25rem; margin-bottom: .5rem; color: var(--text-200); }
.empty-state p { font-size: .9rem; margin-bottom: 1.5rem; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .detail-main     { grid-template-columns: 1fr; }
  .detail-sidebar  { position: static; }
  .cart-layout     { grid-template-columns: 1fr; }
  .stats-cards     { grid-template-columns: 1fr 1fr; }
  .admin-layout    { grid-template-columns: 1fr; }
  .admin-sidebar   { display: none; }
}
@media (max-width: 768px) {
  .nav-links, .nav-search { display: none; }
  .nav-toggle { display: block; }
  .nav-links.mobile-open {
    display: flex; flex-direction: column;
    position: fixed; inset: 64px 0 0;
    background: var(--bg-900); padding: 1.5rem; z-index: 999;
    gap: .25rem;
  }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-img   { display: none; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .stats-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .games-grid  { grid-template-columns: 1fr 1fr; }
  .stats-cards { grid-template-columns: 1fr; }
  .auth-card   { padding: 1.5rem; }
  .cart-item img { width: 80px; }
}
