/* ============================================
   RESPONSIVE STYLES - SloopyGames
   ============================================ */

/* ============================================
   TABLET BREAKPOINT (768px - 1023px)
   ============================================ */

@media (max-width: 1023px) {
  /* Sidebar: Collapsed state */
  .sidebar {
    width: var(--sg-sidebar-collapsed);
  }

  .sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-nav-item {
    width: 34px;
    height: 34px;
    border-radius: var(--sg-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sg-text-faint);
  }

  .sidebar-nav-item.active {
    background: rgba(0, 188, 212, 0.08);
    color: var(--sg-primary);
  }

  /* Hide text elements in collapsed sidebar */
  .sidebar-category-label,
  .sidebar-promo {
    display: none;
  }

  /* Game grid: 4 columns */
  .game-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Featured section: Side by side layout maintained */
  .featured-section {
    display: flex;
    flex-direction: row;
  }
}

/* ============================================
   MOBILE BREAKPOINT (< 768px)
   ============================================ */

@media (max-width: 767px) {
  /* ============================================
     MOBILE SIDEBAR - Slide-out drawer
     ============================================ */

  .sidebar {
    position: fixed;
    left: calc(var(--sg-sidebar-width) * -1);
    top: 0;
    height: 100vh;
    width: var(--sg-sidebar-width);
    z-index: 1000;
    transition: left var(--sg-transition-normal);
    background: var(--sg-bg-sidebar);
  }

  .sidebar.active {
    left: 0;
  }

  /* Restore expanded state in mobile drawer */
  .sidebar-logo {
    display: block;
    padding: 10px 14px;
  }

  .sidebar-nav-item {
    width: auto;
    height: auto;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    padding: 7px 14px;
    color: var(--sg-text-dim);
  }

  .sidebar-nav-item.active {
    background: rgba(0, 188, 212, 0.06);
    color: var(--sg-primary);
  }

  /* Show category labels and promo in mobile drawer */
  .sidebar-category-label,
  .sidebar-promo {
    display: block;
  }

  /* ============================================
     MOBILE HAMBURGER MENU BUTTON
     ============================================ */

  .hamburger-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    gap: 5px;
  }

  .hamburger-menu span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--sg-text-secondary);
    border-radius: 1px;
    transition: background var(--sg-transition-fast);
  }

  .hamburger-menu:hover span {
    background: var(--sg-primary);
  }

  /* ============================================
     MOBILE SEARCH - Icon that expands on tap
     ============================================ */

  .search-container {
    position: relative;
  }

  .search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--sg-text-dim);
  }

  .search-toggle:hover {
    color: var(--sg-primary);
  }

  .search-input-wrapper {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 0;
    opacity: 0;
    transition: all var(--sg-transition-normal);
    overflow: hidden;
  }

  .search-input-wrapper.active {
    transform: translateY(-50%) scale(1);
    width: 200px;
    opacity: 1;
  }

  /* ============================================
     MOBILE GAME GRID - 2 columns
     ============================================ */

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* ============================================
     MOBILE FEATURED SECTION - Stacked layout
     ============================================ */

  .featured-section {
    display: flex;
    flex-direction: column;
  }

  .featured-main {
    width: 100%;
    margin-bottom: var(--sg-space-md);
  }

  .featured-side {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--sg-space-md);
  }

  .featured-side-card {
    width: 100%;
  }

  /* ============================================
     MOBILE GAME DETAIL PAGE - Single column
     ============================================ */

  .game-detail-layout {
    display: flex;
    flex-direction: column;
  }

  .game-frame-container {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .game-frame {
    width: 100%;
    border-radius: var(--sg-radius-lg);
  }

  .game-info-panel {
    width: 100%;
    margin-top: var(--sg-space-lg);
  }

  /* ============================================
     MOBILE PRICING CARDS - Stack vertically
     ============================================ */

  .pricing-grid {
    grid-template-columns: 1fr;
    gap: var(--sg-space-lg);
  }

  .pricing-card {
    width: 100%;
  }

  /* ============================================
     MOBILE "YOU MIGHT ALSO LIKE" - 3 columns
     ============================================ */

  .related-games-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* ============================================
     MOBILE TOP BAR ADJUSTMENTS
     ============================================ */

  .top-bar-left {
    gap: var(--sg-space-sm);
  }

  .top-bar-right {
    gap: var(--sg-space-xs);
  }

  /* ============================================
     MOBILE OVERLAY for sidebar drawer
     ============================================ */

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
  }

  .sidebar-overlay.active {
    display: block;
  }
}

/* ============================================
   DESKTOP DEFAULT (≥1024px)
   ============================================ */

@media (min-width: 1024px) {
  /* Hide hamburger menu on desktop */
  .hamburger-menu {
    display: none;
  }

  /* Hide mobile search toggle on desktop */
  .search-toggle {
    display: none;
  }

  /* Hide sidebar overlay on desktop */
  .sidebar-overlay {
    display: none;
  }

  /* Sidebar: Full expanded state */
  .sidebar {
    width: var(--sg-sidebar-width);
    position: relative;
    left: 0;
  }

  /* Game grid: 5 columns */
  .game-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  /* Featured section: Side by side layout */
  .featured-section {
    display: flex;
    flex-direction: row;
  }

  .featured-main {
    flex: 2;
    margin-right: var(--sg-space-md);
  }

  .featured-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--sg-space-md);
  }
}
