/* PlanBouffe - Styles Public (Bento UI) */

:root {
    --primary: #ff7a00;           /* orange vif appétissant */
    --primary-dark: #d85e00;
    --secondary: #1b4332;         /* vert profond feuille */
    --success: #2d6a4f;
    --danger: #d00000;
    --bg: #fff7ed;                /* crème */
    --surface: #ffffff;
    --surface-alt: #fff0da;
    --text: #1f2933;
    --text-light: #52616b;
    --border: #f0d9c2;
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.18);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --gradient: linear-gradient(135deg, #ffe0b2 0%, #ffd6a5 40%, #ffb347 100%);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gradient);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px;
}

.container {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
}

/* Header */
.main-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    box-shadow: var(--shadow);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.main-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.main-header h1 a {
    color: inherit;
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xs);
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary);
    color: white;
}

/* Footer */
.main-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Bottom Nav (mobile style) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 1000;
}

.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    font-size: 0.85rem;
    gap: 0.25rem;
    padding: 0.35rem 0;
}

.bottom-nav__item .icon {
    font-size: 1.2rem;
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }
    body {
        padding-bottom: 0;
    }
}

/* Search & Filters */
.search-section {
    background: var(--surface-alt);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.search-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Recipes Grid (Bento Style) */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.bento-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.clickable-card {
    cursor: pointer;
}

.recipe-card {
    height: 100%;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s, background 0.2s, border-color 0.2s;
}

.recipe-card.recipe-added {
    background: #ecfdf3;
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.recipe-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--bg);
}

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

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

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

.recipe-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.recipe-description {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    flex: 1;
}

.recipe-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.recipe-actions .btn {
    flex: 1 1 140px;
    text-align: center;
}

.recipe-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: var(--bg);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.badge-price {
    background: #fef3c7;
    color: #92400e;
}

.badge-difficulty {
    background: #dbeafe;
    color: #1e40af;
}

.badge-time {
    background: #e5e7eb;
    color: #111827;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-xs);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Recipe Detail */
.recipe-detail-content {
    max-width: 900px;
    margin: 0 auto;
}

.recipe-header {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.recipe-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.recipe-meta-large {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.recipe-meta-large .badge {
    font-size: 1rem;
    padding: 0.5rem 1rem;
}

.recipe-cover {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.recipe-cover img {
    width: 100%;
    height: auto;
    display: block;
}

.recipe-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.gallery-item {
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

.recipe-description-full {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.recipe-description-full p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text);
}

/* Ingredients Section */
.ingredients-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.ingredients-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.ingredients-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.ingredients-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ingredients-list li:last-child {
    border-bottom: none;
}

.ingredient-name {
    font-weight: 500;
    color: var(--text);
}

.ingredient-quantity {
    color: var(--text-light);
    font-size: 0.875rem;
}

.btn-add-to-list {
    width: 100%;
    margin-top: 1rem;
}

/* Steps Section */
.steps-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.steps-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.steps-list {
    list-style: decimal;
    padding-left: 1.5rem;
}

.steps-list li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.8;
}

.steps-list li:last-child {
    border-bottom: none;
}

/* Shopping List */
.shopping-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.shopping-list-header h2 {
    font-size: 2rem;
    color: var(--text);
}

.view-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.view-toggle-wrapper select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface);
}

.shopping-items {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.shopping-item:last-child {
    border-bottom: none;
}

.shopping-item:hover {
    background: var(--bg);
}

.shopping-item:not(.checked) .item-name {
    color: var(--text);
    text-decoration: none;
}

.shopping-item.checked .item-name {
    text-decoration: line-through;
    color: var(--text-light);
}

.shopping-item.is-uncertain .item-name,
.shopping-item.is-uncertain .item-quantity {
    color: #b91c1c;
    font-weight: 600;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.item-name {
    font-weight: 500;
    color: var(--text);
}

.item-quantity {
    color: var(--text-light);
    font-size: 0.875rem;
}

.btn-remove-item {
    background: var(--danger);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: background 0.2s;
}

.btn-remove-item:hover {
    background: #dc2626;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-state p {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}

.modal-overlay.open {
    display: flex;
}

.modal-card {
    background: white;
    color: var(--text);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    padding: 1.75rem;
}

.modal-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    color: var(--text);
}

.modal-card p {
    margin-bottom: 1.25rem;
    color: var(--text-light);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Loading & Error */
.loading,
.error-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.125rem;
}

.error-message {
    color: var(--danger);
    background: #fee2e2;
    border-radius: var(--radius);
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-nav {
        width: 100%;
        justify-content: center;
    }
    
    .recipes-grid {
        grid-template-columns: 1fr;
    }
    
    .recipe-header h1 {
        font-size: 2rem;
    }
    
    .recipe-gallery {
        grid-template-columns: 1fr;
    }
    
    .shopping-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
}

@media (min-width: 1200px) {
    .recipes-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.1rem;
    }
}
