:root {
    --bg-color: #fdfbf7;
    --surface-color: #ffffff;
    --text-primary: #2d312e;
    --text-secondary: #747d76;
    --primary-color: #d9534f;
    --accent-color: #e2a65a;
    --border-color: #ebebeb;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
.fw-light { font-weight: 300; }
.fw-bold { font-weight: 600; }

h1, h2, h3 {
    color: var(--text-primary);
    font-weight: 600;
}

/* Navigation */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(253, 251, 247, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.logo {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    color: var(--primary-color);
}

.search-container {
    flex: 0 1 500px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    background: var(--surface-color);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.1);
}

.search-suggestions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.search-suggestions::-webkit-scrollbar {
    display: none;
}

.suggestion-tag {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.suggestion-tag:hover, .suggestion-tag.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nav-actions {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: var(--transition);
    position: relative;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.03);
}

.nav-btn.active {
    color: var(--primary-color);
    background: rgba(217, 83, 79, 0.08);
}

#prepBadge {
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(30%, -30%);
    font-weight: bold;
}

/* Views */
.view {
    display: none;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
}

.view.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.recipe-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid var(--border-color);
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.recipe-img-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.recipe-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.recipe-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.recipe-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.recipe-title {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.recipe-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.type-tag {
    font-size: 0.7rem;
    background: #f0f0f0;
    color: var(--text-secondary);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
}

.recipe-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
}

.recipe-ingredients-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.add-prep-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    transition: var(--transition);
    z-index: 10;
}

.add-prep-btn:hover {
    background: white;
    transform: scale(1.1);
}

.add-prep-btn.added {
    background: var(--primary-color);
    color: white;
}

/* Meal Prep */
.meal-prep-container {
    max-width: 1000px;
    margin: 0 auto;
}

.meal-prep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--surface-color);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.servings-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.number-input {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.number-input button {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.number-input button:hover {
    background: rgba(0,0,0,0.05);
}

.number-input input {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    -moz-appearance: textfield;
}
.number-input input::-webkit-outer-spin-button,
.number-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.prep-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.prep-recipes, .prep-shopping-list {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.prep-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.prep-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.prep-item img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.prep-item-info h4 {
    margin-bottom: 0.2rem;
}

.prep-item-remove {
    margin-left: auto;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    transition: var(--transition);
}

.prep-item-remove:hover {
    color: var(--primary-color);
}

.shopping-list-content {
    margin-top: 1.5rem;
}

.shopping-category {
    margin-bottom: 1.5rem;
}

.shopping-category h4 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.shopping-list-content ul {
    list-style: none;
}

.shopping-list-content li {
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    overflow-y: auto;
    z-index: 201;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-lg);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.close-modal:hover {
    background: white;
    transform: scale(1.1);
}

.recipe-detail-img {
    width: 100%;
    height: 350px;
    object-fit: cover;
}

.recipe-detail-body {
    padding: 2.5rem;
}

.recipe-detail-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.recipe-detail-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.recipe-detail-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
}

@media (max-width: 768px) {
    .recipe-detail-grid {
        grid-template-columns: 1fr;
    }
    .prep-layout {
        grid-template-columns: 1fr;
    }
    nav {
        flex-wrap: wrap;
        gap: 1rem;
    }
    .search-bar {
        order: 3;
        flex: 1 1 100%;
    }
}

.detail-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    display: inline-block;
}

.ingredients-list {
    list-style: none;
}

.ingredients-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.instructions-list {
    list-style: none;
    counter-reset: inst-counter;
}

.instructions-list li {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.instructions-list li::before {
    counter-increment: inst-counter;
    content: counter(inst-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Add Recipe Form Styles */
.modal-header {
    padding: 2.5rem 2.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

#addRecipeForm {
    padding: 2rem 2.5rem 2.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 195, 74, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: var(--transition);
    margin-top: 1rem;
}

.submit-btn:hover {
    background: #7cb342;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-btn.icon-only {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 600px) {
    }
}

/* Modal Print & Scaler Styles */
.modal-print-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2.5rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 20;
}

.modal-servings-adjust {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.modal-servings-adjust input {
    width: 60px;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.modal-btns {
    display: flex;
    gap: 0.8rem;
}

.delete-btn {
    background: transparent;
    color: #ff5252;
    border: 1px solid #ff5252;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.delete-btn:hover {
    background: #ff5252;
    color: white;
}

.print-btn {
    background: var(--text-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.print-btn:hover {
    background: black;
    transform: translateY(-1px);
}

/* PRINT STYLES */
@media print {
    .no-print, nav, .search-container, .nav-actions, .close-modal, .add-prep-btn {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        overflow: visible !important;
    }

    .modal {
        position: absolute !important;
        display: block !important;
        opacity: 1 !important;
        background: white !important;
    }

    .modal-overlay {
        display: none !important;
    }

    .modal-content {
        position: relative !important;
        width: 100% !important;
        max-width: none !important;
        max-height: none !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        transform: none !important;
    }

    .recipe-detail-img {
        height: 300px !important;
        border-radius: 0 !important;
    }

    .recipe-detail-body {
        padding: 1.5rem !important;
    }

    .recipe-detail-header h2 {
        font-size: 2.5rem !important;
        color: black !important;
    }

    .recipe-detail-grid {
        display: block !important;
    }

    .detail-section {
        margin-bottom: 2rem !important;
        break-inside: avoid;
    }

    .ingredients-list li, .instructions-list li {
        color: black !important;
    }
}
