/* ============================================
   SINGLE GAME PAGE — AFK-26
   3-column layout: Left Nav + Main + Right Sidebar
   Reference: CrazyGames style
   ============================================ */

/* === LAYOUT WRAPPER === */
.sg-wrapper {
  display: flex;
  min-height: calc(100vh - 60px);
  background: #0f1923;
  color: #e0e6ed;
}

/* === LEFT SIDEBAR NAV === */
.sg-left-nav {
  width: 60px;
  min-width: 60px;
  background: #141e2b;
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  transition: width .25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.sg-left-nav::-webkit-scrollbar { width: 3px; }
.sg-left-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.sg-left-nav.is-expanded {
  width: 200px;
}

/* Toggle button */
.sg-nav-toggle {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: none;
  color: #8b97a8;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  transition: background .2s;
}
.sg-nav-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Separators */
.sg-nav-sep {
  width: 32px;
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: 8px 0;
  flex-shrink: 0;
}

/* Nav items */
.sg-nav-item {
  display: flex;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  margin-bottom: 4px;
  color: #8b97a8;
  text-decoration: none;
  font-size: 18px;
  justify-content: center;
  transition: all .2s;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}
.sg-nav-item:hover,
.sg-nav-item.is-active {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}
.sg-nav-item .sg-nav-icon {
  flex-shrink: 0;
  width: 40px;
  text-align: center;
  font-size: 18px;
  line-height: 1;
}
.sg-nav-item .sg-nav-label {
  display: none;
  font-size: 13px;
  margin-left: 4px;
  color: #c8d0da;
}

/* Expanded state */
.sg-left-nav.is-expanded .sg-nav-item {
  width: 180px;
  justify-content: flex-start;
  padding-left: 0;
}
.sg-left-nav.is-expanded .sg-nav-item .sg-nav-label {
  display: inline;
}

/* Tooltip on hover (collapsed mode) */
.sg-left-nav:not(.is-expanded) .sg-nav-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 52px;
  background: #1e2d3d;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 99;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  pointer-events: none;
}

/* Category section label */
.sg-nav-section-label {
  display: none;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #566374;
  padding: 10px 12px 4px;
  width: 100%;
}
.sg-left-nav.is-expanded .sg-nav-section-label {
  display: block;
}

/* === MAIN CONTENT AREA === */
.sg-main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px;
  max-width: 900px;
}

/* --- Game Hero --- */
.sg-hero {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #1a2634;
  margin-bottom: 20px;
  position: relative;
}
.sg-hero-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.sg-hero-iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  display: block;
}
.sg-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.45);
  cursor: pointer;
  transition: background .2s;
}
.sg-play-overlay:hover { background: rgba(0,0,0,.3); }
.sg-play-overlay .sg-play-btn {
  width: 72px; height: 72px;
  background: #7a1fa2;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(122,31,162,.5);
  transition: transform .2s;
}
.sg-play-overlay:hover .sg-play-btn { transform: scale(1.1); }
.sg-play-btn svg { fill: #fff; width: 32px; height: 32px; margin-left: 4px; }

/* --- Game Info Bar --- */
.sg-info-bar {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: #1a2634;
  border-radius: 12px;
}
.sg-game-icon {
  width: 80px; height: 80px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.08);
}
.sg-info-content { flex: 1; min-width: 0; }
.sg-game-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  line-height: 1.2;
}
.sg-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13px;
  color: #8b97a8;
  margin-bottom: 10px;
}
.sg-meta-row span { display: inline-flex; align-items: center; gap: 4px; }
.sg-meta-row strong { color: #c8d0da; font-weight: 600; }
.sg-meta-row a { color: #8da4f0; text-decoration: none; }
.sg-meta-row a:hover { color: #afbfff; text-decoration: underline; }

/* Action buttons */
.sg-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all .2s;
}
.sg-btn-primary {
  background: #7a1fa2;
  color: #fff;
}
.sg-btn-primary:hover { background: #8e35b5; color: #fff; text-decoration: none; }
.sg-btn-secondary {
  background: rgba(255,255,255,.08);
  color: #c8d0da;
}
.sg-btn-secondary:hover { background: rgba(255,255,255,.14); color: #fff; text-decoration: none; }
.sg-btn img { width: 20px; height: 20px; }

/* Tags */
.sg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sg-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255,255,255,.06);
  border-radius: 20px;
  font-size: 12px;
  color: #8da4f0;
  text-decoration: none;
  transition: all .2s;
}
.sg-tag:hover { background: rgba(141,164,240,.15); color: #afbfff; text-decoration: none; }

/* --- Rating block --- */
.sg-rating-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #1a2634;
  border-radius: 12px;
  margin-bottom: 20px;
}
.sg-rating-score {
  font-size: 28px;
  font-weight: 700;
  color: #4caf50;
  line-height: 1;
}
.sg-rating-stars { flex: 1; }
.sg-rating-count {
  font-size: 12px;
  color: #8b97a8;
}

/* --- Game Description --- */
.sg-description {
  background: #1a2634;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.sg-description-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px;
}
.sg-description .sg-content {
  font-size: 14px;
  line-height: 1.7;
  color: #b0bac6;
}
.sg-description .sg-content p { margin: 0 0 12px; }
.sg-description .sg-content img { max-width: 100%; height: auto; border-radius: 8px; }
.sg-description .sg-content iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 8px;
}
.sg-description .sg-content a { color: #8da4f0; }
.sg-description .sg-content h2,
.sg-description .sg-content h3,
.sg-description .sg-content h4 { color: #e0e6ed; margin: 16px 0 8px; }

/* --- Screenshots Slider --- */
.sg-screenshots {
  margin-bottom: 20px;
}
.sg-screenshots-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px;
}
.sg-screenshots .swiper-slide img {
  width: 100%;
  border-radius: 8px;
  display: block;
}
.sg-screenshots .swiper {
  border-radius: 12px;
  overflow: hidden;
}
.sg-screenshots .swiper-button-prev,
.sg-screenshots .swiper-button-next {
  color: #fff;
  background: rgba(0,0,0,.5);
  width: 36px; height: 36px;
  border-radius: 50%;
}
.sg-screenshots .swiper-button-prev::after,
.sg-screenshots .swiper-button-next::after { font-size: 14px; }
.sg-screenshots .swiper-pagination-bullet { background: #fff; }
.sg-screenshots .swiper-pagination-bullet-active { background: #7a1fa2; }

/* --- NPH Info --- */
.sg-nph-block {
  background: #1a2634;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.sg-nph-block h3 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 10px;
}
.sg-nph-block ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sg-nph-block ul li {
  padding: 5px 0;
  font-size: 13px;
  color: #8b97a8;
}
.sg-nph-block ul li a { color: #8da4f0; text-decoration: none; }
.sg-nph-block ul li a:hover { text-decoration: underline; }
.sg-nph-block ul li i { width: 18px; margin-right: 6px; color: #566374; }

/* --- Related Games (bottom) --- */
.sg-related {
  margin-bottom: 20px;
}
.sg-related-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px;
}
.sg-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.sg-related-card {
  border-radius: 10px;
  overflow: hidden;
  background: #1a2634;
  transition: transform .2s;
}
.sg-related-card:hover { transform: translateY(-3px); }
.sg-related-card a { text-decoration: none; }
.sg-related-card img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  display: block;
}
.sg-related-card h4 {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #c8d0da;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Comments section --- */
.sg-comments {
  background: #1a2634;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.sg-comments-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px;
}

/* === RIGHT SIDEBAR === */
.sg-right-sidebar {
  width: 280px;
  min-width: 280px;
  padding: 20px 16px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sg-right-sidebar-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  padding-left: 4px;
}
.sg-sidebar-games {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sg-sidebar-game {
  border-radius: 10px;
  overflow: hidden;
  background: #1a2634;
  transition: transform .2s;
}
.sg-sidebar-game:hover { transform: translateY(-2px); }
.sg-sidebar-game a { text-decoration: none; display: block; }
.sg-sidebar-game img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.sg-sidebar-game h4 {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #c8d0da;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === DOWNLOAD BUTTONS === */
.sg-download-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sg-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  transition: opacity .2s;
}
.sg-download-btn:hover { opacity: .85; color: #fff; text-decoration: none; }
.sg-download-btn.android { background: #3ddc84; color: #1a2634; }
.sg-download-btn.ios { background: #007aff; }
.sg-download-btn.apk { background: #ff6b35; }
.sg-download-btn img { width: 18px; height: 18px; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .sg-right-sidebar {
    width: 220px;
    min-width: 220px;
  }
  .sg-sidebar-games {
    grid-template-columns: 1fr;
  }
  .sg-main {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  .sg-wrapper {
    flex-direction: column;
  }
  .sg-left-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100% !important;
    height: 56px;
    min-width: unset;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 8px;
    border-right: none;
    border-top: 1px solid rgba(255,255,255,.1);
    z-index: 100;
    gap: 2px;
  }
  .sg-left-nav .sg-nav-toggle,
  .sg-left-nav .sg-nav-sep,
  .sg-left-nav .sg-nav-section-label { display: none; }
  .sg-left-nav .sg-nav-item {
    width: 44px; height: 44px;
    margin: 6px 2px;
    flex-shrink: 0;
  }
  .sg-left-nav .sg-nav-item .sg-nav-label { display: none !important; }
  .sg-left-nav:not(.is-expanded) .sg-nav-item[data-tooltip]:hover::after { display: none; }
  .sg-right-sidebar {
    width: 100%;
    min-width: unset;
    padding: 0 16px 70px;
  }
  .sg-sidebar-games {
    grid-template-columns: repeat(3, 1fr);
  }
  .sg-main {
    padding: 16px 16px 20px;
  }
  .sg-game-title { font-size: 18px; }
  .sg-game-icon { width: 60px; height: 60px; border-radius: 12px; }
  .sg-info-bar { padding: 12px; gap: 12px; }
}

@media (max-width: 480px) {
  .sg-sidebar-games {
    grid-template-columns: repeat(2, 1fr);
  }
  .sg-related-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .sg-hero { border-radius: 8px; }
  .sg-info-bar,
  .sg-description,
  .sg-nph-block,
  .sg-comments,
  .sg-rating-block { border-radius: 8px; }
}

/* === Override theme defaults inside single-game === */
.sg-wrapper * { box-sizing: border-box; }
.sg-wrapper a:hover { text-decoration: none; }

/* KK Star Ratings dark override */
.sg-rating-block .kksr-star { filter: brightness(1.2); }
.sg-rating-block .kksr-legend { color: #8b97a8 !important; font-size: 12px !important; }
