/* --- 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; }
.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 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-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-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.rf-card { background: var(--card-bg); border-radius: var(--card-radius); padding: 26px; box-shadow: 0 5px 20px rgba(0,0,0,0.04); display: flex; flex-direction: column; align-items: flex-start; transition: transform 0.2s, box-shadow 0.2s; }
.rf-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0,0,0,0.1); }
.rf-card p { font-size: 13px; color: var(--text-grey); }
.rf-card button { margin-top: auto; cursor: pointer; min-height: 40px; border: 0; border-radius: 8px; padding: 10px 16px; font: 600 13px var(--font-body); background: var(--primary); color: #fff; }
.rf-tag { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #167c43; text-transform: uppercase; }
.rf-card h3 { font-family: var(--font-display); font-size: 22px; margin: 6px 0; color: var(--primary); }

.rf-serving-image { position: relative; overflow: hidden; width: 100%; aspect-ratio: 1.25; border-radius: 16px; margin-bottom: 18px; background: #171717; }
.rf-serving-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rf-serving-image.rf-card-image img { position: absolute; width: 154%; height: auto; max-width: none; left: -27%; top: -36%; }
.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; }

#recipeDialog { padding: 0; border: 0; border-radius: var(--card-radius); width: calc(100% - 32px); max-width: 800px; max-height: 90vh; color: var(--text-dark); }
#recipeDialog::backdrop { background: rgba(0,0,0,0.6); }
.rf-dialog-head { padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid #ddd; }
.rf-dialog-head h2 { font-family: var(--font-display); color: #167c43; margin: 0; font-size: 28px; }
.rf-dialog-head button { background: #eee; font-size: 24px; border: 0; border-radius: 8px; width: 40px; height: 40px; cursor: pointer; }
.rf-dialog-body { display: grid; grid-template-columns: 280px 1fr; }
.rf-dialog-body section { padding: 24px; }
.rf-dialog-body .rf-ingredients-col { background: #eee; }
.rf-dialog-body ul { list-style: none; padding: 0; margin: 0; }
.rf-dialog-body li { padding: 10px 0; border-bottom: 1px solid #d4d4d4; font-size: 13px; }
.rf-missing { color: #9c4b10; }
.rf-dialog-body ol { padding-left: 20px; margin: 0; }
.rf-dialog-body ol li { margin-bottom: 12px; font-size: 14px; border: 0; padding: 0; }
#rfDetailImage { padding: 24px 24px 0; }
#rfDetailImage:empty { display: none; }
#rfDetailImage .rf-serving-image { max-width: 560px; margin: 0 auto; }

.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); }

@media (max-width: 850px) {
    .rf-dialog-body { grid-template-columns: 1fr; }
    .rf-refine { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
    .rf-search-card, .rf-card { padding: 20px; }
    .rf-cards { grid-template-columns: 1fr; }
    .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; }
}
