/* Recipes Page Specific Styles */

/* Recipe Image Fallback System */
.recipe-card img {
  transition: all 0.5s ease;
  background-color: #f3f4f6;
  background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%), 
                    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #e5e7eb 75%), 
                    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.recipe-card .relative:not(.image-loaded)::after {
  content: "🍽️";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  opacity: 0.3;
  z-index: 1;
  pointer-events: none;
}

.recipe-card .relative.image-loaded::after {
  display: none;
}

/* Image Loading Animation */
.recipe-card img[style*="opacity: 0"] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Hero Section Enhancements */
.recipes-hero {
  background: var(--primary);
  position: relative;
  overflow: hidden;
}

.recipes-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.1;
}

/* Recipe Card Animations */
.recipe-card {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.recipe-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.recipe-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.recipe-card:hover::before {
  left: 100%;
}

/* Category Icons */
.category-icon {
  transition: all 0.3s ease;
  position: relative;
}

.category-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(138, 0, 0, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.category-icon:hover::after {
  width: 100px;
  height: 100px;
}

/* Search Input Enhancements */
.recipe-search {
  position: relative;
  transition: all 0.3s ease;
}

.recipe-search:focus-within {
  transform: scale(1.02);
  box-shadow: 0 0 0 4px rgba(138, 0, 0, 0.1);
}

/* Recipe Rating Stars */
.recipe-rating {
  display: inline-flex;
  align-items: center;
}

.recipe-rating .star {
  transition: all 0.2s ease;
}

.recipe-rating:hover .star {
  transform: scale(1.1);
}

/* Grid/List Toggle Styles */
#gridToggle.active {
  background-color: var(--primary) !important;
  color: white !important;
}

#listToggle.active {
  background-color: var(--primary) !important;
  color: white !important;
}

/* List View Styles */
.recipe-card.list-view {
  display: flex;
  align-items: stretch;
  max-width: none;
}

.recipe-card.list-view .recipe-image {
  width: 200px;
  height: 150px;
  flex-shrink: 0;
}

.recipe-card.list-view .recipe-content {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Category Filter Active */
.category-item.active .bg-white {
  background-color: var(--primary) !important;
  color: white !important;
}

.category-item.active h3 {
  color: var(--primary) !important;
}

/* Favorite Button */
.favorite-btn.favorited i {
  color: #ef4444 !important;
  fill: currentColor;
}

/* Load More Button Animation */
.load-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Toast Notification */
.recipes-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  background: rgba(17,24,39,0.95);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.2s ease;
}

.recipes-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Animation for new recipe cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recipe-card.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Filter Buttons */
.filter-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.filter-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.filter-btn:hover::before {
  left: 100%;
}

/* Recipe Image Overlay Effects */
.recipe-image {
  position: relative;
  overflow: hidden;
}

.recipe-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.recipe-card:hover .recipe-image::after {
  opacity: 1;
}

/* Loading Animation for Recipe Cards */
.recipe-card.loading {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered Animation for Recipe Grid */
.recipe-card:nth-child(1) {
  animation-delay: 0.1s;
}
.recipe-card:nth-child(2) {
  animation-delay: 0.2s;
}
.recipe-card:nth-child(3) {
  animation-delay: 0.3s;
}
.recipe-card:nth-child(4) {
  animation-delay: 0.4s;
}
.recipe-card:nth-child(5) {
  animation-delay: 0.5s;
}
.recipe-card:nth-child(6) {
  animation-delay: 0.6s;
}

/* Recipe Category Hover Effects */
.recipe-category {
  transition: all 0.3s ease;
  cursor: pointer;
}

.recipe-category:hover {
  transform: translateY(-4px);
}

.recipe-category.active {
  background: var(--primary);
  color: white;
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(138, 0, 0, 0.3);
}

/* Newsletter Form Enhancements */
.newsletter-form {
  position: relative;
}

.newsletter-form input:focus {
  box-shadow: 0 0 0 3px rgba(138, 0, 0, 0.1);
  border-color: var(--sqube-red);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .recipe-card {
    margin-bottom: 1rem;
  }

  .category-icon {
    width: 60px;
    height: 60px;
  }

  .recipe-search {
    margin-bottom: 1rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .recipe-card {
    background: #1f2937;
    border: 1px solid #374151;
  }

  .recipe-card:hover {
    background: #111827;
    border-color: var(--sqube-red);
  }
}

/* Print Styles */
@media print {
  .recipe-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .recipe-card:hover {
    transform: none;
  }
}
