/* ============================================
   LAYOUT STYLES - SloopyGames
   ============================================ */

/* ============================================
   BASE PAGE LAYOUT
   ============================================ */

body {
  background: var(--sg-bg-base);
  min-height: 100vh;
}

.page-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.main-container {
  display: flex;
  width: 100%;
}

/* ============================================
   SIDEBAR - EXPANDED STATE (185px)
   ============================================ */

.sidebar {
  width: var(--sg-sidebar-width);
  flex-shrink: 0;
  background: var(--sg-bg-sidebar);
  border-right: var(--sg-border-width) solid var(--sg-border);
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 10px 14px;
  border-bottom: var(--sg-border-width) solid var(--sg-border);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  color: var(--sg-text-dim);
  text-decoration: none;
  transition: color var(--sg-transition-fast), background var(--sg-transition-fast);
  width: 100%;
}

.nav-item:hover {
  color: var(--sg-text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

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

.nav-item svg {
  flex-shrink: 0;
}

.nav-item span {
  white-space: nowrap;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  color: var(--sg-text-dim);
}

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

.sidebar-separator {
  height: 0.5px;
  background: var(--sg-border);
  margin: 6px 0;
}

.sidebar-categories {
  display: flex;
  flex-direction: column;
}

.category-label {
  padding: 3px 14px;
  font-size: 9.5px;
  color: var(--sg-text-ghost);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-category-label {
  padding: 3px 14px;
  font-size: 9.5px;
  color: var(--sg-text-ghost);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-promo {
  margin-top: auto;
  padding: 10px 14px;
}

/* ============================================
   SIDEBAR - COLLAPSED STATE (54px)
   ============================================ */

.sidebar.collapsed {
  width: var(--sg-sidebar-collapsed);
}

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

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

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

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
  flex: 1;
  background: var(--sg-bg-base);
  padding: var(--sg-content-padding);
  display: flex;
  flex-direction: column;
}

/* ============================================
   TOP BAR
   ============================================ */

.top-bar {
  background: var(--sg-bg-topbar);
  padding: 9px 18px;
  border-bottom: var(--sg-border-width) solid var(--sg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  flex: 1;
  background: var(--sg-bg-card);
  border: var(--sg-border-width) solid var(--sg-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--sg-text-primary);
  font-family: var(--sg-font);
  font-size: 14px;
  outline: none;
}

.search-input::placeholder {
  color: var(--sg-text-dim);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ad-free-pill {
  background: rgba(0, 188, 212, 0.1);
  color: var(--sg-primary);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

.user-icon {
  color: var(--sg-text-secondary);
  cursor: pointer;
}

/* ============================================
   AD BAR
   ============================================ */

.ad-bar {
  background: linear-gradient(135deg, rgba(0, 188, 212, 0.05), rgba(255, 107, 157, 0.05));
  border-bottom: var(--sg-border-width) solid var(--sg-border);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ad-bar-text {
  color: var(--sg-text-secondary);
  font-size: 14px;
}

.ad-bar-link {
  color: var(--sg-accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.ad-bar-link:hover {
  text-decoration: underline;
}

/* ============================================
   FEATURED SECTION
   ============================================ */

.featured-section {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.featured-main {
  flex: 2;
  background: var(--sg-tint-featured-main);
  border-radius: var(--radius-xl);
  padding: 20px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-badge {
  background: var(--sg-accent);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: flex-start;
}

.featured-label {
  color: var(--sg-text-primary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.featured-title {
  font-family: var(--sg-font);
  font-size: 24px;
  font-weight: 700;
  color: var(--sg-text-primary);
  margin-bottom: 8px;
}

.featured-meta {
  color: var(--sg-text-muted);
  font-size: 14px;
}

.featured-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.featured-side-card {
  background: var(--sg-bg-card);
  border: var(--sg-border-width) solid var(--sg-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.featured-side-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.featured-side-title {
  font-family: var(--sg-font);
  font-size: 16px;
  font-weight: 600;
  color: var(--sg-text-secondary);
  margin-bottom: 4px;
}

.featured-side-meta {
  color: var(--sg-text-muted);
  font-size: 13px;
}

/* ============================================
   GAME SECTION
   ============================================ */

.game-section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--sg-font);
  font-size: 20px;
  font-weight: 700;
  color: var(--sg-text-primary);
  margin: 0;
}

.view-all-link {
  color: var(--sg-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.view-all-link:hover {
  text-decoration: underline;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--sg-grid-gap);
}

.game-card {
  background: var(--sg-bg-card);
  border: var(--sg-border-width) solid var(--sg-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--sg-transition-normal);
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-2px);
}

.game-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.game-thumbnail svg {
  width: 100%;
  height: 100%;
}

.game-info {
  padding: 12px;
}

.game-title {
  font-family: var(--sg-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--sg-text-secondary);
  margin-bottom: 4px;
}

.game-meta {
  color: var(--sg-text-faint);
  font-size: 12px;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  background: var(--sg-bg-base);
  border-top: var(--sg-border-width) solid var(--sg-border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-left {
  color: var(--sg-text-ghost);
  font-size: 13px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-right a {
  color: var(--sg-text-ghost);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--sg-transition-fast);
}

.footer-right a:hover {
  color: var(--sg-text-secondary);
}

/* ============================================
   RESPONSIVE - TABLET (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(--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;
  }
}

/* ============================================
   RESPONSIVE - MOBILE (< 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 TOP BAR
      ============================================ */

  .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-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);
  }

  /* ============================================
      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;
  }
}

/* ============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================ */

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

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