/* ==========================================================================
   MIPB Phytosterol Tools — phytosterol-table.css
   Covers [phytosterol_table] (.mphy-*) and [compare_phytosterols] (.mphyc-*)
   Colour theme: teal (#00695c)
   ========================================================================== */

/* ---- Variables ---- */
:root {
  --phy-primary:   #00695c;
  --phy-accent:    #26a69a;
  --phy-bar-bg:    #e0f2f1;
  --phy-bar-fill:  #00695c;
  --phy-border:    #e0e0e0;
  --phy-row-hover: #f0faf9;
  --phy-muted:     #757575;
  --phy-radius:    6px;
}

/* ==========================================================================
   Static top-10 SEO block
   ========================================================================== */
.mphy-top10 { margin-bottom: 2rem; }
.mphy-top10 h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.mphy-top10-list { margin: 0; padding-left: 1.4rem; }
.mphy-top10-list li { margin-bottom: .3rem; line-height: 1.5; }

/* ==========================================================================
   Main wrapper
   ========================================================================== */
.mphy-wrap {
  max-width: 1100px;
  margin: 0 auto;
  font-family: inherit;
}

/* ==========================================================================
   Controls row
   ========================================================================== */
.mphy-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  margin-bottom: 1rem;
}

.mphy-search,
.mphy-group-select {
  padding: .45rem .7rem;
  border: 1px solid var(--phy-border);
  border-radius: var(--phy-radius);
  font-size: .93rem;
  background: #fff;
  flex: 1 1 180px;
  max-width: 320px;
}

.mphy-search:focus,
.mphy-group-select:focus {
  outline: 2px solid var(--phy-primary);
  outline-offset: 1px;
}

.mphy-order-btn {
  padding: .45rem .9rem;
  background: var(--phy-primary);
  color: #fff;
  border: none;
  border-radius: var(--phy-radius);
  font-size: .88rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: filter .15s;
}
.mphy-order-btn:hover { filter: brightness(1.15); }

/* ==========================================================================
   Sort tabs
   ========================================================================== */
.mphy-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .8rem;
}

.mphy-tab {
  padding: .38rem .85rem;
  background: #f1f3f4;
  border: 1px solid var(--phy-border);
  border-radius: 20px;
  font-size: .85rem;
  cursor: pointer;
  color: #333;
  transition: background .15s, color .15s;
}
.mphy-tab:hover { background: var(--phy-bar-bg); }
.mphy-tab.active {
  background: var(--phy-primary);
  color: #fff;
  border-color: var(--phy-primary);
}

/* ==========================================================================
   Table
   ========================================================================== */
.mphy-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--phy-border);
  border-radius: var(--phy-radius);
}

.mphy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.mphy-table thead th {
  background: #f8f9fa;
  padding: .6rem .7rem;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid var(--phy-border);
  white-space: nowrap;
}

.mphy-table tbody tr {
  border-bottom: 1px solid var(--phy-border);
  transition: background .1s;
}
.mphy-table tbody tr:last-child { border-bottom: none; }
.mphy-table tbody tr:hover { background: var(--phy-row-hover); }
.mphy-table td { padding: .55rem .7rem; vertical-align: middle; }

.mphy-rank {
  width: 3rem;
  text-align: right;
  color: var(--phy-muted);
  font-size: .82rem;
}

.mphy-name { font-weight: 500; }

.mphy-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mphy-null { color: var(--phy-muted); }

.mphy-loading {
  text-align: center;
  padding: 2rem;
  color: var(--phy-muted);
}

/* Bar column */
.mphy-col-bar { width: 90px; padding-right: .5rem; }
.mphy-bar {
  height: 10px;
  background: var(--phy-bar-fill);
  border-radius: 3px;
  min-width: 2px;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.mphy-pagination {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}

.mphy-pg-btn {
  padding: .35rem .8rem;
  background: var(--phy-primary);
  color: #fff;
  border: none;
  border-radius: var(--phy-radius);
  font-size: .85rem;
  cursor: pointer;
  transition: filter .15s;
}
.mphy-pg-btn:hover { filter: brightness(1.15); }

.mphy-pg-info {
  font-size: .85rem;
  color: #555;
}

/* ==========================================================================
   Legend
   ========================================================================== */
.mphy-legend {
  margin-top: .75rem;
  font-size: .82rem;
  color: #666;
}

/* ==========================================================================
   FAQ section (ranking page)
   ========================================================================== */
.mphy-faq {
  max-width: 1100px;
  margin: 2rem auto 0;
}

.mphy-faq h2 {
  font-size: 1.2rem;
  margin-bottom: .75rem;
  color: var(--phy-primary);
}

.mphy-faq details {
  border: 1px solid var(--phy-border);
  border-radius: var(--phy-radius);
  margin-bottom: .5rem;
  padding: .6rem .9rem;
}

.mphy-faq details[open] {
  border-color: var(--phy-primary);
}

.mphy-faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  list-style: none;
  padding-right: 1.2rem;
  position: relative;
}
.mphy-faq summary::-webkit-details-marker { display: none; }
.mphy-faq summary::after {
  content: '+';
  position: absolute;
  right: 0;
  color: var(--phy-primary);
  font-size: 1.1rem;
  line-height: 1;
}
.mphy-faq details[open] summary::after { content: '−'; }

.mphy-faq details p {
  margin: .6rem 0 .2rem;
  font-size: .92rem;
  line-height: 1.65;
  color: #444;
}

/* ==========================================================================
   Comparison tool (.mphyc-*)
   ========================================================================== */
.mphyc-wrap {
  max-width: 1100px;
  margin: 0 auto;
  font-family: inherit;
}

.mphyc-heading {
  font-size: 1.35rem;
  margin-bottom: .4rem;
}

.mphyc-intro {
  font-size: .93rem;
  color: #555;
  margin-bottom: 1rem;
}

/* Search / autocomplete */
.mphyc-search-row { margin-bottom: .75rem; }

.mphyc-ac-wrap { position: relative; display: inline-block; width: 100%; max-width: 420px; }

.mphyc-search {
  width: 100%;
  padding: .48rem .75rem;
  border: 1px solid var(--phy-border);
  border-radius: var(--phy-radius);
  font-size: .93rem;
  box-sizing: border-box;
}
.mphyc-search:focus {
  outline: 2px solid var(--phy-primary);
  outline-offset: 1px;
}

.mphyc-suggestions {
  position: absolute;
  z-index: 999;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--phy-border);
  border-top: none;
  border-radius: 0 0 var(--phy-radius) var(--phy-radius);
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.mphyc-suggestions li {
  padding: .45rem .75rem;
  cursor: pointer;
  font-size: .9rem;
  border-bottom: 1px solid #f5f5f5;
  display: flex;
  flex-direction: column;
}
.mphyc-suggestions li:last-child { border-bottom: none; }
.mphyc-suggestions li:hover,
.mphyc-suggestions li:focus { background: var(--phy-bar-bg); outline: none; }
.mphyc-suggestions li small { font-size: .78rem; color: var(--phy-muted); }

/* Chips */
.mphyc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .75rem;
  min-height: 1.8rem;
}

.mphyc-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--phy-bar-bg);
  border: 1px solid var(--phy-accent);
  border-radius: 20px;
  padding: .2rem .65rem;
  font-size: .83rem;
  color: #00413a;
}

.mphyc-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--phy-primary);
  font-size: .9rem;
  line-height: 1;
  padding: 0;
}
.mphyc-chip-remove:hover { color: #d32f2f; }

/* Tabs */
.mphyc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .8rem;
}

.mphyc-tab {
  padding: .38rem .85rem;
  background: #f1f3f4;
  border: 1px solid var(--phy-border);
  border-radius: 20px;
  font-size: .85rem;
  cursor: pointer;
  color: #333;
  transition: background .15s, color .15s;
}
.mphyc-tab:hover { background: var(--phy-bar-bg); }
.mphyc-tab.active {
  background: var(--phy-primary);
  color: #fff;
  border-color: var(--phy-primary);
}

/* Table */
.mphyc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--phy-border);
  border-radius: var(--phy-radius);
}

.mphyc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.mphyc-table thead th {
  background: #f8f9fa;
  padding: .6rem .7rem;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid var(--phy-border);
  white-space: nowrap;
}

.mphyc-table tbody tr {
  border-bottom: 1px solid var(--phy-border);
  transition: background .1s;
}
.mphyc-table tbody tr:last-child { border-bottom: none; }
.mphyc-table tbody tr:hover { background: var(--phy-row-hover); }
.mphyc-table td { padding: .55rem .7rem; vertical-align: middle; }

.mphyc-name { font-weight: 500; }
.mphyc-grp  { font-size: .85rem; color: #555; }

.mphyc-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mphyc-null  { color: var(--phy-muted); }
.mphyc-empty { text-align: center; padding: 2rem; color: var(--phy-muted); }

/* Bar */
.mphyc-col-bar { width: 80px; }
.mphyc-bar {
  height: 10px;
  background: var(--phy-bar-fill);
  border-radius: 3px;
  min-width: 2px;
}

/* Remove button */
.mphyc-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--phy-muted);
  font-size: .9rem;
  padding: .15rem .3rem;
  border-radius: 3px;
  transition: color .15s;
}
.mphyc-remove-btn:hover { color: #d32f2f; }

/* Legend */
.mphyc-legend {
  margin-top: .75rem;
  font-size: .82rem;
  color: #666;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 760px) {
  .mphy-col-grp  { display: none; }
  .mphyc-grp     { display: none; }
}

@media (max-width: 640px) {
  .mphy-col-bar  { display: none; }
  .mphy-col-sit,
  .mphy-col-cam  { display: none; }
  .mphyc-col-bar { display: none; }
  .mphyc-col-sit,
  .mphyc-col-cam { display: none; }
}

@media (max-width: 480px) {
  .mphy-col-sti  { display: none; }
  .mphyc-col-sti { display: none; }
}

/* ── Header grid layout ────────────────────────────────────────────────── */
.mphy-header-grid {
    max-width: 1040px;
    margin: 0 auto 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 720px) {
    .mphy-header-grid { grid-template-columns: 1fr; }
}

/* ── Insight box ───────────────────────────────────────────────────────── */
.mphy-insight-box {
    background: #e0f2f1;
    border: 1px solid #80cbc4;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
}
.mphy-insight-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #00695c;
    margin: 0 0 0.75rem;
}
.mphy-insight-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: #333;
}
.mphy-insight-list li::before {
    content: '✓ ';
    color: #00695c;
    font-weight: 700;
}

/* ── Context card ──────────────────────────────────────────────────────── */
.mphy-context-card {
    margin-top: 1rem;
    background: #fff;
    border: 1px solid #80cbc4;
    border-left: 4px solid #00695c;
    border-radius: 6px;
    padding: 0.9rem 1rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #444;
}
.mphy-context-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #00695c;
    margin: 0 0 0.4rem;
}
.mphy-context-card p:last-child { margin: 0; }
.mphy-context-card a { color: #00695c; }

/* ── Related tools grid ────────────────────────────────────────────────── */
.mphy-related {
    max-width: 1120px;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    margin-top: 2.5rem;
    padding: 0 1rem;
    box-sizing: border-box;
}
.mphy-related-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--phy-primary);
}
.mphy-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.mphy-related-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: 3px solid var(--card-accent, #00695c);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    min-height: 140px;
    transition: box-shadow 0.18s, transform 0.18s;
}
.mphy-related-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.1); transform: translateY(-2px); }
.mphy-related-icon { font-size: 2.25rem; flex-shrink: 0; color: var(--card-accent, #2e7d32); }
.mphy-related-icon svg { width: 38px; height: 38px; flex-shrink: 0; }
.mphy-related-name { display: block; font-size: 0.9rem; font-weight: 700; color: var(--card-accent, #00695c); margin-bottom: 0.25rem; }
.mphy-related-desc { font-size: 0.8rem; color: #555; margin: 0; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
