/* ============================================
   Responsive / Media Queries
   ============================================ */

/* --- Recipe detail --- */
@media (max-width: 1024px) {
    .recipe-layout { grid-template-columns: 1fr 280px; gap: 32px; }
}
@media (max-width: 768px) {
    .recipe-layout { grid-template-columns: 1fr; }
    .recipe-sidebar { display: none; }
    .ingredients-fab { display: flex; }
    .recipe-ingredients-mobile {
        display: block;
        background: var(--color-white);
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        padding: 28px 24px;
        margin-top: 40px;
    }
    .recipe-ingredients-mobile h2 {
        font-family: var(--font-heading);
        font-size: 1.4rem;
        font-weight: 600;
        margin-bottom: 4px;
    }
    .recipe-title { font-size: 2rem; line-height: 1.15; margin-bottom: 10px; }
    .recipe-desc { font-size: 1.08rem; line-height: 1.7; margin-bottom: 22px; }
    .recipe-author-row {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
        gap: 0;
    }
    .recipe-author-link { margin-bottom: 10px; }
    .recipe-share-buttons {
        justify-content: center;
        gap: 6px;
        padding-top: 10px;
        border-top: 1px solid var(--color-border);
    }
    .share-btn { width: 38px; height: 38px; }
    .recipe-meta-bar { gap: 16px; padding: 16px 18px; }
    .meta-item svg { width: 18px; height: 18px; }
    .meta-label { font-size: .78rem; }
    .meta-value { font-size: .92rem; }
    .recipe-section-title { font-size: 1.15rem; }
    .recipe-body { font-size: 1.02rem; line-height: 1.8; }
    .ingredient-item { font-size: 1rem; }
    .method-tabs { flex-direction: column; }
    .method-tab { width: 100%; justify-content: center; }
    .recipe-cover img { aspect-ratio: 4/3; }
    .gallery-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .gallery-grid figure { border-radius: var(--radius); }
    .recipe-detail { padding: 28px 0 60px; }
    .recipe-main { overflow: hidden; }
    .recipe-cover { margin-left: -24px; margin-right: -24px; border-radius: 0; }
    .recipe-body img,
    .recipe-body iframe,
    .recipe-body video { max-width: 100%; height: auto; }
    .review-card { padding: 16px; }
    .review-form-wrapper { padding: 16px; }
    .review-reply-form textarea,
    .review-form textarea { max-width: 100%; box-sizing: border-box; }
}
@media (max-width: 480px) {
    .recipe-title { font-size: 1.6rem; line-height: 1.15; }
    .recipe-desc { font-size: .95rem; }
    .gallery-grid { grid-template-columns: 1fr; }
    .gallery-grid figure { border-radius: var(--radius); margin: 0 auto; max-width: 100%; }
    .gallery-grid img { border-radius: var(--radius) var(--radius) 0 0; }
    .recipe-meta-bar { flex-direction: column; gap: 12px; }
    .recipe-cover { margin-bottom: 28px; }
}

/* --- General --- */
@media (max-width: 1560px) {
    .latest-with-sidebar > .listing-sidebar { display: none; }
}
@media (max-width: 768px) {
    .right-sidebar {
        width: 100%;
        position: static;
        padding: 0 24px;
        margin-top: 16px;
    }
    .right-sidebar > .sidebar-box {
        max-width: 500px;
        margin: 0 auto;
        max-height: none;
    }
}
@media (max-width: 1200px) {
    .recipes-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
    .recipes-grid { grid-template-columns: repeat(2, 1fr); }
    .categories-grid { grid-template-columns: repeat(3, 1fr); }
    .bimby-inner { gap: 40px; }
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-container {
        flex-wrap: wrap;
    }
    .nav-list {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding-bottom: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height .35s ease;
    }
    .nav-list.open { max-height: calc(100vh - 120px); overflow-y: auto; padding-bottom: 8px; }
    .nav-list > li > a {
        padding: 12px 0;
        border-bottom: 1px solid rgba(255, 255, 255, .15);
    }
    .nav-icon { width: 18px; height: 18px; }
    .inline-search { max-width: 100%; }

    /* Filter sidebar → mobile drawer */
    .listing-section.listing-with-filters {
        display: block;
    }
    .listing-section.listing-with-filters > .listing-content > .container {
        margin-left: auto;
    }
    #filterForm {
        width: auto !important;
        padding: 0;
        position: static;
    }
    #filterForm > .ad-container {
        display: none;
    }
    .filter-toggle-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: var(--color-white);
        border: 1px solid var(--color-border);
        border-radius: 50px;
        padding: 8px 18px;
        font-size: .85rem;
        font-weight: 600;
        color: var(--color-text);
        cursor: pointer;
        margin-bottom: 16px;
        transition: border-color .2s, box-shadow .2s;
    }
    .filter-toggle-btn:hover {
        border-color: var(--color-primary);
    }
    .filter-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -300px;
        width: 280px;
        height: auto;
        max-height: none;
        z-index: 1000;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--color-border);
        overflow-y: auto;
        transition: left .3s ease;
        padding: 0 20px 20px;
    }
    .filter-sidebar.open {
        left: 0;
    }
    .filter-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 0;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--color-border);
        position: sticky;
        top: 0;
        background: var(--color-white);
        z-index: 1;
    }
    .filter-sidebar-title {
        font-family: var(--font-heading);
        font-size: 1.1rem;
        font-weight: 700;
    }
    .filter-close-btn {
        background: none;
        border: none;
        padding: 4px;
        cursor: pointer;
        color: var(--color-text-light);
        display: flex;
        align-items: center;
    }
    .filter-close-btn:hover {
        color: var(--color-text);
    }
    .filter-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .4);
        z-index: 999;
    }
    .filter-overlay.open {
        display: block;
    }

    /* Advanced filter modal on mobile */
    .adv-filter-modal { width: 95%; max-height: 90vh; }
    .adv-filter-header { padding: 14px 18px; }
    .adv-filter-body { padding: 16px 18px; }
    .adv-filter-footer { padding: 14px 18px; }
    .adv-filter-ing-list { max-height: 180px; }
    .filter-time-input { max-width: 80px; }

    /* Megamenu mobile: accordion */
    .megamenu {
        position: static;
        transform: none;
        min-width: 0;
        width: 100%;
        background: rgba(255, 255, 255, .07);
        box-shadow: none;
        border-radius: 0;
        opacity: 1;
        visibility: visible;
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s ease;
        padding: 0;
    }
    .nav-megamenu-trigger:hover .megamenu {
        /* Disable hover on mobile, use click */
        opacity: 1;
        visibility: visible;
        max-height: 0;
    }
    .nav-megamenu-trigger.megamenu-open .megamenu {
        max-height: none;
        padding: 8px 0 0;
    }
    .nav-megamenu-trigger.megamenu-open .nav-chevron {
        transform: rotate(180deg);
    }
    .megamenu-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .megamenu-item {
        padding: 10px 16px;
        border-radius: 0;
    }
    .megamenu-item:hover {
        background: rgba(255, 255, 255, .08);
    }
    .megamenu-icon {
        width: 34px;
        height: 34px;
        background: rgba(255, 255, 255, .12);
        color: rgba(255, 255, 255, .9);
    }
    .megamenu-item:hover .megamenu-icon {
        background: rgba(255, 255, 255, .2);
        color: #fff;
    }
    .megamenu-icon svg { width: 18px; height: 18px; }
    .megamenu-name {
        color: rgba(255, 255, 255, .9);
        font-size: .82rem;
    }
    .megamenu-count {
        color: rgba(255, 255, 255, .5);
        font-size: .72rem;
    }
    .megamenu-footer {
        color: rgba(255, 255, 255, .7);
        border-top-color: rgba(255, 255, 255, .15);
        padding: 12px 0;
        margin-top: 4px;
    }
    .megamenu-footer:hover { color: #fff; }

    .hero-carousel { height: 400px; }
    .carousel-caption { padding: 28px 24px; }
    .carousel-caption h2 { font-size: 1.8rem; }
    .carousel-arrow { width: 40px; height: 40px; }
    .carousel-prev { left: 12px; }
    .carousel-next { right: 12px; }
    .carousel-dots { right: 24px; bottom: 16px; }

    .categories-section { padding: var(--section-padding-mobile) 0; }
    .category-cta { opacity: 1; transform: none; }

    /* Mobile category cards: big square images, text below */
    .categories-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .category-card {
        padding: 0;
        border: none;
        border-radius: 12px;
        box-shadow: 0 1px 4px rgba(0,0,0,.1);
    }
    .category-card:hover { transform: none; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
    .category-image {
        aspect-ratio: 1/1;
    }
    .category-card h3 {
        font-size: .92rem;
        padding: 8px 10px 2px;
    }
    .category-card h3::after { display: none; }
    .category-count {
        padding: 0 10px 8px;
        font-size: .72rem;
    }

    .latest-section { padding: var(--section-padding-mobile) 0 56px; }
    .recipes-grid,
    .latest-section .recipes-grid { grid-template-columns: 1fr; max-width: 500px; margin: 0 auto; }
    .section-title { font-size: 1.8rem; margin-bottom: 32px; }

    .bimby-inner { grid-template-columns: 1fr; gap: 32px; }
    .bimby-image { order: -1; }

    .footer-top { grid-template-columns: 1fr; gap: 36px; }
    .footer-nav { grid-template-columns: repeat(3, 1fr); gap: 20px; }
    .footer-bottom { flex-direction: column; gap: 12px; text-align: center; align-items: center; }
    .footer-credit { gap: 8px; }

    /* Top bar mobile */
    .top-bar-inner {
        height: 48px;
        padding: 0 16px;
    }
    .top-bar-tagline { display: none; }
    .top-bar-right { display: none; }
    .topbar-profile { display: block; margin-left: auto; }

    .category-hero { padding: 16px 0 18px; top: 0; }
    .category-hero.stuck { padding: 5px 0; }
    .category-hero-title { font-size: 1.5rem; }
    .bimby-hero { padding: 28px 0 32px; }
    .bimby-hero-title { font-size: 2rem; }
.category-nav { top: 0; }
    .category-pills { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; gap: 6px; padding-bottom: 4px; }
    .pill { white-space: nowrap; padding: 7px 16px; font-size: .75rem; }
    .listing-section { padding: 40px 0 56px; }
}

@media (max-width: 480px) {
    .hero-carousel { height: 320px; }
    .carousel-caption h2 { font-size: 1.5rem; }
    .carousel-caption p { display: none; }
    .logo-main { font-size: 2rem; }
    .logo-sub { font-size: 1rem; }
    .categories-grid { gap: 8px; }
    .category-card h3 { font-size: .84rem; }
    .category-count { font-size: .68rem; }
    .footer-nav { grid-template-columns: 1fr 1fr; }
    .footer-nav-col:last-child { grid-column: 1 / -1; }
    .pagination { padding: 4px; }
    .pagination-page { width: 32px; height: 32px; font-size: .8rem; }
    .pagination-arrow { width: 32px; height: 32px; }
    .pagination-ellipsis { width: 22px; font-size: .8rem; }
}
