/* Темна тема для сторінки рецептів */
:root{
    --bg-1: #121826; /* основний фон */
    --bg-2: #1C2230; /* блоки */
    --accent: #FF7A00; /* акценти */
    --muted: #9aa6b6;
}

body {
    background-color: var(--bg-1);
    color: #e6eef8;
}

.recipes-page h2 {
    color: var(--accent);
    font-size: 2rem;
    margin: 0; /* remove bottom margin so header items align on one row */
}

.recipes-header {
    max-width: 1200px;
    margin: 0 auto 1.25rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.recipes-header h2 { flex: 0 0 auto; }
.recipes-header .header-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }

.catalog-button {
    background: linear-gradient(90deg, #ff8c1a, #ff7a00);
    border: none;
    color: #fff;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 26px rgba(255,122,0,0.12);
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
    height: 40px;
    line-height: 1;
}

.catalog-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 44px rgba(255,122,0,0.16);
    filter: brightness(1.02);
}

.catalog-button:focus { outline: 3px solid rgba(255,122,0,0.12); outline-offset: 3px }

.catalog-button .cat-icon { font-size: 1rem; display:inline-block; color: #fff }

.recipes-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* ========== МОБІЛЬНА АДАПТАЦІЯ recipes.html (max-width: 768px) ========== */
@media (max-width: 768px) {
    * { box-sizing: border-box !important; }
    body { overflow-x: hidden !important; width: 100% !important; }
    
    main.recipes-page {
        margin-top: 70px !important;
        padding: 1rem !important;
        width: 100% !important;
    }
    
    .recipes-header {
        max-width: 100% !important;
        margin: 0 !important;
        margin-bottom: 1rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }
    
    .recipes-header h2 {
        color: var(--accent) !important;
        font-size: 1.5rem !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .header-actions {
        margin-left: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: stretch !important;
        width: 100% !important;
    }
    
    .header-actions > div {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: stretch !important;
        width: 100% !important;
    }
    
    /* Пошук і фільтр для обох сторінок */
    #searchInput.page-search,
    #filterInput.page-search {
        width: 100% !important;
        max-width: none !important;
        padding: 0.65rem 1rem !important;
        padding-left: 44px !important;
        font-size: 0.95rem !important;
    }
    
    /* Кнопки: пошук, категорії, фільтр */
    .catalog-button,
    #searchBtn,
    #filterBtn,
    #catalogBtn,
    #catalogBtnCommunity {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.65rem 1rem !important;
        height: 44px !important;
        font-size: 0.95rem !important;
    }
    
    /* КАТЕГОРІЇ — ГОРИЗОНТАЛЬНИЙ СКРОЛЛ */
    .categories-container,
    .categories {
        display: flex !important;
        gap: 0.75rem !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 0.75rem 0 !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    .categories-container::-webkit-scrollbar,
    .categories::-webkit-scrollbar {
        height: 4px !important;
    }
    
    .categories-container::-webkit-scrollbar-track,
    .categories::-webkit-scrollbar-track {
        background: rgba(255, 122, 0, 0.1) !important;
    }
    
    .categories-container::-webkit-scrollbar-thumb,
    .categories::-webkit-scrollbar-thumb {
        background: #FF7A00 !important;
        border-radius: 2px !important;
    }
    
    .cat-btn {
        flex: 0 0 auto !important;
        min-width: 100px !important;
        height: 40px !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
        white-space: nowrap !important;
    }
    
    /* СІТКА РЕЦЕПТІВ — ОДНА КОЛОНКА */
    .recipes-grid {
        max-width: 100% !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    
    .recipe-card {
        background: linear-gradient(180deg, rgba(0,0,0,0.06), rgba(0,0,0,0.22)) !important;
        border: 1px solid rgba(255,255,255,0.03) !important;
        border-radius: 14px !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        box-shadow: 0 8px 26px rgba(2,6,23,0.65) !important;
        width: 100% !important;
        height: auto !important;
    }
    
    .recipe-image {
        height: 200px !important;
        width: 100% !important;
        object-fit: cover !important;
        display: block !important;
        aspect-ratio: 16 / 9 !important;
    }
    
    .recipe-card-content {
        display: flex !important;
        flex-direction: column !important;
        padding: 1rem !important;
        gap: 0.5rem !important;
        flex: 1 !important;
    }
    
    .recipe-name {
        font-size: 1rem !important;
        font-weight: 600 !important;
        margin: 0 !important;
        color: #fff !important;
        line-height: 1.3 !important;
        word-wrap: break-word !important;
    }
    
    .recipe-desc {
        font-size: 0.85rem !important;
        color: #9aa6b6 !important;
        margin: 0 !important;
        line-height: 1.4 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }
    
    .recipe-meta {
        display: flex !important;
        gap: 1rem !important;
        font-size: 0.8rem !important;
        color: #9aa6b6 !important;
        margin-top: 0.25rem !important;
        flex-wrap: wrap !important;
    }
    
    .recipe-action-btn {
        align-self: flex-start !important;
        padding: 0.5rem 1rem !important;
        margin-top: 0.5rem !important;
        font-size: 0.9rem !important;
        height: 40px !important;
    }
    
    /* ПАГІНАЦІЯ */
    .pagination {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 1200px !important;
        margin: 2rem auto !important;
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
    }
    
    .pagination > * {
        margin: 0 !important;
    }
    
    .page-btn {
        width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        font-size: 0.9rem !important;
        padding: 0 !important;
    }
    
    /* МОДАЛІ */
    .recipe-modal-overlay {
        padding: 0 !important;
        z-index: 2000 !important;
    }
    
    .recipe-modal {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 12px 12px 0 0 !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
    }
    
    .modal-image-wrap {
        max-width: 100% !important;
    }
    
    .modal-image {
        height: 220px !important;
        width: 100% !important;
        object-fit: cover !important;
    }
    
    .modal-body {
        padding: 1rem !important;
    }
}

.recipe-card {
    background: linear-gradient(180deg, rgba(0,0,0,0.06), rgba(0,0,0,0.22));
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 26px rgba(2,6,23,0.65);
    transition: transform 280ms cubic-bezier(.2,.9,.2,1), box-shadow 280ms ease, border-color 280ms ease, background 260ms ease;
}

.recipe-image {
    height: 170px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.recipe-image::after{
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.28) 100%);
    transition: opacity 260ms ease;
    opacity: 0.9;
}

.recipe-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0.08));
    flex: 1 1 auto;
}

.recipe-info h4 { color: #fff; margin:0; font-size:1.05rem; transition: transform 220ms ease, color 220ms ease }
.recipe-description { color: var(--muted); font-size: 0.95rem; margin:0; }
/* Clamp description so meta row sits consistently like in soups */
.recipe-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-meta { display:flex; justify-content:space-between; align-items:center; margin-top: auto; flex-wrap: nowrap; gap: 0.5rem; }
recipe-meta .meta-left { display: flex; align-items: center; gap: 0.35rem; min-width: 0; flex: 1 1 auto; flex-wrap: nowrap; overflow: visible; }
.recipe-meta .meta-right { display: flex; align-items: center; gap: 0.6rem; flex: 0 0 auto; }
.cook-time { color: #ffffff; font-weight:600; flex: 0 0 auto; margin-right: 0.4rem; }


.details-btn { background: none; border: 1px solid rgba(255,255,255,0.06); color: var(--accent); padding:0.28rem 0.5rem; border-radius:8px; cursor:pointer; backdrop-filter: blur(2px) }
.details-btn:hover { background: linear-gradient(90deg, rgba(255,122,0,0.95), rgba(255,122,0,0.85)); color: #111; transform: translateY(-3px) }

/* Ensure details button is vertically centered like soups and has consistent size */
.details-btn { display: inline-flex; align-items: center; justify-content: center; height: 30px; padding: 0 0.6rem; }
.recipe-meta .meta-left, .recipe-meta .meta-right { gap: 0.5rem; }
.cook-time { margin-right: 0.25rem; white-space: nowrap; min-width: 36px; flex-shrink: 0; position: relative; z-index: 2; }

/* Ensure recipe card action button matches soups layout */
.recipe-button {
    background: linear-gradient(90deg, #ff7a00, #ff8c1a);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 0.35rem 1.1rem;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255,122,0,0.12);
}
.recipe-button:hover { transform: translateY(-2px); }

/* Make like button visually consistent and aligned */

.recipe-like { height: 34px; width: 34px; display:inline-flex; align-items:center; justify-content:center; padding:0; }

/* Ensure consistent card height so meta aligns across categories */
.recipe-card { min-height: 360px; }

.recipe-like { background: rgba(255,255,255,0.02); border-radius:8px; border:none; color: var(--muted); font-size:1.1rem; cursor: pointer; padding:6px 8px; transition: transform 180ms ease, color 180ms ease, background 180ms ease }
.recipe-like.liked { color: var(--accent); background: rgba(255,122,0,0.12); transform: scale(1.06) }

.recipe-details { display:none; margin-top:8px; color: #cfe6ff; font-size:0.9rem }
.recipe-details.open { display:block }

.recipe-card:hover { transform: translateY(-6px) scale(1.01); box-shadow: 0 18px 36px rgba(2,6,23,0.7); border-color: rgba(255,122,0,0.15) }
.recipe-card:hover .recipe-image::after { opacity: 0.65 }
.recipe-card:hover .recipe-info h4 { transform: translateY(-2px); color: #fff }

/* Пагінація */
.pagination { max-width:1200px; margin:1.5rem auto; display:flex; gap:8px; justify-content:center }
.page-btn, .page-next { background: var(--bg-2); color: #fff; border: 1px solid rgba(255,255,255,0.04); padding:0.6rem 0.9rem; border-radius:8px; cursor:pointer }
.page-btn.active { background: var(--accent); color:#111 }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(3,6,12,0.95);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1),
                visibility 280ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    padding: 1rem;
    pointer-events: none;
}

.modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-1);
    border-radius: 12px;
    width: min(920px, 95%);
    position: relative;
    padding: 2rem;
    color: var(--text-primary);
    box-shadow: 0 12px 40px rgba(2,6,23,0.8);
    transform: translateY(24px) scale(0.98);
    transition: transform 320ms cubic-bezier(.2,.9,.2,1);
}

.modal[aria-hidden="false"] .modal-content {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 10;
    transition: color 180ms ease;
}

.modal-close:hover {
    color: var(--accent);
}

.categories-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.cat-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: #e6eef8;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.cat-btn:hover {
    background: linear-gradient(90deg, rgba(255,122,0,0.12), rgba(255,122,0,0.06));
    border-color: rgba(255,122,0,0.18);
    color: #fff;
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 20px rgba(255,122,0,0.06);
}

.cat-btn .cat-icon { font-size: 1rem; display:inline-block }

.cat-btn[aria-pressed="true"], .cat-btn.active {
    background: linear-gradient(90deg, #ff7a00, #ff8c1a);
    color: #111;
    border-color: transparent;
    box-shadow: 0 10px 26px rgba(255,122,0,0.14);
    transform: translateY(-2px);
}

@media (max-width: 780px) {
    .categories-modal-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem }
}



/* Адаптивність */
@media (max-width: 1100px){ .recipes-grid{ grid-template-columns: repeat(3,1fr) } .categories-modal-grid{ grid-template-columns: repeat(3,1fr) } }
@media (max-width: 780px){ .recipes-grid{ grid-template-columns: repeat(2,1fr) } .categories-modal-grid{ grid-template-columns: repeat(2,1fr) } }
@media (max-width: 480px){ .recipes-grid{ grid-template-columns: 1fr } .categories-modal-grid{ grid-template-columns: 1fr } .recipes-header{ flex-direction:column; align-items:flex-start } }

/* Community recipes page background */
.recipes-page {
    background-color: var(--bg-1);
    min-height: 100vh;
}

.recipes-page .recipes-header {
    color: #ffffff;
}

.recipes-page .recipes-header h2 {
    color: #ffffff;
}

/* Ensure fade container visible class still works */
.fade-page{ min-height:100vh }

/* prevent scroll when modal open */
body.no-scroll{ overflow: hidden; height: 100vh }

/* Force identical recipe card design on Recipes page by reusing main card rules
   (prefixed with .recipes-page to avoid affecting other pages) */
.recipes-page .recipe-card {
    background: linear-gradient(180deg, rgba(0,0,0,0.06), rgba(0,0,0,0.22));
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 26px rgba(2,6,23,0.65);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.recipes-page .recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 14px 36px rgba(2,6,23,0.78);
    border-color: rgba(255,122,0,0.12);
    background: linear-gradient(180deg, rgba(0,0,0,0.07), rgba(0,0,0,0.26));
}

.recipes-page .recipe-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: #e9ecef;
}

.recipes-page .recipe-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.recipes-page .recipe-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.recipes-page .recipe-description {
    font-size: 0.95rem;
    color: #9aa6b6;
    margin: 0.25rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
}

.recipes-page .recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.recipes-page .meta-left {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible;
    align-items: center;
}

.recipes-page .recipe-category {
    display: inline-block;
    background: #ffffff;
    color: #ff7a00;
    padding: 0.08rem 0.32rem; /* smaller padding to reduce footprint */
    border-radius: 12px;
    font-size: 0.72rem; /* slightly smaller text */
    font-weight: 700;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 6px 14px rgba(2,6,23,0.12);
    white-space: nowrap;
    overflow: hidden; /* prevent overflow */
    text-overflow: ellipsis;
    max-width: 120px; /* limit width so it won't overlap other elements */
    position: relative;
    left: 0; /* remove negative offset that caused overlap */
    vertical-align: middle;
    line-height: 1.2;
    box-sizing: border-box;
}

.recipes-page .cook-time { white-space: nowrap; flex: 0 0 auto; margin-right: 0.5rem; min-width: 36px; flex-shrink: 0; position: relative; z-index: 2; display: inline-block; color:#fff; font-size:0.85rem }

.recipes-page .meta-right { display: flex; gap: 0.5rem; align-items: center; margin-left: 6px }

.recipes-page .recipe-button { background: linear-gradient(90deg, #ff7a00, #ff8c1a); color:#fff; border:none; border-radius:999px; padding:0.35rem 1.1rem; height:34px; font-weight:700; font-size:0.95rem }

.recipes-page .recipe-like { background: none; border: none; cursor: pointer; padding: 0; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary, #9aa6b6); transition: color 0.2s ease, transform 0.2s ease }

.recipes-page .recipe-like.liked { color: #ff6b6b }

.recipes-page .recipe-card { min-height: 360px }

@media (max-width: 768px) {
    .recipes-page .recipes-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem }
    .recipes-page .recipe-image { height: 150px }
    .recipes-page .recipe-info { padding: 1rem }
}

@media (max-width: 480px) {
    .recipes-page .recipes-grid { grid-template-columns: 1fr }
    .recipes-page .recipe-meta { flex-direction: column; align-items: flex-start; gap: 0.5rem }
    .recipes-page .meta-right { width: 100%; justify-content: space-between; margin-left: 0 }
    .recipes-page .recipe-category { left: 0 }
}

.recipe-button {
    background: linear-gradient(90deg, #ff7a00, #ff8c1a);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 0.35rem 1.1rem;
    height: 34px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 160ms ease, box-shadow 160ms ease;
    box-shadow: 0 4px 10px rgba(255,122,0,0.12);
}


