/* ==========================================================================
   MIPB FDC-Derived Tools — fdc-tools.css
   Covers [ala_table] and [carotenoid_table] — both use .mfdc-* classes.
   Carotenoid tool adds .mcar-wrap to override the accent colour.
   ========================================================================== */

/* ---- Shared variables — ALA (plant green) ---- */
:root {
  --fdc-primary:   #2e7d32;   /* forest green — ALA / omega-3 */
  --fdc-accent:    #66bb6a;
  --fdc-bar-bg:    #e8f5e9;
  --fdc-bar-fill:  #2e7d32;
  --fdc-insight-bg: #e8f5e9;
  --fdc-insight-border: #a5d6a7;
  --fdc-insight-text: #1b5e20;
  --fdc-border:    #e0e0e0;
  --fdc-row-hover: #f1f8f2;
  --fdc-muted:     #757575;
  --fdc-radius:    6px;
}

/* ---- Carotenoid overrides — warm orange ---- */
.mcar-wrap,
.mcar-header,
.mcar-wrap ~ .mfdc-faq,
.mcar-wrap ~ .mfdc-related {
  --fdc-primary:   #c04000;
  --fdc-accent:    #fb8c00;
  --fdc-bar-bg:    #fff3e0;
  --fdc-bar-fill:  #c04000;
  --fdc-insight-bg: #fff3e0;
  --fdc-insight-border: #ffcc80;
  --fdc-insight-text: #993300;
  --fdc-row-hover: #fff8f0;
}

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

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

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

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

.mfdc-search:focus,
.mfdc-category-select:focus {
  outline: 2px solid var(--fdc-primary);
  outline-offset: 1px;
}

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

/* ==========================================================================
   Sort tabs (carotenoid tool)
   ========================================================================== */
.mfdc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .8rem;
}

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

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

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

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

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

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

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

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

.mfdc-null { color: var(--fdc-muted); }

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

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

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

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

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

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

/* ==========================================================================
   FAQ section
   ========================================================================== */
.mfdc-faq {
  max-width: 1100px;
  margin: 2rem auto 0;
}

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

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

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

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

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

/* ==========================================================================
   FDC Compare tools — [compare_ala] and [compare_carotenoid]
   Classes: .mfdcc-*
   ========================================================================== */

/* ALA compare: green */
.mfdcc-ala {
  --fdcc-primary:   #2e7d32;
  --fdcc-bar-fill:  #2e7d32;
  --fdcc-bar-bg:    #e8f5e9;
  --fdcc-row-hover: #f1f8f2;
}

/* Carotenoid compare: warm orange */
.mfdcc-car {
  --fdcc-primary:   #c04000;
  --fdcc-bar-fill:  #c04000;
  --fdcc-bar-bg:    #fff3e0;
  --fdcc-row-hover: #fff8f0;
}

.mfdcc-wrap {
  max-width: 1100px;
  margin: 0 auto;
  font-family: inherit;
}

.mfdcc-search-wrap { margin-bottom: .85rem; }

.mfdcc-label {
  display: block;
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: .4rem;
  color: #333;
}

.mfdcc-autocomplete { position: relative; }

.mfdcc-input {
  width: 100%;
  max-width: 480px;
  padding: .45rem .75rem;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: .93rem;
  background: #fff;
  box-sizing: border-box;
}
.mfdcc-input:focus { outline: 2px solid var(--fdcc-primary, #2e7d32); outline-offset: 1px; }

.mfdcc-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}
.mfdcc-dropdown li {
  padding: .5rem .75rem;
  cursor: pointer;
  font-size: .9rem;
  border-bottom: 1px solid #f0f0f0;
}
.mfdcc-dropdown li:last-child { border-bottom: none; }
.mfdcc-dropdown li:hover { background: #f5f5f5; }

.mfdcc-hint {
  display: block;
  font-size: .78rem;
  color: #777;
}

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

.mfdcc-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--fdcc-bar-bg, #e8f5e9);
  border: 1px solid var(--fdcc-primary, #2e7d32);
  border-radius: 20px;
  padding: .25rem .65rem;
  font-size: .82rem;
  color: #333;
}

.mfdcc-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #666;
  padding: 0;
  display: flex;
  align-items: center;
}
.mfdcc-chip-remove:hover { color: #c00; }

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

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

/* Results table */
.mfdcc-results { margin-bottom: .5rem; }

.mfdcc-placeholder {
  color: #777;
  font-size: .9rem;
  font-style: italic;
  margin: 1rem 0;
}

.mfdcc-table-wrap {
  overflow-x: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}

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

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

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

.mfdcc-name { font-weight: 500; }
.mfdcc-cat  { font-size: .82rem; color: #555; }
.mfdcc-val  { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.mfdcc-col-bar { width: 100px; }
.mfdcc-bar {
  height: 10px;
  background: var(--fdcc-bar-fill, #2e7d32);
  border-radius: 3px;
  min-width: 2px;
}

.mfdcc-legend {
  margin-top: .6rem;
  font-size: .82rem;
  color: #666;
}

@media (max-width: 600px) {
  .mfdcc-cat { display: none; }
  .mfdcc-col-bar { display: none; }
}

/* ==========================================================================
   Responsive — hide lower-priority columns on smaller screens
   ========================================================================== */

/* Hide category on narrow viewports */
@media (max-width: 640px) {
  .mfdc-col-cat { display: none; }
  .mfdc-col-bar { display: none; }
}

/* Carotenoid: progressively hide minor columns */
@media (max-width: 900px) {
  .mcar-col-cx { display: none; }  /* β-Cryptoxanthin */
}
@media (max-width: 760px) {
  .mcar-col-ac  { display: none; }  /* α-Carotene */
  .mcar-col-lut { display: none; }  /* Lutein+Zeaxanthin */
}
@media (max-width: 560px) {
  .mcar-col-lyc { display: none; }  /* Lycopene */
}

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

/* ── Insight box ───────────────────────────────────────────────────────── */
.mfdc-insight-box {
    background: var(--fdc-insight-bg, #e8f5e9);
    border: 1px solid var(--fdc-insight-border, #a5d6a7);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
}
.mfdc-insight-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--fdc-insight-text, #1b5e20);
    margin: 0 0 0.75rem;
}
.mfdc-insight-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: #333;
}
.mfdc-insight-list li::before {
    content: '✓ ';
    color: var(--fdc-insight-text, #1b5e20);
    font-weight: 700;
}

/* ── Context card ──────────────────────────────────────────────────────── */
.mfdc-context-card {
    margin-top: 1rem;
    background: #fff;
    border: 1px solid var(--fdc-insight-border, #a5d6a7);
    border-left: 4px solid var(--fdc-primary, #2e7d32);
    border-radius: 6px;
    padding: 0.9rem 1rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #444;
}
.mfdc-context-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fdc-insight-text, #1b5e20);
    margin: 0 0 0.4rem;
}
.mfdc-context-card p:last-child { margin: 0; }
.mfdc-context-card a { color: var(--fdc-primary, #2e7d32); }

/* ── Related tools grid ────────────────────────────────────────────────── */
.mfdc-related {
    max-width: 1120px;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    margin-top: 2.5rem;
    padding: 0 1rem;
    box-sizing: border-box;
}
.mfdc-related-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--fdc-primary);
}
.mfdc-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.mfdc-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, var(--fdc-primary, #2e7d32));
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    min-height: 140px;
    transition: box-shadow 0.18s, transform 0.18s;
}
.mfdc-related-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.1); transform: translateY(-2px); }
.mfdc-related-icon { font-size: 2.25rem; flex-shrink: 0; color: var(--card-accent, var(--fdc-primary, #2e7d32)); }
.mfdc-related-icon svg { width: 38px; height: 38px; flex-shrink: 0; }
.mfdc-related-name { display: block; font-size: 0.9rem; font-weight: 700; color: var(--card-accent, var(--fdc-primary, #2e7d32)); margin-bottom: 0.25rem; }
.mfdc-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; }
