/* ============================================
   TeraBoxPro — Main Stylesheet
   ============================================ */

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

:root {
  --bg:        #0d0f1a;
  --bg2:       #13172a;
  --bg3:       #1a1f35;
  --card:      #1e2440;
  --card-h:    #252c50;
  --accent:    #f7c948;
  --accent2:   #ff6b35;
  --neon:      #00e5ff;
  --neon2:     #a855f7;
  --text:      #e8ecff;
  --text-muted:#8892c0;
  --border:    #2a3258;
  --radius:    14px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --glow:      0 0 20px rgba(247,201,72,0.3);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============ HEADER ============ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,15,26,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.4rem; font-weight: 900;
  white-space: nowrap;
}
.logo-icon { font-size: 1.6rem; }
.logo-accent { color: var(--accent); }

.main-nav {
  display: flex; gap: 6px;
  margin-left: auto;
}
.main-nav a {
  padding: 6px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all .2s;
}
.main-nav a:hover { color: var(--text); background: var(--bg3); }

.header-actions {
  display: flex; gap: 8px;
}
.btn-search, .btn-cache {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: 'Nunito', sans-serif;
  transition: all .2s;
  white-space: nowrap;
}
.btn-search:hover, .btn-cache:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* Search Bar */
.search-bar {
  display: none;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 12px 0;
}
.search-bar.open { display: block; }
.search-bar .container {
  display: flex; gap: 8px;
}
.search-bar input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  outline: none;
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar button {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 10px 16px;
  cursor: pointer; font-size: 1rem;
}

/* ============ HERO ============ */
.hero {
  position: relative;
  padding: 80px 0 60px;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(168,85,247,0.25) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(0,229,255,0.2) 0%, transparent 50%),
              radial-gradient(ellipse at 60% 80%, rgba(247,201,72,0.15) 0%, transparent 50%);
}
.hero-content {
  position: relative; text-align: center;
}
.hero-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 8px;
}
.hero-sub { color: var(--accent); }
.hero-desc {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 16px 0 32px;
}
.hero-btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 14px 40px;
  border-radius: 50px;
  box-shadow: var(--glow);
  transition: transform .2s, box-shadow .2s;
}
.hero-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(247,201,72,0.5); }

/* ============ CATEGORIES ============ */
.categories-strip {
  padding: 20px 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.cats-scroll {
  display: flex; gap: 10px;
  overflow-x: auto; padding-bottom: 4px;
}
.cats-scroll::-webkit-scrollbar { height: 3px; }
.cat-btn {
  flex-shrink: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all .2s;
}
.cat-btn:hover, .cat-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* ============ GAMES SECTION ============ */
.games-section { padding: 40px 0 60px; }

.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.4rem;
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

/* ---- GAME CARD ---- */
.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  position: relative;
}
.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(247,201,72,0.2);
}
.game-card-thumb {
  width: 100%; aspect-ratio: 4/3;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  position: relative;
  overflow: hidden;
}
.game-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.game-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: #000;
  font-size: 0.7rem; font-weight: 800;
  padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase;
}
.game-card-info { padding: 12px; }
.game-card-title {
  font-weight: 800; font-size: 0.95rem;
  margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-card-meta {
  display: flex; justify-content: space-between; align-items: center;
}
.game-cat {
  font-size: 0.75rem; color: var(--text-muted);
  background: var(--bg3); padding: 2px 8px; border-radius: 10px;
}
.game-rating {
  font-size: 0.8rem; color: var(--accent);
}
.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 .2s;
  font-size: 3rem;
}
.game-card:hover .play-overlay { opacity: 1; }

/* ============ AD SLOTS ============ */
.ad-slot {
  margin: 20px auto;
  display: flex; justify-content: center; align-items: center;
  min-height: 90px;
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ad-slot > div {
  width: 100%; display: flex; justify-content: center;
}
.ad-placeholder {
  width: 100%; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: var(--text-muted);
  letter-spacing: 1px; text-transform: uppercase;
}

/* ============ MODAL ============ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 95vw; max-width: 960px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
}
.modal-close {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 1rem;
}
.modal-body {
  flex: 1; position: relative; background: #000;
}
#gameFrame {
  width: 100%; height: 100%;
  min-height: 500px;
  border: none;
}
.modal-footer {
  display: flex; gap: 10px; justify-content: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.modal-footer button {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: 8px 20px; cursor: pointer;
  font-family: 'Nunito', sans-serif; font-weight: 700;
}
.modal-footer button:hover { background: var(--accent); color: #000; border-color: var(--accent); }

/* ============ FOOTER ============ */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 30px 0;
}
.footer-inner {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 16px; justify-content: space-between;
}
.footer-copy { color: var(--text-muted); font-size: 0.85rem; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-muted); font-size: 0.85rem; }
.footer-links a:hover { color: var(--accent); }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: #1a2e1a; border: 1px solid #2d6a2d;
  color: #6dff6d; padding: 12px 28px; border-radius: 50px;
  font-weight: 700; z-index: 999;
  transition: transform .3s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .hero { padding: 50px 0 40px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .btn-cache span { display: none; }
}

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

/* ============ NO RESULTS ============ */
.no-results {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ============ LOADING SKELETON ============ */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-h) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
  aspect-ratio: 4/3;
}
@keyframes shimmer { to { background-position: -200% 0; } }
