/* ============================================
   JexraPlay - Game Portal Stylesheet
   Dark theme gaming portal design
   ============================================ */

/* ── Design Tokens ── */
:root {
  --color-bg-primary: #0b0e17;
  --color-bg-secondary: #141829;
  --color-bg-surface: #1c2035;
  --color-bg-elevated: #242945;
  --color-bg-hover: #2d3355;
  --color-text-heading: #f0f2f8;
  --color-text-body: #b0b7c8;
  --color-text-muted: #6b7394;
  --color-accent: #7c6aef;
  --color-accent-hover: #9585f5;
  --color-accent-glow: rgba(124, 106, 239, 0.25);
  --color-success: #00d4aa;
  --color-border: #2a2f4a;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.4);
  --header-height: 60px;
  --content-max-width: 1360px;
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--color-bg-primary);
  color: var(--color-text-body);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent-hover); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-accent); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input { font: inherit; }
h1, h2, h3, h4 { color: var(--color-text-heading); line-height: 1.3; }

/* ── Site Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.header-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: var(--header-height);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.site-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

.site-brand-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-heading);
  letter-spacing: -0.02em;
}

/* ── Category Navigation ── */
.nav-categories {
  flex: 1;
  overflow: hidden;
}

.nav-categories-list {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}

.nav-categories-list::-webkit-scrollbar { display: none; }

.nav-category-link {
  padding: 5px 13px;
  border-radius: 18px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.nav-category-link:hover,
.nav-category-link.is-active {
  background: var(--color-accent);
  color: #fff;
}

/* ─ Header Actions ── */
.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--color-bg-surface);
  transition: background var(--transition-fast);
}

.btn-icon:hover { background: var(--color-accent); }

/* ── Search Bar ── */
.search-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: var(--color-bg-primary);
}

.search-panel.is-open { max-height: 72px; }

.search-form {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  padding: 12px 20px;
  gap: 10px;
}

.search-input {
  flex: 1;
  padding: 9px 16px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-heading);
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-input:focus { border-color: var(--color-accent); }

.search-submit {
  padding: 9px 22px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition-fast);
}

.search-submit:hover { background: var(--color-accent-hover); }

/* ─ Main Content ── */
.page-content {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 24px 20px;
  min-height: calc(100vh - var(--header-height) - 180px);
}

/* ── Hero Slider ── */
.hero-banner {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  aspect-ratio: 21 / 9;
}

.hero-slides { position: relative; width: 100%; height: 100%; }

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.hero-slide.is-active { opacity: 1; }

.hero-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-slide-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 32px 24px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
}

.hero-slide-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.hero-slide-desc {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.92rem;
  margin-bottom: 14px;
}

.hero-play-btn {
  display: inline-block;
  padding: 10px 28px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background var(--transition-fast);
}

.hero-play-btn:hover { background: var(--color-accent-hover); color: #fff; }

.hero-dots {
  position: absolute;
  bottom: 12px;
  right: 20px;
  display: flex;
  gap: 7px;
  z-index: 2;
}

.hero-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transition: all var(--transition-fast);
}

.hero-dot.is-active {
  background: var(--color-accent);
  transform: scale(1.35);
}

/* ── Section ── */
.content-section { margin-bottom: 36px; }

.section-heading {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-border);
}

/* ── Category Grid ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 10px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 8px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  text-align: center;
  transition: all var(--transition-base);
  border: 1px solid transparent;
}

.category-card:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.category-icon { font-size: 1.7rem; line-height: 1; }
.category-name { font-size: 0.82rem; font-weight: 600; color: var(--color-text-heading); }
.category-count { font-size: 0.72rem; color: var(--color-text-muted); }

/* ── Game Card Grid ── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}

.game-card {
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
  border: 1px solid transparent;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-hover);
}

.game-card-thumb {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--color-bg-primary);
}

.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.game-card:hover .game-card-thumb img { transform: scale(1.06); }

.game-card-body { padding: 10px 12px; }

.game-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.game-card-tag {
  font-size: 0.72rem;
  color: var(--color-accent-hover);
  background: var(--color-accent-glow);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

/* ── Category Page Layout ── */
.category-page-layout {
  display: flex;
  gap: 24px;
}

.sidebar-panel {
  width: 210px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  align-self: flex-start;
}

.sidebar-heading {
  font-size: 1.05rem;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}

.sidebar-nav li { margin-bottom: 2px; }

.sidebar-nav-link {
  display: block;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--color-text-body);
  transition: all var(--transition-fast);
}

.sidebar-nav-link:hover,
.sidebar-nav-link.is-active {
  background: var(--color-accent);
  color: #fff;
}

.category-page-main { flex: 1; min-width: 0; }
.category-page-title { font-size: 1.5rem; margin-bottom: 8px; }
.category-page-desc { color: var(--color-text-body); margin-bottom: 22px; font-size: 0.95rem; }

/* ── Game Detail Page ── */
.game-detail-layout { display: flex; gap: 24px; }
.game-detail-main { flex: 1; min-width: 0; }

.game-iframe-container { margin-bottom: 16px; }

.game-iframe-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.game-iframe-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.game-action-bar {
  display: flex;
  gap: 10px;
  padding: 12px 0;
}

.btn-fullscreen {
  padding: 8px 20px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background var(--transition-fast);
}

.btn-fullscreen:hover { background: var(--color-accent-hover); }

.game-info-block { margin-bottom: 24px; }
.game-info-title { font-size: 1.5rem; margin-bottom: 10px; }

.game-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.meta-category-link {
  padding: 4px 14px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 18px;
  font-size: 0.82rem;
  font-weight: 600;
}

.meta-tag-item {
  padding: 4px 12px;
  background: var(--color-bg-surface);
  border-radius: 18px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.game-description {
  color: var(--color-text-body);
  line-height: 1.85;
  padding: 20px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.game-tips-section {
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.game-tips-title {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--color-accent-hover);
}

.game-tips-list {
  list-style: disc;
  padding-left: 20px;
}

.game-tips-list li {
  color: var(--color-text-body);
  line-height: 1.75;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.game-update-info {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.related-games-section { margin-top: 28px; }

/* ── Search Page ── */
.search-page-heading { margin-bottom: 18px; }

.search-page-input-wrap { margin-bottom: 22px; }

.search-page-input {
  width: 100%;
  padding: 13px 18px;
  background: var(--color-bg-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-heading);
  font-size: 1.05rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-page-input:focus { border-color: var(--color-accent); }

.search-hint-text { color: var(--color-text-muted); }
.search-no-results { text-align: center; padding: 40px; color: var(--color-text-muted); }

/* ── Static Pages ── */
.static-page-content {
  max-width: 780px;
  margin: 0 auto;
  background: var(--color-bg-surface);
  padding: 32px;
  border-radius: var(--radius-lg);
}

.static-page-content h1 {
  font-size: 1.7rem;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-border);
}

.static-page-content h2 {
  font-size: 1.2rem;
  margin: 22px 0 10px;
  color: var(--color-accent-hover);
}

.static-page-content p {
  color: var(--color-text-body);
  line-height: 1.85;
  margin-bottom: 12px;
}

.static-page-content ul {
  margin: 10px 0;
  padding-left: 22px;
  list-style: disc;
}

.static-page-content li {
  color: var(--color-text-body);
  line-height: 1.8;
  margin-bottom: 4px;
}

.static-page-desc {
  color: var(--color-text-body);
  margin-bottom: 22px;
  font-size: 1rem;
}

/* ── FAQ ── */
.faq-item {
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 16px 20px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-heading);
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition-fast);
}

.faq-question:hover { background: var(--color-bg-hover); }

.faq-answer {
  padding: 0 20px 16px;
  color: var(--color-text-body);
  line-height: 1.75;
  display: none;
}

.faq-item.is-open .faq-answer { display: block; }
.faq-item.is-open .faq-question { color: var(--color-accent-hover); }

/* ── 404 Page ── */
.error-page-container {
  text-align: center;
  padding: 80px 20px;
}

.error-code {
  font-size: 5rem;
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 12px;
  line-height: 1;
}

.error-message {
  font-size: 1.15rem;
  color: var(--color-text-body);
  margin-bottom: 24px;
}

.btn-home {
  display: inline-block;
  padding: 12px 32px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background var(--transition-fast);
}

.btn-home:hover { background: var(--color-accent-hover); color: #fff; }

/* ─ Site Footer ── */
.site-footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  margin-top: 48px;
  padding: 36px 20px 18px;
}

.footer-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 28px;
}

.footer-brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-heading);
  margin-bottom: 8px;
}

.footer-brand-desc {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.footer-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-heading);
  margin-bottom: 10px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.footer-link {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  transition: color var(--transition-fast);
}

.footer-link:hover { color: var(--color-accent-hover); }

.footer-link-block {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 5px;
  transition: color var(--transition-fast);
}

.footer-link-block:hover { color: var(--color-accent-hover); }

.footer-copyright {
  max-width: var(--content-max-width);
  margin: 22px auto 0;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-copyright-text {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .footer-container { grid-template-columns: 1fr 1fr; }
  .sidebar-panel { width: 175px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
}

@media (max-width: 768px) {
  .hero-banner { aspect-ratio: 16 / 9; }
  .hero-slide-title { font-size: 1.15rem; }
  .hero-slide-desc { display: none; }
  .category-page-layout { flex-direction: column; }
  .sidebar-panel {
    width: 100%;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .sidebar-heading { width: 100%; margin-bottom: 6px; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 5px; }
  .sidebar-nav-link { padding: 5px 11px; font-size: 0.78rem; }
  .game-detail-layout { flex-direction: column; }
  .footer-container { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); }
  .nav-categories-list { display: none; }
  .nav-categories-list.is-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-secondary);
    padding: 16px;
    overflow-y: auto;
    z-index: 999;
  }
}

@media (max-width: 480px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .game-card-body { padding: 7px 9px; }
  .game-card-title { font-size: 0.78rem; }
  .page-content { padding: 14px 12px; }
  .section-heading { font-size: 1.08rem; }
  .static-page-content { padding: 20px 16px; }
}
