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

/* =============================================
   VARIABLES
   ============================================= */
:root {
  --navy-950: #070B14;
  --navy-900: #0D1117;
  --navy-800: #131929;
  --navy-700: #1A2236;
  --navy-600: #232F45;
  --navy-500: #2D3D58;
  --slate-border: #1E2D47;
  --slate-card: #151D2E;
  --violet: #7C3AED;
  --violet-light: #8B5CF6;
  --violet-pale: rgba(124,58,237,0.15);
  --text-primary: #E6EDF3;
  --text-secondary: #94A3B8;
  --text-muted: #4B5563;
  --emerald: #10B981;
  --amber: #F59E0B;
  --red: #EF4444;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--navy-900);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--navy-800); }
::-webkit-scrollbar-thumb { background: var(--navy-500); border-radius: 3px; }

/* =============================================
   UTILITIES
   ============================================= */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-inter { font-family: 'Inter', sans-serif; }
.bg-navy { background: var(--navy-900); }
.bg-navy-dark { background: var(--navy-950); }
.text-slate-400 { color: var(--text-secondary); }
.text-slate-500 { color: var(--text-muted); }
.text-violet { color: var(--violet-light); }
.min-h-screen { min-height: 100vh; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.mx-6 { margin-left: 24px; margin-right: 24px; }
.ml-auto { margin-left: auto; }
.max-w-xs { max-width: 280px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-1 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.w-full { width: 100%; }
.hover-white:hover { color: white; }

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--violet); color: white;
  padding: 10px 20px; border-radius: var(--radius);
  font-weight: 500; font-size: 14px; border: none;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: var(--violet-light); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy-700); color: var(--text-primary);
  padding: 10px 20px; border-radius: var(--radius);
  font-weight: 500; font-size: 14px;
  border: 1px solid var(--slate-border);
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--navy-600); }

.btn-ghost {
  display: inline-flex; align-items: center;
  background: transparent; color: var(--text-secondary);
  padding: 8px 12px; border-radius: var(--radius);
  font-weight: 500; font-size: 14px; border: none;
  transition: background 0.2s, color 0.2s;
}
.btn-ghost:hover { background: var(--navy-700); color: white; }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(239,68,68,0.1); color: #F87171;
  padding: 6px 14px; border-radius: var(--radius);
  font-size: 13px; border: 1px solid rgba(239,68,68,0.2);
  transition: background 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* =============================================
   FORMS
   ============================================= */
.input-field {
  width: 100%;
  background: var(--navy-800);
  border: 1px solid var(--slate-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}
.input-field:focus { border-color: rgba(124,58,237,0.5); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.input-field::placeholder { color: var(--text-muted); }

textarea.input-field { resize: vertical; min-height: 80px; }
select.input-field { appearance: none; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--slate-card);
  border: 1px solid var(--slate-border);
  border-radius: var(--radius-xl);
}
.card-hover {
  background: var(--slate-card);
  border: 1px solid var(--slate-border);
  border-radius: var(--radius-xl);
  transition: border-color 0.2s, transform 0.2s;
}
.card-hover:hover { border-color: rgba(124,58,237,0.4); transform: translateY(-2px); }
.card-body { padding: 20px; }
.card-sm { padding: 16px; }

/* =============================================
   BADGES
   ============================================= */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
}
.badge-active   { background: rgba(16,185,129,0.15); color: #34D399; }
.badge-draft    { background: rgba(245,158,11,0.15); color: #FCD34D; }
.badge-inactive { background: rgba(239,68,68,0.15);  color: #F87171; }
.badge-violet   { background: rgba(124,58,237,0.15); color: #A78BFA; }
.badge-paid     { background: rgba(245,158,11,0.15); color: #FCD34D; }

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-border);
}
.navbar-inner {
  display: flex; align-items: center;
  height: 64px; gap: 0;
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; color: white;
  margin-right: 32px;
}
.brand-icon {
  width: 32px; height: 32px;
  background: var(--violet);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: white;
}
.navbar-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 12px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover, .nav-link.active { background: var(--navy-700); color: white; }
.nav-link.violet { color: var(--violet-light); }
.navbar-auth { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(124,58,237,0.2); color: var(--violet-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.mobile-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; padding: 8px; }
.mobile-toggle span { display: block; width: 20px; height: 2px; background: var(--text-secondary); border-radius: 2px; }
.mobile-menu { display: none; padding: 12px 16px; border-top: 1px solid var(--slate-border); flex-direction: column; gap: 4px; }
.mobile-menu.open { display: flex; }

/* =============================================
   HERO SLIDER
   ============================================= */
.hero-slider { position: relative; border-radius: var(--radius-xl); overflow: hidden; border: 1px solid var(--slate-border); }
.hero-track { display: flex; transition: transform 0.7s ease; }
.hero-slide { position: relative; flex-shrink: 0; width: 100%; aspect-ratio: 21/8; min-height: 240px; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide-bg { width: 100%; height: 100%; background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to right, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 60%, transparent 100%); }
.hero-content { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 56px; }
.hero-text { max-width: 520px; }
.hero-title { font-size: clamp(24px, 4vw, 40px); font-weight: 800; color: white; line-height: 1.2; margin-bottom: 12px; }
.hero-desc { font-size: 15px; color: rgba(255,255,255,0.75); margin-bottom: 24px; }
.hero-dots { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.hero-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.3); border: none; cursor: pointer; transition: all 0.3s; }
.hero-dot.active { background: var(--violet); width: 20px; border-radius: 4px; }
.hero-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.5); border: none; color: white; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; z-index: 2; }
.hero-arrow:hover { background: rgba(0,0,0,0.8); }
.hero-arrow-left { left: 12px; }
.hero-arrow-right { right: 12px; }
.hero-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); border-radius: var(--radius-xl); border: 1px solid var(--slate-border); text-align: center; padding: 40px; }
.hero-empty h1 { font-size: clamp(28px, 5vw, 52px); font-weight: 800; margin-bottom: 12px; }
.hero-empty h1 span { color: var(--violet-light); }

/* =============================================
   SECTIONS
   ============================================= */
.section { margin-bottom: 48px; }
.section-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 22px; font-weight: 700; color: white; }
.section-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.section-link { font-size: 13px; color: var(--violet-light); }
.section-link:hover { text-decoration: underline; }

/* =============================================
   GAME CARDS
   ============================================= */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.games-grid-lg { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.game-card { display: block; text-decoration: none; }
.game-card-inner { background: var(--slate-card); border: 1px solid var(--slate-border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color 0.2s, transform 0.2s; }
.game-card:hover .game-card-inner { border-color: rgba(124,58,237,0.4); transform: translateY(-2px); }
.game-thumb { position: relative; aspect-ratio: 4/3; background: var(--navy-700); overflow: hidden; }
.game-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.game-card:hover .game-thumb img { transform: scale(1.05); }
.game-thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 32px; }
.game-play-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; }
.game-card:hover .game-play-overlay { opacity: 1; }
.game-play-btn { background: var(--violet); color: white; padding: 8px 20px; border-radius: var(--radius); font-weight: 600; font-size: 14px; }
.game-featured-badge { position: absolute; top: 8px; left: 8px; background: rgba(124,58,237,0.9); color: white; padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 600; }
.game-info { padding: 10px 12px; }
.game-title { font-size: 13px; font-weight: 600; color: white; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.2s; }
.game-card:hover .game-title { color: #A78BFA; }
.game-meta { display: flex; justify-content: space-between; align-items: center; }
.game-category { font-size: 11px; color: var(--text-muted); }
.game-plays { font-size: 11px; color: var(--text-muted); }
.game-rank { position: absolute; top: -8px; left: -8px; z-index: 2; width: 24px; height: 24px; background: var(--violet); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; box-shadow: 0 2px 8px rgba(124,58,237,0.4); }
.game-rank-wrap { position: relative; }

/* =============================================
   FILTER BAR
   ============================================= */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filter-btn { padding: 6px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; border: 1px solid var(--slate-border); background: var(--navy-700); color: var(--text-secondary); cursor: pointer; transition: all 0.2s; }
.filter-btn:hover, .filter-btn.active { background: var(--violet); border-color: var(--violet); color: white; }

/* =============================================
   AD SLOT
   ============================================= */
.ad-slot { background: rgba(26,34,54,0.5); border: 1px dashed rgba(45,61,88,0.6); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 12px; }
.ad-slot-horizontal { height: 90px; }
.ad-slot-mid { height: 100px; }

/* =============================================
   LEADERBOARD
   ============================================= */
.leaderboard-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.leaderboard-table th { text-align: left; padding: 12px 16px; color: var(--text-muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--slate-border); }
.leaderboard-table td { padding: 14px 16px; border-bottom: 1px solid rgba(30,45,71,0.5); }
.leaderboard-table tr:hover td { background: rgba(26,34,54,0.4); }
.lb-rank { font-size: 18px; }
.lb-user { display: flex; align-items: center; gap: 8px; }
.lb-avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(124,58,237,0.2); color: var(--violet-light); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }
.lb-score { font-weight: 700; color: var(--violet-light); }
.lb-top td { background: rgba(124,58,237,0.05); }

/* =============================================
   NEWSLETTER
   ============================================= */
.newsletter-section { background: linear-gradient(135deg, rgba(124,58,237,0.08) 0%, transparent 60%); border: 1px solid rgba(124,58,237,0.2); border-radius: var(--radius-xl); padding: 48px; text-align: center; }
.newsletter-title { font-size: 28px; font-weight: 700; color: white; margin-bottom: 8px; }
.newsletter-sub { color: var(--text-secondary); margin-bottom: 24px; }
.newsletter-form { display: flex; gap: 12px; max-width: 400px; margin: 0 auto; }

/* =============================================
   GAME PAGE
   ============================================= */
.game-page { display: grid; grid-template-columns: 1fr 280px; gap: 32px; }
.game-frame-wrap { background: black; border-radius: var(--radius-xl); overflow: hidden; border: 1px solid var(--slate-border); aspect-ratio: 16/9; position: relative; }
.game-iframe { width: 100%; height: 100%; border: 0; }
.game-start-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.game-start-thumb { position: absolute; inset: 0; opacity: 0.15; object-fit: cover; width: 100%; height: 100%; }
.game-start-content { position: relative; z-index: 1; text-align: center; }

/* =============================================
   AUTH PAGES
   ============================================= */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy-950); padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 24px; font-size: 20px; font-weight: 700; color: white; }
.auth-title { font-size: 24px; font-weight: 700; color: white; }
.auth-sub { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-footer a { color: var(--violet-light); }

/* =============================================
   FLASH MESSAGES
   ============================================= */
.flash { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-radius: var(--radius); font-size: 14px; margin: 0 0 16px; }
.flash button { background: none; border: none; font-size: 18px; cursor: pointer; opacity: 0.6; color: inherit; margin-left: 16px; }
.flash button:hover { opacity: 1; }
.flash-error   { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.25); color: #FCA5A5; }
.flash-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.25); color: #6EE7B7; }

/* =============================================
   FOOTER
   ============================================= */
.footer { background: var(--navy-900); border-top: 1px solid var(--slate-border); margin-top: 64px; padding: 48px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer-title { font-size: 13px; font-weight: 600; color: white; margin-bottom: 12px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 13px; color: var(--text-secondary); transition: color 0.2s; }
.footer-links a:hover { color: white; }
.footer-bottom { padding-top: 20px; border-top: 1px solid var(--slate-border); display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }

/* =============================================
   ADMIN LAYOUT
   ============================================= */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: var(--navy-900); border-right: 1px solid var(--slate-border); display: flex; flex-direction: column; flex-shrink: 0; position: fixed; height: 100vh; overflow-y: auto; }
.sidebar-brand { padding: 16px; border-bottom: 1px solid var(--slate-border); }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 500; color: var(--text-secondary); transition: all 0.15s; }
.sidebar-link:hover { background: var(--navy-800); color: white; }
.sidebar-link.active { background: rgba(124,58,237,0.15); color: #A78BFA; }
.sidebar-bottom { padding: 12px 8px; border-top: 1px solid var(--slate-border); }
.admin-main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-height: 100vh; }
.admin-header { height: 56px; background: var(--navy-900); border-bottom: 1px solid var(--slate-border); display: flex; align-items: center; padding: 0 24px; gap: 12px; flex-shrink: 0; }
.admin-content { padding: 24px; flex: 1; }

/* Admin tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; padding: 10px 16px; color: var(--text-muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--slate-border); white-space: nowrap; }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid rgba(30,45,71,0.5); vertical-align: middle; }
.admin-table tr:hover td { background: rgba(26,34,54,0.4); }
.admin-table .actions { display: flex; gap: 8px; align-items: center; }
.admin-table .action-link { font-size: 12px; color: var(--violet-light); cursor: pointer; background: none; border: none; padding: 0; }
.admin-table .action-link:hover { text-decoration: underline; }
.admin-table .action-delete { font-size: 12px; color: #F87171; cursor: pointer; background: none; border: none; padding: 0; }
.admin-table .action-delete:hover { text-decoration: underline; }

/* Admin page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: white; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Admin stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--slate-card); border: 1px solid var(--slate-border); border-radius: var(--radius-lg); padding: 16px; }
.stat-icon { font-size: 20px; margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: white; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Admin grid 2col */
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; }
.pagination span { font-size: 13px; color: var(--text-secondary); }

/* =============================================
   PARTNERS
   ============================================= */
.partners-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.partner-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; background: var(--slate-card); border: 1px solid var(--slate-border); border-radius: var(--radius-lg); transition: border-color 0.2s; }
.partner-card:hover { border-color: rgba(124,58,237,0.4); }
.partner-logo { height: 48px; object-fit: contain; filter: grayscale(1); transition: filter 0.2s; }
.partner-card:hover .partner-logo { filter: grayscale(0); }
.partner-name { font-size: 13px; color: var(--text-secondary); text-align: center; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .navbar-links, .navbar-auth { display: none; }
  .mobile-toggle { display: flex; margin-left: auto; }
  .games-grid { grid-template-columns: repeat(2, 1fr); }
  .game-page { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-content { padding: 0 24px; }
  .newsletter-form { flex-direction: column; }
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .admin-grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .games-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
