/* static/css/mobile-recipe-grid.css */
@import url('./colors.css');

/* Mobile Recipe Grid Layout */
@media (max-width: 576px) {

    /* Two-column grid container */
    #recipe-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 0 16px;
        margin-bottom: 80px;
        /* Space for floating chat button */
    }

    /* Override Bootstrap column classes on mobile */
    #recipe-list .col-lg-3,
    #recipe-list .col-md-4,
    #recipe-list .col-sm-6 {
        width: 100%;
        padding: 0;
        margin-bottom: 0;
    }

    /* Enhanced recipe card for mobile */
    .recipe-card {
        border-radius: 1.5rem;
        /* consistent rounded-2xl */
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        /* soft shadow */
        transition: all 0.3s ease;
        background: white;
        height: auto;
        min-height: 280px;
    }

    .recipe-card:hover {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
        /* enhanced shadow */
        transform: translateY(-4px) scale(1.02);
        /* slight scale-up */
    }

    /* Larger image wrapper for better visual impact */
    .recipe-image-wrapper {
        height: 140px;
        position: relative;
        overflow: hidden;
    }

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

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

    /* Gradient overlay for better text readability */
    .recipe-image-wrapper::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50%;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.3));
        pointer-events: none;
    }

    /* Enhanced bookmark container */
    .recipe-card .bookmark-container {
        top: 4px;
        right: 8px;
        background-color: rgba(0, 0, 0, 0.5);
        border-radius: 4px;
        width: 36px;
        height: 36px;
    }

    .recipe-card .bookmark-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }

    .recipe-card .bookmark-icon svg {
        width: 24px;
        height: 24px;
        filter: drop-shadow(0px 0px 2px rgba(0, 0, 0, 0.5));
    }

    .recipe-card .bookmark-icon svg path {
        fill: none;
        stroke: var(--bs-white);
        stroke-width: 2px;
        stroke-linejoin: round;
        stroke-linecap: round;
    }

    .recipe-card a.bookmark-icon:hover svg path {
        fill: var(--bs-orange);
        stroke: var(--bs-orange);
    }

    .recipe-card .bookmark-icon.bookmarked svg path {
        fill: var(--bs-orange);
        stroke: var(--bs-orange);
    }

    .recipe-card .bookmark-icon.bookmarked:hover svg path {
        fill: var(--bs-orange);
        stroke: var(--bs-orange);
    }



    /* Recipe details with better spacing */
    .recipe-details {
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        height: calc(100% - 140px);
    }

    /* Enhanced recipe header */
    .recipe-header {
        margin-bottom: 8px;
        min-height: auto;
    }

    .recipe-title {
        font-size: 14px;
        font-weight: 600;
        line-height: 1.3;
        margin: 0 0 4px 0;
        color: var(--bs-gray-800);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .recipe-title a {
        color: inherit;
        text-decoration: none;
        transition: color 0.2s ease;
    }

    .recipe-title a:hover {
        color: var(--bs-primary-600);
    }

    /* Compact recipe source */
    .recipe-source {
        font-size: 11px;
        color: var(--bs-gray-600);
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        margin-bottom: 0;
    }

    .recipe-source a {
        color: var(--bs-primary-600);
        text-decoration: none;
    }

    .recipe-source a:hover {
        color: var(--bs-primary-700);
    }

    /* Streamlined recipe info */
    .recipe-info {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin-top: auto;
    }

    /* Compact rating display */
    .recipe-rating {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 11px;
        color: var(--bs-gray-600);
    }

    .recipe-rating .star {
        font-size: 12px;
        color: var(--bs-gray-300);
    }

    .recipe-rating .star.filled {
        color: #ffd700;
    }

    .rating-value {
        font-size: 10px;
        color: var(--bs-gray-500);
        margin-left: 2px;
    }

    /* Compact time display */
    .recipe-time {
        font-size: 11px;
        color: var(--bs-gray-600);
        display: flex;
        align-items: center;
        gap: 4px;
        margin-bottom: 0;
    }

    .recipe-time::before {
        content: '⏱';
        font-size: 12px;
        opacity: 0.7;
    }

    /* Ingredients as tags */
    .recipe-ingredients {
        font-size: 10px;
        color: var(--bs-gray-600);
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin: 0;
        font-style: normal;
    }

    /* Cluster layout adjustments for mobile */
    .cluster {
        margin-bottom: 24px;
    }

    .cluster-title {
        font-size: 20px;
        font-weight: 700;
        color: var(--bs-gray-800);
        margin-bottom: 16px;
        padding: 0 16px;
        position: sticky;
        left: 0;
        background: var(--bs-gray-50);
        z-index: 10;
    }

    /* Mobile cluster recipe row - keep horizontal scroll but make cards smaller */
    .recipe-row {
        display: flex;
        overflow-x: auto;
        gap: 12px;
        padding: 0 16px 16px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .recipe-row::-webkit-scrollbar {
        display: none;
    }

    /* Cluster recipe cards - smaller for horizontal scrolling */
    .recipe-row .recipe-card {
        flex-shrink: 0;
        width: 160px;
        min-height: 240px;
    }

    .recipe-row .recipe-image-wrapper {
        height: 100px;
    }

    .recipe-row .recipe-details {
        padding: 10px;
        height: calc(100% - 100px);
    }

    .recipe-row .recipe-title {
        font-size: 13px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    /* Loading states */
    .recipe-card.loading {
        background: var(--bs-gray-100);
        animation: pulse 1.5s ease-in-out infinite;
    }

    @keyframes pulse {

        0%,
        100% {
            opacity: 1;
        }

        50% {
            opacity: 0.7;
        }
    }

    /* Empty state */
    .no-recipes {
        grid-column: 1 / -1;
        text-align: center;
        padding: 40px 20px;
        color: var(--bs-gray-600);
    }

    .no-recipes-icon {
        font-size: 48px;
        color: var(--bs-gray-400);
        margin-bottom: 16px;
    }

    .no-recipes-text {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .no-recipes-subtext {
        font-size: 14px;
        color: var(--bs-gray-500);
    }
}

/* Tablet adjustments */
@media (min-width: 577px) and (max-width: 768px) {
    #recipe-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        padding: 0 20px;
    }

    #recipe-list .col-lg-3,
    #recipe-list .col-md-4,
    #recipe-list .col-sm-6 {
        width: 100%;
        padding: 0;
        margin-bottom: 0;
    }
}

/* Desktop - keep original layout */
@media (min-width: 769px) {
    /* Original desktop styles remain unchanged */
}