/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;600;700&display=swap');

:root {
    --bg-color: #F5F5F7;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --card-bg: #FFFFFF;
    --accent-color: #0071E3;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
    /* Colors derived from Hues */
    --color-saturation: 85%;
    --color-lightness: 95%;
    /* Very light background for cards */
    --active-lightness: 50%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Poppins', sans-serif;
}

/* === Discovery Hub (Bento Grid) === */
.discovery-hub {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.filters-primary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (min-width: 768px) {
    .filters-primary {
        grid-template-columns: repeat(5, 1fr);
        gap: 24px;
    }
}

.filters-secondary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (min-width: 768px) {
    .filters-secondary {
        gap: 24px;
    }
}

.bento-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 120px;
    user-select: none;
}

.bento-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.bento-card:active {
    transform: scale(0.96);
}

/* Category Specifics */
.category-card {
    /* Use CSS variable --hue to determine color */
    background: hsl(var(--hue), var(--color-saturation), var(--color-lightness));
    color: hsl(var(--hue), 60%, 20%);
}

.category-card.active {
    background: hsl(var(--hue), 70%, 50%);
    color: white;
    box-shadow: 0 10px 25px -5px hsla(var(--hue), 70%, 50%, 0.4);
}

.cat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.cat-name {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

/* Search Card Specifics */
.search-card {
    width: 100%;
    background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 99%, #FECFEF 100%);
    /* Placeholder Gradient */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* Trendy Deep Purple/Blue */
    align-items: flex-start;
    /* Align text left */
    text-align: left;
    min-height: 180px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.search-container {
    display: flex;
    gap: 16px;
    align-items: center;
}

@media (max-width: 767px) {
    .search-container {
        flex-direction: column;
        align-items: stretch;
    }
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-input {
    width: 100%;
    border-radius: 50px;
    border: none;
    padding: 12px 20px 12px 45px;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.btn-generate {
    background: #FFD166;
    /* Vibrant Yellow/Orange */
    color: #333;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    min-width: 160px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    background: #ffdb85;
}

.btn-generate .btn-icon {
    font-size: 1.2rem;
}

.search-input:focus {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: #fff;
    outline: none;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    pointer-events: none;
}

/* === Recipe Grid === */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    animation: fadeIn 0.6s ease-out;
}

.recipe-card {
    position: relative;
    aspect-ratio: 4/5;
    /* Uniform sizing */
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: all 0.4s ease;
    background-color: #ddd;
    /* Loading placeholder */
}

.recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.recipe-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.8s ease;
}

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

.recipe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.8) 100%);
}

.recipe-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    color: white;
    z-index: 2;
}

.recipe-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.recipe-meta {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.verified-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #fff;
    color: #198754;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* === Details View === */
.details-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    position: relative;
    animation: slideUp 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.details-img-container {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    height: 100%;
    min-height: 400px;
    /* Ensure visual weight */
}

.details-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.step-number {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--accent-color);
    min-width: 40px;
}

.border-bottom-dashed {
    border-bottom: 1px dashed #e0e0e0 !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    .main-container {
        padding: 1rem;
    }

    .bento-card {
        padding: 1rem;
    }

    .cat-icon {
        font-size: 1.5rem;
    }

    .discovery-hub {
        gap: 12px;
    }
}