/* ============================================
   COMPLETE THEME SYSTEM - FIXED VERSION
   ============================================ */

/* WASTE MANAGEMENT COLOR VARIABLES */
:root {
  /* Waste Management Colors */
  --organic: #047857;
  --plastic: #3b82f6;
  --paper: #92400e;
  --general: #6b7280;
  --glass: #06b6d4;
  --action-red: #d9222a;
  --highlight-gold: #f59e0b;

  /* Light variations */
  --organic-light: #34d399;
  --plastic-light: #60a5fa;
  --paper-light: #d97706;
  --general-light: #9ca3af;
  --glass-light: #22d3ee;
  --action-red-light: #f87171;
  --highlight-gold-light: #fbbf24;
}

/* ============================================
   LIGHT MODE (DEFAULT)
   ============================================ */
:root {
  --organic-bg: #ecfdf5;
  --plastic-bg: #eff6ff;
  --paper-bg: #fef3c7;
  --general-bg: #f9fafb;
  --glass-bg: #ecfeff;
  --action-red-bg: #fee2e2;
  --highlight-gold-bg: #fffbeb;

  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  --bg-body: #f9fafb;
  --bg-nav: #ffffff;
  --bg-footer: #1f2937;
  --bg-card: #ffffff;
  --bg-section: #ffffff;
  --bg-alt: #f3f4f6;

  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.15);
  --border: #e5e7eb;
}

/* ============================================
   DARK MODE - COMPLETE OVERRIDE
   ============================================ */
.dark {
  --organic-bg: rgba(16, 185, 129, 0.15) !important;
  --plastic-bg: rgba(59, 130, 246, 0.15) !important;
  --paper-bg: rgba(146, 64, 14, 0.2) !important;
  --general-bg: rgba(107, 114, 128, 0.15) !important;
  --glass-bg: rgba(6, 182, 212, 0.15) !important;
  --action-red-bg: rgba(217, 34, 42, 0.15) !important;
  --highlight-gold-bg: rgba(245, 158, 11, 0.15) !important;

  --text-primary: #f9fafb !important;
  --text-secondary: #d1d5db !important;
  --text-muted: #9ca3af !important;

  --bg-body: #0f172a !important;
  --bg-nav: #1e293b !important;
  --bg-footer: #020617 !important;
  --bg-card: #1f2937 !important;
  --bg-section: #111827 !important;
  --bg-alt: #374151 !important;

  --shadow: rgba(0, 0, 0, 0.3) !important;
  --shadow-lg: rgba(0, 0, 0, 0.5) !important;
  --border: rgba(255, 255, 255, 0.1) !important;
}

/* ============================================
   FORCE OVERRIDE TAILWIND CLASSES
   ============================================ */

/* BODY AND BACKGROUNDS */
body {
  background-color: var(--bg-body) !important;
  color: var(--text-primary) !important;
}

/* NAVIGATION */
nav {
  background-color: var(--bg-nav) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* TEXT COLORS - Override ALL Tailwind text classes */
.text-gray-900,
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary) !important;
}

.text-gray-700,
.text-gray-600 {
  color: var(--text-secondary) !important;
}

.text-gray-500,
.text-gray-400 {
  color: var(--text-muted) !important;
}

/* WHITE TEXT - Override specifically */
.text-white {
  color: #ffffff !important;
}

/* BACKGROUND OVERRIDES */
.bg-white {
  background-color: var(--bg-card) !important;
}

.bg-gray-50 {
  background-color: var(--bg-body) !important;
}

.bg-gray-100 {
  background-color: var(--bg-alt) !important;
}

.bg-gray-800 {
  background-color: var(--bg-footer) !important;
}

.bg-gray-900 {
  background-color: var(--bg-section) !important;
}

.bg-gray-950 {
  background-color: #020617 !important;
}

/* CARD BACKGROUNDS */
.service-card,
.stats-card,
.team-card,
.approach-card {
  box-shadow: 0 1px 3px var(--shadow) !important;
  border: 1px solid var(--border) !important;
}

/* SERVICE CARD SPECIFIC BACKGROUNDS */
.service-card-organic {
  background-color: var(--organic-bg) !important;
  border-top: 4px solid var(--organic) !important;
}

.service-card-plastic {
  background-color: var(--plastic-bg) !important;
  border-top: 4px solid var(--plastic) !important;
}

.service-card-paper {
  background-color: var(--paper-bg) !important;
  border-top: 4px solid var(--paper) !important;
}

.service-card-general {
  background-color: var(--general-bg) !important;
  border-top: 4px solid var(--general) !important;
}

.service-card-glass {
  background-color: var(--glass-bg) !important;
  border-top: 4px solid var(--glass) !important;
}

.service-card-red {
  background-color: var(--action-red-bg) !important;
  border-top: 4px solid var(--action-red) !important;
}
.service-card-gold {
  background-color: var(--highlight-gold-bg) !important;
  border-top: 4px solid var(--highlight-gold) !important;
}

/* ICON CONTAINERS */
.icon-organic {
  background-color: var(--organic-bg) !important;
  color: var(--organic) !important;
  border: 2px solid var(--organic) !important;
}

.icon-plastic {
  background-color: var(--plastic-bg) !important;
  color: var(--plastic) !important;
  border: 2px solid var(--plastic) !important;
}

.icon-paper {
  background-color: var(--paper-bg) !important;
  color: var(--paper) !important;
  border: 2px solid var(--paper) !important;
}

.icon-general {
  background-color: var(--general-bg) !important;
  color: var(--general) !important;
  border: 2px solid var(--general) !important;
}

.icon-glass {
  background-color: var(--glass-bg) !important;
  color: var(--glass) !important;
  border: 2px solid var(--glass) !important;
}

.icon-red {
  background-color: var(--action-red-bg) !important;
  color: var(--action-red) !important;
  border: 2px solid var(--action-red) !important;
}
.icon-gold {
  background-color: var(--highlight-gold-bg) !important;
  color: var(--highlight-gold) !important;
  border: 2px solid var(--highlight-gold) !important;
}

/* THEME COLOR UTILITIES */
.theme-organic {
  color: var(--organic) !important;
}
.theme-plastic {
  color: var(--plastic) !important;
}
.theme-paper {
  color: var(--paper) !important;
}
.theme-general {
  color: var(--general) !important;
}
.theme-glass {
  color: var(--glass) !important;
}
.theme-red {
  color: var(--action-red) !important;
}
.theme-gold {
  color: var(--highlight-gold) !important;
}

.bg-theme-organic {
  background-color: var(--organic) !important;
}
.bg-theme-plastic {
  background-color: var(--plastic) !important;
}
.bg-theme-paper {
  background-color: var(--paper) !important;
}
.bg-theme-general {
  background-color: var(--general) !important;
}
.bg-theme-glass {
  background-color: var(--glass) !important;
}
.bg-theme-red {
  background-color: var(--action-red) !important;
}
.bg-theme-gold {
  background-color: var(--highlight-gold) !important;
}

/* ============================================
   THEME TOGGLE SWITCH
   ============================================ */
.theme-toggle {
  position: relative;
  width: 60px;
  height: 30px;
  background-color: #374151;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background-color: #4b5563;
}

.theme-toggle.dark {
  background-color: var(--organic);
}

.theme-toggle.dark:hover {
  background-color: #059669;
}

.theme-toggle-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle.dark .theme-toggle-slider {
  transform: translateX(28px);
}

/* ============================================
   GRADIENTS AND PATTERNS
   ============================================ */
.gradient-bg {
  background: linear-gradient(
    135deg,
    var(--organic) 0%,
    #047857 100%
  ) !important;
}

.hero-pattern {
  background-image: radial-gradient(
      circle at 25px 25px,
      rgba(255, 255, 255, 0.1) 2px,
      transparent 0
    ),
    radial-gradient(
      circle at 75px 75px,
      rgba(255, 255, 255, 0.05) 2px,
      transparent 0
    );
  background-size: 100px 100px;
}

/* ============================================
   HOVER EFFECTS
   ============================================ */
.service-card:hover,
.stats-card:hover,
.approach-card:hover,
.team-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px var(--shadow-lg) !important;
  transition: all 0.3s ease;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
  background: var(--organic) !important;
  color: white !important;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
  background: #059669 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4) !important;
}

.btn-secondary {
  background: transparent !important;
  color: var(--organic) !important;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid var(--organic) !important;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background: var(--organic) !important;
  color: white !important;
  transform: translateY(-2px);
}

/* ============================================
   NAVIGATION LINKS
   ============================================ */
.nav-link {
  transition: all 0.3s ease;
  color: var(--text-secondary) !important;
}

.nav-link:hover {
  color: var(--organic) !important;
}

.nav-link.active {
  color: var(--text-primary) !important;
  font-weight: 600;
}

/* ============================================
   ANIMATIONS
   ============================================ */
.fade-in {
  animation: fadeIn 0.8s ease-in;
}

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

/* ============================================
   SMOOTH TRANSITIONS
   ============================================ */
* {
  transition: background-color 0.4s ease, color 0.4s ease,
    border-color 0.4s ease, box-shadow 0.4s ease !important;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
  .theme-toggle {
    width: 50px;
    height: 25px;
  }

  .theme-toggle-slider {
    width: 19px;
    height: 19px;
    top: 2px;
    left: 2px;
    font-size: 10px;
  }

  .theme-toggle.dark .theme-toggle-slider {
    transform: translateX(23px);
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.theme-toggle:focus {
  outline: 2px solid var(--organic);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  .fade-in {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================
   BLOG-SPECIFIC STYLES
   ============================================ */

/* Filter Buttons */
.filter-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s;
  background-color: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.dark .filter-btn {
  color: #9ca3af;
  border-color: #374151;
}

.filter-btn:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.dark .filter-btn:hover {
  background-color: #374151;
  color: #f9fafb;
}

.filter-btn.active {
  background-color: #10b981;
  color: white;
  border-color: #10b981;
}

.dark .filter-btn.active {
  background-color: #10b981;
  color: white;
}

/* Blog Card Hover Effects */
.blog-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-card:hover {
  transform: translateY(-4px);
}

/* Line Clamp Utilities */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Prose Styles for Blog Content */
.prose {
  color: #374151;
  max-width: 65ch;
}

.dark .prose {
  color: #d1d5db;
}

.prose h2 {
  color: #111827;
  font-weight: 700;
  font-size: 1.875rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.3333333;
}

.dark .prose h2 {
  color: #f9fafb;
}

.prose h3 {
  color: #111827;
  font-weight: 600;
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.dark .prose h3 {
  color: #f9fafb;
}

.prose p {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.prose a {
  color: #10b981;
  text-decoration: underline;
  font-weight: 500;
}

.prose a:hover {
  color: #059669;
}

.prose strong {
  color: #111827;
  font-weight: 600;
}

.dark .prose strong {
  color: #f9fafb;
}

.prose ul,
.prose ol {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  padding-left: 1.625rem;
}

.prose li {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.prose blockquote {
  font-style: italic;
  color: #6b7280;
  border-left: 4px solid #10b981;
  padding-left: 1.5rem;
  margin: 2rem 0;
}

.dark .prose blockquote {
  color: #9ca3af;
}

.prose img {
  border-radius: 0.5rem;
  margin: 2rem 0;
}

.prose figure {
  margin: 2rem 0;
}

.prose figcaption {
  color: #6b7280;
  font-size: 0.875rem;
  text-align: center;
  margin-top: 0.75rem;
}

.dark .prose figcaption {
  color: #9ca3af;
}

.prose code {
  background-color: #f3f4f6;
  color: #ec4899;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.dark .prose code {
  background-color: #374151;
  color: #fb7185;
}

.prose pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
}

/* Lead Paragraph (Introduction) */
.prose .lead {
  font-size: 1.25rem;
  line-height: 1.6;
  color: #4b5563;
}

.dark .prose .lead {
  color: #d1d5db;
}

/* Reading Progress Bar (Optional Enhancement) */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(to right, #10b981, #059669);
  z-index: 1000;
  transition: width 0.1s ease;
}

/* Smooth Scroll Behavior */
html {
  scroll-behavior: smooth;
}

/* Search Input Focus State */
#search-input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Animation for Blog Cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.blog-card {
  animation: fadeInUp 0.5s ease-out;
}

/* Stagger animation for multiple cards */
.blog-card:nth-child(1) {
  animation-delay: 0.1s;
}
.blog-card:nth-child(2) {
  animation-delay: 0.2s;
}
.blog-card:nth-child(3) {
  animation-delay: 0.3s;
}
.blog-card:nth-child(4) {
  animation-delay: 0.4s;
}
.blog-card:nth-child(5) {
  animation-delay: 0.5s;
}
.blog-card:nth-child(6) {
  animation-delay: 0.6s;
}

/* ============================================
   BLOG IMAGE GALLERY STYLES
   ============================================ */

/* Image Gallery Grid */
.image-gallery {
  margin: 2rem 0;
}

.image-gallery .gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
}

.image-gallery img {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s ease;
}

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

/* Image Pairs (2 images side by side) */
.image-pair {
  margin: 2rem 0;
}

.image-pair figure {
  margin: 0;
}

.image-pair img {
  transition: transform 0.3s ease;
}

.image-pair img:hover {
  transform: scale(1.02);
}

/* Shared caption for image groups */
.image-gallery + p.italic,
.image-pair + p.italic {
  font-style: italic;
  color: #6b7280;
  text-align: center;
  margin-top: -1rem;
  margin-bottom: 2rem;
}

.dark .image-gallery + p.italic,
.dark .image-pair + p.italic {
  color: #9ca3af;
}

/* Lightbox Styles */
#image-lightbox {
  backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#lightbox-image {
  transition: opacity 0.15s ease;
  max-height: 80vh;
  max-width: 100%;
  object-fit: contain;
}

#lightbox-close,
#lightbox-prev,
#lightbox-next {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}

#lightbox-close:hover,
#lightbox-prev:hover,
#lightbox-next:hover {
  background: rgba(16, 185, 129, 0.8);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
}

#lightbox-prev,
#lightbox-next {
  font-size: 2rem;
  font-weight: bold;
}

#lightbox-close {
  font-size: 2.5rem;
  line-height: 0;
}

/* Hide navigation buttons if only one image */
#image-lightbox[data-single-image="true"] #lightbox-prev,
#image-lightbox[data-single-image="true"] #lightbox-next {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .image-gallery {
    grid-template-columns: 1fr 1fr !important;
  }

  #lightbox-prev,
  #lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  #lightbox-close {
    width: 40px;
    height: 40px;
    font-size: 2rem;
  }
}

/* Single/Double image layout (not gallery) */
.prose figure {
  margin: 2rem 0;
}

.prose figure img {
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.prose figure img:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.prose figcaption {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.5rem;
  font-style: italic;
}

.dark .prose figcaption {
  color: #9ca3af;
}

/* Loading state for images */
.prose img {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

.prose img[src] {
  animation: none;
  background: none;
}

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

.dark .prose img {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

.dark .prose img[src] {
  animation: none;
  background: none;
}

/* Image zoom cursor */
.prose img[data-processed="true"] {
  cursor: zoom-in;
}

/* Click indicator overlay */
.image-click-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 0.5rem;
  pointer-events: none;
}

figure:hover .image-click-indicator {
  opacity: 1;
}

/* Image navigation hint */
.image-navigation-hint {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  animation: slideDown 0.5s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dark .image-navigation-hint {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Gallery caption overlay */
.gallery-item .absolute {
  transition: opacity 0.3s ease;
}

.gallery-item:hover .absolute {
  opacity: 1;
}

/* Post Navigation Styles */
.post-navigation-container a {
  display: block;
  transition: all 0.3s ease;
}

.post-navigation-container a:hover {
  transform: translateY(-4px);
}

/* Related Posts hover effect */
.related-posts-container article {
  transition: all 0.3s ease;
}

.related-posts-container article:hover {
  transform: translateY(-4px);
}

/* Loading states */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}
