/* ── Polyphenol Comparison Tool — [compare_polyphenols] ─────────────────
   Brand colour: deep purple (#283593)
   ───────────────────────────────────────────────────────────────────── */

.mpc-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1a1a2e;
    max-width: 1100px;
    margin: 0 auto;
}

/* ── Food picker ── */
.mpc-picker {
    background: #f0f0fa;
    border: 1.5px solid #c5cae9;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
}
.mpc-picker-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #5c6b8a;
    margin-bottom: 12px;
}
.mpc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 38px;
    align-items: center;
}
.mpc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1.5px solid #283593;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #1a237e;
}
.mpc-chip button {
    background: none;
    border: none;
    cursor: pointer;
    color: #5c6b8a;
    font-size: 15px;
    line-height: 1;
    padding: 0;
}
.mpc-chip button:hover { color: #c0392b; }
.mpc-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.mpc-search-wrap { position: relative; flex: 1; min-width: 200px; }
.mpc-search-input {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #c5cae9;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    outline: none;
}
.mpc-search-input:focus {
    border-color: #283593;
    box-shadow: 0 0 0 3px rgba(40,53,147,.1);
}
.mpc-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #c5cae9;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}
.mpc-autocomplete-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #e8eaf6;
}
.mpc-autocomplete-item:last-child { border-bottom: none; }
.mpc-autocomplete-item:hover { background: #f0f0fa; }
.mpc-autocomplete-item .mpc-ac-cat {
    font-size: 11px;
    color: #5c6b8a;
    margin-left: 6px;
}
.mpc-compare-btn {
    background: #283593;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-transition: background .2s;
    transition: background .2s;
    white-space: nowrap;
}
.mpc-compare-btn:hover { background: #1a237e; }
.mpc-compare-btn:disabled { opacity: .5; cursor: default; }

/* ── Filters ── */
.mpc-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    align-items: flex-end;
}
.mpc-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 160px;
}
.mpc-filter-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #5c6b8a;
}
.mpc-filter-group select,
.mpc-filter-group input[type="text"] {
    border: 1.5px solid #c5cae9;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.mpc-filter-group select:focus { border-color: #283593; }

/* ── Table ── */
.mpc-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1.5px solid #c5cae9;
    margin-bottom: 16px;
}
.mpc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}
.mpc-table thead th {
    background: #e8eaf6;
    color: #1a237e;
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1.5px solid #c5cae9;
    white-space: nowrap;
}
.mpc-table thead th.mpc-th-food {
    text-align: center;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.mpc-table thead th.mpc-th-compound { min-width: 180px; }
.mpc-table tbody tr { border-bottom: 1px solid #e8eaf6; }
.mpc-table tbody tr:last-child { border-bottom: none; }
.mpc-table tbody tr:hover { background: #f0f0fa; }
.mpc-table tbody tr.mpc-class-header td {
    background: #e8eaf6;
    font-size: 11px;
    font-weight: 700;
    color: #283593;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 6px 14px;
    border-bottom: 1px solid #c5cae9;
}
.mpc-table td { padding: 9px 14px; vertical-align: middle; }
.mpc-compound-name { font-weight: 600; color: #1a237e; font-size: 13px; }
.mpc-compound-class { font-size: 11px; color: #5c6b8a; }
.mpc-cell-value {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #1a237e;
}
.mpc-cell-value.mpc-best { color: #1a237e; }
.mpc-cell-unit {
    font-size: 10px;
    font-weight: 400;
    color: #5c6b8a;
    display: block;
}
.mpc-cell-empty { text-align: center; color: #bbb; font-size: 18px; }

/* ── States ── */
.mpc-placeholder {
    text-align: center;
    padding: 50px 20px;
    color: #5c6b8a;
    font-size: 14px;
    border: 1.5px dashed #c5cae9;
    border-radius: 12px;
    margin-bottom: 16px;
}
.mpc-loading {
    text-align: center;
    padding: 40px 20px;
    color: #5c6b8a;
    font-size: 14px;
}
.mpc-spinner {
    display: inline-block;
    width: 22px; height: 22px;
    border: 3px solid #c5cae9;
    border-top-color: #283593;
    border-radius: 50%;
    -webkit-animation: mac-spin .7s linear infinite;
    animation: mac-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@-webkit-keyframes mac-spin { to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }
@keyframes mac-spin { to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }

/* ── Mini bar inside comparison cell ── */
.mpc-bar {
    display: block;
    height: 5px;
    border-radius: 3px;
    background: -webkit-linear-gradient(left, #283593, #9fa8da);
    background: linear-gradient(90deg, #283593, #9fa8da);
    margin-top: 3px;
    min-width: 2px;
    max-width: 100%;
}

/* ── Share bar ── */
.mpc-share-bar {
    display: none;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.mpc-share-bar.visible { display: flex; }
.mpc-share-label {
    font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: #5c6b8a; white-space: nowrap;
}
.mpc-share-icons { display: flex; gap: 8px; align-items: center; }
.mpc-social-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    border: 1.5px solid #c5cae9; background: #fff;
    cursor: pointer;
    -webkit-transition: all 0.18s;
    transition: all 0.18s;
    text-decoration: none; flex-shrink: 0;
}
.mpc-social-btn svg { width: 18px; height: 18px; display: block; }
.mpc-social-btn:hover { -webkit-transform: translateY(-2px); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.14); }
.mpc-social-btn.pinterest { border-color: #E60023; }
.mpc-social-btn.pinterest:hover { background: #E60023; }
.mpc-social-btn.pinterest:hover svg path { fill: #fff; }
.mpc-social-btn.facebook  { border-color: #1877F2; }
.mpc-social-btn.facebook:hover  { background: #1877F2; }
.mpc-social-btn.facebook:hover svg path { fill: #fff; }
.mpc-social-btn.whatsapp  { border-color: #25D366; }
.mpc-social-btn.whatsapp:hover  { background: #25D366; }
.mpc-social-btn.whatsapp:hover svg path { fill: #fff; }
.mpc-social-btn.twitter   { border-color: #000; }
.mpc-social-btn.twitter:hover   { background: #000; }
.mpc-social-btn.twitter:hover svg path { fill: #fff; }
.mpc-copy-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 600;
    border: 1.5px solid #c5cae9; cursor: pointer;
    background: #f0f0fa; color: #5c6b8a;
    -webkit-transition: all 0.15s;
    transition: all 0.15s; white-space: nowrap;
}
.mpc-copy-btn:hover { background: #e8eaf6; color: #1a1a2e; border-color: #283593; }
.mpc-copy-btn.copied { background: #283593; color: #fff; border-color: #283593; }

/* ── Select wrapper (styled select for cooking method) ── */
.mpc-select-wrap { position: relative; }
.mpc-select-wrap::after {
    content: '▾';
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    color: #283593; font-size: 11px; pointer-events: none;
}
.mpc-select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 28px;
    cursor: pointer;
    width: 100%;
}

/* ── Retention factor badge ── */
.mpc-rf-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 5px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    white-space: nowrap;
}
.mpc-rf-badge.mpc-rf-na {
    background: #f0f0f0;
    color: #888;
    border-color: #ccc;
}

/* ── Winner / best cell ── */
.mpc-cell-value.mpc-best {
    color: #1a237e;
    background: #e8eaf6;
}
.mpc-winner-star {
    color: #c8a020;
    font-size: 13px;
    display: inline;
}

/* ── Responsive ── */
@media (max-width: 680px) {
    .mpc-filters { flex-direction: column; }
    .mpc-table { font-size: 12px; }
    .mpc-table td, .mpc-table thead th { padding: 7px 8px; }
}

/* ── Attribution ── */
.mipb-data-source {
    margin-top: 1rem;
    font-size: 12px;
    color: #999;
    text-align: right;
}
.mipb-source-label { font-weight: 600; color: #888; }
.mipb-data-source a { color: #283593; text-decoration: none; }
.mipb-data-source a:hover { text-decoration: underline; }

/* ── Related tools section ───────────────────────────────────── */
.mat-related {
    /* Break out of the narrow 729 px Breakdance column so the
       4-card row can use the full section-container width (1120 px). */
    max-width: 1120px;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    margin-top: 2.5rem;
    padding: 0 1rem;                    /* breathing room at viewport edge */
    box-sizing: border-box;
}
.mat-related-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #283593;
    margin-bottom: 1rem;
}
.mat-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* always 4 cards in one row */
    gap: 1rem;
}
.mat-related-card {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
    border: 1px solid #dde;
    border-top: 3px solid var(--card-accent, #283593);
    border-radius: 8px;
    text-decoration: none;
    background: #fff;
    min-height: 140px;                  /* even out card heights */
    transition: box-shadow .18s, transform .18s;
}
.mat-related-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
    transform: translateY(-2px);
}
.mat-related-icon { font-size: 2.25rem; flex-shrink: 0; line-height: 1; color: var(--card-accent, #283593); }
.mat-related-icon svg { width: 38px; height: 38px; flex-shrink: 0; }
.mat-related-body { display: flex; flex-direction: column; gap: .25rem; }
.mat-related-name { font-size: .9rem; font-weight: 700; color: #1a1a2e; }
.mat-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;                   /* clamp to 3 lines max */
}
