/* ============================================================
   MIPB — Ellagitannins Table & Comparison Tool
   Stylesheet for [ellagic_table] and [compare_ellagic]
   Theme: Deep Purple — pomegranate elegance
   ============================================================ */

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

/* ── Top-10 SEO block ────────────────────────────────────────── */
.mell-top10 { margin-bottom: 0; }
.mell-top10 h2 { font-size: 1.25rem; margin-bottom: .5rem; color: #6A1B9A; }
.mell-top10-list { margin: 0; padding-left: 1.4rem; }
.mell-top10-list li { margin-bottom: .3rem; line-height: 1.5; }

/* ── Insight box ─────────────────────────────────────────────── */
.mell-insight-box {
    background: #F3E5F5;
    border: 1px solid #CE93D8;
    border-left: 4px solid #6A1B9A;
    border-radius: 6px;
    padding: .85rem 1rem;
    margin-bottom: .9rem;
}
.mell-insight-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #6A1B9A;
    margin: 0 0 .55rem;
}
.mell-insight-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .88rem;
    color: #333;
}
.mell-insight-list li { margin-bottom: .28rem; line-height: 1.5; }

/* ── Main wrap ────────────────────────────────────────────────── */
.mell-wrap {
    --primary:  #6A1B9A;
    --bg-light: #F3E5F5;
    --border:   #CE93D8;
    --bar-bg:   #8E24AA;
    max-width: 1040px;
    margin: 0 auto;
    font-family: inherit;
}

/* ── Controls row ────────────────────────────────────────────── */
.mell-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: .75rem;
}
.mell-search,
.mell-select {
    padding: .45rem .7rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .9rem;
    background: #fff;
    color: #333;
    outline: none;
    transition: border-color .15s;
}
.mell-search { flex: 1 1 200px; min-width: 150px; }
.mell-select { flex: 0 1 220px; }
.mell-search:focus,
.mell-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px #F3E5F5; }

.mell-btn {
    padding: .45rem .9rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: .88rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.mell-btn:hover { background: #8E24AA; }

/* ── Table ────────────────────────────────────────────────────── */
.mell-table-wrap { overflow-x: auto; margin-top: .6rem; }
.mell-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.mell-table th {
    background: var(--primary);
    color: #fff;
    padding: .55rem .75rem;
    text-align: left;
    white-space: nowrap;
    font-weight: 600;
}
.mell-table td {
    padding: .45rem .75rem;
    border-bottom: 1px solid #F3E5F5;
    vertical-align: middle;
    color: #222;
}
.mell-table tr:hover td { background: var(--bg-light); }
.mell-table tr:last-child td { border-bottom: none; }

.col-rank  { width: 3rem; text-align: center; color: #777; font-size: .82rem; }
.col-food  { min-width: 160px; }
.col-group { min-width: 120px; color: #555; font-size: .85rem; }
.col-val   { width: 8rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.col-bar   { width: 120px; padding-right: .5rem; }

/* ── Bar ─────────────────────────────────────────────────────── */
.mell-bar {
    height: 10px;
    background: linear-gradient(90deg, #6A1B9A, #8E24AA);
    border-radius: 3px;
    min-width: 2px;
}

/* ── Pagination ──────────────────────────────────────────────── */
.mell-pagination {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .75rem;
    flex-wrap: wrap;
}
.mell-page-info { font-size: .85rem; color: #555; flex: 1 1 auto; }
.mell-page-btn {
    padding: .4rem .85rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s;
}
.mell-page-btn:hover { background: #8E24AA; }

/* ── Loading / empty states ──────────────────────────────────── */
.mell-loading,
.mell-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #888;
    font-style: italic;
}

/* ── Attribution ─────────────────────────────────────────────── */
.mell-attribution {
    margin-top: 1rem;
    font-size: .78rem;
    color: #777;
    line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────
   COMPARISON TOOL — [compare_ellagic]
   ──────────────────────────────────────────────────────────── */

.mellc-wrap {
    --primary:  #6A1B9A;
    --bg-light: #F3E5F5;
    --border:   #CE93D8;
    max-width: 960px;
    margin: 0 auto;
}

/* ── Picker area ─────────────────────────────────────────────── */
.mellc-picker-area { margin-bottom: 1rem; }
.mellc-search-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.mellc-search {
    flex: 1;
    padding: .5rem .8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .9rem;
    background: #fff;
    outline: none;
    transition: border-color .15s;
}
.mellc-search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px #F3E5F5; }

/* ── Suggestion dropdown ────────────────────────────────────── */
.mellc-suggestions {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(106,27,154,.12);
    position: relative;
    z-index: 100;
}
.mellc-sug-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    cursor: pointer;
    border-bottom: 1px solid #F3E5F5;
    font-size: .88rem;
}
.mellc-sug-item:last-child { border-bottom: none; }
.mellc-sug-item:hover { background: var(--bg-light); }
.mellc-sug-item .sug-name { flex: 1; font-weight: 500; }
.mellc-sug-item .sug-cat  { font-size: .78rem; color: #777; white-space: nowrap; }
.mellc-sug-item .sug-val  { font-size: .82rem; color: var(--primary); font-weight: 600;
                              white-space: nowrap; margin-left: .3rem; }

/* ── Chips ───────────────────────────────────────────────────── */
.mellc-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.mellc-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .65rem;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: .83rem;
    color: #333;
}
.mellc-chip-x {
    background: none;
    border: none;
    cursor: pointer;
    color: #777;
    font-size: 1rem;
    line-height: 1;
    padding: 0 .1rem;
    transition: color .1s;
}
.mellc-chip-x:hover { color: var(--primary); }

/* ── Table ───────────────────────────────────────────────────── */
.mellc-table-wrap { overflow-x: auto; margin-top: .75rem; }
.mellc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.mellc-table th {
    background: var(--primary);
    color: #fff;
    padding: .55rem .75rem;
    text-align: left;
    white-space: nowrap;
    font-weight: 600;
}
.mellc-table td {
    padding: .5rem .75rem;
    border-bottom: 1px solid #F3E5F5;
    vertical-align: middle;
    color: #222;
}
.mellc-table tr:hover td { background: var(--bg-light); }
.mellc-table tr:last-child td { border-bottom: none; }
.mellc-table .col-val {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--primary);
    width: 9rem;
}
.mellc-table .col-bar { width: 160px; }

/* ── Bar ─────────────────────────────────────────────────────── */
.mellc-bar {
    height: 12px;
    background: linear-gradient(90deg, #6A1B9A, #8E24AA);
    border-radius: 3px;
    min-width: 2px;
}

/* ── Legend & attribution ─────────────────────────────────────── */
.mellc-legend {
    margin-top: .75rem;
    font-size: .85rem;
    color: #555;
    line-height: 1.6;
}
.mellc-attribution {
    margin-top: .5rem;
    font-size: .78rem;
    color: #777;
    line-height: 1.5;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .mell-controls { flex-direction: column; align-items: stretch; }
    .mell-search, .mell-select, .mell-btn { width: 100%; }
    .mellc-search { width: 100%; }
    .col-group { display: none; }
    .mell-table .col-group { display: none; }
}

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