/* ============================================================
   RECIPE DETAIL PAGE  –  recipe-view.css
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --rv-accent:       var(--primary-color, #d51243);
  --rv-accent-light: color-mix(in srgb, var(--rv-accent) 10%, #fff);
  --rv-bg:           #f7f8fa;
  --rv-card:         #ffffff;
  --rv-text:         var(--tp-text-body, #040404);
  --rv-muted:        var(--tp-text-secondary, #686666);
  --rv-border:       #e8eaf0;
  --rv-radius:       12px;
  --rv-shadow:       0 2px 12px rgba(0,0,0,.07);
  --rv-shadow-md:    0 4px 20px rgba(0,0,0,.10);
  --rv-trans:        all .22s cubic-bezier(.4,0,.2,1);
  --rv-max:          1320px;
}

/* ============================================================
   GLOBAL FONT & BASE TEXT
   ============================================================ */
.rv-page,
.rv-page * {
  font-family: var(--secondary-font, inherit) !important;
}

/* Restore Font Awesome font on icon pseudo-elements */
.rv-page .fa::before,
.rv-page .fas::before,
.rv-page .far::before,
.rv-page .fal::before,
.rv-page .fab::before,
.rv-page [class*=" fa-"]::before,
.rv-page [class^="fa-"]::before {
  font-family: "Font Awesome 5 Pro", "Font Awesome 5 Free", "FontAwesome" !important;
}

/* Non-heading elements: consistent body text style – scoped to recipe content only, not product cards */
.rv-section p,
.rv-section li,
.rv-section span,
.rv-section td,
.rv-section th,
.rv-section label,
.rv-prose p,
.rv-prose span,
.rv-method p,
.rv-method li,
.rv-ingredients li,
.rv-ingredients span,
.rv-info-card__label,
.rv-info-card__val {
  color: var(--tp-text-secondary);
  font-size: 0.875rem;
  line-height: 1.8;
  font-weight: 500;
}

/* ============================================================
   HERO
   ============================================================ */
.rv-page { background: var(--rv-bg); }

.rv-hero {
  position: relative;
  height: 480px;
  overflow: hidden;
  background: #111;
}

.rv-hero-swiper,
.rv-hero-swiper .swiper-wrapper,
.rv-hero-swiper .swiper-slide { height: 100%; }
.swiper-pagination { display: none !important; }

.rv-hero__img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.rv-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.2) 55%, transparent 100%);
  z-index: 2;
  display: flex;
  align-items: flex-end;
}

.rv-hero__content {
  width: 100%;
  max-width: var(--rv-max);
  margin: 0 auto;
  padding: 0 20px 28px;
}

.rv-hero__cat {
  display: inline-block;
  background: var(--rv-accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 50px;
  margin-bottom: 10px;
}

.rv-hero__title {
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin: 0 0 12px;
  max-width: 760px;
}

.rv-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: rgba(255,255,255,.9);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.rv-hero__meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rv-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 50px;
  border: 1.5px solid rgba(255,255,255,.6);
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--rv-trans);
}
.rv-share-btn:hover { background: rgba(255,255,255,.22); }

.rv-swiper-progress {
  position: absolute;
  bottom: 16px; right: 16px;
  z-index: 10;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
}
.rv-swiper-progress svg {
  width: 36px; height: 36px;
  transform: rotate(-90deg);
  stroke: rgba(255,255,255,.8);
  fill: none;
  stroke-width: 3;
}

/* ============================================================
   CONTAINER & LAYOUT
   ============================================================ */
.rv-container {
  max-width: var(--rv-max);
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* Info cards row */
.rv-info-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 20px 0;
}

.rv-info-card {
  background: var(--rv-card);
  border-radius: var(--rv-radius);
  box-shadow: var(--rv-shadow);
  border: 1px solid var(--rv-border);
  padding: 18px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: var(--rv-trans);
}
.rv-info-card:hover { box-shadow: var(--rv-shadow-md); transform: translateY(-2px); }

.rv-info-card__icon {
  font-size: 1.3rem;
  color: var(--rv-accent);
  margin-bottom: 2px;
}
.rv-info-card__label {
  font-size: .72rem;
  color: var(--rv-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rv-info-card__val {
  font-size: .95rem;
  font-weight: 700;
  color: var(--rv-text);
}

/* Main 2-col grid */
.rv-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 0.9375rem;
  align-items: start;
}

/* ============================================================
   SECTIONS (shared)
   ============================================================ */
.rv-section {
  background: var(--rv-card);
  border-radius: var(--rv-radius);
  box-shadow: var(--rv-shadow);
  border: 1px solid var(--rv-border);
  padding: 24px;
  margin-bottom: 16px;
}
.rv-section:last-child { margin-bottom: 0; }

.rv-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--rv-text);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--rv-accent-light);
}
.rv-section__title i { color: var(--rv-accent); }

/* Prose text */
.rv-prose {
  font-size: .875rem;
  color: var(--rv-muted);
  line-height: 1.8;
}
.rv-prose p { margin: 0 0 10px; }
.rv-prose p:last-child { margin-bottom: 0; }

/* Tags */
.rv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.rv-tag {
  padding: 4px 12px;
  background: #f0f4ff;
  color: #4f46e5;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--rv-trans);
}
.rv-tag:hover { background: #e0e7ff; }

/* ============================================================
   INGREDIENTS
   ============================================================ */
.rv-ingredients { font-size: .875rem; }

/* Section headings within ingredients (e.g. "For the sauce") */
.rv-ingredients h2,
.rv-ingredients h3 {
  font-size: .85rem;
  font-weight: 700;
  color: var(--rv-accent);
  margin: 20px 0 10px;
  padding: 7px 14px;
  background: var(--rv-accent-light);
  border-left: 3px solid var(--rv-accent);
  border-radius: 0 8px 8px 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rv-ingredients h2:first-child,
.rv-ingredients h3:first-child { margin-top: 0; }

/* Raw ul/li from editor – hidden before JS runs, JS replaces them */
.rv-ingredients ul,
.rv-ingredients ol { list-style: none; margin: 0; padding: 0; }
.rv-ingredients li { display: none; } /* JS replaces these */
.rv-ingredients p  { display: none; } /* JS replaces these */

/* Interactive checkbox items injected by JS */
.rv-ingredient-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin-bottom: 4px;
  background: var(--rv-bg);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  font-size: .85rem;
  color: var(--rv-text);
  line-height: 1.5;
  user-select: none;
}
.rv-ingredient-item:hover {
  background: var(--rv-accent-light);
  border-color: var(--rv-accent);
}
.rv-ingredient-item.checked { opacity: .5; }
.rv-ingredient-item.checked .rv-ingredient-text {
  text-decoration: line-through;
  color: var(--rv-muted);
}

.rv-ingredient-checkbox {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: 2px solid var(--rv-accent);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--rv-trans);
  background: #fff;
}
.rv-ingredient-checkbox i { display: none; font-size: 10px; color: #fff; }
.rv-ingredient-checkbox.checked { background: var(--rv-accent); border-color: var(--rv-accent); }
.rv-ingredient-checkbox.checked i { display: block; }

.rv-ingredient-text { flex: 1; }

/* Inline product links inside ingredient text (parenthetical) */
.rv-ingredient-product-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--rv-accent);
  font-weight: 600;
  text-decoration: none;
  font-size: .8rem;
  border-bottom: 1px dashed var(--rv-accent);
  transition: opacity .15s;
}
.rv-ingredient-product-link:hover { opacity: .75; }
.rv-ingredient-product-link i { font-size: .7rem; }

/* Shop icon on the right (JS-injected, for parenthetical matches) */
.rv-ingredient-link {
  color: var(--rv-accent);
  text-decoration: none;
  font-size: .82rem;
  margin-left: auto;
  flex-shrink: 0;
  padding: 3px 8px;
  background: var(--rv-accent-light);
  border-radius: 50px;
  display: flex; align-items: center; gap: 4px;
  transition: background .15s;
}
.rv-ingredient-link:hover { background: #c5f0f0; }

/* ============================================================
   METHOD
   ============================================================ */
.rv-method {
  font-size: .875rem;
  color: var(--rv-muted);
  line-height: 1.85;
}

/* Section titles */
.rv-method h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--rv-text);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--rv-accent-light);
  display: flex; align-items: center; gap: 8px;
}
.rv-method h2:first-child { margin-top: 0; }

.rv-method h3 {
  font-size: .875rem;
  font-weight: 700;
  color: var(--rv-accent);
  margin: 18px 0 8px;
  padding: 6px 12px;
  background: var(--rv-accent-light);
  border-left: 3px solid var(--rv-accent);
  border-radius: 0 6px 6px 0;
}
.rv-method h4 {
  font-size: .85rem;
  font-weight: 700;
  color: var(--rv-text);
  margin: 12px 0 6px;
}

/* Paragraphs */
.rv-method p { margin: 0 0 12px; }
.rv-method p:last-child { margin-bottom: 0; }

/* Numbered steps (ol) — styled with accent counter circles */
.rv-method ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rv-step;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rv-method ol li {
  counter-increment: rv-step;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--rv-card);
  border: 1px solid var(--rv-border);
  border-left: 3px solid var(--rv-accent);
  border-radius: 10px;
  padding: 14px 16px;
  line-height: 1.75;
  transition: box-shadow .2s, border-color .2s;
  color: var(--rv-text);
}
.rv-method ol li:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  border-left-color: var(--rv-accent);
}
.rv-method ol li::before {
  content: counter(rv-step);
  flex-shrink: 0;
  width: 30px; height: 30px;
  background: var(--rv-accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 800;
  margin-top: 1px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  letter-spacing: 0;
}

/* Bullet lists (ul) */
.rv-method ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rv-method ul li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
  border-bottom: 1px solid var(--rv-border);
  line-height: 1.6;
}
.rv-method ul li:last-child { border-bottom: none; }
.rv-method ul li::before {
  content: '';
  flex-shrink: 0;
  width: 7px; height: 7px;
  background: var(--rv-accent);
  border-radius: 50%;
  margin-top: 7px;
}

.rv-method strong { color: var(--rv-text); font-weight: 700; }
.rv-method a { color: var(--rv-accent); text-decoration: underline; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.rv-sticky {
  position: -webkit-sticky;
  position: sticky;
  top: 100px;          /* clears fixed header – adjust if header height differs */
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  align-self: flex-start;  /* critical: stops sticky from stretching to grid height */
}
.rv-sticky::-webkit-scrollbar { display: none; }

.rv-sidebar-card {
  background: var(--rv-card);
  border-radius: var(--rv-radius);
  box-shadow: var(--rv-shadow);
  border: 1px solid var(--rv-border);
  padding: 20px;
}

.rv-sidebar-card__title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--rv-text);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--rv-accent-light);
}
.rv-sidebar-card__title i { color: var(--rv-accent); }

/* Nutrition table */
.rv-nutrition .nutrition-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--rv-border);
  font-size: .8rem;
}
.rv-nutrition .nutrition-item:last-of-type { border-bottom: none; }
.rv-nutrition .nutrition-label { color: var(--rv-muted); font-weight: 500; }
.rv-nutrition .nutrition-value { font-weight: 700; color: var(--rv-text); }
.rv-nutrition .nutrition-value.text-success { color: #16a34a; }
.rv-nutrition p.small { font-size: .72rem; color: var(--rv-muted); margin: 10px 0 0; }
.rv-nutrition p.text-danger { color: #dc2626 !important; }

/* ============================================================
   SECTION HEADER (shared for products + related)
   ============================================================ */
.rv-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 36px 0 16px;
}
.rv-section-header__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--rv-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rv-section-header__title i { color: var(--rv-accent); }
.rv-section-header__link {
  font-size: .84rem;
  font-weight: 600;
  color: var(--rv-accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--rv-trans);
}
.rv-section-header__link:hover { opacity: .8; }

/* Slider arrows */
.rv-slider-arrows { display: flex; gap: 8px; }
.rv-arrow {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--rv-border);
  background: var(--rv-card);
  color: var(--rv-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .95rem;
  transition: var(--rv-trans);
  box-shadow: var(--rv-shadow);
}
.rv-arrow:hover { border-color: var(--rv-accent); color: var(--rv-accent); }

/* ============================================================
   SIDEBAR PRODUCTS (sticky, 1 at a time)
   ============================================================ */
.rv-sidebar-products { padding: 16px; }

.rv-sidebar-products__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.rv-sidebar-products__header .rv-sidebar-card__title { margin: 0; border-bottom: none; padding-bottom: 0; }

.rv-sidebar-products__arrows { display: flex; gap: 6px; }

.rv-arrow--sm {
  width: 30px; height: 30px;
  font-size: .8rem;
}

.rv-products-swiper { overflow: hidden; border-radius: 8px; }
.rv-products-swiper .swiper-slide { height: auto; }

.rv-prod-counter {
  text-align: center;
  font-size: .75rem;
  color: var(--rv-muted);
  margin-top: 8px;
  font-weight: 600;
  letter-spacing: .03em;
}

/* ============================================================
   SIDEBAR – QUICK ACTIONS
   ============================================================ */
.rv-sidebar-actions { padding: 16px; }
.rv-action-btns { display: block; }
.rv-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--rv-bg);
  border: 1px solid var(--rv-border);
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--rv-text);
  text-decoration: none;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
  width: 100%;
  text-align: left;
}
.rv-action-btn i { color: var(--rv-accent); font-size: .85rem; width: 16px; text-align: center; }
.rv-action-btn:hover {
  background: var(--rv-accent-light);
  border-color: var(--rv-accent);
  color: var(--rv-accent);
}

/* ============================================================
   SIDEBAR – AT A GLANCE
   ============================================================ */
.rv-sidebar-glance { padding: 16px; }
.rv-glance-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
}
.rv-glance-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--rv-border);
  font-size: .82rem;
}
.rv-glance-list li:last-child { border-bottom: none; }
.rv-glance-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--rv-muted);
  font-weight: 500;
}
.rv-glance-label i { color: var(--rv-accent); width: 14px; text-align: center; }
.rv-glance-val {
  font-weight: 700;
  color: var(--rv-text);
  font-size: .82rem;
  text-align: right;
  max-width: 55%;
}
.rv-glance-tags .rv-glance-val {
  font-size: .75rem;
  font-weight: 500;
  color: var(--rv-muted);
}

/* ============================================================
   RELATED RECIPES GRID
   ============================================================ */
.rv-related-section { margin-bottom: 8px; }

.rv-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.rv-related-card {
  display: flex;
  flex-direction: column;
  background: var(--rv-card);
  border-radius: var(--rv-radius);
  box-shadow: var(--rv-shadow);
  border: 1px solid var(--rv-border);
  overflow: hidden;
  text-decoration: none;
  transition: var(--rv-trans);
}
.rv-related-card:hover { box-shadow: var(--rv-shadow-md); transform: translateY(-3px); }

.rv-related-card__img-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #f0f0f0;
}
.rv-related-card__img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.rv-related-card:hover .rv-related-card__img { transform: scale(1.05); }

.rv-related-card__time {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 50px;
  display: flex; align-items: center; gap: 4px;
}

.rv-related-card__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.rv-related-card__title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--rv-text);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rv-related-card__cta {
  font-size: .78rem;
  font-weight: 700;
  color: var(--rv-accent);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* Mobile full-width products slider – hidden on desktop (sidebar handles it) */
.rv-mobile-products { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Prevent any horizontal overflow on the whole recipe page */
.rv-page { overflow-x: hidden; }

@media (max-width: 1024px) {
  .rv-hero { height: 400px; }
  .rv-grid { grid-template-columns: 1fr; }
  .rv-sticky { position: static; }
  .rv-info-cards { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  /* Hide sidebar entirely on mobile – products shown in full-width slider below */
  .rv-sidebar { display: none; }
  .rv-sidebar-card { padding: 14px; }
  .rv-related-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  /* Show mobile products slider */
  .rv-mobile-products { display: block; margin-bottom: 24px; }
  .rv-mobile-products .rv-section-header__title { font-size: 1rem; }
}

@media (max-width: 640px) {
  .rv-hero { height: 300px; }
  .rv-hero__title { font-size: 1.4rem; }
  .rv-hero__meta { gap: 12px; font-size: .8rem; }
  .rv-container { padding: 0 12px 48px; }
  .rv-info-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .rv-info-card { padding: 12px 8px; }
  .rv-info-card__icon { font-size: 1.1rem; }
  .rv-section { padding: 16px; }
  .rv-related-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .rv-section-header { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 420px) {
  .rv-related-grid { grid-template-columns: 1fr; }
}
