/* ==========================================================================
   MIPB Choline Tools — choline-table.css
   Covers [choline_table] (.mchol-*) and [compare_choline] (.mcholc-*)
   ========================================================================== */

/* ---- Shared variables ---- */
:root {
  --ch-primary:   #1565c0;   /* deep blue — choline brand colour */
  --ch-accent:    #42a5f5;
  --ch-bar-bg:    #e3f2fd;
  --ch-bar-fill:  #1565c0;
  --ch-border:    #e0e0e0;
  --ch-row-hover: #f5f9ff;
  --ch-muted:     #757575;
  --ch-radius:    6px;
}

/* ============================================================
   [choline_table] — Ranking tool (.mchol-*)
   ============================================================ */

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

/* Controls */
.mchol-wrap { max-width: 1100px; margin: 0 auto; font-family: inherit; }
.mchol-controls {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  margin-bottom: 1rem;
}
.mchol-search, .mchol-group-select {
  padding: .45rem .7rem; border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius); font-size: .93rem;
  background: #fff; flex: 1 1 180px; max-width: 320px;
}
.mchol-search:focus, .mchol-group-select:focus { outline: 2px solid var(--ch-primary); outline-offset: 1px; }
.mchol-order-btn {
  padding: .45rem .9rem; background: var(--ch-primary); color: #fff;
  border: none; border-radius: var(--ch-radius); font-size: .88rem;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.mchol-order-btn:hover { background: #0d47a1; }

/* Sort tabs */
.mchol-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.mchol-tab {
  padding: .38rem .85rem; background: #f1f3f4; border: 1px solid var(--ch-border);
  border-radius: 20px; font-size: .85rem; cursor: pointer; color: #333;
  transition: background .15s, color .15s;
}
.mchol-tab:hover { background: var(--ch-bar-bg); }
.mchol-tab.active {
  background: var(--ch-primary); color: #fff; border-color: var(--ch-primary);
}

/* Table */
.mchol-table-wrap { overflow-x: auto; border: 1px solid var(--ch-border); border-radius: var(--ch-radius); }
.mchol-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mchol-table thead th {
  background: #f8f9fa; padding: .6rem .7rem; text-align: left;
  font-weight: 600; color: #333; border-bottom: 2px solid var(--ch-border);
  white-space: nowrap;
}
.mchol-table tbody tr { border-bottom: 1px solid var(--ch-border); transition: background .1s; }
.mchol-table tbody tr:last-child { border-bottom: none; }
.mchol-table tbody tr:hover { background: var(--ch-row-hover); }
.mchol-table td { padding: .55rem .7rem; vertical-align: middle; }
.mchol-rank { width: 3rem; text-align: right; color: var(--ch-muted); font-size: .82rem; }
.mchol-name { font-weight: 500; }
.mchol-val  { text-align: right; font-variant-numeric: tabular-nums; }
.mchol-null { color: var(--ch-muted); }
.mchol-loading { text-align: center; padding: 2rem; color: var(--ch-muted); }

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

/* Pagination */
.mchol-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: .6rem; margin-top: .8rem; font-size: .88rem;
}
.mchol-pg-btn {
  padding: .3rem .8rem; background: var(--ch-primary); color: #fff;
  border: none; border-radius: var(--ch-radius); cursor: pointer; font-size: .85rem;
}
.mchol-pg-btn:hover { background: #0d47a1; }
.mchol-pg-info { color: #555; }

/* Legend & FAQ */
.mchol-legend { font-size: .82rem; color: #666; margin-top: .7rem; }
.mchol-faq { margin-top: 2rem; }
.mchol-faq h2 { font-size: 1.15rem; margin-bottom: .7rem; }
.mchol-faq details { border: 1px solid var(--ch-border); border-radius: var(--ch-radius); margin-bottom: .5rem; }
.mchol-faq summary {
  padding: .65rem .9rem; font-weight: 500; cursor: pointer;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.mchol-faq summary::-webkit-details-marker { display: none; }
.mchol-faq summary::after { content: '+'; font-size: 1.1rem; color: var(--ch-primary); }
.mchol-faq details[open] summary::after { content: '−'; }
.mchol-faq details p { padding: .1rem .9rem .8rem; margin: 0; font-size: .9rem; line-height: 1.6; }

/* Responsive */
@media (max-width: 720px) {
  .mchol-col-group, .mchol-col-pc, .mchol-col-gpc, .mchol-col-bar { display: none; }
}

/* ============================================================
   [compare_choline] — Comparison tool (.mcholc-*)
   ============================================================ */

.mcholc-wrap { max-width: 1100px; margin: 0 auto; font-family: inherit; }
.mcholc-label { font-weight: 500; margin-bottom: .4rem; display: block; }

.mcholc-autocomplete { position: relative; max-width: 480px; }
.mcholc-input {
  width: 100%; padding: .45rem .7rem; border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius); font-size: .93rem; box-sizing: border-box;
}
.mcholc-input:focus { outline: 2px solid var(--ch-primary); outline-offset: 1px; }
.mcholc-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid var(--ch-border);
  border-top: none; border-radius: 0 0 var(--ch-radius) var(--ch-radius);
  list-style: none; margin: 0; padding: 0; max-height: 240px;
  overflow-y: auto; z-index: 100; box-shadow: 0 4px 10px rgba(0,0,0,.1);
}
.mcholc-dropdown li {
  padding: .5rem .8rem; cursor: pointer; font-size: .9rem; border-bottom: 1px solid #f0f0f0;
}
.mcholc-dropdown li:hover { background: var(--ch-bar-bg); }
.mcholc-hint { color: var(--ch-muted); font-size: .8rem; display: block; }

/* Chips */
.mcholc-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; min-height: 1.8rem; }
.mcholc-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--ch-bar-bg); border: 1px solid var(--ch-accent);
  border-radius: 20px; padding: .2rem .7rem; font-size: .85rem;
}
.mcholc-chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--ch-primary); font-size: 1rem; padding: 0; line-height: 1;
}

/* Tabs */
.mcholc-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.mcholc-tab {
  padding: .38rem .85rem; background: #f1f3f4; border: 1px solid var(--ch-border);
  border-radius: 20px; font-size: .85rem; cursor: pointer;
}
.mcholc-tab.active { background: var(--ch-primary); color: #fff; border-color: var(--ch-primary); }

/* Placeholder */
.mcholc-placeholder { color: var(--ch-muted); font-style: italic; padding: 1.5rem 0; }

/* Results table */
.mcholc-table-wrap { overflow-x: auto; border: 1px solid var(--ch-border); border-radius: var(--ch-radius); margin-bottom: .5rem; }
.mcholc-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mcholc-table thead th {
  background: #f8f9fa; padding: .55rem .7rem; text-align: left;
  font-weight: 600; border-bottom: 2px solid var(--ch-border); white-space: nowrap;
}
.mcholc-active-col { background: #e3f0ff !important; }
.mcholc-table tbody tr { border-bottom: 1px solid var(--ch-border); transition: background .1s; }
.mcholc-table tbody tr:last-child { border-bottom: none; }
.mcholc-table tbody tr:hover { background: var(--ch-row-hover); }
.mcholc-table tbody tr.mcholc-top { background: var(--ch-bar-bg, #e3f2fd); font-weight: 600; }
.mcholc-table td { padding: .5rem .7rem; vertical-align: middle; }
.mcholc-val { text-align: right; font-variant-numeric: tabular-nums; }
.mcholc-bar-col { width: 90px; }
.mcholc-bar { height: 10px; background: var(--ch-bar-fill); border-radius: 3px; min-width: 2px; }

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

/* Responsive */
@media (max-width: 640px) {
  .mcholc-table th:nth-child(2),
  .mcholc-table td:nth-child(2) { display: none; }
  .mcholc-bar-col { display: none; }
}

/* ── FAQ section ─────────────────────────────────────────────── */
.mchol-faq { max-width: 960px; margin: 2rem auto 0; font-family: inherit; }
.mchol-faq h2 { font-size: 1.2rem; margin-bottom: .75rem; color: var(--primary, #1565c0); }
.mchol-faq details { border: 1px solid var(--border, #bbdefb); border-radius: 6px; margin-bottom: .5rem; padding: .6rem .9rem; }
.mchol-faq details[open] { border-color: var(--primary, #1565c0); }
.mchol-faq summary { cursor: pointer; font-weight: 600; font-size: .95rem; list-style: none; padding-right: 1.4rem; position: relative; }
.mchol-faq summary::-webkit-details-marker { display: none; }
.mchol-faq summary::after { content: '+'; position: absolute; right: 0; color: var(--primary, #1565c0); font-size: 1.1rem; line-height: 1; }
.mchol-faq details[open] summary::after { content: '−'; }
.mchol-faq details p { margin: .6rem 0 .2rem; font-size: .92rem; line-height: 1.65; color: #444; }

/* ── Header grid (two-column layout) ────────────────────────── */
.mchol-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) {
    .mchol-header-grid { grid-template-columns: 1fr; }
}

/* ── Insight box (dataset snapshot) ─────────────────────────── */
.mchol-insight-box {
    background: #e3f2fd;
    border: 1px solid var(--border, #90caf9);
    border-radius: 8px;
    padding: 1rem 1.2rem;
}
.mchol-insight-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary, #1565c0);
    margin: 0 0 .6rem;
}
.mchol-insight-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: .9rem;
    line-height: 1.7;
    color: #333;
}
.mchol-insight-list li { border-bottom: 1px solid #dcedc8; padding: .2rem 0; }
.mchol-insight-list li:last-child { border-bottom: none; }

/* ── Context card ────────────────────────────────────────────── */
.mchol-context-card {
    margin-top: .8rem;
    background: #fff8e1;
    border-left: 4px solid #f9a825;
    border-radius: 0 6px 6px 0;
    padding: .7rem 1rem;
    font-size: .88rem;
    color: #444;
    line-height: 1.6;
}
.mchol-context-label {
    font-weight: 700;
    font-size: .85rem;
    color: #c43e00;
    margin: 0 0 .3rem;
}
.mchol-context-card p:last-child { margin: 0; }
.mchol-context-card a { color: var(--primary, #1565c0); }

/* ── Related tools section ───────────────────────────────────── */
.mchol-related {
    max-width: 1120px;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    margin-top: 2.5rem;
    padding: 0 1rem;
    box-sizing: border-box;
}
.mchol-related-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary, #1565c0);
    margin-bottom: 1rem;
}
.mchol-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.mchol-related-card {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
    border: 1px solid #dde;
    border-top: 3px solid var(--card-accent, var(--primary, #1565c0));
    border-radius: 8px;
    text-decoration: none;
    background: #fff;
    min-height: 140px;
    transition: box-shadow .18s, transform .18s;
}
.mchol-related-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
    transform: translateY(-2px);
}
.mchol-related-icon { font-size: 2.25rem; flex-shrink: 0; line-height: 1; color: var(--card-accent, #1565c0); }
.mchol-related-icon svg { width: 38px; height: 38px; flex-shrink: 0; }
.mchol-related-body { display: flex; flex-direction: column; gap: .25rem; }
.mchol-related-name { font-size: .9rem; font-weight: 700; color: #1a1a2e; }
.mchol-related-desc { font-size: .8rem; color: #555; margin: 0; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
