/* ============================================
   CATEGORIES - DARK THEME
   ============================================ */

:root {
  /* CORE THEME VARIABLES - Base Colors */
  --theme-primary-color: #e53e3e;
  --theme-secondary-color: #c53030;
  --theme-accent-color: #ff6b35;
  --theme-background-color: #f8f9fa;
  --theme-text-color: #333333;
  --theme-font-family: 'Poppins', sans-serif;

  /* DERIVED COLOR VARIABLES - Dark Mode */
  --cat-primary: var(--theme-accent-color);
  --cat-primary-600: color-mix(in srgb, var(--theme-accent-color) 85%, #000000);
  --cat-primary-50: color-mix(in srgb, var(--theme-accent-color) 15%, #000000);
  
  --cat-secondary: var(--theme-primary-color);
  --cat-secondary-600: var(--theme-secondary-color);
  --cat-secondary-50: color-mix(in srgb, var(--theme-primary-color) 15%, #000000);
  
  --cat-accent: var(--theme-secondary-color);
  --cat-accent-600: color-mix(in srgb, var(--theme-secondary-color) 85%, #000000);
  --cat-accent-50: color-mix(in srgb, var(--theme-secondary-color) 15%, #000000);
  
  --cat-bg-main: color-mix(in srgb, var(--theme-text-color) 10%, #000000);
  --cat-bg-secondary: color-mix(in srgb, var(--theme-text-color) 5%, #000000);
  --cat-bg-tertiary: color-mix(in srgb, var(--theme-text-color) 3%, #000000);
  
  --cat-text-primary: var(--theme-background-color);
  --cat-text-secondary: color-mix(in srgb, var(--theme-background-color) 90%, #ffffff);
  --cat-text-light: color-mix(in srgb, var(--theme-background-color) 80%, #ffffff);
  --cat-text-lighter: color-mix(in srgb, var(--theme-background-color) 70%, #ffffff);
  
  --cat-border: color-mix(in srgb, var(--theme-text-color) 20%, #000000);
  --cat-border-light: color-mix(in srgb, var(--theme-text-color) 10%, #000000);
  --cat-shadow: color-mix(in srgb, var(--theme-accent-color) 8%, rgba(0, 0, 0, 0.4));
  --cat-shadow-lg: color-mix(in srgb, var(--theme-primary-color) 15%, rgba(0, 0, 0, 0.4));
  --cat-shadow-xl: color-mix(in srgb, var(--theme-secondary-color) 10%, rgba(0, 0, 0, 0.3));
  
  /* Transitions - Playful */
  --cat-transition-base: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --cat-transition-fast: 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --cat-transition-slow: 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   CATEGORIES SECTION - DARK
   ============================================ */

.categories-section {
  padding: 80px 0 100px;
  margin: 0;
  background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 50%, #16213e 100%);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.categories-section::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(255, 107, 53, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(229, 62, 62, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.categories-section > * {
  position: relative;
  z-index: 1;
}

.categories-container {
  margin: 0 auto;
  padding: 0 40px;
  max-width: 1500px;
  width: 100%;
  box-sizing: border-box;
}

.categories-header {
  text-align: center;
  margin-bottom: 70px;
  padding: 0;
}

.categories-title {
  font-size: 2.8rem;
  font-weight: 900;
  margin: 0 0 24px;
  background: linear-gradient(135deg, var(--cat-primary), var(--cat-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.categories-description {
  font-size: 1.05rem;
  color: var(--cat-text-light);
  margin: 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   SEARCH & FILTER CONTROLS
   ============================================ */

.categories-controls {
  margin-bottom: 70px;
  display: flex;
  justify-content: center;
  padding: 0;
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 550px;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 1px solid var(--cat-border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: rgba(26, 26, 46, 0.6);
  color: var(--cat-text-primary);
  transition: all var(--cat-transition-base);
  backdrop-filter: blur(10px);
}

.search-input::placeholder {
  color: var(--cat-text-light);
}

.search-input:focus {
  outline: none;
  border-color: var(--cat-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-primary) 10%, rgba(0, 0, 0, 0.5));
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  pointer-events: none;
}

/* ============================================
   CATEGORIES GRID - COMPACT
   ============================================ */

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 48px;
  align-items: stretch;
  padding: 0;
  max-width: 100%;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

@media (min-width: 640px) {
  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 56px;
    padding: 0;
  }
}

@media (min-width: 1000px) {
  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 64px;
    padding: 0;
  }
}

/* ============================================
   CATEGORY CARD - DARK & PLAYFUL
   ============================================ */

.category-card {
  background: rgba(26, 26, 46, 0.6);
  border: 1px solid var(--cat-border);
  border-radius: 12px;
  padding: 36px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: all var(--cat-transition-base);
  height: 100%;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, transparent 50%, rgba(229, 62, 62, 0.1) 100%);
  opacity: 0;
  transition: opacity var(--cat-transition-base);
  pointer-events: none;
}

.category-card:hover {
  transform: translateY(-8px) scale(1.04) rotate(1deg);
  border-color: var(--cat-primary);
  box-shadow: 
    0 12px 32px rgba(255, 107, 53, 0.2),
    inset 0 0 20px rgba(255, 107, 53, 0.05);
}

.category-card:hover::before {
  opacity: 1;
}

.category-icon {
  font-size: 3.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, var(--cat-primary-50) 0%, var(--cat-accent-50) 100%);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
  animation: wiggle 3s ease-in-out infinite;
}

.category-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.category-icon:has(img) {
  width: 100%;
  height: 200px;
  margin: -36px -36px 0 -36px;
  border-radius: 12px 12px 0 0;
  background: transparent;
  animation: none;
  box-shadow: none;
  overflow: hidden;
  max-width: calc(100% + 72px);
  box-sizing: border-box;
}

.category-icon:has(img) img {
  width: 100%;
  height: 100%;
  border-radius: 12px 12px 0 0;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-3deg) scale(1.05); }
  75% { transform: rotate(3deg) scale(1.05); }
}

.category-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.category-name {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--cat-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-description {
  font-size: 0.95rem;
  color: var(--cat-text-light);
  line-height: 1.6;
  margin: 0 0 20px;
  flex: 1;
  font-weight: 500;
}

.category-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--cat-border);
}

.category-count {
  font-size: 0.9rem;
  color: var(--cat-accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-count strong {
  color: var(--cat-primary);
}

/* ============================================
   BACK TO CATALOGUE BUTTON
   ============================================ */

.back-to-catalogue-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(26, 26, 46, 0.6);
  color: var(--cat-text-primary);
  border: 2px solid var(--cat-primary);
  text-decoration: none;
  border-radius: 8px;
  transition: all var(--cat-transition-base);
  margin-bottom: 24px;
  font-weight: 700;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.back-to-catalogue-btn:hover {
  background: linear-gradient(135deg, var(--cat-primary), var(--cat-accent));
  color: white;
  border-color: var(--cat-primary);
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* ============================================
   LOAD MORE BUTTON & LOADING INDICATOR
   ============================================ */

#load-more-container {
  text-align: center;
  padding: 40px 0;
  margin-top: 40px;
  display: block;
}

#load-more-btn {
  padding: 14px 48px;
  background: rgba(26, 26, 46, 0.6);
  color: var(--cat-text-primary);
  border: 2px solid var(--cat-primary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  transition: all var(--cat-transition-base);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
  backdrop-filter: blur(10px);
}

#load-more-btn:hover {
  background: linear-gradient(135deg, var(--cat-primary), var(--cat-accent));
  color: white;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.3);
}

#load-more-btn:active {
  transform: translateY(0) scale(1.02);
}

#load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#loading-indicator {
  text-align: center;
  padding: 24px;
  display: none;
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(26, 26, 46, 0.6);
  border-top: 4px solid var(--cat-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

#loading-indicator p {
  color: var(--cat-text-secondary);
  font-size: 0.95rem;
}

/* ============================================
   NO RESULTS MESSAGE
   ============================================ */

.no-results-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 140px 60px;
  text-align: center;
  border-radius: 12px;
  background: rgba(26, 26, 46, 0.4);
  border: 1px dashed var(--cat-border);
  backdrop-filter: blur(10px);
  margin: 0;
}

.no-results-icon {
  font-size: 64px;
  margin-bottom: 32px;
  display: block;
  animation: float-icon 2s ease-in-out infinite;
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.no-results-message h3 {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--cat-text-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.no-results-message p {
  font-size: 0.95rem;
  color: var(--cat-text-light);
  margin: 0;
  font-weight: 500;
  max-width: 450px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .categories-section {
    padding: 50px 0 70px;
  }

  .categories-container {
    padding: 0 25px;
  }

  .categories-title {
    font-size: 2.2rem;
    margin-bottom: 20px;
  }

  .categories-header {
    margin-bottom: 50px;
  }

  .categories-controls {
    margin-bottom: 50px;
  }

  .category-card {
    padding: 28px;
    gap: 20px;
  }

  .category-icon {
    width: 80px;
    height: 80px;
  }

  .category-icon:has(img) {
    width: 100%;
    margin: -28px -28px 0 -28px;
    max-width: calc(100% + 56px);
  }

  .no-results-message {
    padding: 100px 30px;
    margin: 0;
  }
}

@media (max-width: 480px) {
  .categories-section {
    padding: 40px 0 60px;
  }

  .categories-container {
    padding: 0 15px;
  }

  .categories-title {
    font-size: 1.8rem;
  }

  .categories-header {
    margin-bottom: 40px;
  }

  .categories-controls {
    margin-bottom: 40px;
  }

  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
  }

  .category-card {
    padding: 24px;
    gap: 16px;
  }

  .category-icon {
    width: 75px;
    height: 75px;
    font-size: 2.5rem;
  }

  .category-icon:has(img) {
    width: 100%;
    margin: -24px -24px 0 -24px;
    max-width: calc(100% + 48px);
  }

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

  .no-results-message {
    padding: 80px 20px;
    margin: 0;
  }
}
