/* Copyright (c) 2026 Ashley Bayliss. All rights reserved. */
/* Taste profile, browse sidebar, difficulty, calories, weekly challenge, Plus and admin. */

/* ---------- check chips & option cards ---------- */
.check-chip { position: relative; display: inline-flex; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip span {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-size: 0.92rem; transition: background .15s, border-color .15s;
}
.check-chip:hover span { border-color: var(--accent); }
.check-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check-chip input:checked + span::before { content: "✓"; font-weight: 700; }
.check-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.option-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.option-cards-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.option-card { position: relative; cursor: pointer; }
.option-card input { position: absolute; opacity: 0; }
.option-card span {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: var(--space-4); border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--card);
}
.option-card small { color: var(--muted); }
.option-card:hover span { border-color: var(--accent); }
.option-card input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.option-card input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- taste wizard ---------- */
.taste-form { display: grid; gap: var(--space-4); margin-top: var(--space-5); }
.taste-step legend { float: left; width: 100%; font-family: var(--font-display); font-size: 1.35rem; padding: 0; margin-bottom: var(--space-4); }
.taste-step legend + * { clear: both; }
.taste-step .step-count { display: block; font-family: var(--font-body, inherit); font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.taste-progress { height: 6px; border-radius: 999px; background: var(--surface); overflow: hidden; display: none; }
.taste-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.taste-form.is-wizard .taste-progress { display: block; }
.taste-nav { justify-content: flex-end; }

/* ---------- difficulty & calories ---------- */
.difficulty { display: inline-flex; align-items: center; gap: 6px; }
.difficulty-dots { display: inline-flex; gap: 3px; }
.difficulty-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.difficulty-dots i.on { background: var(--accent); }
.recipe-facts { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-4) 0; }
.fact { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--surface); min-width: 9rem; }
.fact .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fact .value { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.fact small { color: var(--muted); }
.appliance-warning { display: flex; gap: 8px; align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--highlight); margin-bottom: var(--space-4); }
.badge-plus { background: #f5c542; color: #3b2a00; }

/* ---------- servings ---------- */
.servings-note { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); margin-top: 2px; }
.servings-note button { font-size: inherit; }
[data-scaler].is-default [data-servings-label] { color: var(--accent); }
.servings-original { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); font-size: .75rem; }

/* ---------- browse with sidebar ---------- */
.browse-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.filter-sidebar { position: sticky; top: var(--space-4); max-height: calc(100vh - 2rem); overflow: auto; padding: var(--space-4); }
.filter-sidebar summary { display: none; }
.filter-group { border: 0; margin: 0 0 var(--space-4); padding: 0 0 var(--space-4); border-bottom: 1px solid var(--line); }
.filter-group:last-of-type { border-bottom: 0; }
.filter-group legend, .filter-group > .filter-title { font-weight: 700; font-size: .9rem; margin-bottom: var(--space-2); padding: 0; }
.filter-group label.opt { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: .92rem; cursor: pointer; }
.filter-group label.opt input { accent-color: var(--accent); }
.filter-group select, .filter-group input[type=search] { width: 100%; }
.filter-actions { display: flex; flex-direction: column; gap: var(--space-2); }
.filter-actions .small { text-align: center; }
.results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
@media (max-width: 880px) {
  .browse-layout { grid-template-columns: 1fr; }
  .filter-sidebar { position: static; max-height: none; }
  .filter-sidebar summary { display: flex; justify-content: space-between; font-weight: 700; cursor: pointer; }
  .filter-sidebar:not([open]) > :not(summary) { display: none; }
}

/* ---------- cards ---------- */
.recipe-card .meta .kcal { white-space: nowrap; }
.card-supporter { position: absolute; right: 8px; top: 8px; }

/* ---------- weekly challenge ---------- */
.challenge-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-6); align-items: center; padding: var(--space-6); }
.challenge-hero .recipe-card { max-width: 420px; }
.challenge-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; margin-top: var(--space-3); }
.challenge-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); }
.nomination-list { display: grid; gap: var(--space-3); }
.nomination { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius); background: var(--surface); }
.nomination img, .nomination svg { width: 64px; height: 48px; object-fit: cover; border-radius: var(--radius-sm); flex: none; }
.nomination .grow { flex: 1; min-width: 0; }
.nomination .votes { font-weight: 700; min-width: 3.5rem; text-align: center; }
.nomination.is-mine { outline: 2px solid var(--accent); }
@media (max-width: 760px) { .challenge-hero { grid-template-columns: 1fr; padding: var(--space-4); } }

/* ---------- creator support ---------- */
.creator-support { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); justify-content: space-between; padding: var(--space-4); border-radius: var(--radius); background: var(--accent-soft); margin: var(--space-5) 0; }

/* ---------- Plus ---------- */
.plan-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: var(--space-5) 0; }
.plan { display: flex; flex-direction: column; gap: var(--space-3); }
.plan.is-featured { border: 2px solid var(--accent); }
.plan .price { font-family: var(--font-display); font-size: 1.8rem; }
.plan ul { padding-left: 1.1rem; margin: 0; display: grid; gap: 6px; }

/* ---------- admin ---------- */
.stat-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: var(--space-5); }
.stat { padding: var(--space-4); }
.stat .num { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: .85rem; }
.meter { height: 14px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter.is-warn span { background: #d9822b; }
.meter.is-full span { background: #c0392b; }
.meter-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); font-size: .85rem; color: var(--muted); margin-top: 6px; }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: var(--space-3); }
.mini-bars span { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.mini-bars span.today { opacity: 1; outline: 2px solid var(--ink); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table td.actions { white-space: nowrap; }
.admin-table td.actions form { display: inline; }
.table-wrap { overflow-x: auto; }

/* ---------- servings slider ---------- */
.servings-slider { margin: calc(var(--space-2) * -1) 0 var(--space-4); }
.servings-track { --thumb: 20px; position: relative; height: 28px; }
.servings-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 6px; transform: translateY(-50%);
  border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--line);
}
/* One dot per size the slider can stop on; dots up to the thumb fill in */
.servings-stop {
  position: absolute; top: 50%; z-index: 0; width: 10px; height: 10px; border-radius: 999px;
  left: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--at)); transform: translate(-50%, -50%);
  background: var(--card); border: 2px solid var(--muted); pointer-events: none;
}
.servings-stop.is-passed { background: var(--accent); border-color: var(--accent); }
.servings-stop.is-original { width: 14px; height: 14px; border-color: var(--accent-2, var(--accent)); box-shadow: 0 0 0 2px var(--card); }
.servings-slider.is-dense .servings-stop { width: 6px; height: 6px; border-width: 1px; }
.servings-slider.is-dense .servings-stop.is-original { width: 10px; height: 10px; border-width: 2px; }
.servings-slider input[type=range] {
  position: relative; z-index: 1; width: 100%; height: 28px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.servings-slider input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 28px; }
.servings-slider input[type=range]::-moz-range-track { background: transparent; height: 28px; }
.servings-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: 4px; border-radius: 999px;
  background: var(--accent); border: 3px solid var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / .3);
}
.servings-slider input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 999px; background: var(--accent); border: 3px solid var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / .3);
}
.servings-slider input[type=range]:focus-visible { outline: none; }
.servings-slider input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.servings-slider input[type=range]:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.servings-slider-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.plain-list { list-style: none; padding: 0; margin: 0 0 var(--space-3); display: grid; gap: 4px; }

/* ---------- settings: change username ---------- */
.settings-rename { margin: var(--space-3) 0; }
.settings-rename summary { cursor: pointer; font-weight: 550; color: var(--accent); width: fit-content; }
.settings-rename[open] summary { margin-bottom: var(--space-3); }

/* ---------- admin ---------- */
/* "Turn on" and "Turn off" take the same room, so the next link doesn't shift */
.action-toggle { min-width: 4.6em; text-align: left; }
/* Site settings use the full admin width: two columns of settings on wide screens */
@media (min-width: 900px) {
  .admin-settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4) var(--space-6); align-items: start; }
  .admin-settings-form > .btn { grid-column: 1 / -1; justify-self: start; }
}

/* ---------- settings: taste ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3) var(--space-4); }
.default-servings input[type=number]:disabled { opacity: .5; }
.site-finder { display: flex; gap: var(--space-4); align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.site-finder p { margin: var(--space-1) 0 0; max-width: 60em; }
@media (max-width: 719px) { .site-finder { flex-direction: column; align-items: stretch; } }
.spinner { display: inline-block; width: .9em; height: .9em; vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 999px; animation: nb-spin .8s linear infinite; }
@keyframes nb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.mono-input { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
.alert-ok { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---------- ratings: other sites' ratings are attributed and visibly secondary ---------- */
.source-rating { display: inline-flex; align-items: center; gap: 4px; }
.source-rating .icon, .stars-source .icon { color: var(--muted); }
.stars-source { color: var(--muted); font-weight: 500; }

/* ---------- collections ---------- */
.breadcrumbs { margin-bottom: var(--space-2); color: var(--muted); }
.breadcrumbs a { color: inherit; }
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.collection-card { display: flex; flex-direction: column; gap: var(--space-2); text-decoration: none; color: var(--ink); }
.collection-card:hover { border-color: var(--accent); }
