/* ============================================
   RECETTE PLUGIN — CSS Mobile-First
   ============================================ */

:root {
    --r-orange: #e07b39;
    --r-orange-dark: #c4632a;
    --r-orange-light: #fdf0e6;
    --r-cream: #fef9f4;
    --r-text: #1a1a1a;
    --r-text-muted: #6b6b6b;
    --r-border: #e8e0d8;
    --r-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --r-shadow-hover: 0 8px 24px rgba(0,0,0,0.14);
    --r-radius: 16px;
    --r-radius-sm: 10px;
    --r-font: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --r-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ── */
.recette-app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--r-cream);
    font-family: var(--r-font);
    position: relative;
    -webkit-font-smoothing: antialiased;
}

.recette-vue {
    padding-bottom: 40px;
}

/* ── Header ── */
.recette-header {
    background: #fff;
    border-bottom: 1px solid var(--r-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.recette-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    gap: 12px;
}

.recette-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.recette-logo-icon { font-size: 22px; }

.recette-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--r-text);
    letter-spacing: -0.3px;
}

.recette-back-btn,
.recette-filter-toggle {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--r-orange-light);
    color: var(--r-orange);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--r-transition);
    position: relative;
}

.recette-back-btn:hover,
.recette-filter-toggle:hover {
    background: var(--r-orange);
    color: #fff;
    transform: scale(1.05);
}

.recette-filter-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--r-orange);
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ── Search Bar ── */
.recette-search-bar {
    padding: 16px;
    background: #fff;
}

.recette-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.recette-search-icon {
    position: absolute;
    left: 14px;
    color: var(--r-text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.recette-input {
    width: 100%;
    padding: 13px 40px 13px 44px;
    border: 2px solid var(--r-border);
    border-radius: 50px;
    font-size: 15px;
    font-family: var(--r-font);
    background: var(--r-cream);
    color: var(--r-text);
    transition: border-color var(--r-transition), box-shadow var(--r-transition);
    box-sizing: border-box;
    outline: none;
}

.recette-input:focus {
    border-color: var(--r-orange);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(224,123,57,0.15);
}

.recette-input::placeholder { color: #aaa; }

.recette-clear-btn {
    position: absolute;
    right: 12px;
    background: #ddd;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background var(--r-transition);
}

.recette-clear-btn:hover { background: #bbb; color: #333; }

/* ── Moment Chips ── */
.recette-moment-chips {
    display: flex;
    gap: 8px;
    padding: 0 16px 14px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: #fff;
}

.recette-moment-chips::-webkit-scrollbar { display: none; }

.recette-chip {
    white-space: nowrap;
    padding: 7px 16px;
    border-radius: 50px;
    border: 2px solid var(--r-border);
    background: #fff;
    color: var(--r-text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--r-transition);
    font-family: var(--r-font);
}

.recette-chip:hover {
    border-color: var(--r-orange);
    color: var(--r-orange);
}

.recette-chip.active {
    background: var(--r-orange);
    border-color: var(--r-orange);
    color: #fff;
    font-weight: 600;
}

/* ── Filters Panel ── */
.recette-filters-panel {
    display: none;
    background: #fff;
    border-bottom: 1px solid var(--r-border);
    padding: 16px;
    animation: slideDown 0.25s ease;
}

.recette-filters-panel.open { display: block; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.recette-filters-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.recette-filter-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--r-text-muted);
    margin-bottom: 6px;
}

.recette-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--r-border);
    border-radius: var(--r-radius-sm);
    font-size: 14px;
    font-family: var(--r-font);
    background: var(--r-cream);
    color: var(--r-text);
    outline: none;
    cursor: pointer;
    transition: border-color var(--r-transition);
}

.recette-select:focus { border-color: var(--r-orange); }

.recette-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recette-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--r-text);
}

.recette-toggle input { display: none; }

.recette-toggle-track {
    width: 44px;
    height: 24px;
    background: #ddd;
    border-radius: 50px;
    position: relative;
    transition: background var(--r-transition);
    flex-shrink: 0;
}

.recette-toggle-track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform var(--r-transition);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.recette-toggle input:checked ~ .recette-toggle-track {
    background: var(--r-orange);
}

.recette-toggle input:checked ~ .recette-toggle-track::after {
    transform: translateX(20px);
}

.recette-reset-btn {
    margin-top: 14px;
    width: 100%;
    padding: 10px;
    border: 2px solid var(--r-border);
    border-radius: var(--r-radius-sm);
    background: transparent;
    color: var(--r-text-muted);
    font-size: 13px;
    font-family: var(--r-font);
    cursor: pointer;
    transition: all var(--r-transition);
}

.recette-reset-btn:hover {
    border-color: var(--r-orange);
    color: var(--r-orange);
}

/* ── Results Info ── */
.recette-results-info {
    padding: 12px 16px 4px;
    font-size: 13px;
    color: var(--r-text-muted);
}

/* ── Recipe Grid ── */
.recette-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px 16px;
}

/* ── Recipe Card ── */
.recette-card {
    background: #fff;
    border-radius: var(--r-radius);
    overflow: hidden;
    box-shadow: var(--r-shadow);
    cursor: pointer;
    transition: all var(--r-transition);
    border: 1px solid rgba(0,0,0,0.04);
    position: relative;
}

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

.recette-card:active {
    transform: scale(0.97);
}

.recette-card-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, #f0e6d8 0%, #e8d5c0 100%);
}

.recette-card-img-placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, #fdf0e6 0%, #fae0c8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

.recette-card-body {
    padding: 10px 12px 12px;
}

.recette-card-moment {
    font-size: 11px;
    color: var(--r-orange);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.recette-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--r-text);
    line-height: 1.3;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recette-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.recette-meta-item {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--r-text-muted);
}

.recette-card-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.recette-badge {
    padding: 2px 7px;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 600;
}

.recette-badge-diff {
    background: var(--r-orange-light);
    color: var(--r-orange-dark);
}

.recette-badge-veg {
    background: #e8f5e9;
    color: #2e7d32;
}

.recette-badge-sg {
    background: #fff8e1;
    color: #f57f17;
}

/* ── Loading & Empty ── */
.recette-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 0;
    color: var(--r-text-muted);
    font-size: 14px;
}

.recette-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--r-border);
    border-top-color: var(--r-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.recette-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--r-text-muted);
}

.recette-empty-icon { font-size: 48px; margin-bottom: 12px; }

.recette-empty h3 {
    font-size: 16px;
    color: var(--r-text);
    margin-bottom: 6px;
}

/* ── Pagination ── */
.recette-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 16px;
    flex-wrap: wrap;
}

.recette-page-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--r-border);
    background: #fff;
    color: var(--r-text);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--r-transition);
    font-family: var(--r-font);
    font-weight: 600;
}

.recette-page-btn.active {
    background: var(--r-orange);
    border-color: var(--r-orange);
    color: #fff;
}

.recette-page-btn:hover:not(.active) {
    border-color: var(--r-orange);
    color: var(--r-orange);
}

/* ── Detail View ── */
.recette-detail {
    background: #fff;
    min-height: 100vh;
}

.recette-detail-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: linear-gradient(135deg, #fdf0e6, #fae0c8);
}

.recette-detail-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recette-detail-hero-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
}

.recette-detail-body {
    padding: 20px 16px 40px;
}

.recette-detail-moment {
    display: inline-block;
    padding: 4px 14px;
    background: var(--r-orange-light);
    color: var(--r-orange);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.recette-detail-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--r-text);
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

.recette-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.recette-stat-card {
    background: var(--r-cream);
    border-radius: var(--r-radius-sm);
    padding: 14px 10px;
    text-align: center;
    border: 1px solid var(--r-border);
}

.recette-stat-icon { font-size: 20px; margin-bottom: 4px; }

.recette-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--r-text);
    display: block;
}

.recette-stat-label {
    font-size: 11px;
    color: var(--r-text-muted);
}

.recette-detail-section {
    margin-bottom: 24px;
}

.recette-detail-section h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--r-text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--r-border);
}

.recette-ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recette-ingredients-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--r-text);
    padding: 8px 12px;
    background: var(--r-cream);
    border-radius: var(--r-radius-sm);
    border-left: 3px solid var(--r-orange);
}

.recette-ingredients-list li::before {
    content: '•';
    color: var(--r-orange);
    font-weight: 700;
    font-size: 16px;
}

.recette-etapes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    counter-reset: etapes;
}

.recette-etapes-list li {
    display: flex;
    gap: 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--r-text);
    counter-increment: etapes;
}

.recette-etape-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--r-orange);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}

.recette-detail-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ── Animations ── */
.recette-card {
    animation: fadeUp 0.3s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Desktop adaptation ── */
@media (min-width: 600px) {
    .recette-app {
        max-width: 960px;
        border-radius: 20px;
        margin: 20px auto;
        overflow: hidden;
        box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    }

    .recette-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .recette-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ── Bouton Ajouter ── */
.recette-add-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--r-orange);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: all var(--r-transition);
}
.recette-add-btn:hover {
    background: var(--r-orange-dark);
    transform: scale(1.08);
}

/* ── Actions détail (modifier / supprimer) ── */
.recette-detail-actions {
    display: flex;
    gap: 10px;
    padding: 16px 16px 0;
    margin-bottom: -4px;
}
.recette-btn-edit {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--r-orange);
    border-radius: 50px;
    background: #fff;
    color: var(--r-orange);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--r-font);
    cursor: pointer;
    transition: all var(--r-transition);
}
.recette-btn-edit:hover {
    background: var(--r-orange);
    color: #fff;
}
.recette-btn-delete {
    padding: 12px 18px;
    border: 2px solid #ffcdd2;
    border-radius: 50px;
    background: #fff;
    color: #e53935;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--r-font);
    cursor: pointer;
    transition: all var(--r-transition);
}
.recette-btn-delete:hover {
    background: #e53935;
    color: #fff;
    border-color: #e53935;
}

/* ── Formulaire d'édition inline ── */
.recette-edit-form {
    padding: 16px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.recette-edit-form .recette-form-group { margin-bottom: 0; }
.recette-edit-form .recette-form-label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #444;
    margin-bottom: 8px;
}
.recette-edit-form .recette-input,
.recette-edit-form .recette-textarea {
    width: 100%;
    box-sizing: border-box;
}
.recette-edit-form .recette-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--r-border);
    border-radius: 12px;
    font-size: 14px;
    font-family: var(--r-font);
    resize: vertical;
    background: var(--r-cream);
    transition: border-color .2s;
    outline: none;
    box-sizing: border-box;
}
.recette-edit-form .recette-textarea:focus {
    border-color: var(--r-orange);
    background: #fff;
}
.recette-edit-form .recette-moment-chips {
    padding: 0;
    background: transparent;
    flex-wrap: wrap;
}
.recette-btn-save {
    width: 100%;
    padding: 14px;
    background: var(--r-orange);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--r-font);
    cursor: pointer;
    transition: all var(--r-transition);
}
.recette-btn-save:hover { background: var(--r-orange-dark); }
.recette-btn-cancel-edit {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: var(--r-text-muted);
    border: 2px solid var(--r-border);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--r-font);
    cursor: pointer;
    transition: all var(--r-transition);
}
.recette-btn-cancel-edit:hover {
    border-color: #999;
    color: var(--r-text);
}

/* ── Confirmation suppression ── */
.recette-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.recette-confirm-box {
    background: #fff;
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.recette-confirm-box h3 { font-size: 18px; margin-bottom: 8px; }
.recette-confirm-box p  { color: var(--r-text-muted); font-size: 14px; margin-bottom: 20px; }
.recette-confirm-btns   { display: flex; gap: 10px; }
.recette-confirm-btns button { flex: 1; padding: 12px; border-radius: 50px; font-size: 14px; font-weight: 700; font-family: var(--r-font); cursor: pointer; border: 2px solid; transition: all .2s; }
.recette-confirm-cancel { background: #fff; border-color: var(--r-border); color: var(--r-text-muted); }
.recette-confirm-cancel:hover { border-color: #999; }
.recette-confirm-ok     { background: #e53935; border-color: #e53935; color: #fff; }
.recette-confirm-ok:hover { background: #c62828; border-color: #c62828; }

/* ── Header actions (+ et logout) ── */
.recette-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.recette-logout-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f5f5f5;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all var(--r-transition);
    flex-shrink: 0;
}
.recette-logout-btn:hover {
    background: #ffebee;
    color: #e53935;
    transform: scale(1.05);
}
