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

/* Enhanced Mobile Carousel for Recipe Clusters */
@media (max-width: 576px) {

    /* Cluster container with better spacing */
    .cluster {
        margin-bottom: 32px;
        position: relative;
    }

    /* Enhanced cluster title with gradient background */
    .cluster-title {
        font-size: 18px;
        font-weight: 700;
        color: var(--bs-gray-800);
        margin-bottom: 12px;
        padding: 12px 16px 8px;
        background: linear-gradient(135deg, var(--bs-primary-50), var(--bs-secondary-50));
        border-radius: 12px 12px 0 0;
        position: sticky;
        left: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Cluster count indicator */
    .cluster-count {
        background: var(--bs-primary-500);
        color: white;
        font-size: 11px;
        font-weight: 600;
        padding: 4px 8px;
        border-radius: 12px;
        min-width: 24px;
        text-align: center;
    }

    /* Enhanced recipe row with better scrolling */
    .recipe-row {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 16px;
        padding: 0 16px 20px;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        position: relative;
    }

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

    /* Scroll indicators */
    .recipe-row::before,
    .recipe-row::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 20px;
        width: 20px;
        pointer-events: none;
        z-index: 5;
        transition: opacity 0.3s ease;
    }

    .recipe-row::before {
        left: 0;
        background: linear-gradient(to right, rgba(248, 249, 250, 0.8), transparent);
        opacity: 0;
    }

    .recipe-row::after {
        right: 0;
        background: linear-gradient(to left, rgba(248, 249, 250, 0.8), transparent);
    }

    .recipe-row.scrolled::before {
        opacity: 1;
    }

    .recipe-row.at-end::after {
        opacity: 0;
    }

    /* Enhanced carousel recipe cards */
    .recipe-row .recipe-card {
        flex-shrink: 0;
        width: 180px;
        min-height: 260px;
        border-radius: 1.5rem;
        /* consistent rounded-2xl */
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        /* soft shadow */
        transition: all 0.3s ease;
        background: white;
        position: relative;
    }

    .recipe-row .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 */
    }

    .recipe-row .recipe-card:first-child {
        margin-left: 0;
    }

    .recipe-row .recipe-card:last-child {
        margin-right: 16px;
    }

    /* Carousel image styling */
    .recipe-row .recipe-image-wrapper {
        height: 120px;
        border-radius: 1.5rem 1.5rem 0 0;
        /* consistent rounded-2xl */
        overflow: hidden;
        position: relative;
    }

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

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

    /* Image overlay gradient */
    .recipe-row .recipe-image-wrapper::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 40%;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.4));
        pointer-events: none;
    }

    /* Carousel card details */
    .recipe-row .recipe-details {
        padding: 12px;
        height: calc(100% - 120px);
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

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

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

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

    .recipe-row .recipe-source {
        font-size: 10px;
        color: var(--bs-gray-600);
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        margin-bottom: 4px;
    }

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

    /* Compact info for carousel cards */
    .recipe-row .recipe-info {
        margin-top: auto;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .recipe-row .recipe-rating {
        font-size: 10px;
        color: var(--bs-gray-600);
        display: flex;
        align-items: center;
        gap: 2px;
    }

    .recipe-row .recipe-rating .star {
        font-size: 11px;
    }

    .recipe-row .recipe-time {
        font-size: 10px;
        color: var(--bs-gray-600);
        display: flex;
        align-items: center;
        gap: 3px;
    }

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

    .recipe-row .recipe-ingredients {
        font-size: 9px;
        color: var(--bs-gray-500);
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin: 0;
    }

    /* Carousel navigation dots */
    .carousel-dots {
        display: flex;
        justify-content: center;
        gap: 6px;
        padding: 8px 16px 0;
        margin-top: -8px;
    }

    .carousel-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--bs-gray-300);
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .carousel-dot.active {
        background: var(--bs-primary-500);
        transform: scale(1.2);
    }

    /* Touch feedback */
    .recipe-row .recipe-card:active {
        transform: scale(0.98);
    }

    /* Smooth momentum scrolling */
    .recipe-row {
        scroll-snap-type: x mandatory;
    }

    .recipe-row .recipe-card {
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    /* Loading state for carousel */
    .recipe-row.loading {
        min-height: 260px;
        background: linear-gradient(90deg,
                var(--bs-gray-100) 0%,
                var(--bs-gray-200) 50%,
                var(--bs-gray-100) 100%);
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
    }

    @keyframes shimmer {
        0% {
            background-position: -200% 0;
        }

        100% {
            background-position: 200% 0;
        }
    }

    /* Cluster action buttons */
    .cluster-actions {
        position: absolute;
        top: 12px;
        right: 16px;
        display: flex;
        gap: 8px;
        z-index: 15;
    }

    .cluster-action-btn {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(8px);
        border: 1px solid rgba(0, 0, 0, 0.1);
        color: var(--bs-gray-600);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 14px;
        transition: all 0.2s ease;
    }

    .cluster-action-btn:hover {
        background: white;
        color: var(--bs-primary-600);
        transform: scale(1.05);
    }

    .cluster-action-btn:active {
        transform: scale(0.95);
    }
}

/* Tablet carousel adjustments */
@media (min-width: 577px) and (max-width: 768px) {
    .recipe-row .recipe-card {
        width: 200px;
        min-height: 280px;
    }

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

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

    .recipe-row .recipe-title {
        font-size: 15px;
    }
}

/* Desktop - minimal carousel enhancements and hide mobile elements */
@media (min-width: 577px) {

    /* Hide mobile carousel elements on desktop */
    .cluster-count,
    .cluster-actions,
    .carousel-dots {
        display: none !important;
    }

    /* Reset cluster title styling for desktop */
    .cluster-title {
        background: none;
        padding: 0 0 8px 0;
        border-radius: 0;
        position: static;
    }
}

@media (min-width: 769px) {
    .recipe-row::-webkit-scrollbar {
        height: 8px;
    }

    .recipe-row::-webkit-scrollbar-track {
        background: var(--bs-gray-100);
        border-radius: 4px;
    }

    .recipe-row::-webkit-scrollbar-thumb {
        background: var(--bs-gray-400);
        border-radius: 4px;
    }

    .recipe-row::-webkit-scrollbar-thumb:hover {
        background: var(--bs-gray-500);
    }
}