:root {
    --font-main: 'Montserrat', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

/* Header Styling */
.recipe-explorer-header {
    padding: 140px 5% 60px;
    background: var(--bg);
    text-align: center;
}

.explorer-title {
    font-family: var(--font-logo);
    font-size: clamp(2.5rem, 8vw, 5rem);
    letter-spacing: -3px;
    line-height: 0.9;
    margin-bottom: 30px;
}

.search-container-premium {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.search-input-lg {
    width: 100%;
    padding: 25px 35px;
    padding-left: 70px;
    border-radius: 100px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    background: var(--bg-variant);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 1.1rem;
    transition: all 0.4s ease;
}

.search-input-lg:focus { outline: none; border-color: var(--accent); }
.search-icon-lg { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; color: var(--accent); }

/* Explorer Layout */
.explorer-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    padding: 0 5% 100px;
}

.filter-group { margin-bottom: 40px; }
.filter-label {
    font-family: var(--font-logo);
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 20px;
    color: var(--accent);
}

.filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.7;
}

.filter-option input { margin-right: 12px; accent-color: var(--accent); }

/* Grid */
.recipe-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

@media (max-width: 992px) {
    .explorer-container { grid-template-columns: 1fr; }
    .filter-sidebar { display: none; }
}
/* --- Main Ingredients Category Section --- */
.ingredients-filter-wrapper {
    max-width: 900px;
    margin: 40px auto 20px;
    padding: 0 20px;
    text-align: center;
}

.ingredients-scroll {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.ingredient-chip {
    padding: 12px 24px;
    background: var(--card);
    border: 1px solid rgba(157, 124, 93, 0.2);
    border-radius: 100px;
    color: var(--text);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--easing);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ingredient-chip i {
    color: var(--accent);
    font-size: 1rem;
}

.ingredient-chip:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    background: rgba(157, 124, 93, 0.05);
}

.ingredient-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(157, 124, 93, 0.3);
}

.ingredient-chip.active i {
    color: #fff;
}

@media (max-width: 768px) {
    .ingredients-scroll {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 15px;
        -webkit-overflow-scrolling: touch;
    }
    .ingredient-chip {
        white-space: nowrap;
    }
}
/* --- Corrected Search & AI Icon Positioning --- */
.search-container-premium {
    max-width: 800px; /* This keeps it from getting TOO wide on desktop */
    width: 100%;      /* This ensures it tries to fill the 800px */
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-lg {
    flex-grow: 1;
    width: 100%;
    padding: 22px 85px 22px 65px;
    border-radius: 100px;
    /* Use the variable instead of the hardcoded hex code */
    background: var(--input-base); 
    /* Use the text variable so it turns dark in light mode */
    color: var(--text); 
    border: 1px solid rgba(157, 124, 93, 0.3);
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    outline: none;
    transition: all 0.5s var(--easing); /* Keeps the transition smooth */
}

/* Optional: Add a subtle shadow in light mode for better depth */
[data-theme="light"] .search-input-lg {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.search-icon-lg {
    position: absolute;
    left: 25px;
    color: var(--accent);
    font-size: 1.2rem;
    pointer-events: none;
}

.camera-search-btn {
    position: absolute;
    right: 20px; /* Moves it inside the right edge */
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.ai-camera-wrapper {
    position: relative;
    color: var(--muted);
    font-size: 1.4rem;
    transition: all 0.3s ease;
}

.ai-badge-mini {
    position: absolute;
    top: -5px;
    right: -10px;
    background: var(--accent);
    color: white;
    font-family: 'League Spartan', sans-serif;
    font-size: 0.5rem;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 800;
}

.camera-search-btn:hover .ai-camera-wrapper {
    color: var(--accent);
    transform: scale(1.1);
}

/* 1. Ensure the grid stays consistent */
.recipe-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 2. Fixed height for the card link wrapper */
.recipe-card-link { 
    text-decoration: none; 
    color: inherit; 
    display: flex; /* Ensures the card fills the link height */
}

/* 3. Make the card itself flexible but with a minimum/fixed feel */
.recipe-card-secondary {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* background: #fff; */
    border-radius: 12px;
    overflow: hidden;
    /* border: 1px solid #eee; */
    transition: 0.3s;
}

/* 4. Fixed height for the image area */
.card-img-wrapper {
    height: 200px;
    overflow: hidden;
    position: relative;
}
.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 5. Uniform Padding and Body spacing */
.card-body-custom {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Pushes the footer to the bottom */
}

.card-body-custom h5 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    height: 2.4em; /* Allows for 2 lines of title */
    overflow: hidden;
}

/* 6. CLAMPING THE DESCRIPTION */
.card-body-custom p {
    font-size: 0.9rem;
    color: #666;
    margin: 10px 0;
    /* This hides text after 2 lines and adds "..." */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em; /* Keeps the space consistent */
}

.card-footer-custom {
    margin-top: auto; /* Always sticks footer to the bottom of the card */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    /* border-top: 1px solid #f9f9f9; */
}

.difficulty-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    backdrop-filter: blur(4px);
    z-index: 2;
}
/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .explorer-container {
        display: flex;
        flex-direction: column; /* Stack sidebar on top of content */
    }

    .filter-sidebar {
        width: 100%;
        margin-bottom: 20px;
        padding: 10px;
        background: #fdfdfd;
        border-radius: 12px;
        border: 1px solid #eee;
    }

    .filter-group {
        display: flex;
        flex-wrap: wrap; /* Allow categories to wrap to the next line */
        gap: 10px;
        align-items: center;
    }

    .filter-label {
        width: 100%; /* Keeps the "Categories" label on its own line */
        margin-bottom: 8px;
        font-weight: bold;
    }

    .filter-option {
        background: #fff;
        padding: 6px 12px;
        border-radius: 20px;
        border: 1px solid #ddd;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        cursor: pointer;
    }

    .filter-option input {
        margin-right: 6px;
    }

    .recipe-list-grid {
        grid-template-columns: 1fr; /* Single column for very small screens */
    }
}
/* --- RESTRICTION MODAL STYLING --- */
.ai-modal {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
}

.ai-modal-content {
    background-color: #1a1a1a;
    margin: 12% auto;
    padding: 40px 30px;
    border: 1px solid rgba(212, 163, 115, 0.3);
    width: 90%;
    max-width: 420px;
    border-radius: 20px;
    text-align: center;
    color: white;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.ai-modal-icon {
    font-size: 3.5rem;
    color: #d4a373;
    margin-bottom: 20px;
    text-shadow: 0 0 15px rgba(212, 163, 115, 0.3);
}

.modal-action-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.ai-modal-btn {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
}

.btn-login { background: #d4a373; color: #fff; }
.btn-register { background: transparent; color: #d4a373; border: 1px solid #d4a373; }

.ai-modal-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(212, 163, 115, 0.2); }

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #555;
}

/* --- CHIPS & CARDS STYLING --- */
.ingredients-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: none;
}
.ingredients-scroll::-webkit-scrollbar { display: none; }

.ingredient-chip {
    padding: 8px 18px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(157, 124, 93, 0.2);
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ingredient-chip.active {
    background: #d4a373;
    color: #fff;
    border-color: #d4a373;
}

.ingredient-chip.active span::before {
    content: '✓ ';
    font-weight: bold;
}

.recipe-card-secondary {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.3s;
}
.recipe-card-link:hover .recipe-card-secondary { transform: translateY(-5px); }