/**
 * Mediplant — Herbs index + profile + compare styles (Phase 2).
 * Pair with mediplant-shared.css (design tokens). Uses Niramit + Roboto from Google Fonts
 * loaded via _site-header-additions.html.
 */

/* ============================================================
 * PAGE HERO  (used by /herbs and other tool pages)
 * ========================================================== */
.mp-page-hero {
  position: relative;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 48px;
  padding: 60px 24px;
  background-color: var(--mp-green-deep);
  background-image:
    linear-gradient(135deg, rgba(52, 78, 50, 0.78) 0%, rgba(30, 132, 115, 0.55) 100%),
    var(--mp-page-hero-image,
      url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 320'><defs><linearGradient id='g' x1='0' x2='1' y1='0' y2='1'><stop offset='0%25' stop-color='%23344E32'/><stop offset='100%25' stop-color='%231E8473'/></linearGradient></defs><rect width='800' height='320' fill='url(%23g)'/></svg>"));
  background-size: cover;
  background-position: center;
  color: #fff;
  text-align: center;
}
.mp-page-hero-overlay { display: none; }
.mp-page-hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
}
.mp-page-hero h1 {
  font-family: var(--mp-display);
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0 0 14px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.mp-page-hero p {
  font-family: var(--mp-body);
  font-size: 17px;
  color: rgba(255, 255, 255, 0.92);
  margin: 0 auto 28px;
  max-width: 520px;
  line-height: 1.5;
}
.mp-page-hero-search {
  display: flex;
  justify-content: center;
}
.mp-page-hero-search input[type="search"] {
  width: 100%;
  max-width: 560px;
  padding: 14px 22px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-family: var(--mp-body);
  background: #fff;
  color: var(--mp-text);
  outline: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transition: box-shadow 0.15s;
}
.mp-page-hero-search input[type="search"]:focus {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.20), 0 0 0 4px rgba(238, 156, 129, 0.35);
}
@media (max-width: 720px) {
  .mp-page-hero { min-height: 260px; padding: 48px 20px; }
  .mp-page-hero h1 { font-size: 38px; }
  .mp-page-hero p  { font-size: 15px; }
}

/* ============================================================
 * HERBS INDEX
 * ========================================================== */
#mp-herbs {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.mp-herbs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .mp-herbs-layout { grid-template-columns: 1fr; gap: 20px; }
}

#mp-herb-filters {
  position: sticky;
  top: 20px;
  align-self: start;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  padding: 18px 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}
.mp-filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--mp-peach);
}
.mp-filter-head h2 {
  font-family: var(--mp-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--mp-green);
  margin: 0;
}
#mp-clear-filters {
  background: transparent;
  border: 1px solid var(--mp-border);
  color: var(--mp-muted);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--mp-body);
  cursor: pointer;
  transition: all 0.15s;
}
#mp-clear-filters:hover {
  color: var(--mp-mauve);
  border-color: var(--mp-mauve);
}

.mp-filter-group { margin-bottom: 14px; }
.mp-filter-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--mp-muted);
  margin-bottom: 6px;
  font-weight: 500;
  font-family: var(--mp-body);
}

/* ── Multi-select dropdown ──
   Uses <details>/<summary> for open/close behavior. The summary acts as the
   button (shows label + count); the panel inside lists checkboxes. */
.mp-multi {
  position: relative;
  font-family: var(--mp-body);
}
.mp-multi[open] { z-index: 5; }
.mp-multi > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: 1.5px solid var(--mp-border);
  border-radius: var(--mp-radius-sm);
  background: var(--mp-surface);
  font-size: 13.5px;
  color: var(--mp-text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}
.mp-multi > summary::-webkit-details-marker { display: none; }
.mp-multi > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--mp-green);
  border-bottom: 2px solid var(--mp-green);
  transform: rotate(45deg);
  margin-top: -4px;
  transition: transform 0.15s;
}
.mp-multi[open] > summary::after { transform: rotate(-135deg); margin-top: 2px; }
.mp-multi > summary:hover { border-color: var(--mp-green); }
.mp-multi[data-active="true"] > summary {
  border-color: var(--mp-green);
  background: var(--mp-green-soft);
  font-weight: 500;
}
.mp-multi-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--mp-green);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}
.mp-multi-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius-sm);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
  padding: 6px;
  z-index: 10;
}
.mp-multi-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--mp-text);
  cursor: pointer;
  user-select: none;
}
.mp-multi-option:hover { background: var(--mp-green-soft); }
.mp-multi-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--mp-border);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s;
}
.mp-multi-option input[type="checkbox"]:checked {
  background: var(--mp-green);
  border-color: var(--mp-green);
}
.mp-multi-option input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Indigenous toggle (single-value, kept simple) */
.mp-indigenous-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--mp-surface);
  border: 1.5px solid var(--mp-border);
  border-radius: var(--mp-radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--mp-text);
  font-family: var(--mp-body);
}
.mp-indigenous-toggle input { accent-color: var(--mp-green); }

/* ── Result bar (count + sort) ── */
.mp-result-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--mp-muted);
  font-family: var(--mp-body);
}
#mp-herb-sort {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius-sm);
  background: var(--mp-surface);
  font-size: 13px;
  font-family: var(--mp-body);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='%23456941' d='M6 8L2 4h8z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 8px;
}

/* ── Active filter chips ── */
.mp-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--mp-peach-soft);
  border-radius: var(--mp-radius-sm);
  align-items: center;
}
.mp-active-filters[hidden] { display: none; }
.mp-active-filters-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mp-mauve);
  font-weight: 600;
  font-family: var(--mp-body);
  margin-right: 4px;
}
.mp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: #fff;
  border: 1px solid var(--mp-border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--mp-text);
  font-family: var(--mp-body);
}
.mp-chip-key {
  color: var(--mp-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}
.mp-chip-remove {
  background: transparent;
  border: none;
  color: var(--mp-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  transition: background 0.1s, color 0.1s;
}
.mp-chip-remove:hover { background: var(--mp-mauve-soft); color: var(--mp-mauve); }
.mp-active-filters-clear {
  background: transparent;
  border: none;
  color: var(--mp-mauve);
  font-size: 12px;
  font-family: var(--mp-body);
  font-weight: 500;
  cursor: pointer;
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 6px;
}
.mp-active-filters-clear:hover { background: rgba(158, 75, 86, 0.10); }

/* ── Cards grid (4 × 10 on desktop, responsive below) ── */
#mp-herb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
@media (max-width: 1100px) {
  #mp-herb-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  #mp-herb-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
@media (max-width: 460px) {
  #mp-herb-grid { grid-template-columns: 1fr; }
}
.mp-herb-card {
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.mp-herb-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
  border-color: var(--mp-peach);
}
.mp-herb-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}
.mp-herb-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--mp-green-soft);
  position: relative;
  overflow: hidden;
}
.mp-herb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--mp-green-soft);
}
.mp-herb-thumb img[data-failed="true"] { display: none; }
.mp-herb-thumb[data-failed="true"]::before {
  content: "🌿";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  opacity: 0.45;
}
.mp-herb-body {
  padding: 14px 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mp-herb-title {
  font-family: var(--mp-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--mp-green);
}
.mp-herb-sci {
  font-style: italic;
  color: var(--mp-muted);
  font-size: 13px;
  font-family: var(--mp-body);
}
.mp-herb-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}
.mp-herb-meta .mp-pill[data-kind="type"] {
  background: var(--mp-surface-2);
  color: var(--mp-muted);
}

.mp-compare-toggle {
  background: transparent;
  border: 1px solid var(--mp-border);
  color: var(--mp-muted);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-family: var(--mp-body);
  cursor: pointer;
  margin-top: 8px;
  align-self: flex-start;
  transition: all 0.15s;
}
.mp-compare-toggle:hover { border-color: var(--mp-teal); color: var(--mp-teal); }
.mp-compare-toggle.active {
  background: var(--mp-teal);
  color: #fff;
  border-color: var(--mp-teal);
}

#mp-compare-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--mp-text);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  font-family: var(--mp-body);
  z-index: 100;
}
#mp-compare-bar a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  background: var(--mp-green);
  padding: 6px 14px;
  border-radius: 999px;
}
#mp-compare-bar button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mp-body);
}

/* ── Pagination ── */
.mp-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
  font-family: var(--mp-body);
}
.mp-pagination:empty { display: none; }
.mp-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--mp-border);
  border-radius: 8px;
  color: var(--mp-text);
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.mp-page-btn:hover:not([disabled]):not(.is-current) {
  border-color: var(--mp-green);
  color: var(--mp-green);
}
.mp-page-btn.is-current {
  background: var(--mp-green);
  border-color: var(--mp-green);
  color: #fff;
  font-weight: 500;
  cursor: default;
}
.mp-page-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.mp-page-ellipsis {
  padding: 0 4px;
  color: var(--mp-muted);
  font-size: 13px;
}
.mp-page-info {
  margin-left: 12px;
  color: var(--mp-muted);
  font-size: 12.5px;
}

/* ============================================================
 * HERB PROFILE  (matches the Licorice sample mockup)
 *   ┌───────────────────────────────────────────────────┐
 *   │ Title                                             │
 *   ├──────────┬────────────────────────────────────────┤
 *   │ [image]  │  Description                           │
 *   │ [pills]  │                                        │
 *   │ [save]   │                                        │
 *   └──────────┴────────────────────────────────────────┘
 *   ┌───────────────────────────────────────────────────┐
 *   │ Usable items   │  …                               │
 *   │ ─── peach divider ─────────────────────────────── │
 *   │ How to use     │  …                               │
 *   │ …                                                 │
 *   └───────────────────────────────────────────────────┘
 * ========================================================== */
#mp-herb-profile {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

/* TITLE — full-width header above the hero grid */
.mp-profile-header {
  margin-bottom: 24px;
}
.mp-profile-header h1 {
  font-family: var(--mp-display);
  font-size: 40px;
  font-weight: 600;
  color: var(--mp-green);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
@media (max-width: 720px) {
  .mp-profile-header h1 { font-size: 30px; }
}

/* HERO ROW — image+pills on the left, description on the right.
   Title is moved out of this grid so description aligns with the image top. */
.mp-profile-hero {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 32px;
}
@media (max-width: 720px) {
  .mp-profile-hero { grid-template-columns: 1fr; gap: 20px; }
}

.mp-profile-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--mp-green-soft);
  border-radius: var(--mp-radius);
  overflow: hidden;
  position: relative;
  margin-bottom: 16px;
}
.mp-profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mp-profile-image img[data-failed="true"] { display: none; }
.mp-profile-image[data-failed="true"]::before {
  content: "🌿";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  opacity: 0.40;
}

.mp-profile-sci {
  font-style: italic;
  color: var(--mp-muted);
  font-size: 15px;
  font-family: var(--mp-body);
  margin-bottom: 8px;
}
.mp-profile-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.mp-fav-btn {
  padding: 10px 22px;
  background: #fff;
  border: 1.5px solid var(--mp-green);
  color: var(--mp-green);
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
  font-family: var(--mp-body);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
}
.mp-fav-btn:hover  { background: var(--mp-green-soft); }
.mp-fav-btn.saved  { background: var(--mp-green); color: #fff; }

.mp-profile-right {
  font-family: var(--mp-body);
}
.mp-profile-description {
  font-size: 18px;
  line-height: 1.7;
  color: var(--mp-text);
  margin-bottom: 16px;
}
.mp-profile-description p { margin-bottom: 12px; }

/* TABLE-STYLE ROWS — label | content with peach divider between */
.mp-profile-rows {
  margin-top: 24px;
  border-top: 1px solid var(--mp-peach);
}
.mp-profile-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--mp-peach);
}
@media (max-width: 600px) {
  .mp-profile-row { grid-template-columns: 1fr; gap: 6px; padding: 16px 0; }
}
.mp-profile-row-label {
  font-family: var(--mp-body);
  font-size: 15px;
  color: var(--mp-muted);
  font-weight: 400;
  padding-top: 2px;
}
.mp-profile-row-content {
  font-family: var(--mp-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--mp-text);
}
.mp-profile-row-content p:not(:last-child) { margin-bottom: 8px; }
.mp-profile-row-content ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.mp-profile-row-content li { padding: 1px 0; }
.mp-profile-row-content em {
  color: var(--mp-faint);
  font-style: italic;
}

/* ============================================================
 * HERBS COMPARE
 * ========================================================== */
#mp-herb-compare {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px;
}
#mp-herb-compare h1 {
  font-family: var(--mp-display);
  font-size: 36px;
  color: var(--mp-green);
  margin-bottom: 24px;
  font-weight: 600;
}
.mp-compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  overflow: hidden;
  font-family: var(--mp-body);
}
.mp-compare-table th,
.mp-compare-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--mp-peach);
  font-size: 13.5px;
  line-height: 1.5;
}
.mp-compare-table tr:last-child th,
.mp-compare-table tr:last-child td { border-bottom: none; }
.mp-compare-table th {
  background: var(--mp-surface-2);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mp-muted);
  width: 180px;
}
.mp-compare-table td img {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--mp-green-soft);
}
.mp-compare-table a {
  color: var(--mp-green);
  text-decoration: none;
}
.mp-compare-table a:hover { text-decoration: underline; }
