/* Homepage Enhancement Styles - Lightweight and Mobile-First */
/* Optimized for both emerald (light) and forest (dark) DaisyUI themes */

/* Hero Section Enhancements */
.hero {
  min-height: auto;
  padding: 3rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero .hero-content {
  width: 100%;
  max-width: none;
  text-align: center;
  display: flex;
  justify-content: center;
}

@media (min-width: 768px) {
  .hero {
    padding: 4rem 1rem;
  }
}

/* Gradient Background - Light Theme (Emerald) */
.hero.bg-gradient-to-br,
[data-theme="emerald"] .hero.bg-gradient-to-br {
  background: linear-gradient(135deg, 
    rgba(16, 185, 129, 0.1),    /* emerald-500 with 10% opacity */
    rgba(6, 182, 212, 0.05),    /* cyan-500 with 5% opacity */
    rgba(139, 92, 246, 0.1)     /* violet-500 with 10% opacity */
  );
}

/* Gradient Background - Dark Theme (Forest) */
html.dark .hero.bg-gradient-to-br,
[data-theme="forest"] .hero.bg-gradient-to-br {
  background: linear-gradient(135deg, 
    rgba(34, 197, 94, 0.15),    /* green-500 with 15% opacity for better visibility in dark */
    rgba(14, 165, 233, 0.08),   /* blue-500 with 8% opacity */
    rgba(168, 85, 247, 0.12)    /* purple-500 with 12% opacity */
  );
  border: 1px solid rgba(255, 255, 255, 0.05); /* subtle border for dark mode */
}

/* Quick Access Cards - Enhanced Hover Effects */
.group.card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  overflow: hidden; /* Prevent icon overflow */
}

.group.card .card-body {
  overflow: hidden; /* Ensure content stays within bounds */
}

/* Card Hover - Light Theme */
.group.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Card Hover - Dark Theme */
html.dark .group.card:hover,
[data-theme="forest"] .group.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Optimize for mobile touch */
@media (hover: none) and (pointer: coarse) {
  .group.card:hover {
    transform: none;
  }
  
  .group.card:active {
    transform: translateY(1px);
    transition: transform 0.1s ease;
  }
}

/* Category Icon Animation */
.group.card .text-3xl,
.group.card .text-4xl {
  transition: transform 0.3s ease, filter 0.3s ease;
}

/* Icon Hover - Light Theme */
.group.card:hover .text-3xl,
.group.card:hover .text-4xl {
  transform: scale(1.05); /* Reduced from 1.1 to prevent overflow */
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Icon Hover - Dark Theme */
html.dark .group.card:hover .text-3xl,
html.dark .group.card:hover .text-4xl,
[data-theme="forest"] .group.card:hover .text-3xl,
[data-theme="forest"] .group.card:hover .text-4xl {
  transform: scale(1.05); /* Reduced from 1.1 to prevent overflow */
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Enhanced Button Styles */
.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

/* Button Shadows - Light Theme */
.btn-primary {
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.3); /* emerald shadow */
}

.btn-primary:hover {
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

/* Button Shadows - Dark Theme */
html.dark .btn-primary,
[data-theme="forest"] .btn-primary {
  box-shadow: 0 4px 14px 0 rgba(34, 197, 94, 0.4); /* green shadow for forest theme */
}

html.dark .btn-primary:hover,
[data-theme="forest"] .btn-primary:hover {
  box-shadow: 0 6px 20px 0 rgba(34, 197, 94, 0.5);
  transform: translateY(-1px);
}

/* Features Section Styling - Light Theme */
.bg-base-200\/50 {
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.05);
  background-color: rgba(248, 250, 252, 0.5); /* slate-50 with opacity */
}

/* Features Section Styling - Dark Theme */
html.dark .bg-base-200\/50,
[data-theme="forest"] .bg-base-200\/50 {
  background-color: rgba(30, 41, 59, 0.5); /* slate-800 with opacity */
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* CTA Card Enhancement - Light Theme */
.card.bg-gradient-to-r {
  background: linear-gradient(90deg, 
    rgba(16, 185, 129, 0.1),    /* emerald-500 */
    rgba(6, 182, 212, 0.1)      /* cyan-500 */
  );
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* CTA Card Enhancement - Dark Theme */
html.dark .card.bg-gradient-to-r,
[data-theme="forest"] .card.bg-gradient-to-r {
  background: linear-gradient(90deg, 
    rgba(34, 197, 94, 0.15),    /* green-500 with higher opacity for dark */
    rgba(14, 165, 233, 0.15)    /* blue-500 */
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mobile Optimizations */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .btn-lg {
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
  }
  
  .grid.grid-cols-2 {
    gap: 0.75rem;
  }
  
  .card-body.p-3 {
    padding: 0.75rem;
  }
}

/* Desktop card layout optimization */
@media (min-width: 1024px) {
  .grid.lg\\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Improve loading performance */
.dream-grid {
  content-visibility: auto;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  .group.card,
  .btn-primary,
  .text-3xl,
  .text-4xl {
    transition: none;
  }
  
  .group.card:hover {
    transform: none;
  }
}

/* Focus states for keyboard navigation */
.group.card:focus-visible {
  outline: 2px solid var(--p);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--p);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .hero,
  .bg-base-200\/50,
  .card.bg-gradient-to-r {
    background: none !important;
    box-shadow: none !important;
  }
}

/* Quick Access Section Heading Centering */
.mb-12.mt-12 h2 {
  text-align: center !important;
  width: 100% !important;
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Homepage Article List Enhancements - Clean Minimal Style */
.homepage-article-item {
  transition: background-color 0.2s ease;
  margin-bottom: 2rem !important;
  padding: 1.5rem 1rem !important;
  border-bottom: 1px solid rgba(0,0,0,0.1) !important;
}

.homepage-article-item:hover {
  background-color: rgba(0,0,0,0.05) !important;
}

.homepage-article-item:last-child {
  border-bottom: none !important;
}

/* Force 2-column grid layout on large screens with high specificity */
@media (min-width: 1024px) {
  div.homepage-articles-grid.grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 4rem !important;
    row-gap: 3rem !important;
  }
  
  /* Override any Tailwind utilities */
  .homepage-articles-grid article.homepage-article-item {
    width: 100% !important;
    max-width: none !important;
  }
}

/* Line clamp utility for text truncation */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

/* Section spacing enhancements */
.section-spacing {
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .section-spacing {
    margin-bottom: 4rem;
  }
}

/* Homepage specific spacing improvements */
.homepage-section h2 {
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .homepage-section h2 {
    margin-bottom: 2.5rem;
  }
}

/* Enhanced article meta styling */
.article-meta {
  font-size: 0.75rem;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.homepage-article-item:hover .article-meta {
  opacity: 1;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .group.card {
    border: 2px solid var(--bc);
  }
  
  .hero.bg-gradient-to-br {
    background: var(--b2);
    border: 2px solid var(--bc);
  }
  
  .homepage-article-item {
    border: 2px solid var(--bc);
  }
}

/* Homepage Hero Search Bar Styling - Fixed Layout */
.hero-content > div > div:last-child {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.75rem !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  padding-top: 1.5rem !important; /* Add top padding to search/buttons row */
}

@media (min-width: 640px) {
  .hero-content > div > div:last-child {
    flex-direction: row !important;
  }
}

/* Search container */
.hero-content .relative {
  position: relative !important;
  width: 100% !important;
  max-width: 16rem !important; /* Increased from 12rem */
  flex-shrink: 1 !important;
}

@media (max-width: 639px) {
  .hero-content .relative {
    max-width: 100% !important;
    margin-bottom: 0.75rem !important;
  }
}

/* Search input */
.hero-content input[placeholder*="Search"] {
  width: 100% !important;
  padding: 0.5rem 2.5rem 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
  height: 2.5rem !important;
  line-height: 1.5rem !important;
  box-sizing: border-box !important;
}

/* Search button - ensure it's inside the input */
.hero-content .relative button {
  position: absolute !important;
  width: 1.5rem !important;
  height: 1.5rem !important;
  right: 0.5rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.hero-content .relative button ion-icon {
  font-size: 1.25rem !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
}

/* Quick Access Benefits Information - Extra Bottom Padding */
.mb-12.mt-12 h2.pb-4 {
  padding-bottom: 1rem !important; /* pb-4 */
}

/* Ensure buttons don't wrap and stay inline */
.hero-content .btn {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
}

/* Force proper button sizing in hero */
.hero-content .btn-md {
  padding: 0.5rem 1rem !important;
  height: 2.5rem !important;
  font-size: 0.875rem !important;
  min-height: unset !important;
}

/* Force buttons container to stay horizontal on desktop */
@media (min-width: 640px) {
  .hero-content .flex {
    flex-wrap: nowrap !important;
  }
  
  /* Ensure minimum space for all elements */
  .hero-content > div > div:last-child {
    min-width: fit-content !important;
  }
}