/* --- RECIPE FINDER PAGE --- */
/* Namespaced with rf- to avoid clashing with the dark full-bleed .card
   styles used by the Spirits/Cocktails collection grid. */
.rf-text-button { background: transparent; border: 0; color: #167c43; padding: 0; text-decoration: underline; cursor: pointer; font: inherit; }

/* --- Search card: tabs + panels + refine row --- */
.rf-search-card { background: var(--card-bg); border-radius: var(--card-radius); padding: 32px; box-shadow: 0 10px 30px rgba(0,0,0,0.06); margin-bottom: 32px; }

.rf-tabs { display: flex; gap: 4px; background: #f0f0f0; border-radius: 14px; padding: 4px; margin-bottom: 24px; }
.rf-tab { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 13px 20px; font: 700 13px var(--font-body); letter-spacing: 0.02em; color: var(--text-grey); cursor: pointer; transition: background 0.2s, color 0.2s, box-shadow 0.2s; }
.rf-tab:hover { color: var(--primary); }
.rf-tab.active { background: #fff; color: var(--primary); box-shadow: 0 2px 10px rgba(0,0,0,0.1); }

.rf-tab-intro { color: var(--text-grey); font-size: 13px; margin: 0 0 18px; }

/* Ingredient category dropdowns */
.rf-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.rf-cat { position: relative; }
.rf-cat-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; background: #f7f7f7; border: 1px solid #e5e5e5; border-radius: 10px; padding: 13px 16px; font: 600 13px var(--font-body); color: var(--primary); cursor: pointer; transition: border-color 0.2s, background 0.2s, color 0.2s; }
.rf-cat-btn::after { content: '▾'; color: #999; font-size: 11px; flex-shrink: 0; }
.rf-cat-btn:hover { border-color: var(--accent); }
.rf-cat-btn.has-selection { background: #edf9f1; border-color: var(--accent); color: #167c43; }
.rf-cat-btn.has-selection::after { color: #167c43; }
.rf-cat-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; min-width: 230px; max-width: 290px; max-height: 270px; overflow-y: auto; background: #fff; border: 1px solid #eee; border-radius: 12px; box-shadow: 0 16px 36px rgba(0,0,0,0.16); padding: 10px; }
.rf-cat-option { display: flex; align-items: center; gap: 10px; padding: 9px 8px; font-size: 13px; color: var(--text-dark); border-radius: 8px; cursor: pointer; }
.rf-cat-option:hover { background: #f5f5f5; }
.rf-cat-option input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }

.rf-selected-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 22px; padding-top: 20px; border-top: 1px solid #eee; }
.rf-chips { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 200px; }
.rf-chips .muted { font-size: 13px; }
.rf-chip { background: #edf9f1; color: #167c43; border: 0; border-radius: 20px; font-size: 12px; font-weight: 700; padding: 7px 14px; cursor: pointer; }
.rf-selected-actions { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }

.rf-search-btn { cursor: pointer; min-height: 46px; border: 0; border-radius: 10px; padding: 12px 28px; font: 700 13px var(--font-body); letter-spacing: 0.02em; background: var(--accent); color: #102819; box-shadow: 0 4px 14px var(--accent-glow); transition: transform 0.15s, box-shadow 0.15s, background 0.15s; white-space: nowrap; }
.rf-search-btn:hover { background: #27b863; transform: translateY(-1px); box-shadow: 0 6px 18px var(--accent-glow); }
.rf-search-btn:active { transform: translateY(0); }

/* Free search */
.rf-free-form { display: flex; gap: 8px; background: var(--primary); padding: 8px; border-radius: 100px; align-items: center; box-shadow: 0 10px 24px rgba(0,0,0,0.1); }
.rf-free-form input { flex: 1; border: 0; border-radius: 50px; height: 48px; padding: 0 20px; font: inherit; font-size: 14px; background: #fff; outline: none; min-width: 0; }
.rf-free-form input:focus-visible { box-shadow: 0 0 0 3px var(--accent-glow); }
.rf-free-form .rf-search-btn { border-radius: 50px; height: 48px; box-shadow: none; }

/* AI concierge */
.rf-concierge-answer { margin-top: 16px; padding: 16px 18px; border-radius: 14px; font-size: 14px; line-height: 1.6; }
.rf-concierge-answer:empty { display: none; }
.rf-concierge-answer.is-loading { background: #f3f4f6; color: var(--text-grey); }
.rf-concierge-answer.is-answer { background: var(--accent-glow); color: var(--primary); border: 1px solid var(--accent); }
.rf-concierge-answer.is-error { background: var(--danger-bg); color: var(--danger); }
#rfConciergeResults.grid:empty { display: none; margin-top: 0; }
#rfConciergeResults.grid { margin-top: 18px; }
.rf-feedback { font-size: 12px; color: var(--text-grey); margin: 12px 2px 0; min-height: 1em; }

/* Refine row: drink type / servings / units */
.rf-refine { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-top: 24px; padding-top: 22px; border-top: 1px solid #eee; }
.rf-refine[hidden] { display: none; }
.rf-refine label { font-weight: 600; font-size: 12px; color: var(--primary); }
.rf-refine input, .rf-refine select { display: block; width: 100%; font: inherit; font-size: 14px; min-height: 44px; border: 1px solid #ccc; border-radius: 9px; padding: 10px; background: #fff; margin-top: 6px; }

.rf-results-section { margin-top: 8px; }
.rf-results-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.rf-meta { color: var(--text-grey); font-size: 13px; margin: 0 0 16px; }
.rf-empty { padding: 24px; border: 1px dashed #b9b9b9; border-radius: 16px; color: var(--text-grey); }
.rf-result-section { margin-bottom: 30px; }
.rf-result-section h2 { font-family: var(--font-display); font-size: 26px; margin: 0 0 16px; color: var(--primary); }

.rf-photo-caption { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.7); color: #fff; padding: 7px 10px; font-size: 10px; line-height: 1.4; }

/* Recipe detail dialog — same visual language as the product detail modal
   (modals.css: .product-detail-modal / .modal-body / .detail-*), but as a
   native <dialog> so Escape-to-close and focus handling stay browser-native. */
#recipeDialog { padding: 0; border: 0; border-radius: var(--card-radius); background: white; box-shadow: 0 25px 50px rgba(0,0,0,0.3); width: 90%; max-width: 900px; height: 80vh; overflow: hidden; color: var(--text-dark); }
#recipeDialog[open] { display: flex; }
#recipeDialog::backdrop { background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); }
#recipeDialog .detail-section ol { padding-left: 20px; margin: 0; }
#recipeDialog .detail-section ol li { margin-bottom: 12px; font-size: 0.95rem; line-height: 1.5; color: var(--text-grey); }
.rf-missing { color: #9c4b10; }

@media (max-width: 768px) {
    #recipeDialog { width: 100%; height: 100%; max-width: 100%; border-radius: 0; }
}

.rf-ingredient-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 10px; }
.rf-ingredient-row input, .rf-ingredient-row select { min-height: 40px; }
.rf-ingredient-row button { border: 0; border-radius: 8px; background: #eee; cursor: pointer; padding: 0 12px; }

.rf-admin-bar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.rf-add-recipe-btn { background: var(--primary); color: #fff; border: 0; border-radius: 10px; padding: 12px 20px; font-weight: 700; cursor: pointer; font-family: var(--font-body); }

.rf-results-toolbar { gap: 10px; }

/* --- Ratings (lightweight, no login) --- */
.rf-rating-avg { font-size: 13px; color: var(--text-grey); margin-bottom: 8px; }
.rf-rating-stars { display: flex; gap: 4px; }
.rf-star-btn { background: transparent; border: 0; font-size: 26px; line-height: 1; color: #d8d8d4; cursor: pointer; padding: 2px; transition: color 0.15s, transform 0.1s; }
.rf-star-btn:hover { color: #f5b301; transform: scale(1.15); }
.rf-rating-thanks { font-size: 13px; color: #167c43; font-weight: 700; margin: 0; }

/* --- Similar recipes --- */
.rf-similar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.rf-similar-card { border: 0; background: #f7f7f7; border-radius: 12px; padding: 8px; cursor: pointer; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; transition: background 0.15s; }
.rf-similar-card:hover { background: #edf9f1; }
.rf-similar-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.rf-similar-card span { font-size: 12px; font-weight: 600; color: var(--primary); line-height: 1.3; }

/* --- Shopping list --- */
.rf-shopping-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; }
#shoppingListDialog { padding: 0; border: 0; border-radius: var(--card-radius); background: white; box-shadow: 0 25px 50px rgba(0,0,0,0.3); width: 92%; max-width: 420px; max-height: 80vh; overflow: hidden; color: var(--text-dark); }
#shoppingListDialog[open] { display: flex; }
#shoppingListDialog::backdrop { background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); }
.rf-shopping-modal { padding: 28px; overflow-y: auto; width: 100%; display: flex; flex-direction: column; box-sizing: border-box; }

.rf-shopping-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.rf-shopping-header h2 { font-family: var(--font-display); margin: 0; color: var(--primary); font-size: 1.35rem; line-height: 1.3; }
.rf-shopping-close { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; border: 0; background: #f2f2ef; color: var(--text-grey); font-size: 1.25rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s; }
.rf-shopping-close:hover { background: #e7e7e2; color: var(--text-dark); }

.rf-shopping-items { list-style: none; margin: 0; padding: 0; }
.rf-shopping-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid #eee; font-size: 14px; color: var(--text-dark); }
.rf-shopping-item:first-child { border-top: 0; }
.rf-shopping-item::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.rf-shopping-item span { flex: 1; }
.rf-shopping-remove { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--danger-bg); color: var(--danger); font-size: 14px; line-height: 1; cursor: pointer; transition: background 0.15s, color 0.15s; }
.rf-shopping-remove:hover { background: var(--danger); color: #fff; }

.rf-shopping-actions { display: flex; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #eee; }
.rf-shopping-action-btn { flex: 1; cursor: pointer; border: 1px solid #ddd; background: #fff; border-radius: 9px; padding: 11px 10px; font: 700 12px var(--font-body); color: var(--primary); transition: border-color 0.15s, background 0.15s; white-space: nowrap; }
.rf-shopping-action-btn:hover { border-color: var(--accent); background: var(--accent-glow); }
.rf-shopping-action-danger { color: var(--danger); }
.rf-shopping-action-danger:hover { border-color: var(--danger); background: var(--danger-bg); }

@media (max-width: 480px) {
    .rf-shopping-modal { padding: 22px; }
}

@media (max-width: 850px) {
    .rf-refine { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
    .rf-search-card { padding: 20px; }
    .rf-cat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .rf-cat-panel { left: auto; right: 0; }
    .rf-refine { grid-template-columns: 1fr; gap: 12px; }
    .rf-ingredient-row { grid-template-columns: 1fr 1fr; }
    .rf-ingredient-row input:first-child { grid-column: 1/-1; }
    .rf-tab { font-size: 12px; padding: 12px 10px; }
    .rf-selected-row { flex-direction: column; align-items: stretch; }
    .rf-selected-actions { justify-content: space-between; }
    .rf-search-btn { flex: 1; }
}
