/* ===================================================================
   Recipes tab (mobile redesign §3) — Gallery⇄List swipe pager,
   A–Z scrubber, per-recipe add-to-plan buttons.
   Prototype: "Ramekin Mobile.dc.html" turn 5a.
   ================================================================= */

:root {
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.rcx-page {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------------- Header ---------------- */

.rcx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rcx-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.rcx-title {
  margin: 0;
  font-size: 24px;
  font-weight: var(--font-bold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.rcx-count {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.rcx-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  background: var(--brand-primary);
  border: 1px solid var(--brand-primary-hover);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: var(--font-semibold);
  text-decoration: none;
  box-shadow: 0 2px 6px -2px rgba(56, 122, 152, 0.5);
  flex: none;
}

.rcx-add-btn:hover {
  background: var(--brand-primary-hover);
  color: #fff;
}

.rcx-add-btn i {
  font-size: 11px;
}

/* ---------------- Search ---------------- */

.rcx-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

.rcx-search i {
  color: var(--color-neutral-300);
  font-size: 13px;
  flex: none;
}

.rcx-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text-primary);
}

.rcx-search input::placeholder {
  color: var(--color-neutral-300);
}

/* ---------------- Gallery / List segmented control ---------------- */

.rcx-seg {
  position: relative;
  display: flex;
  background: var(--bg-subtle);
  border-radius: 12px;
  padding: 4px;
}

.rcx-seg-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  bottom: 4px;
  background: var(--bg-surface);
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(15, 35, 43, 0.1);
  transition: transform 0.25s ease;
}

.rcx-seg-thumb.is-list {
  transform: translateX(100%);
}

.rcx-seg-btn {
  flex: 1;
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s ease;
}

.rcx-seg-btn.is-active {
  color: var(--text-primary);
}

/* ---------------- Swipe pager ---------------- */

.rcx-pager-wrap {
  position: relative;
  /* Height is set by recipes_tab.js (viewport minus header stack & nav);
     this is a safety floor for no-JS rendering. */
  min-height: 380px;
}

.rcx-pager {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rcx-pager::-webkit-scrollbar {
  display: none;
}

.rcx-pane {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  scrollbar-width: none;
}

.rcx-pane::-webkit-scrollbar {
  display: none;
}

/* ---------------- Gallery tiles (2-up) ---------------- */

.rcx-grid {
  padding: 6px 2px 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rcx-tile {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  height: 172px;
  box-shadow: 0 3px 10px -4px rgba(15, 35, 43, 0.18);
}

.rcx-tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rcx-tile-link {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-decoration: none;
}

.rcx-tile-cap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 26px 12px 38px;
}

.rcx-tile.has-img .rcx-tile-cap {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.88) 34%, rgba(255, 255, 255, 0.96) 100%);
}

.rcx-tile-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rcx-tile-meta {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.rcx-badge-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 7px;
  border-radius: var(--radius-md);
  background: var(--tint-warning);
  color: var(--color-warning);
  font-size: 10px;
  font-weight: var(--font-medium);
}

.rcx-tile-actions {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

.rcx-tile-action {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-error, #b42318);
  cursor: pointer;
  box-shadow: 0 2px 6px -2px rgba(56, 122, 152, 0.5);
}

.rcx-tile-action:hover {
  background: #fff;
}

.rcx-tile-action.is-plan {
  background: var(--brand-primary);
  color: #fff;
}

.rcx-tile-action.is-plan:hover {
  background: var(--brand-primary-hover);
}

.rcx-tile-action i {
  font-size: 12px;
}

.rcx-tile-rating {
  position: absolute;
  left: 9px;
  bottom: 8px;
  z-index: 3;
}

/* Soft tint placeholders (design-language palette) */
.rcx-tint-0 { background: #E3EDF1; }
.rcx-tint-1 { background: #E1EBE5; }
.rcx-tint-2 { background: #DBE8EE; }
.rcx-tint-3 { background: #E9ECDF; }
.rcx-tint-4 { background: #EBE7DE; }
.rcx-tint-5 { background: #E4EAEC; }

/* ---------------- List pane ---------------- */

.rcx-list {
  padding: 6px 22px 26px 2px;
  display: flex;
  flex-direction: column;
}

.rcx-letter {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--brand-primary);
  padding: 12px 0 2px;
  letter-spacing: 0.06em;
}

.rcx-letter:first-child {
  padding-top: 8px;
}

.rcx-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--bg-subtle);
}

/* Search filtering sets [hidden] on rows; without this counter-rule the
   display:flex above beats the UA's [hidden]{display:none} and List view
   ignores the search box entirely (QA 2026-07-26 H4). */
.rcx-row[hidden] {
  display: none;
}

.rcx-row-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  text-decoration: none;
}

.rcx-row-thumb {
  width: 50px;
  height: 50px;
  flex: none;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-300);
  font-size: 17px;
}

.rcx-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rcx-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rcx-row-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rcx-row-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.rcx-row-warn {
  color: var(--color-warning);
  font-size: 10px;
}

.rcx-row-actions {
  display: flex;
  gap: 6px;
}

.rcx-row-action {
  width: 32px;
  height: 32px;
  flex: none;
  border: none;
  border-radius: var(--radius-full);
  background: var(--tint-error, #fef3f2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-error, #b42318);
  cursor: pointer;
}

.rcx-row-action:hover {
  background: var(--color-error-100, #fee4e2);
}

.rcx-row-action.is-plan {
  background: var(--tint-info);
  color: var(--brand-primary);
}

.rcx-row-action.is-plan:hover {
  background: var(--brand-primary-soft);
}

.rcx-row-action i {
  font-size: 13px;
}

.rcx-row-rating {
  flex: 0 0 100%;
  padding: 0 0 7px 62px;
  margin-top: -8px;
}

/* ---------------- A–Z scrubber ---------------- */

.rcx-scrub {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  z-index: 5;
  width: 18px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  touch-action: none;
  user-select: none;
}

.rcx-scrub.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.rcx-scrub-letter {
  font-size: 9px;
  line-height: 1.15;
  color: var(--border-subtle);
}

.rcx-scrub-letter.has {
  font-weight: var(--font-bold);
  color: var(--brand-primary);
}

/* ---------------- Pager dots ---------------- */

.rcx-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 4;
  pointer-events: none;
}

.rcx-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--border-subtle);
  transition: background 0.2s ease;
}

.rcx-dot.is-on {
  background: var(--brand-primary);
}

/* ---------------- No results / empty states ---------------- */

.rcx-no-results {
  padding: 24px 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.rcx-empty {
  text-align: center;
  padding: var(--space-16) var(--space-5);
  background: var(--bg-surface);
  border-radius: 20px;
  border: 2px dashed var(--border-subtle);
  margin-top: var(--space-4);
}

.rcx-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  color: var(--brand-primary-soft);
}

.rcx-empty-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-3);
  color: var(--text-primary);
}

.rcx-empty-text {
  color: var(--text-muted);
  margin: 0 auto var(--space-6);
  font-size: var(--text-base);
  max-width: 320px;
}

.rcx-empty-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.rcx-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-3) var(--space-5);
  background: var(--brand-primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-full);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.rcx-empty-btn:hover {
  background: var(--brand-primary-hover);
  color: #fff;
}

.rcx-empty-btn.is-secondary {
  background: var(--text-secondary);
}
