/* ===== Header: search & favorites bar ===== */
.recipe-tools-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.recipe-tools-btn,
.recipe-tools-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    border-radius: 50px;
    padding: 9px 18px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    letter-spacing: 0.3px;
}

.recipe-tools-btn {
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary-color, #4CAF50);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
}

.recipe-tools-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.recipe-tools-link {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    color: #e53935;
    border: 1.5px solid rgba(229, 57, 53, 0.15);
}

.recipe-tools-link:hover {
    background: #fff;
    color: #c62828;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(229, 57, 53, 0.2);
}

.recipe-tools-link .fa-heart {
    color: #e53935;
    transition: transform 0.3s ease;
}

.recipe-tools-link:hover .fa-heart {
    transform: scale(1.2);
}

.favorites-count-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e53935;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    transition: transform 0.3s ease;
}

.favorites-count-badge:empty,
.favorites-count-badge[data-count="0"] {
    display: none;
}

/* ===== Card: heart overlay on image ===== */
.recipe-card {
    position: relative;
}

.recipe-card > .recipe-card-fav {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    padding: 0;
}

.recipe-card > .recipe-card-fav .fa {
    font-size: 16px;
    color: #bdbdbd;
    transition: all 0.25s ease;
    line-height: 1;
}

.recipe-card > .recipe-card-fav:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.recipe-card > .recipe-card-fav:hover .fa {
    color: #e53935;
}

.recipe-card > .recipe-card-fav.is-active {
    background: rgba(229, 57, 53, 0.12);
}

.recipe-card > .recipe-card-fav.is-active .fa {
    color: #e53935;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.35); }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.recipe-card-fav.just-toggled .fa {
    animation: heartPop 0.45s ease;
}

/* ===== Single recipe: heart overlay on main photo ===== */
.single-recipe .recipe-image-inner {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.single-recipe-fav {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    padding: 0;
}

.single-recipe-fav .fa {
    font-size: 20px;
    color: #bdbdbd;
    transition: all 0.25s ease;
    line-height: 1;
}

.single-recipe-fav:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.single-recipe-fav:hover .fa {
    color: #e53935;
}

.single-recipe-fav.is-active {
    background: rgba(229, 57, 53, 0.12);
}

.single-recipe-fav.is-active .fa {
    color: #e53935;
}

/* ===== Search modal ===== */
.recipe-search-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease;
}

.recipe-search-modal.is-open {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity 0.3s ease;
}

.recipe-search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.recipe-search-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(720px, calc(100% - 32px));
    margin-top: 8vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: translateY(-20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.recipe-search-modal.is-open .recipe-search-modal__dialog {
    transform: translateY(0) scale(1);
}

.recipe-search-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid #f0f0f0;
}

.recipe-search-modal__header h2 {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recipe-search-modal__header h2::before {
    content: "\f002";
    font-family: FontAwesome;
    font-size: 0.95rem;
    color: var(--primary-color, #4CAF50);
}

.recipe-search-modal__close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: #f5f5f5;
    color: #78909c;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.recipe-search-modal__close:hover {
    background: #e0e0e0;
    color: #37474f;
    transform: rotate(90deg);
}

.recipe-search-modal__body {
    padding: 16px 22px 22px;
}

.recipe-search-modal__input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 12px 16px;
    background: #fafafa;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.recipe-search-modal__input-wrap:focus-within {
    border-color: var(--primary-color, #4CAF50);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    background: #fff;
}

.recipe-search-modal__input-wrap i {
    color: #9e9e9e;
    font-size: 1.05rem;
}

.recipe-search-modal__input-wrap:focus-within i {
    color: var(--primary-color, #4CAF50);
}

.recipe-search-modal__input-wrap input {
    flex: 1;
    border: 0;
    outline: none;
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    background: transparent;
    color: #2c3e50;
}

.recipe-search-modal__input-wrap input::placeholder {
    color: #b0bec5;
}

.recipe-search-modal__meta {
    margin: 12px 0 14px;
    color: #78909c;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.recipe-search-modal__results {
    max-height: 56vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: #e0e0e0 transparent;
}

.recipe-search-modal__results::-webkit-scrollbar {
    width: 5px;
}

.recipe-search-modal__results::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.recipe-search-item {
    display: grid;
    grid-template-columns: 68px 1fr;
    gap: 12px;
    padding: 10px;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    align-items: center;
}

.recipe-search-item:hover {
    border-color: var(--primary-color, #4CAF50);
    background: linear-gradient(135deg, #f1f8e9, #fff);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.08);
    transform: translateX(4px);
}

.recipe-search-item__image {
    width: 68px;
    height: 68px;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.recipe-search-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-search-item__title {
    margin: 0 0 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
}

.recipe-search-item__meta {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-color, #4CAF50);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.recipe-search-item__excerpt {
    margin: 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.82rem;
    color: #78909c;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-search-empty {
    text-align: center;
    padding: 32px 16px;
    color: #9e9e9e;
    font-size: 0.95rem;
}

.recipe-search-empty i {
    display: block;
    font-size: 2.4rem;
    margin-bottom: 12px;
    color: #e0e0e0;
}

/* ===== Favorites page ===== */
.favorites-page {
    max-width: 1200px;
    margin: 30px auto 60px;
    padding: 0 20px;
}

.favorites-page h1 {
    margin: 0 0 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    color: #2c3e50;
}

.favorites-page__subtitle {
    margin: 0 0 4px;
    color: #78909c;
    font-size: 0.95rem;
    line-height: 1.5;
}

.favorites-page__top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eceff1;
}

.favorites-page__clear {
    border: 1.5px solid #ef9a9a;
    background: #fff;
    color: #c62828;
    border-radius: 50px;
    padding: 10px 18px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.favorites-page__clear:hover {
    background: #ffebee;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.12);
}

.favorites-page__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.favorites-page .recipe-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.favorites-page .recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.favorites-page .recipe-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.favorites-page .recipe-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.favorites-page .recipe-cat-wrapper {
    margin-bottom: 6px;
}

.favorites-page .recipe-cat {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    color: var(--primary-color, #4CAF50);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.favorites-page .recipe-title {
    margin: 0 0 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
}

.favorites-page .recipe-excerpt {
    margin: 0 0 14px;
    color: #78909c;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.88rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.favorites-page .recipe-card-footer {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.favorites-page .btn-more {
    display: inline-block;
    border-radius: 8px;
    background: var(--primary-color, #4CAF50);
    color: #fff;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 10px 18px;
    transition: all 0.25s ease;
}

.favorites-page .btn-more:hover {
    background: #388E3C;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
}

.favorites-empty {
    text-align: center;
    padding: 48px 24px;
    border: 2px dashed #e0e0e0;
    border-radius: 16px;
    background: linear-gradient(135deg, #fafafa, #f5f5f5);
    color: #9e9e9e;
}

.favorites-empty i.fa {
    display: block;
    font-size: 3rem;
    margin-bottom: 16px;
    color: #e0e0e0;
}

.favorites-empty p {
    margin: 0 0 16px;
    font-size: 1.05rem;
    color: #78909c;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .recipe-tools-bar {
        gap: 6px;
        margin-top: 8px;
    }

    .recipe-tools-btn,
    .recipe-tools-link {
        font-size: 0.72rem;
        padding: 6px 12px;
        gap: 4px;
    }

    .favorites-count-badge {
        min-width: 16px;
        height: 16px;
        font-size: 0.65rem;
    }

    .recipe-card > .recipe-card-fav {
        width: 34px;
        height: 34px;
    }

    .recipe-card > .recipe-card-fav .fa {
        font-size: 15px;
    }

    .recipe-search-modal__dialog {
        margin-top: 4vh;
        border-radius: 14px;
    }

    .recipe-search-modal__header {
        padding: 14px 16px 12px;
    }

    .recipe-search-modal__body {
        padding: 12px 16px 16px;
    }

    .recipe-search-modal__input-wrap {
        padding: 10px 12px;
    }

    .recipe-search-item {
        grid-template-columns: 56px 1fr;
        gap: 10px;
        padding: 8px;
    }

    .recipe-search-item__image {
        width: 56px;
        height: 56px;
    }

    .recipe-search-item__title {
        font-size: 0.88rem;
    }

    .single-recipe-fav {
        width: 40px;
        height: 40px;
        top: 12px;
        left: 12px;
    }

    .single-recipe-fav .fa {
        font-size: 18px;
    }

    .favorites-page h1 {
        font-size: 1.4rem;
    }

    .favorites-page__grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .recipe-tools-bar {
        gap: 4px;
        margin-top: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .recipe-tools-btn,
    .recipe-tools-link {
        font-size: 0.68rem;
        padding: 5px 8px;
        gap: 3px;
    }

    .recipe-tools-btn .fa,
    .recipe-tools-link .fa {
        font-size: 0.9em;
    }

    .favorites-count-badge {
        min-width: 14px;
        height: 14px;
        font-size: 0.6rem;
    }
}
