.recipe-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 480px;
}

.recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.recipe-card.grid-layout {
}

.recipe-card.list-layout {
    flex-direction: row;
    height: auto;
}

.recipe-card.list-layout .image-container {
    width: 200px;
    height: 150px;
    flex-shrink: 0;
}

.recipe-card.list-layout .card-content {
    flex: 1;
    padding: 1rem;
}

/* Image Container */
.image-container {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 200px;
}

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

.recipe-card:hover .recipe-image {
    transform: scale(1.05);
}

/* Rating Badge */
.rating-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ff6b35;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Card Content */
.card-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Card Body Alignment Fix - Ensures all cards have consistent layout */
.recipe-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1rem;
    min-height: 0;
}

/* Title row with view count - Fixed height and alignment */
.recipe-card .card-body > .d-flex:first-of-type {
    flex-shrink: 0;
    min-height: 3.5rem;
    margin-bottom: 0.5rem;
    align-items: flex-start;
}

.recipe-card .card-body .card-title {
    flex: 1;
    margin: 0;
    line-height: 1.3;
    font-size: 1rem;
    font-weight: 600;
    padding-right: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* View count badge alignment */
.recipe-card .card-body .badge.bg-dark-subtle {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Description - Fixed height (2 lines max) */
.recipe-card .card-body > p.text-muted.small {
    flex-shrink: 0;
    min-height: 2.5rem;
    max-height: 2.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.25rem;
    margin-bottom: 0.75rem !important;
    padding: 0;
}

/* Country and time badges row - Fixed spacing */
.recipe-card .card-body > .d-flex.justify-content-between:not(:first-of-type) {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

/* Bottom section with difficulty and tags - Push to bottom */
.recipe-card .card-body > .mt-2 {
    margin-top: auto;
    flex-shrink: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.recipe-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.recipe-description {
    color: #7f8c8d;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
}

/* Recipe Tags */
.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.country-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.time-tag {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.difficulty-tag {
    background: #ecf0f1;
    color: #2c3e50;
}

/* Badge Quality Improvements */
.badge {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-smooth: always;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.badge-gradient-1,
.badge-gradient-2,
.badge-gradient-3,
.badge-gradient-4,
.badge-gradient-5 {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-smooth: always;
    will-change: transform;
    transform: translateZ(0);
}

.difficulty-easy {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.difficulty-medium {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.difficulty-hard {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

/* Recipe Stats */
.recipe-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #ecf0f1;
}

.views-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #95a5a6;
    font-size: 0.85rem;
}

/* Favorite Button */
.favorite-btn {
    transition: all 0.3s ease;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    background: white;
    border-radius: 20px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.favorite-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.favorite-btn.favorited {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.favorite-btn.favorited .favorite-text {
    display: none;
}

.favorite-btn.favorited::after {
    content: "Favorited";
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .recipe-card.list-layout {
        flex-direction: column;
    }
    
    .recipe-card.list-layout .image-container {
        width: 100%;
        height: 200px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .favorite-btn {
        align-self: flex-start;
    }
}

/* Loading States */
.recipe-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.recipe-card.loading .image-container {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Error States */
.recipe-card.error .image-container {
    background: #f8d7da;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #721c24;
}

.recipe-card.error .image-container::before {
    content: "Image not available";
    font-size: 0.9rem;
    text-align: center;
}

/* Favorite Button */
.favorite-btn {
    transition: all 0.3s ease;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    background: white;
    border-radius: 20px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.favorite-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.favorite-btn.favorited {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.favorite-btn.favorited .favorite-text {
    display: none;
}

.favorite-btn.favorited::after {
    content: "Favorited";
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .recipe-card.list-layout {
        flex-direction: column;
    }
    
    .recipe-card.list-layout .image-container {
        width: 100%;
        height: 200px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .favorite-btn {
        align-self: flex-start;
    }
}

/* Loading States */
.recipe-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.recipe-card.loading .image-container {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Error States */
.recipe-card.error .image-container {
    background: #f8d7da;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #721c24;
}

.recipe-card.error .image-container::before {
    content: "Image not available";
    font-size: 0.9rem;
    text-align: center;
}




/* Favorite Button */
.favorite-btn {
    transition: all 0.3s ease;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    background: white;
    border-radius: 20px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.favorite-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.favorite-btn.favorited {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.favorite-btn.favorited .favorite-text {
    display: none;
}

.favorite-btn.favorited::after {
    content: "Favorited";
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .recipe-card.list-layout {
        flex-direction: column;
    }
    
    .recipe-card.list-layout .image-container {
        width: 100%;
        height: 200px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .favorite-btn {
        align-self: flex-start;
    }
}

/* Loading States */
.recipe-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.recipe-card.loading .image-container {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Error States */
.recipe-card.error .image-container {
    background: #f8d7da;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #721c24;
}

.recipe-card.error .image-container::before {
    content: "Image not available";
    font-size: 0.9rem;
    text-align: center;
}


/* Favorite Button */
.favorite-btn {
    transition: all 0.3s ease;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    background: white;
    border-radius: 20px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.favorite-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.favorite-btn.favorited {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.favorite-btn.favorited .favorite-text {
    display: none;
}

.favorite-btn.favorited::after {
    content: "Favorited";
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .recipe-card.list-layout {
        flex-direction: column;
    }
    
    .recipe-card.list-layout .image-container {
        width: 100%;
        height: 200px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .favorite-btn {
        align-self: flex-start;
    }
}

/* Loading States */
.recipe-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.recipe-card.loading .image-container {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Error States */
.recipe-card.error .image-container {
    background: #f8d7da;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #721c24;
}

.recipe-card.error .image-container::before {
    content: "Image not available";
    font-size: 0.9rem;
    text-align: center;
}



