/* Search and Filter Styles */
.search-filter-container {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-section {
    margin-bottom: 1.5rem;
}

.search-input-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1.1rem;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1.2rem;
}

.filters-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: inline-flex;
    flex-direction: column;
}

.filter-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.dietary-filters {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.dietary-filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dietary-filter {
    width: 18px;
    height: 18px;
    accent-color: #007bff;
}

.dietary-label {
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
}

.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.sort-select {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
}

.results-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.results-count {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.clear-filters-btn {
    padding: 0.5rem 1rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.clear-filters-btn:hover {
    background: #5a6268;
}

/* Recipe Cards Grid */
.recipes-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
    width: 90%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.recipe-card {
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    height: auto;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.recipe-header {
    width: 100%;
    background: white;
}

.recipe-body {
    display: flex;
    flex-direction: row;
    width: 100%;
    align-items: stretch;
}

.recipe-image,
.featured-image {
    position: relative;
    width: 50%;
    min-height: 350px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-sizing: border-box;
    overflow: hidden;
}

.recipe-image img,
.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
    border-radius: 8px;
}

.recipe-card:hover .recipe-image img {
    transform: scale(1.05);
}

.recipe-difficulty {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recipe-difficulty.easy {
    background: #28a745;
    color: white;
}

.recipe-difficulty.medium {
    background: #ffc107;
    color: #212529;
}

.recipe-difficulty.medium-plus {
    background: #fd7e14;
    color: white;
}

.recipe-difficulty.hard {
    background: #dc3545;
    color: white;
}

.recipe-content {
    width: 50%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Author and date row */
.recipe-author-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.recipe-author-row .author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recipe-author-row .date {
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.author-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

.author-btn:hover {
    background-color: var(--secondary-color);
    text-decoration: none;
}

.recipe-title-link {
    font-size: 1.1rem;
    font-weight: 600;
    color: #007bff;
    text-decoration: none;
    margin-right: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.recipe-title-link:hover {
    text-decoration: underline;
}

.recipe-quick-links .quick-link {
    color: #4a90e2;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.recipe-quick-links .quick-link:hover {
    text-decoration: underline;
}

/* Recipe description */
.recipe-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* Meta information row */
.recipe-meta-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 0;
    border-top: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
}

.recipe-meta-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.recipe-meta-label {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.recipe-meta-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

.recipe-meta-value i {
    color: #4a90e2;
    font-size: 1.1rem;
}

/* Tags and dietary info */
.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.recipe-tag {
    background: #f0f4f8;
    color: #495057;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

.recipe-dietary {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.recipe-dietary .dietary-icon {
    position: relative;
    cursor: help;
    display: inline-block;
}

.recipe-dietary .dietary-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.recipe-dietary .dietary-icon:hover::after {
    opacity: 1;
}

.recipe-dietary .dietary-icon::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.recipe-dietary .dietary-icon:hover::before {
    opacity: 1;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

/* Recipe Actions */
.recipe-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    align-self: flex-end;
    margin-top: auto;
    padding-top: 1rem;
    color: white;
}

.recipe-actions .btn-weekly-menu,
.recipe-actions .btn-follow,
.recipe-card .action-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.recipe-card .action-btn {
    background-color: #e2e8f0;
    color: #1a202c;
    border: 1px solid #cbd5e0;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.recipe-card .action-btn:hover {
    background-color: #cbd5e0;
}

.recipe-card .action-btn.btn-favorite.active {
    background-color: #064e3b !important;
    /* Dark Green */
    color: white !important;
    border-color: #064e3b !important;
}

.recipe-card .action-btn.btn-weekly-menu.active {
    background-color: #10b981 !important;
    /* Light Green */
    color: white !important;
    border-color: #10b981 !important;
}

.recipe-card .action-btn.btn-follow.active {
    background-color: var(--secondary-color) !important;
    color: white !important;
    border-color: var(--secondary-color) !important;
}

.recipe-content>.btn-view-recipe {
    width: 100%;
    padding: 1rem;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.recipe-content>.btn-view-recipe:hover {
    background-color: #0056b3;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus and Accessibility */
.recipe-card:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.filter-select:focus,
.search-input:focus,
.btn-view-recipe:focus,
.clear-filters-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .recipe-card {
        border: 2px solid #000;
    }

    .search-input,
    .filter-select {
        border: 2px solid #000;
    }
}

/* Recipe details grid: headings on top, values below, in a single row */
.recipe-details-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
    border-top: 1px dashed #e9ecef;
    padding-top: 0.75rem;
    align-items: start;
}

.recipe-details-grid .detail-item {
    text-align: center;
    padding: 0.25rem 0.25rem;
}

.recipe-details-grid .detail-heading {
    font-size: 0.72rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.recipe-details-grid .detail-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
}

/* Responsive: collapse to two columns on smaller screens */
@media (max-width: 768px) {
    .recipe-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Detail-item visual button styling (heading on top, value below) */
.recipe-details-grid .detail-item {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    box-shadow: 0 4px 10px rgba(16, 24, 40, 0.04);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    cursor: default;
}

.recipe-details-grid .detail-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.07);
}

.recipe-details-grid .detail-heading {
    font-size: 0.72rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

.recipe-details-grid .detail-value {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.filter-controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}


/* Wide Recipe Card (New Layout) */
.recipe-card-wide {
    display: flex;
    flex-direction: row;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    height: 280px;
    /* Fixed height for consistency */
    margin-bottom: 2rem;
    position: relative;
    border: 1px solid #f0f0f0;
}

.recipe-card-wide:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

/* Left Section: Image (30%) */
.wide-image {
    width: 30%;
    height: 100%;
    background-color: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.wide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.recipe-card-wide:hover .wide-image img {
    transform: scale(1.05);
}

/* Middle Section: Info (35%) */
.wide-info {
    width: 35%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px dashed #e9ecef;
}

.wide-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 1rem 0;
    line-height: 1.3;
}

.wide-author-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: #555;
    background: transparent;
    padding: 0;
}

.wide-author-row i {
    color: var(--primary-color);
}

.wide-date {
    font-size: 0.9rem;
    color: #888;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Right Section: Details (35%) */
.wide-details {
    width: 35%;
    padding: 2rem;
    background-color: #fbfbfb;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

.wide-description {
    font-size: 1rem;
    color: #666;
    line-height: 1.6;
    display: block;
    /* Removed webkit-box */
    max-height: 4.8em;
    /* Approximate 3 lines */
    overflow: hidden;
    margin: 0 0 1rem 0;
    min-height: 1.6rem;
    /* Ensure space is reserved even if empty */
}

.wide-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.wide-meta-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: #444;
    font-weight: 500;
    white-space: nowrap;
}

.wide-meta-item i {
    color: var(--primary-color);
    width: 16px;
    text-align: center;
}

/* Adjust Grid Container to Single Column */
.recipes-container,
.recipe-showcase {
    display: grid !important;
    grid-template-columns: 1fr !important;
    /* Force single column */
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .recipe-card-wide {
        flex-direction: column;
        height: auto;
    }

    .wide-image,
    .wide-info,
    .wide-details {
        width: 100%;
        border-right: none;
    }

    .wide-image {
        height: 250px;
    }

    .wide-info {
        padding: 1.5rem;
        border-bottom: 1px dashed #e9ecef;
    }

    .wide-details {
        padding: 1.5rem;
    }
}