/* ==========================================================================
   MIPB Oxalate Tools — oxalate-table.css
   Covers [oxalate_table] (.mox-*) and [compare_oxalate] (.moxc-*)
   ========================================================================== */

/* ---- Shared variables ---- */
:root {
  --ox-primary:   #6a1b9a;   /* deep purple — kidney stone awareness color */
  --ox-accent:    #9c27b0;
  --ox-bar-bg:    #f3e5f5;
  --ox-bar-fill:  #6a1b9a;
  --ox-border:    #e0e0e0;
  --ox-row-hover: #faf5fc;
  --ox-muted:     #757575;
  --ox-radius:    6px;
}

/* ============================================================
   [oxalate_table] — Ranking tool (.mox-*)
   ============================================================ */

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

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

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

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

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

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

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

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

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

/* ── Context card ────────────────────────────────────────────── */
.mox-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;
}
.mox-context-label {
    font-weight: 700;
    font-size: .85rem;
    color: #c43e00;
    margin: 0 0 .3rem;
}
.mox-context-card p:last-child { margin: 0; }
.mox-context-card a { color: var(--primary, #6a1b9a); }

/* ── Related tools section ───────────────────────────────────── */
.mox-related {
    max-width: 1120px;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    margin-top: 2.5rem;
    padding: 0 1rem;
    box-sizing: border-box;
}
.mox-related-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary, #6a1b9a);
    margin-bottom: 1rem;
}
.mox-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.mox-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, #6a1b9a));
    border-radius: 8px;
    text-decoration: none;
    background: #fff;
    min-height: 140px;
    transition: box-shadow .18s, transform .18s;
}
.mox-related-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
    transform: translateY(-2px);
}
.mox-related-icon { font-size: 2.25rem; flex-shrink: 0; line-height: 1; color: var(--card-accent, #6a1b9a); }
.mox-related-icon svg { width: 38px; height: 38px; flex-shrink: 0; }
.mox-related-body { display: flex; flex-direction: column; gap: .25rem; }
.mox-related-name { font-size: .9rem; font-weight: 700; color: #1a1a2e; }
.mox-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; }

/* ============================================================
   [compare_oxalate] — Comparison tool (.moxc-*)
   ============================================================ */

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

.moxc-autocomplete { position: relative; max-width: 480px; }
.moxc-input {
  width: 100%; padding: .45rem .7rem; border: 1px solid var(--ox-border);
  border-radius: var(--ox-radius); font-size: .93rem; box-sizing: border-box;
}
.moxc-input:focus { outline: 2px solid var(--ox-primary); outline-offset: 1px; }
.moxc-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid var(--ox-border);
  border-top: none; border-radius: 0 0 var(--ox-radius) var(--ox-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);
}
.moxc-dropdown li {
  padding: .5rem .8rem; cursor: pointer; font-size: .9rem; border-bottom: 1px solid #f0f0f0;
}
.moxc-dropdown li:hover { background: var(--ox-bar-bg); }
.moxc-hint { color: var(--ox-muted); font-size: .8rem; display: block; }

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

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

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

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

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

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