/* ==========================================================================
   COLOR VARIABLES
   ========================================================================== */
:root {
  /* Dark Mode (Default) */
  --bg-primary: #1c1c1c;
  --bg-secondary: #2a2a2a;
  --bg-secondary-rgb: 42, 42, 42;
  --bg-tertiary: #222;
  /* Footer, Table Background */
  --bg-gradient-start: #2a2a2a;
  --bg-gradient-end: #1a1a1a;
  --text-primary: #e0e0e0;
  --text-secondary: #ccc;
  --text-heading: #fff;
  --text-disabled: #555;
  --border-primary: #444;
  --border-secondary: #383838;
  --accent-primary: #e44d26;
  --accent-primary-rgb: 228, 77, 38;
  --accent-primary-hover: #f55a35;
  --accent-primary-transparent: rgba(228, 77, 38, 0.3);
  --accent-border: rgba(228, 77, 38, 0.5);
  --accent-glow: rgba(228, 77, 38, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-strong-color: rgba(0, 0, 0, 0.4);
  --shadow-text-color: rgba(0, 0, 0, 0.7);
  --card-border-light-trans: rgba(255, 255, 255, 0.1);
  --card-bg-trans: rgba(42, 42, 42, 0.7);
  --spinner-base: rgba(228, 77, 38, 0.2);
  --spinner-top: var(--accent-primary);
  --card-sheen-gradient: linear-gradient(135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0));
  --bg-overlay-dark: rgba(0, 0, 0, 0.8);
  --element-bg-hover: #3a3a3a;
  /* Dark mode hover */

  /* Content Page Specific Variables */
  --code-bg: #2e2e2e;
  --code-border: #444;
  --scrollbar-track-bg: #2c2c2c;
  --scrollbar-thumb-bg: #555;
  --scrollbar-thumb-hover-bg: #777;
  --table-header-bg: #333;
  --table-row-hover-bg: #383838;
  --scroll-arrow-bg-trans: rgba(0, 0, 0, 0.5);
}

/* Light Mode Overrides */
body.light-mode {
  --bg-primary: #f4f4f4;
  --bg-secondary: #ffffff;
  --bg-secondary-rgb: 255, 255, 255;
  --bg-tertiary: #e0e0e0;
  /* Footer, Table Background */
  --bg-gradient-start: #ffffff;
  --bg-gradient-end: #f0f0f0;
  --text-primary: #333333;
  --text-secondary: #555555;
  --text-heading: #111111;
  --text-disabled: #aaaaaa;
  --border-primary: #cccccc;
  --border-secondary: #dddddd;
  /* Accents can often stay the same, or adjust slightly if needed */
  /* --accent-primary: #d8441f; */
  /* --accent-primary-hover: #e8502a; */
  --accent-primary-rgb: 228, 77, 38;
  --accent-primary-transparent: rgba(228, 77, 38, 0.15);
  --accent-border: rgba(228, 77, 38, 0.4);
  --accent-glow: rgba(228, 77, 38, 0.3);
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-strong-color: rgba(0, 0, 0, 0.15);
  --shadow-text-color: rgba(0, 0, 0, 0.2);
  --card-border-light-trans: rgba(0, 0, 0, 0.1);
  --card-bg-trans: rgba(255, 255, 255, 0.8);
  --spinner-base: rgba(228, 77, 38, 0.15);
  /* Spinner top can stay the same */
  --card-sheen-gradient: linear-gradient(135deg,
      rgba(0, 0, 0, 0.03),
      rgba(0, 0, 0, 0));
  /* Subtle dark sheen for light */
  --bg-overlay-dark: rgba(244, 244, 244, 0.85);
  /* Light overlay */
  --element-bg-hover: #e8e8e8;
  /* Light mode hover */

  /* Content Page Specific Variables - Light Mode */
  --code-bg: #f0f0f0;
  --code-border: #ddd;
  --scrollbar-track-bg: #f0f0f0;
  --scrollbar-thumb-bg: #ccc;
  --scrollbar-thumb-hover-bg: #bbb;
  --table-header-bg: #f0f0f0;
  --table-row-hover-bg: #f9f9f9;
  --scroll-arrow-bg-trans: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
     RESET & BASE STYLES
     ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  /* Removed 0px as 0 is sufficient */
  background-color: var(--bg-primary);
  /* Use variable */
  color: var(--text-primary);
  /* Use variable */
  transition: background-color 0.3s ease, color 0.3s ease;
  /* Smooth transition */
}

/* ==========================================================================
     LAYOUT & CONTAINER
     ========================================================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px;
  align-items: center;
  /* This typically applies to flex containers, might be unused if .container is not display:flex */
}

/* ==========================================================================
     MODERN HEADER & NAVIGATION STYLES
     ========================================================================== */

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
  overflow: hidden;
}

/* ==========================================================================
     SOCIAL SIDEBAR - Enhanced
     ========================================================================== */
.social-sidebar {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 1001;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-secondary);
}

.social-icon:hover {
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  background: var(--accent-primary);
  color: white;
}

/* Individual social icon colors */
.social-icon.facebook:hover {
  background: #1877f2;
}

.social-icon.threads:hover {
  background: #000000;
}

.social-icon.instagram:hover {
  background: linear-gradient(45deg,
      #f09433,
      #e6683c,
      #dc2743,
      #cc2366,
      #bc1888);
}

.social-icon.pinterest:hover {
  background: #bd081c;
}

/* Hide social sidebar on mobile */
@media (max-width: 768px) {
  .social-sidebar {
    display: none;
  }
}

/* ==========================================================================
     MAIN HEADER STYLES
     ========================================================================== */
.site-header {
  background: rgba(var(--bg-secondary-rgb), 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid var(--border-primary);
}

.site-header.scrolled {
  padding: 8px 0;
  background: rgba(var(--bg-secondary-rgb), 0.98);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.site-header.hidden {
  transform: translateY(-100%);
}

.header-container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

/* ==========================================================================
     LOGO SECTION
     ========================================================================== */
.logo-section {
  flex-shrink: 0;
}

.site-logo {
  display: block;
  padding: 4px 0;
  transition: all 0.3s ease;
}

.site-logo:hover {
  transform: scale(1.05);
}

.header-logo {
  height: 50px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: all 0.3s ease;
}

.site-header.scrolled .header-logo {
  height: 40px;
}

/* ==========================================================================
     NAVIGATION STYLES
     ========================================================================== */
.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Theme Toggle Button */
.theme-toggle-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-primary);
  padding: 10px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.theme-toggle-button:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(var(--accent-primary-rgb), 0.4);
}

.theme-icon {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}

.theme-toggle-button:hover .theme-icon {
  transform: rotate(180deg);
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  list-style: none;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.nav-menu li {
  margin: 0;
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 50px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  background: transparent;
}

.nav-icon {
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

/* Modern hover effect */
.nav-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
      var(--accent-primary),
      var(--accent-secondary));
  border-radius: 50px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.nav-link:hover::before,
.nav-link.active::before {
  opacity: 1;
  transform: scale(1);
}

.nav-link:hover,
.nav-link.active {
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(var(--accent-primary-rgb), 0.4);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
  transform: scale(1.2);
}


/* ==========================================================================
     MOBILE RESPONSIVE STYLES
     ========================================================================== */
@media (max-width: 768px) {
  .header-container {
    gap: 1rem;
  }

  .nav-menu {
    border-radius: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .hide-on-mobile {
    display: none !important;
  }

  .nav-link {
    font-size: 1.2rem;
    padding: 8px 12px;
  }

  .nav-icon {
    font-size: 1.4rem;
  }

  .theme-text {
    display: none;
  }

  .header-logo {
    height: 40px;
  }
}

@media (max-width: 480px) {
  .header-container {
    width: 95%;
    padding: 0 10px;
  }

  .theme-toggle-button {
    padding: 6px 8px;
    min-width: 40px;
    justify-content: center;
  }

  .nav-link {
    font-size: 1.1rem;
    padding: 14px 20px;
  }
}

/* ==========================================================================
     DARK MODE ADJUSTMENTS
     ========================================================================== */
@media (prefers-color-scheme: dark) {
  .site-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .social-icon {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
  }
}

/* ==========================================================================
     ANIMATIONS & MICRO-INTERACTIONS
     ========================================================================== */
/* Focus styles for accessibility */
.nav-link:focus,
.theme-toggle-button:focus,
.social-icon:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .nav-link::before {
    background: var(--accent-primary);
  }

  .site-header {
    border-bottom: 2px solid var(--border-primary);
  }
}

/* ==========================================================================
     TYPOGRAPHY
     ========================================================================== */
h1 {
  text-align: center;
  color: var(--text-heading);
  /* Use variable */
  margin-bottom: 30px;
  /* Note: Context-specific h1 styles are in .content-page and .wallpaper-info */
}

/* ==========================================================================
     FORMS & INPUTS (Search, Selectors)
     ========================================================================== */

/* App Selector (Top level, if used outside panel) */
.app-selector {
  margin-bottom: 40px;
  text-align: center;
}

.app-selector select {
  padding: 10px 15px;
  font-size: 16px;
  border-radius: 5px;
  border: 1px solid var(--border-primary);
  /* Use variable */
  min-width: 200px;
  background-color: var(--bg-secondary);
  /* Use variable */
  color: var(--text-primary);
  /* Use variable */
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Search bar styles */
.search-container {
  margin-bottom: 40px;
  text-align: center;
  /* Note: .top-main-controls .search-container overrides margin-bottom */
}

.search-form {
  display: flex;
  margin: 0 auto;
  width: 100%;
}

.search-input {
  flex-grow: 1;
  padding: 10px 15px;
  font-size: 16px;
  border: 1px solid var(--border-primary);
  /* Use variable */
  border-radius: 5px 0 0 5px;
  outline: none;
  background-color: var(--bg-secondary);
  /* Use variable */
  color: var(--text-primary);
  /* Use variable */
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.search-button {
  padding: 10px 20px;
  background-color: var(--accent-primary);
  /* Use variable */
  color: white;
  border: none;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

.search-button:hover {
  background-color: var(--accent-primary-hover);
  /* Use variable */
}

/* JQuery UI Autocomplete */
.ui-autocomplete {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  background: var(--bg-secondary);
  /* Use variable */
  border: 1px solid #ddd;
  /* Consider var(--border-primary) */
  border-radius: 4px;
  box-shadow: 0 4px 8px var(--shadow-color);
  /* Use variable */
  padding: 5px 0;
  color: var(--text-primary);
}

.ui-autocomplete .ui-menu-item {
  padding: 5px 10px;
  cursor: pointer;
  font-size: 14px;
}

.ui-autocomplete .ui-menu-item:hover {
  background-color: var(--accent-primary);
  /* Use variable */
  color: white;
}

.ui-helper-hidden-accessible {
  display: none;
}

/* ==========================================================================
     FILTER CONTROLS (Categories, Tags - Legacy Buttons)
     ========================================================================== */
.horizontal-items {
  /* General utility for horizontal flex items, used by old selectors */
  display: flex;
  gap: 10px;
  justify-content: center;
}

.category-selector-container,
.tag-selector-container {
  margin-bottom: 40px;
  position: relative;
}

.category-selector,
.tag-selector {
  /* Container for legacy category/tag buttons */
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
}

.category-btn,
.tag-btn {
  /* Legacy category/tag button style */
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 20px;
  border: 1px solid var(--border-secondary);
  /* Use variable */
  background-color: var(--bg-secondary);
  /* Use variable */
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  /* Consider var(--shadow-color) */
  text-decoration: none;
  color: var(--text-secondary);
  /* Use variable */
}

.category-btn:hover,
.tag-btn:hover {
  background-color: var(--element-bg-hover, #3a3a3a);
  color: var(--text-heading);
}

body.light-mode .category-btn:hover,
body.light-mode .tag-btn:hover {
  background-color: var(--element-bg-hover, #e8e8e8);
  color: #000;
}

.category-btn.active,
.tag-btn.active {
  background-color: var(--accent-primary);
  /* Use variable */
  color: white;
  border-color: var(--accent-primary);
  /* Use variable */
}

body.light-mode .category-btn.active,
body.light-mode .tag-btn.active {
  color: white;
  /* Keep text white on active buttons in light mode */
}

/* Tag Show Button (Legacy) */
.tag-btn-show {
  /* Button to reveal tag container */
  background-color: var(--accent-primary);
  /* Use variable */
  color: white;
  border-color: var(--accent-primary);
  /* Use variable */
  margin-bottom: 15px;
  /* Inherits other .tag-btn styles if applied together */
}

body.light-mode .tag-btn-show {
  color: white;
}

/* Tag Container & Filter (Legacy) */
.tag-container {
  /* Collapsible container for legacy tags */
  margin-bottom: 20px;
  background-color: var(--bg-secondary);
  /* Use variable */
  border-radius: 10px;
  box-shadow: 0 4px 6px var(--shadow-strong-color);
  /* Use variable */
  padding: 15px;
  display: none;
  /* Initially hidden */
}

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

.tag-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--text-heading);
  /* Use variable */
}

.tag-filter {
  /* Input to filter tags in legacy view */
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-primary);
  /* Use variable */
  width: 200px;
  font-size: 14px;
  background-color: var(--bg-secondary);
  /* Use variable */
  color: var(--text-primary);
  /* Use variable */
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.tags-grid {
  /* Grid for legacy tags */
  max-height: 200px;
  overflow-y: auto;
  padding-right: 5px;
}

.tag-buttons-wrapper {
  /* Wrapper for tag buttons in legacy view */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}

.tag-letter-group {
  width: 100%;
  margin-bottom: 10px;
}

.tag-letter {
  font-weight: bold;
  margin-bottom: 5px;
  color: var(--accent-primary);
  /* Use variable */
  border-bottom: 1px solid var(--border-primary);
  /* Use variable */
}

/* ==========================================================================
     CATEGORY CAROUSEL (Horizontal Scroll)
     ========================================================================== */
.category-carousel-container {
  width: 100%;
  padding: 1.5rem 50px;
  margin-bottom: 1rem;
  background: linear-gradient(135deg,
      var(--bg-gradient-start),
      var(--bg-gradient-end));
  /* Use variables */
  box-shadow: 0 4px 15px var(--shadow-strong-color);
  /* Use variable */
  /*overflow: hidden;*/
  border-radius: 12px;
  position: relative;
  transition: background 0.3s;
}

.category-carousel {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 1rem 0;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
  gap: 1.5rem;
}

.category-carousel::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari and Opera */
}

.category-card {
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: 12px;
  padding: 0.8rem;
  background: var(--card-bg-trans);
  /* Use variable */
  backdrop-filter: blur(5px);
  border: 1px solid var(--card-border-light-trans);
  /* Use variable */
  position: relative;
  overflow: hidden;
  /* Duplicated transition properties, simplified */
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease,
    border 0.3s ease;
}

.category-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--card-sheen-gradient);
  /* Use variable */
  border-radius: 12px;
  /* Match parent */
  z-index: -1;
  /* Ensure it's behind content */
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px var(--shadow-strong-color);
  /* Use variable */
}

.category-card.active {
  background: var(--accent-primary-transparent);
  /* Use variable */
  box-shadow: 0 0 15px var(--accent-glow);
  /* Use variable */
  border: 1px solid var(--accent-border);
  /* Use variable */
}

.category-image-container {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.8rem;
  position: relative;
  box-shadow: 0 4px 8px var(--shadow-strong-color);
  /* Use variable */
}

.category-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.category-card:hover .category-image {
  transform: scale(1.1);
}

.category-name {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  margin-top: 0.3rem;
  color: var(--text-heading);
  /* Use variable */
  text-shadow: 0 1px 2px var(--shadow-text-color);
  /* Use variable */
}

/* Alternative Horizontal Categories (Simpler, older version?) */
.horizontal-categories {
  position: relative;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px var(--shadow-color);
  display: flex;
  align-items: center;
}

.search-icon-container {
  /* Part of .horizontal-categories */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,
      255,
      255,
      0.2);
  /* Hardcoded, consider variables if themeable */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin-right: 15px;
  flex-shrink: 0;
  transition: all 0.3s ease;
  cursor: pointer;
}

.search-icon-container:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.search-icon {
  /* Icon within .search-icon-container */
  color: white;
  /* Hardcoded, consider var(--text-heading) */
  font-size: 20px;
}

.categories-scroll {
  /* Scroller within .horizontal-categories */
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  padding: 5px 0;
  flex-grow: 1;
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

.category-scroll-item {
  /* Item within .categories-scroll */
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.15);
  /* Hardcoded */
  border-radius: 20px;
  margin-right: 10px;
  white-space: nowrap;
  color: white;
  /* Hardcoded */
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  /* Hardcoded */
}

.category-scroll-item:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.category-scroll-item.active {
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.category-icon {
  /* Icon within .category-scroll-item */
  margin-right: 6px;
  font-size: 14px;
}

.scroll-arrow {
  /* Arrows for .horizontal-categories and cat-horizontal-categories-panel */
  width: 40px;
  height: 40px;
  background: var(--scroll-arrow-bg-trans);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  opacity: 0.7;
  flex-shrink: 0;
  margin: 0 5px;
}

.scroll-arrow:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.7);
  /* Consider a variable */
}

/* NEW ARROW STYLES FOR MAIN CAROUSEL */
.category-carousel-container>.carousel-arrow {
  /* Target direct children */
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background-color: var(--scroll-arrow-bg-trans, rgba(0, 0, 0, 0.5));
  color: var(--text-heading, #fff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.3s, opacity 0.3s;
  opacity: 0.7;
}

.category-carousel-container>.carousel-arrow:hover {
  background-color: var(--accent-primary, #e44d26);
  opacity: 1;
}

.category-carousel-container>.carousel-arrow.disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

.category-carousel-container>.carousel-arrow-left {
  left: 5px;
}

.category-carousel-container>.carousel-arrow-right {
  right: 5px;
}

/* ==========================================================================
     ADVANCED FILTER UI (Top Controls & Collapsible Panel)
     ========================================================================== */

/* --- Top Main Controls Bar --- */
.top-main-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding: 10px 0;
}

/* ADD THIS MEDIA QUERY FOR MOBILE STACKING */
@media (max-width: 767px) {

  /* Adjust breakpoint as needed (767px is common for tablets/phones) */
  .top-main-controls {
    flex-direction: column;
    /* Stack them vertically */
    align-items: stretch;
    /* Make children take full width of the column */
  }

  .top-main-controls .search-container {
    margin-bottom: 15px;
    /* Add some space below search when stacked */
    /* flex-grow: 0; /* Reset flex-grow if it was set for row layout */
    /* width: 100%; /* Ensure it takes full width, though align-items: stretch on parent should do this */
  }

  .main-filter-toggle-and-counter {
    /* margin-left: 0; /* Reset any left margin if it was set for row layout */
    /* width: 100%; /* Optional: make it full width if desired, or let it size to content */
    justify-content: space-between;
    /* Ensure button and counter are still spaced if not full width */
  }
}

.top-main-controls .search-container {
  /* Override for search within this bar */
  flex-grow: 1;
  margin-bottom: 0;
}

.main-filter-toggle-and-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-color) 0px 1px 3px;
  flex-shrink: 0;
}

.filter-toggle-btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.filter-toggle-btn:hover {
  background-color: var(--accent-primary-hover);
}

.filter-toggle-btn:active {
  transform: scale(0.97);
}

.filter-toggle-btn .fas {
  /* Assuming FontAwesome icon */
  font-size: 0.8em;
}

.wallpaper-counter {
  /* Counter display */
  font-size: 16px;
  /* Maintained from one definition */
  font-weight: 600;
  /* Maintained */
  color: var(--text-secondary);
  padding: 8px 16px;
  /* Maintained from one definition */
  /* Other definition: font-size: 0.9rem; - choosing 16px as it's more specific */
}

.wallpaper-counter #counter,
/* For specific counter ID */
.wallpaper-counter #siteCounter {
  /* For specific counter ID */
  font-weight: 700;
  /* Maintained from #counter */
  color: var(--accent-primary);
}

.counter-container {
  /* General container for counter, if used */
  display: flex;
  align-items: center;
  gap: 15px;
}

/* --- Active Filter Info Bar --- */
.filter-info {
  /* Old filter info bar - can be merged or deprecated if new one replaces it */
  text-align: center;
  margin-bottom: 20px;
  padding: 10px;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 8px;
  display: none;
  /* Initially hidden */
}

.filter-info .filter-pill {
  /* Pills for old filter info */
  display: inline-block;
  padding: 5px 10px;
  margin: 5px;
  background-color: var(--accent-primary);
  color: white;
  border-radius: 20px;
  font-size: 14px;
}

.filter-info .clear-filter {
  /* Link to clear old filters */
  color: var(--accent-primary);
  text-decoration: none;
  margin-left: 10px;
  font-weight: bold;
}

.filter-info-active {
  /* New active filter info bar */
  display: flex;
  /* Initially shown, controlled by JS */
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 15px;
  margin-bottom: 20px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-secondary);
}

.filter-info-active .filter-info-label {
  font-weight: 600;
  color: var(--text-heading);
  margin-right: 5px;
  flex-shrink: 0;
}

.filter-info-active .filter-pill {
  /* Pills for new active filter info */
  background-color: var(--accent-primary);
  color: white;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.85rem;
}

.filter-info-active .clear-active-filters-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9em;
  margin-left: auto;
  /* Pushes to the right */
}

.filter-info-active .clear-active-filters-link:hover {
  text-decoration: underline;
}

/* --- Collapsible Filter Panel --- */
.collapsible-filter-panel {
  background-color: var(--bg-tertiary);
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  /* Consider var(--shadow-strong-color) */
  border: 1px solid var(--border-primary);
  /* display: none; /* Should be controlled by JS */
}

.filter-panel-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-secondary);
}

.filter-panel-section:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.filter-panel-section h4 {
  font-size: 1.15rem;
  color: var(--text-heading);
  margin-top: 0;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-primary);
  font-weight: 500;
}

/* App Selector in Panel */
.app-selector-panel select#appSelectPanel {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  border-radius: 5px;
  border: 1px solid var(--border-primary);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  box-sizing: border-box;
  cursor: pointer;
}

.app-selector-panel select#appSelectPanel:hover {
  border-color: var(--accent-border);
  /* Using a defined accent border color */
}

/* Device Type Selector in Panel */
.device-type-selector-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-category-btn {
  /* Specific class for device buttons in panel */
  padding: 7px 14px;
  font-size: 0.85rem;
  border-radius: 18px;
  border: 1px solid var(--border-secondary);
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--text-secondary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  /* Consider var(--shadow-color) */
}

.panel-category-btn:hover {
  background-color: var(--element-bg-hover);
  color: var(--text-heading);
}

.panel-category-btn.active {
  background-color: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 0 5px var(--accent-glow);
}

/* Tag Container in Panel */
.tag-container-panel {
  /* Assuming this is a wrapper class if needed */
  margin-top: 0;
  /* Example, specific to panel if different from generic .tag-container */
}

.tag-header-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tag-title-panel {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-heading);
}

.tag-filter-input-panel {
  /* Renamed for clarity (was tag-filter) */
  padding: 7px 10px;
  border-radius: 18px;
  border: 1px solid var(--border-primary);
  width: 220px;
  font-size: 0.9rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.tags-grid-panel {
  /* Renamed for clarity */
  max-height: 280px;
  overflow-y: auto;
  padding-right: 5px;
}

.tag-letter-group-panel {
  /* Renamed for clarity */
  margin-bottom: 10px;
}

.tag-letter-panel {
  /* Renamed for clarity */
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--accent-primary);
  border-bottom: 1px solid var(--border-primary);
  font-size: 0.9rem;
}

.tag-buttons-wrapper-panel {
  /* Renamed for clarity */
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 5px;
}

.panel-tag-btn {
  /* Specific class for tag buttons in panel */
  padding: 5px 10px;
  font-size: 0.85rem;
  border-radius: 15px;
  border: 1px solid var(--border-secondary);
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--text-secondary);
}

.panel-tag-btn:hover {
  background-color: var(--element-bg-hover);
  color: var(--text-heading);
}

.panel-tag-btn.active {
  background-color: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Theme Scroller in Panel */
.cat-horizontal-categories-panel {
  position: relative;
  display: flex;
  align-items: center;
  background: transparent;
  /* Different from main .horizontal-categories */
  padding: 10px 0;
}

.cat-categories-scroll-panel {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-grow: 1;
  padding: 5px 0;
}

.cat-categories-scroll-panel::-webkit-scrollbar {
  display: none;
}

.panel-theme-item {
  /* Specific class for theme items in panel */
  padding: 7px 14px;
  background: var(--bg-secondary);
  border-radius: 18px;
  margin-right: 10px;
  white-space: nowrap;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  border: 1px solid var(--border-primary);
}

.panel-theme-item:hover {
  background: var(--element-bg-hover);
  color: var(--text-heading);
}

.panel-theme-item.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.panel-theme-icon {
  margin-right: 6px;
  font-size: 0.9em;
}

.cat-scroll-arrow-panel {
  /* Specific class for arrows in panel's theme scroller */
  width: 35px;
  height: 35px;
  background: rgba(0,
      0,
      0,
      0.2);
  /* Hardcoded, consider var(--scroll-arrow-bg-trans) with different opacity */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease;
  opacity: 0.6;
  flex-shrink: 0;
  margin: 0 5px;
}

.cat-scroll-arrow-panel:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.4);
}

/* Panel Actions / Clear Button */
.filter-panel-actions {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border-secondary);
  text-align: center;
}

.clear-panel-filters-button {
  padding: 9px 22px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid var(--accent-border);
  background-color: transparent;
  color: var(--accent-primary);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.clear-panel-filters-button:hover {
  background-color: var(--accent-primary-transparent);
  color: var(--accent-primary-hover);
}

/* ==========================================================================
     WALLPAPER GALLERY & ITEMS
     ========================================================================== */
.gallery-image {
  /* Small preview image, distinct from wallpaper-image on detail page */
  width: 100px;
  height: auto;
  display: block;
  margin: 10px auto;
  transition: all 0.3s ease;
}

.gallery-image:hover {
  transform: scale(1.05);
  opacity: 0.9;
  cursor: pointer;
}

.wallpaper-grid {
  position: relative;
  /* ESSENTIAL for Masonry item positioning */
  margin-bottom: 0;
  /* Adjusted as pagination is removed, loading indicator follows */
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.wallpaper-item {
  position: relative;
  /* Keeps premium badge positioning relative to item */
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 8px var(--shadow-color);
  background-color: var(--bg-secondary);
  opacity: 0;
  transition: opacity 0.4s ease-in, transform 0.3s ease;
  /* transform is for existing hover */
}

.wallpaper-item:hover {
  transform: translateY(-5px);
  /* Existing hover effect */
}

.wallpaper-item.is-loaded {
  opacity: 1;
}

.wallpaper-img {
  display: block;
  /* Important for imagesLoaded and layout */
  width: 100%;
  height: 100%;
  /* If aspect-ratio is on parent, or let natural height flow */
  object-fit: cover;
}

.wallpaper-link {
  display: block;
  width: 100%;
  height: 100%;
}

/* Device-specific aspect ratios and styles */
.desktop-item {
  aspect-ratio: 16/9;
}

.tv-item {
  aspect-ratio: 16/9;
}

.watch-item {
  aspect-ratio: 1/1;
  border-radius: 20px;
}

.watch-circular-item {
  aspect-ratio: 1/1;
  border-radius: 50%;
}

.tablet-item {
  aspect-ratio: 4/3;
}

.premium-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--accent-primary);
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  z-index: 1;
  /* Ensure it's above the image */
}

.delete-wallpaper-btn {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  margin: 10px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.delete-wallpaper-btn:hover {
  background-color: #c82333;
  transform: translateY(-1px);
}

.delete-wallpaper-btn:active {
  transform: translateY(0);
  background-color: #bd2130;
}

.delete-wallpaper-btn i {
  font-size: 13px;
}

.delete-error-message {
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-left: 4px solid #ffc107;
  color: #856404;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.delete-error-message i {
  font-size: 18px;
  color: #ffc107;
}

.no-wallpapers {
  /* Ensure this still works if grid is empty. Masonry won't initialize. */
  width: 100%;
  /* Take full width of the container */
  text-align: center;
  padding: 50px;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 10px;
}

/* Default (Desktop - 5 columns) */
@media (min-width: 1101px) {
  .wallpaper-item {
    width: calc((100% - 4 * 10px) / 5);
    /* 10px is the gutter value used in JS */
    margin-bottom: 10px;
    /* This becomes the vertical gutter for Masonry */
  }
}

/* Smaller Desktop / Large Tablet - 4 columns */
@media (max-width: 1100px) and (min-width: 901px) {
  .wallpaper-item {
    width: calc((100% - 3 * 10px) / 4);
    margin-bottom: 10px;
  }
}

/* Tablet - 3 columns */
@media (max-width: 900px) and (min-width: 601px) {
  .wallpaper-item {
    width: calc((100% - 2 * 10px) / 3);
    margin-bottom: 10px;
  }
}

/* Mobile - 2 columns */
@media (max-width: 600px) {
  .wallpaper-item {
    width: calc((100% - 1 * 10px) / 2);
    margin-bottom: 10px;
  }
}

/* ==========================================================================
     LOADING INDICATOR & ANIMATIONS
     ========================================================================== */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 30px 0;
  padding: 20px;
  width: 100%;
  /* Takes full width of its container */
  color: var(--text-primary);
  /* Use variable */
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--spinner-base);
  /* Use variable */
  border-top-color: var(--spinner-top);
  /* Use variable */
  animation: spin 1s infinite linear;
  margin-bottom: 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

/* ==========================================================================
     WALLPAPER DETAILS PAGE
     ========================================================================== */
.header {
  /* General header class, might conflict if not specific to details page */
  /* Assuming this is for the details page header structure, not site-header */
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.back-btn {
  padding: 10px 15px;
  background-color: var(--bg-secondary);
  border-radius: 5px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: bold;
  box-shadow: 0 2px 4px var(--shadow-color);
  display: inline-block;
  transition: background-color 0.3s;
}

.back-arrow {
  display: inline-block;
  vertical-align: middle;
  font-size: 16px;
  margin-right: 6px;
  transform: translateY(-2px);
}

.back-text {
  display: inline-block;
  vertical-align: middle;
}

.back-btn:hover {
  background-color: var(--element-bg-hover);
}

/* Breadcrumbs styling */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 14px;
  background-color: var(--bg-secondary);
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 2px 4px var(--shadow-color);
}

.breadcrumbs a {
  color: var(--accent-primary);
  text-decoration: none;
  margin: 0 5px;
}

.breadcrumbs a:first-child {
  margin-left: 0;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .separator {
  margin: 0 5px;
  color: var(--text-disabled);
}

.breadcrumbs .current {
  color: var(--text-secondary);
  font-weight: 500;
}

.wallpaper-details {
  /* Main flex container for image and info */
  display: flex;
  gap: 30px;
  margin-bottom: 40px;
}

.wallpaper-image {
  /* Container for the large image on details page */
  flex: 1;
  background-color: var(--bg-secondary);
  border-radius: 10px;
  box-shadow: 0 4px 8px var(--shadow-color);
  padding: 20px;
  text-align: center;
}

.wallpaper-image img {
  /* The actual large image */
  max-width: 100%;
  max-height: 70vh;
  border-radius: 5px;
}

.wallpaper-info {
  /* Container for text info, buttons on details page */
  flex: 0 0 400px;
  /* Fixed width for info column */
  box-sizing: border-box;
  overflow: visible;
  /* Or auto/scroll if content can exceed */
  flex-shrink: 0;
  background-color: var(--bg-secondary);
  border-radius: 10px;
  box-shadow: 0 4px 8px var(--shadow-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.wallpaper-info h1 {
  /* Specific h1 for details page title */
  margin-top: 0;
  font-size: 24px;
  margin-bottom: 20px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  color: var(--text-heading);
  text-align: left;
  /* Overrides general h1 center align */
}

.info-row {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
}

.info-label {
  font-weight: bold;
  margin-right: 15px;
  color: var(--text-secondary);
}

.app-value {
  /* For displaying app name or similar info */
  font-size: 16px;
  color: var(--text-primary);
}

.download-btn {
  display: block;
  width: calc(100% - 30px);
  /* Adjust if padding/margins change */
  max-width: 100%;
  padding: 15px;
  background-color: var(--accent-primary);
  /* Original: #e44d26 */
  color: white;
  text-align: center;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  margin-top: 25px;
  font-size: 16px;
  transition: background-color 0.3s;
}

.download-btn:hover {
  background-color: var(--accent-primary-hover);
  /* Original: #f55a35 */
}

.wallpaper-linked-description {
  margin-bottom: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.wallpaper-linked-description a {
  color: var(--accent-primary);
  text-decoration: underline;
}

.wallpaper-linked-description a:hover {
  color: var(--accent-primary-hover);
}

.category-tags {
  /* Container for tags on details page */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-tag {
  /* Individual tag/category pill on details page */
  background-color: var(--bg-tertiary);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background-color 0.3s, color 0.3s;
  white-space: nowrap;
  flex-shrink: 0;
}

.category-tags a.category-tag {
  /* Make tags linkable */
  text-decoration: none;
}

.category-tags a.category-tag:hover {
  background-color: var(--accent-primary);
  color: white;
}

/* Share Buttons */
.share-section {
  margin-top: 20px;
}

.share-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  text-decoration: none;
  transition: opacity 0.3s;
}

.share-btn:hover {
  opacity: 0.8;
}

.share-btn i {
  /* Assuming FontAwesome or similar icon library */
  font-size: 18px;
}

.share-facebook {
  background-color: #1877f2;
}

.share-twitter {
  background-color: #1da1f2;
}

.share-pinterest {
  background-color: #e60023;
}

.share-whatsapp {
  background-color: #25d366;
}

.copy-link-btn {
  display: flex;
  align-items: center;
  padding: 8px 15px;
  background-color: var(--bg-tertiary);
  border-radius: 20px;
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.copy-link-btn:hover {
  background-color: var(--element-bg-hover);
}

.copy-link-btn i {
  margin-right: 5px;
}

/* Get App Button (e.g., for mobile app promo) */
.get-app-container {
  margin-top: 10px;
}

.get-app-btn {
  display: flex;
  align-items: center;
  padding: 8px 15px;
  background-color: var(--bg-secondary);
  border-radius: 5px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: bold;
  box-shadow: 0 2px 4px var(--shadow-color);
  transition: background-color 0.3s;
  max-width: fit-content;
}

.get-app-btn:hover {
  background-color: var(--element-bg-hover);
}

.get-app-btn img {
  /* For app store badge or icon */
  margin-right: 8px;
}

/* Related Wallpapers Section */
.related-section {
  margin-top: 40px;
}

.related-section h2 {
  margin-bottom: 20px;
  font-size: 22px;
  color: var(--text-heading);
}

.related-wallpapers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.related-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 8px var(--shadow-color);
  background-color: var(--bg-secondary);
  transition: transform 0.3s ease;
  aspect-ratio: 9/16;
  /* Match main wallpaper items */
}

.related-item:hover {
  transform: translateY(-5px);
}

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

.related-link {
  display: block;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
     CONTENT PAGES (About, Terms, Privacy, etc.)
     ========================================================================== */
.content-page {
  padding: 40px 20px 60px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 2px 15px var(--shadow-strong-color);
  margin: 30px auto;
  /* Assuming .container sets max-width */
  animation: fadeIn 0.5s ease-out;
}

.content-page h1 {
  font-size: 32px;
  color: var(--text-heading);
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-primary);
  text-align: left;
  /* Override general h1 center */
}

.content-page h2 {
  font-size: 22px;
  color: var(--accent-primary);
  margin: 35px 0 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-secondary);
}

.content-page p {
  margin-bottom: 20px;
  color: var(--text-primary);
  line-height: 1.6;
}

.content-page strong {
  color: var(--text-heading);
}

.content-page ul {
  margin: 20px 0;
  padding-left: 25px;
  list-style-type: square;
}

.content-page ul li {
  margin-bottom: 10px;
  position: relative;
  /* For potential custom bullets */
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Date display (e.g., for blog posts or last updated) */
p strong+time,
/* For <time> element after <strong> */
p:first-of-type strong {
  /* If date is in first <p> with <strong>, e.g., "Last Updated: " */
  color: var(--text-secondary);
  font-style: italic;
}

/* Code blocks and technical elements */
code,
pre {
  background-color: var(--code-bg);
  border-radius: 4px;
  padding: 2px 5px;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  color: var(--text-primary);
  border: 1px solid var(--code-border);
  font-size: 0.9em;
}

pre {
  padding: 15px;
  overflow-x: auto;
  margin: 20px 0;
  line-height: 1.5;
}

/* Tables in Content Pages */
.content-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background-color: var(--bg-tertiary);
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--border-primary);
}

.content-page th {
  background-color: var(--table-header-bg);
  color: var(--text-heading);
  font-weight: 600;
  border-bottom: 2px solid var(--border-primary);
}

.content-page th,
.content-page td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-secondary);
  text-align: left;
}

.content-page tr:last-child td {
  border-bottom: none;
}

.content-page tr:hover {
  background-color: var(--table-row-hover-bg);
}

/* ==========================================================================
     FOOTER
     ========================================================================== */
footer {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border-top: 1px solid var(--border-secondary);
  padding: 40px 20px;
  margin-top: 30px;
  margin-bottom: 50px;
  text-align: center;
  font-size: 0.9em;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.footer-container {
  max-width: 1200px;
  /* Match main container */
  margin: 0 auto;
  padding: 0 15px;
}

footer p {
  margin: 6px 0;
}

footer a {
  color: var(--accent-primary);
  text-decoration: none;
  margin: 0 5px;
}

footer a:hover {
  text-decoration: underline;
}

.footer-separator {
  margin: 0 5px;
  color: var(--border-primary);
}

/* ==========================================================================
     UTILITY COMPONENTS
     ========================================================================== */

/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-secondary);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  border-top: 1px solid var(--border-primary);
}

.mobile-bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.75rem;
  transition: color 0.3s ease;
}

.mobile-bottom-nav .nav-item i {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.mobile-bottom-nav .nav-item.active,
.mobile-bottom-nav .nav-item:hover {
  color: var(--accent-primary);
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }

  body {
    padding-bottom: 60px;
  }
}

/* Footer Social */
.footer-social {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}


/* --- Theme Toggle Button --- */
.theme-toggle-button {
  /* position: fixed; bottom: 20px; right: 20px; /* If fixed positioning is desired */
  /* Currently styled for inline use e.g. in header */
  padding: 8px 14px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 50px;
  cursor: pointer;
  z-index: 1000;
  /* Ensure visibility if fixed */
  box-shadow: 0 2px 5px var(--shadow-color);
  transition: background-color 0.3s, color 0.3s, border-color 0.3s,
    box-shadow 0.3s;
  font-size: 14px;
  margin-right: 16px;
  margin-left: 16px;
}

.theme-toggle-button:hover {
  background-color: var(--element-bg-hover, #3a3a3a);
  color: var(--text-heading);
}

body.light-mode .theme-toggle-button:hover {
  background-color: var(--element-bg-hover, #e8e8e8);
  color: #000;
}

/* --- Social Sidebar --- */
.social-sidebar {
  position: fixed;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 1000;
}

.social-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 4px var(--shadow-color);
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-icon:hover {
  background-color: var(--accent-primary);
  color: white;
  /* Ensure contrast on accent background */
  transform: scale(1.1);
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-tertiary);
  color: var(--text-heading);
  padding: 10px 20px;
  border-radius: 5px;
  box-shadow: 0 2px 10px var(--shadow-strong-color);
  z-index: 10000;
  /* High z-index for visibility */
  display: none;
  /* Controlled by JS */
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s, opacity 0.3s,
    transform 0.3s;
}

/* ==========================================================================
     CUSTOM SCROLLBAR
     ========================================================================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-bg);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover-bg);
}

/* ==========================================================================
     RESPONSIVE STYLES
     ========================================================================== */

/* --- General Layout & Wallpaper Grid --- */
@media (max-width: 1100px) {
  .wallpaper-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .wallpaper-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .wallpaper-details {
    /* Wallpaper Details Page */
    flex-direction: column;
  }

  .wallpaper-info {
    /* Wallpaper Details Page */
    flex: 1;
    /* Allow to take full width when stacked */
    flex-basis: auto;
    /* Reset fixed basis */
  }

  .related-wallpapers {
    /* Wallpaper Details Page */
    grid-template-columns: repeat(2, 1fr);
  }

  .breadcrumbs {
    /* Wallpaper Details Page */
    font-size: 12px;
  }
}

/* --- Mobile Specific (General) --- */
@media (max-width: 768px) {
  .category-carousel-container {
    /* ADD this */
    padding-left: 40px;
    padding-right: 40px;
  }

  .category-carousel-container>.carousel-arrow {
    /* ADD this */
    width: 35px;
    height: 35px;
  }

  .category-carousel-container>.carousel-arrow-left {
    /* ADD this */
    left: 3px;
  }

  .category-carousel-container>.carousel-arrow-right {
    /* ADD this */
    right: 3px;
  }



  /* Category Carousel on Mobile */
  .category-carousel {
    padding: 0.8rem 0;
    gap: 1rem;
  }

  .category-card {
    min-width: 110px;
  }

  .category-image-container {
    width: 80px;
    height: 80px;
  }

  .category-name {
    font-size: 0.8rem;
  }

  /* Social Sidebar on Mobile */
  .social-sidebar {
    position: fixed;
    /* Keep fixed */
    left: 0;
    top: auto;
    /* Remove top positioning */
    bottom: 0;
    /* Stick to bottom */
    transform: none;
    /* Reset transform */
    flex-direction: row;
    /* Horizontal layout */
    width: 100%;
    background-color: var(--bg-overlay-dark);
    /* Darker overlay for visibility */
    padding: 10px 0;
    justify-content: center;
    gap: 15px;
    /* Adjust gap for horizontal layout */
  }

  .social-sidebar .social-icon {
    margin: 0 10px;
    /* Spacing between icons */
  }

  /* Top Main Controls on Mobile */
  /* Default is column, .top-main-controls @media (min-width: 768px) handles row */
}

@media (max-width: 600px) {
  .wallpaper-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Legacy Category/Tag Selectors Scroll on Mobile */
  .category-selector,
  .tag-selector {
    flex-wrap: nowrap;
    /* Prevent wrapping */
    overflow-x: auto;
    /* Enable horizontal scroll */
    justify-content: flex-start;
    /* Align items to start */
    padding-bottom: 10px;
    /* Space for scrollbar if visible */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar IE/Edge */
  }

  .category-selector::-webkit-scrollbar,
  .tag-selector::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari/Opera */
  }

  .category-btn,
  .tag-btn {
    /* Ensure buttons don't shrink in scroll container */
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Search Form Stack on Mobile */
  .search-form {
    flex-direction: column;
  }

  .search-input {
    border-radius: 5px;
    /* Full radius when stacked */
    margin-bottom: 10px;
  }

  .search-button {
    border-radius: 5px;
    /* Full radius when stacked */
  }

  /* Footer on Small Screens */
  footer {
    font-size: 0.8em;
  }

  footer p span,
  footer p a {
    margin: 5px 5px;
  }

  .footer-separator {
    margin: 0 5px;
    color: var(--border-primary);
  }
}

/* ==========================================================================
     PRINT STYLES
     ========================================================================== */
@media print {

  header,
  footer,
  .site-header,
  /* Explicitly hide site header */
  .main-nav #mobile-menu-toggle,
  /* Hide mobile menu toggle */
  .theme-toggle-button,
  .social-sidebar,
  .filter-toggle-btn,
  /* Hide filter UI elements */
  .collapsible-filter-panel,
  .back-btn,
  /* Hide navigation buttons */
  .share-section,
  /* Hide share buttons */
  .download-btn,
  /* Hide download buttons */
  .get-app-btn,
  .scroll-arrow,
  /* Hide scroll arrows */
  .search-icon-container {
    display: none !important;
    /* Important to override other display properties */
  }

  body {
    background-color: white !important;
    color: black !important;
    font-size: 12pt;
    font-family: "Times New Roman", Times, serif;
    transition: none !important;
    /* Disable transitions */
  }

  .container,
  .content-page,
  .wallpaper-details,
  /* Ensure main content areas are styled for print */
  .wallpaper-info,
  .wallpaper-image {
    width: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: white !important;
    color: black !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .content-page h1,
  .content-page h2,
  .content-page strong,
  .wallpaper-info h1,
  /* Titles on details page */
  .related-section h2 {
    color: black !important;
    border-color: #ccc !important;
    /* Lighter border */
  }

  .content-page p,
  .content-page li,
  .wallpaper-info p,
  /* Text on details page */
  .info-label,
  .app-value,
  .wallpaper-linked-description {
    color: #333 !important;
    /* Dark grey for readability */
  }

  a {
    color: #000 !important;
    text-decoration: underline !important;
  }

  a[href^="http"]:after {
    /* Show full URLs for external links */
    content: " (" attr(href) ")";
    font-size: 0.9em;
  }

  a[href^="/"]:after,
  a[href^="#"]:after {
    /* Don't show for internal/fragment links */
    content: "";
  }

  code,
  pre,
  .content-page table,
  .content-page th,
  .content-page td {
    background-color: #f8f8f8 !important;
    color: black !important;
    border: 1px solid #ddd !important;
  }

  img,
  .wallpaper-img,
  /* Ensure images are handled well */
  .related-img,
  .category-image,
  .wallpaper-image img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
    border-radius: 0 !important;
    /* Remove rounded corners for print consistency */
  }

  .premium-badge,
  /* Hide non-essential visual elements */
  .category-tag,
  .breadcrumbs {
    display: none !important;
  }

  .wallpaper-grid,
  .related-wallpapers {
    display: block !important;
    /* Change grid to block for simpler printing */
  }

  .wallpaper-item,
  .related-item {
    page-break-inside: avoid;
    margin-bottom: 20px;
    /* Add some space between items when stacked */
    box-shadow: none !important;
    border: 1px solid #eee !important;
    /* Light border for separation */
  }
}

.cat-wallpaper-grid {
  position: relative;
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

.cat-wallpaper-grid.is-visible {
  opacity: 1;
}

.cat-wallpaper-item {
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

.cat-wallpaper-item.is-loaded {
  opacity: 1;
}

/* Styles for Buy Me a Coffee Modal */
.bmc-modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  /* Stay in place */
  z-index: 1050;
  /* Sit on top, higher than most elements */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.6);
  /* Dim background */
  padding-top: 50px;
}

.bmc-modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 25px;
  border: 1px solid #ddd;
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: bmcModalAppear 0.3s ease-out;
}

@keyframes bmcModalAppear {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.bmc-modal-content h2 {
  margin-top: 0;
  color: #333;
  font-size: 1.6em;
  margin-bottom: 15px;
}

.bmc-modal-content p {
  color: #555;
  line-height: 1.6;
  margin-bottom: 20px;
  font-size: 1em;
}

.bmc-close-modal-btn {
  background: none;
  border: none;
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.bmc-close-modal-btn:hover,
.bmc-close-modal-btn:focus {
  color: #333;
  text-decoration: none;
}

.bmc-button-link img {
  margin: 15px auto;
  display: block;
  border: 0 !important;
  box-shadow: none !important;
}

.bmc-modal-actions {
  margin-top: 25px;
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.bmc-modal-button {
  padding: 12px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
  transition: background-color 0.2s ease, transform 0.1s ease;
  min-width: 160px;
  /* Ensure buttons have a decent size */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bmc-modal-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bmc-skip-btn {
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
}

.bmc-skip-btn:hover {
  background-color: #e0e0e0;
}

.bmc-support-btn {
  background-color: #ffdd00;
  /* BMC yellow */
  color: #000;
  border: 1px solid #e6c600;
}

.bmc-support-btn:hover {
  background-color: #f0c000;
}

/* =========================================
   DASHBOARD SPECIFIC STYLES
   (Mapped to your Theme Variables)
   ========================================= */

/* Main Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 25px;
  align-items: start;
  margin-top: 20px;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px var(--shadow-color),
    0 2px 4px -1px var(--shadow-strong-color);
  padding: 25px;
  border: 1px solid var(--border-secondary);
  color: var(--text-primary);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: 15px;
  color: var(--text-heading);
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

select,
input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  /* Use bg-primary for inputs so they contrast against the card */
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus,
input[type="file"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-transparent);
}

/* Custom Checkbox Styling */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.checkbox-wrapper:hover {
  background: var(--element-bg-hover);
  border-color: var(--accent-border);
}

.checkbox-wrapper input {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.checkbox-wrapper label {
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-primary);
}

/* Buttons */
.btn-submit {
  width: 100%;
  background-color: var(--accent-primary);
  color: #ffffff;
  /* Always white text on accent button */
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  font-size: 16px;
  box-shadow: 0 2px 4px var(--shadow-color);
}

.btn-submit:hover {
  background-color: var(--accent-primary-hover);
  transform: translateY(-1px);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-item {
  /* Use tertiary bg for stats to stand out slightly from card */
  background: var(--bg-tertiary);
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border-secondary);
}

.stat-count {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Console Log / System Info */
.log-container {
  margin-top: 20px;
}

.log-box {
  background: var(--code-bg);
  color: var(--text-secondary);
  padding: 15px;
  border-radius: 8px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid var(--code-border);
  /* Custom Scrollbar for log box */
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-bg) var(--scrollbar-track-bg);
}

.log-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  margin-bottom: 8px;
  display: inline-block;
}

.log-toggle:hover {
  color: var(--accent-primary);
}

/* Alerts */
.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
  border: 1px solid transparent;
}

/* Success uses a transparent green overlay on top of card bg */
.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  /* Standard success green, usually fine in dark/light */
  border-color: rgba(16, 185, 129, 0.2);
}

/* Utilities within Log */
.text-error {
  color: #ff6b6b;
}

.text-success {
  color: #51cf66;
}

.text-warning {
  color: #fcc419;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}