/* ==========================================
   DOWNLIN - UI COMPONENTS
   shadcn/ui & X.com inspired reusable component styles
   ========================================== */

/* ------------------------------------------
   1. GLOBAL HEADER & NAV
   ------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition-normal);
}

.header-container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {   display: flex;   align-items: center;   gap: 0.6rem;   font-weight: 700;   font-size: 1.25rem;   color: var(--text-primary);   letter-spacing: -0.02em;   transition: opacity var(--transition-fast); }

.logo:hover {
    opacity: 0.85;
}

.logo img {
    height: 24px;
    width: auto;
    border-radius: 5px;
}

/* Light mode */
.logo-dark {
    display: none;
}

.logo-light {
    display: block;
}

/* Dark mode */
[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

/* Header Search Bar */
.header-search {
  position: relative;
  flex: 1;
  max-width: 440px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon-inside {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}
.category-page-grid {
      display: grid;
      grid-template-columns: 280px 1fr;
      gap: 1.75rem;
      align-items: start;
    }

    /* Sticky Sidebar Styles */
    .category-sidebar {
      position: sticky;
      top: 5rem;
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .sidebar-widget {
      background-color: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 1.25rem;
      box-shadow: var(--shadow-sm);
    }

    .widget-title {
      font-size: 0.9rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-primary);
      margin-bottom: 0.85rem;
      padding-bottom: 0.5rem;
      border-bottom: 1px solid var(--border);
    }

    /* Checkbox list styling */
    .filter-checkbox-group {
      display: flex;
      flex-direction: column;
      gap: 0.6rem;
    }

    .filter-checkbox-label {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.85rem;
      color: var(--text-primary);
      cursor: pointer;
    }

    .filter-checkbox-label input[type="checkbox"] {
      accent-color: var(--brand);
      width: 15px;
      height: 15px;
      cursor: pointer;
    }

    /* Tag Input Box */
    .tag-input-box {
      width: 100%;
      padding: 0.6rem 0.75rem;
      font-size: 0.85rem;
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      background: var(--bg-body);
      color: var(--text-primary);
      outline: none;
      transition: border-color 0.15s ease;
    }

    .tag-input-box:focus {
      border-color: var(--brand);
    }

    /* Sidebar Ad Slot */
    .sidebar-ad-slot {
      background-color: var(--card-bg);
      border: 1px dashed var(--border-hover);
      border-radius: var(--radius-lg);
      padding: 1.25rem 1rem;
      text-align: center;
      min-height: 250px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    .ad-tag {
      font-size: 0.65rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
      margin-bottom: 0.5rem;
      display: block;
    }

    /* Controls Bar Simplified */
    .controls-bar-simple {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      margin-bottom: 1.25rem;
      padding: 0.75rem 1rem;
      background-color: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
    }

    /* Custom Responsive Pagination Component (Always Visible) */
    .pagination-wrapper,
    #pagination-controls {
      display: flex !important;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
      margin-top: 2rem;
      flex-wrap: wrap;
      visibility: visible !important;
      opacity: 1 !important;
    }

    .page-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 38px;
      height: 38px;
      padding: 0 0.6rem;
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      background-color: var(--card-bg);
      color: var(--text-primary);
      font-size: 0.875rem;
      font-weight: 500;
      text-decoration: none;
      transition: all 0.15s ease;
      cursor: pointer;
      user-select: none;
    }

    .page-link:hover:not(.disabled):not(.active) {
      border-color: var(--brand);
      color: var(--brand);
      background-color: var(--bg-body);
    }

    .page-link.active {
      background-color: var(--brand);
      border-color: var(--brand);
      color: var(--accent-primary-fg);
      font-weight: 700;
    }

    .page-link.disabled {
      opacity: 0.5;
      cursor: not-allowed;
      pointer-events: none;
    }

    .page-ellipsis {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 32px;
      height: 38px;
      color: var(--text-muted);
      font-weight: 600;
      font-size: 0.875rem;
    }

    /* Responsive Media Queries */
    @media (max-width: 900px) {
      .category-page-grid {
        grid-template-columns: 1fr;
      }

      .category-sidebar {
        position: static;
      }
    }

    @media (max-width: 480px) {

      .pagination-wrapper,
      #pagination-controls {
        gap: 0.25rem;
      }

      .page-link {
        min-width: 34px;
        height: 34px;
        font-size: 0.8rem;
        padding: 0 0.4rem;
      }

      .page-ellipsis {
        min-width: 24px;
        height: 34px;
      }
    }
.header-search input {
  width: 100%;
  height: 38px;
  padding: 0 2.5rem 0 2.4rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  background-color: var(--card-bg);
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(47, 54, 68, 0.15);
}

.search-shortcut-badge {
  position: absolute;
  right: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Suggestions Dropdown */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 120;
  max-height: 360px;
  overflow-y: auto;
  display: none;
}

.search-suggestions.active {
  display: block;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background-color: var(--card-hover);
}

.suggestion-thumb {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  object-fit: cover;
}

/* Nav Menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background-color: var(--card-hover);
}

/* Category Megamenu Dropdown */
.nav-item-dropdown {
  position: relative;
}

.megamenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 620px;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  z-index: 110;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.nav-item-dropdown:hover .megamenu,
.nav-item-dropdown:focus-within .megamenu,
.megamenu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.megamenu-column-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.megamenu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.megamenu-link {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  display: block;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.megamenu-link:hover {
  color: var(--brand);
  background-color: var(--bg-subtle);
}

/* Theme Toggle & Buttons */
.theme-toggle-btn,
.mobile-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.theme-toggle-btn:hover,
.mobile-btn:hover {
  background-color: var(--card-hover);
  border-color: var(--border-hover);
}

/* Mobile Controls */
.mobile-controls {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

/* Mobile Drawer Overlay */
.mobile-nav-drawer {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 99;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  overflow-y: auto;
}

.mobile-nav-drawer.open {
  transform: translateX(0);
}

.mobile-search-wrapper {
  margin-bottom: 1rem;
}

/* ------------------------------------------
   2. BUTTONS & BADGES (shadcn style)
   ------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: var(--accent-primary-fg);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-brand {
  background-color: var(--brand);
  color: var(--accent-primary-fg);
}

.btn-brand:hover {
  background-color: var(--brand-hover);
}

.btn-snack-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.45rem;
  line-height: 1;
  letter-spacing: 0.02em;
}

.btn-secondary {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--card-hover);
  border-color: var(--border-hover);
}

.btn-outline {
  border: 1px solid var(--border);
  background-color: transparent;
  color: var(--text-primary);
}

.btn-outline:hover {
  background-color: var(--card-hover);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background-color: var(--card-hover);
  color: var(--text-primary);
}

.btn-sm {
  font-size: 0.775rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--badge-bg);
  color: var(--badge-text);
  line-height: 1.25;
}

.badge-official {
  background-color: var(--badge-official-bg);
  color: var(--badge-official-text);
}

.badge-github {
  background-color: var(--badge-github-bg);
  color: var(--badge-github-text);
}

.badge-mirror {
  background-color: var(--badge-mirror-bg);
  color: var(--badge-mirror-text);
}

/* ------------------------------------------
   3. HOME PAGE - HERO & POPULAR TEXT LISTS
   ------------------------------------------ */
.home-hero-section {
  padding: 5rem 1rem 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home-brand-title {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.home-tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2.25rem;
  font-weight: 400;
}

.home-search-container {
  width: 100%;
  max-width: 680px;
  position: relative;
  margin-bottom: 1.5rem;
}

.home-search-input {
  width: 100%;
  height: 52px;
  padding: 0 3rem 0 3.25rem;
  font-size: 1rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.home-search-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 4px rgba(54, 56, 61, 0.15);
}

.home-search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.home-search-shortcut {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  pointer-events: none;
}

.home-category-links {
  display: flow-root;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.home-category-links a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
}

.home-category-links a:hover {
  color: var(--brand);
}

.dot-separator {
  color: var(--text-muted);
}

/* Google-inspired Clean Hero Section */
.home-hero-section {
  min-height: calc(72vh - 70px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0 5rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* Responsive Advertisement Slots */
.ad-slot-wrapper {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.ad-slot-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.ad-slot {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  overflow: hidden;
  text-align: center;
  padding: 0.75rem;
  transition: border-color var(--transition-fast);
}

.ad-slot:hover {
  border-color: var(--border-hover);
}

.ad-slot-leaderboard {
  min-height: 90px;
  max-width: 970px;
}

.ad-slot-inline {
  min-height: 100px;
  width: 100%;
}

.ad-slot-sidebar {
  min-height: 250px;
  width: 100%;
}

/* Homepage Popular Text Lists Section */
.popular-section {
  padding: 1.5rem 0 4rem;
  border-top: none;
}

.popular-grid{
    display: flex;
    flex-wrap: nowrap;
    gap: 1.5rem;

    overflow-x: auto;
    overflow-y: hidden;

    scroll-behavior: smooth;
    scroll-snap-type: x proximity;

    padding: 0.25rem 3rem 1rem;

    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;

    position: relative;

    /* Better touch scrolling */
    -webkit-overflow-scrolling: touch;
}

.popular-grid::-webkit-scrollbar {
    display: none;
}
.popular-grid:hover,
.popular-grid:focus-within{
    scrollbar-width: thin;
}
.popular-grid:hover::-webkit-scrollbar-thumb,
.popular-grid:focus-within::-webkit-scrollbar-thumb {
    background: var(--border);
}
/* Keep every card in the row */

.popular-column {
    flex: 0 0 300px;
    min-width: 300px;
    scroll-snap-align: start;
}


.horizontal-scroll-container {
    position: relative;
}


/* Left fade */

.horizontal-scroll-container::before {
    content: "";
    position: absolute;

    left: 0;
    top: 0;
    bottom: 0;

    width: 55px;

    background: linear-gradient(
        to right,
        var(--bg),
        transparent
    );

    pointer-events: none;

    z-index: 5;
}


/* Right fade */

.horizontal-scroll-container::after {
    content: "";
    position: absolute;

    right: 0;
    top: 0;
    bottom: 0;

    width: 55px;

    background: linear-gradient(
        to left,
        var(--bg),
        transparent
    );

    pointer-events: none;

    z-index: 5;
}
.popular-column-header {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
  padding-bottom: 0.25rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.popular-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 1rem;
}

.popular-item-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.popular-item-link:hover {
  background-color: var(--card-hover);
  color: var(--brand);
}

.popular-item-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  padding: 0.25rem 0.5rem;
}

.view-all-link:hover {
  color: var(--brand);
}

/* Homepage Categories & Subcategories Browse Section */
.categories-browse-section {
  padding: 3rem 0 4.5rem;
}

.categories-browse-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.categories-browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.category-browse-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  transition: all var(--transition-fast);
}

.category-browse-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.category-browse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.category-browse-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subcategories-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}

.subcat-pill {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  display: inline-block;
}

.subcat-pill:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--card-bg);
}

color: var(--brand);
}

/* ------------------------------------------
   4. CATEGORY & SEARCH CONTROLS
   ------------------------------------------ */
.page-header-banner {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.breadcrumb a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.85rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.select-control {
  height: 36px;
  padding: 0 2rem 0 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2094a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.select-control:focus {
  outline: none;
  border-color: var(--ring);
}

.layout-switcher {
  display: flex;
  align-items: center;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
}

.layout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.layout-btn.active {
  background-color: var(--card-bg);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Filter Tag Pills Bar */
.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.filter-pill {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background-color: var(--card-bg);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.filter-pill:hover,
.filter-pill.active {
  background-color: var(--accent-primary);
  color: var(--accent-primary-fg);
  border-color: var(--accent-primary);
}

/* ------------------------------------------
   5. DUAL ITEM LAYOUTS (LIST vs CARDS)
   ------------------------------------------ */

/* Layout A - Picture List */
.item-list-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--card-bg);
}

.item-list-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-fast);
  position: relative;
}

.item-list-row:last-child {
  border-bottom: none;
}

.item-list-row:hover {
  background-color: var(--card-hover);
}
.category-alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.category-list-divider {
    margin: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

.subcategories-list {
    padding-top: 0.25rem;
}
.item-thumb-list {
  width: 80px;
  height: 110px;
  min-width: 80px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.item-list-content {
  flex: 1;
  min-width: 0;
}

.item-list-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-list-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-list-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.item-list-arrow {
  color: var(--text-muted);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.item-list-row:hover .item-list-arrow {
  transform: translateX(4px);
  color: var(--brand);
}

/* Layout B - Picture Cards Grid */
.item-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.item-card {
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.item-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.item-card-image-wrap {
  aspect-ratio: 16 / 9;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-card-icon-fallback {
  font-size: 2.5rem;
  font-weight: 700;
  
}

.item-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.item-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.item-card-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ------------------------------------------
   6. ITEM DETAILS PAGE COMPONENTS
   ------------------------------------------ */
.item-detail-hero {
  display: flex;
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.item-hero-thumb {
  width: 140px;
  height: 140px;
  min-width: 140px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--text-secondary);
  overflow: hidden;
}

.item-hero-content {
  flex: 1;
}

.item-hero-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.item-hero-tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.item-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.meta-item-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.meta-item-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Download Links Table */
.download-section {
  margin-bottom: 3rem;
}

.section-heading {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.download-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--card-bg);
}

.download-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.download-table th {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.download-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.download-table tr:last-child td {
  border-bottom: none;
}

.download-table tr:hover td {
  background-color: var(--card-hover);
}

/* Specs & Features & Versions */
.detail-content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.features-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.925rem;
  color: var(--text-primary);
}

.check-icon {
  color: #10b981;
  min-width: 18px;
  margin-top: 2px;
}

/* Spec Table */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.spec-table th,
.spec-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.spec-table th {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  width: 35%;
  font-weight: 600;
  text-align: left;
}

/* Version History Timeline */
.version-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* Screenshots Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}

.gallery-item {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  background-color: var(--bg-subtle);
  cursor: pointer;
  position: relative;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.gallery-item:hover img {
  transform: scale(1.04);
}

/* ------------------------------------------
   7. MODALS, LIGHTBOX & TOASTS
   ------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close-btn {
  font-size: 1.25rem;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background-color: var(--card-hover);
  color: var(--text-primary);
}

.lightbox-img-full {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  display: block;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-lg);
  background-color: var(--accent-primary);
  color: var(--accent-primary-fg);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 200ms ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------------------------------------
   8. PAGINATION & SKELETON LOADERS
   ------------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 2.5rem 0;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--card-bg);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-btn.active {
  background-color: var(--accent-primary);
  color: var(--accent-primary-fg);
  border-color: var(--accent-primary);
}

.page-btn:hover:not(.active):not(:disabled) {
  background-color: var(--card-hover);
  color: var(--text-primary);
}

/* Skeleton Loading State */
.skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--border) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeletonLoading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* ------------------------------------------
   9. SITE FOOTER
   ------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--border);
  background-color: var(--bg);
  padding: 2rem 0;
  margin-top: 4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  flex-wrap: wrap;
}

.footer-links a:hover {
  color: var(--brand);
}