/* ============================================
   WAJIBPUNYA — Game Portal CSS
   Dark Mode • Mobile-First • PWA Ready
   ============================================ */

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

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1a2744;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --text-muted: #6c6c8a;
  --border-color: rgba(108, 92, 231, 0.15);
  --gradient-hero: linear-gradient(135deg, #0f0f1a 0%, #1a1a3e 50%, #2d1b69 100%);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-card: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 30px var(--accent-glow);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ─── Top Navigation ─── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}

.topnav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}

.logo {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), #fd79a8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: -0.5px;
  white-space: nowrap; flex-shrink: 0;
}
.logo span { font-size: 22px; margin-right: 6px; }

.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent-light); background: rgba(108,92,231,0.1); }

.search-box {
  position: relative; flex: 0 1 260px; max-width: 260px;
}
.search-box input {
  width: 100%; padding: 10px 16px 10px 40px;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 50px; color: var(--text-primary); font-size: 14px;
  transition: var(--transition); outline: none;
}
.search-box input:focus { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.search-box input::placeholder { color: var(--text-muted); }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 16px; pointer-events: none;
}

.lang-switcher { display: flex; gap: 4px; flex-shrink: 0; }
.lang-btn {
  padding: 6px 10px; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 600;
  transition: var(--transition);
}
.lang-btn:hover, .lang-btn.active { color: var(--accent-light); background: rgba(108,92,231,0.15); }

.hamburger {
  display: none; flex-direction: column; gap: 5px; padding: 8px;
  background: transparent; cursor: pointer;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: var(--transition); }

/* ─── Container ─── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ─── Hero Section ─── */
.hero {
  background: var(--gradient-hero);
  padding: 60px 24px 80px;
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(108,92,231,0.15) 0%, transparent 60%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(28px, 5vw, 48px); font-weight: 800; line-height: 1.2;
  margin-bottom: 16px; letter-spacing: -1px;
}
.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--accent-light), #fd79a8, #fdcb6e);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { font-size: clamp(15px, 2.5vw, 18px); color: var(--text-secondary); margin-bottom: 32px; max-width: 500px; margin-left: auto; margin-right: auto; }

.hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 36px; border-radius: 50px; font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a29bfe);
  color: white; box-shadow: 0 8px 30px rgba(108,92,231,0.4);
  transition: var(--transition); border: none; cursor: pointer;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(108,92,231,0.5); }

/* ─── Section Titles ─── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-top: 16px;
}
.section-title { font-size: clamp(20px, 3vw, 26px); font-weight: 700; letter-spacing: -0.5px; }
.section-link { color: var(--accent-light); font-size: 14px; font-weight: 500; transition: var(--transition); }
.section-link:hover { text-decoration: underline; }

/* ─── Featured Carousel ─── */
.featured-scroll {
  display: flex; gap: 20px; overflow-x: auto; padding: 8px 0 16px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.featured-scroll::-webkit-scrollbar { display: none; }

.featured-card {
  flex: 0 0 300px; scroll-snap-align: start; border-radius: var(--radius-lg);
  overflow: hidden; position: relative; cursor: pointer;
  transition: var(--transition); background: var(--bg-card);
}
.featured-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-glow); }

.featured-thumb {
  width: 100%; height: 180px; object-fit: cover;
  background: linear-gradient(135deg, var(--bg-secondary), var(--accent));
  display: flex; align-items: center; justify-content: center; font-size: 48px;
}

.featured-info { padding: 16px; }
.featured-info h3 { font-size: 16px; margin-bottom: 4px; }
.featured-info .meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }

/* ─── Category Pills ─── */
.category-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.category-row::-webkit-scrollbar { display: none; }

.cat-pill {
  flex-shrink: 0; padding: 10px 20px; border-radius: 50px;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  color: var(--text-secondary); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.cat-pill:hover, .cat-pill.active { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 4px 20px var(--accent-glow); }

/* ─── Game Grid ─── */
.game-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; padding-bottom: 40px;
}

.game-card {
  border-radius: var(--radius-md); overflow: hidden; background: var(--bg-card);
  transition: var(--transition); cursor: pointer; position: relative;
  border: 1px solid transparent;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow-glow); }

.game-thumb {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  background: linear-gradient(135deg, var(--bg-secondary), #2d1b69);
  display: flex; align-items: center; justify-content: center; font-size: 40px;
  position: relative; overflow: hidden;
}
.game-thumb::after {
  content: '▶'; position: absolute; inset: 0;
  background: rgba(108,92,231,0.7); color: white; font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: var(--transition); border-radius: 0;
}
.game-card:hover .game-thumb::after { opacity: 1; }

.game-info { padding: 12px; }
.game-info h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-info .meta-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.game-badge {
  position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; z-index: 2;
}
.badge-new { background: #00b894; color: white; }
.badge-hot { background: #e17055; color: white; }
.badge-trending { background: var(--accent); color: white; }

/* ─── Category Grid (Home) ─── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding-bottom: 40px; }
.cat-card {
  padding: 24px 16px; border-radius: var(--radius-md); text-align: center;
  background: var(--bg-card); border: 1px solid var(--border-color);
  cursor: pointer; transition: var(--transition); font-size: 15px; font-weight: 600;
}
.cat-card:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); transform: translateY(-2px); }
.cat-card .cat-icon { font-size: 32px; margin-bottom: 8px; display: block; }

/* ─── Footer ─── */
.site-footer {
  background: var(--bg-secondary); border-top: 1px solid var(--border-color);
  padding: 40px 24px; margin-top: 40px; text-align: center;
}
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); font-size: 14px; transition: var(--transition); }
.footer-links a:hover { color: var(--accent-light); }
.footer-copy { color: var(--text-muted); font-size: 13px; }

/* ─── Telegram Share Button ─── */
.tg-share-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-radius: 50px; background: #0088cc; color: white; font-size: 14px; font-weight: 600;
  transition: var(--transition); border: none; cursor: pointer; margin-top: 12px;
}
.tg-share-btn:hover { background: #0077b5; transform: translateY(-1px); }

/* ─── PWA Install Banner ─── */
.pwa-banner {
  display: none; position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: white; padding: 14px 28px; border-radius: 50px;
  font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px rgba(108,92,231,0.5);
  z-index: 200; gap: 12px; align-items: center; white-space: nowrap;
}
.pwa-banner.show { display: flex; }
.pwa-btn-install {
  padding: 8px 20px; border-radius: 50px; background: white; color: var(--accent);
  font-weight: 700; font-size: 13px; border: none; cursor: pointer;
}
.pwa-banner-close {
  background: transparent; color: rgba(255,255,255,0.7); padding: 4px 8px;
  border-radius: 50%; font-size: 18px; cursor: pointer;
}

/* ─── Bottom Nav (Mobile) ─── */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
  background: rgba(15, 15, 26, 0.97); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color); padding: 8px 0; padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.bottom-nav-inner { display: flex; justify-content: space-around; align-items: center; }
.bnav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-muted); padding: 4px 12px; border-radius: 8px; font-size: 10px; font-weight: 600; transition: var(--transition); cursor: pointer; background: transparent; }
.bnav-item.active, .bnav-item:hover { color: var(--accent-light); }
.bnav-icon { font-size: 20px; }

/* ─── Loading Skeleton ─── */
.skeleton { background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card) 50%, var(--bg-secondary) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .nav-links, .lang-switcher { display: none; }
  .hamburger { display: flex; }
  .search-box { flex: 1; max-width: none; }
  .hero { padding: 40px 16px 60px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .featured-card { flex: 0 0 260px; }
  .bottom-nav { display: block; }
  body { padding-bottom: 72px; }
  .container { padding: 0 16px; }
  .pwa-banner { bottom: 90px; left: 16px; right: 16px; transform: none; padding: 14px 20px; font-size: 13px; }
}

@media (max-width: 480px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Animations ─── */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeInUp 0.5s ease forwards; }
