/* Make It Plant Based — Recipe Cross-Database Panels (Phase 2)
 * Loaded ONLY on pages using [mipb_recipe_calculator]
 * Depends on CSS variables defined in form.css (:root block).
 * Mirrors the visual language of polyphenol-recipe.css.
 */

/* ── Outer section (injected after the polyphenol section) ─────────────────── */

.mipb-crossdb-section {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.mipb-crossdb-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin: 0 0 1rem !important;
}

.mipb-crossdb-icon {
    font-size: 14px;
    line-height: 1;
}

/* ── Panels container ────────────────────────────────────────────────────────── */

.mipb-crossdb-panels {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* ── Individual panel (<details>) ───────────────────────────────────────────── */

.mipb-crossdb-panel {
    border: 1px solid var(--border);
    border-radius: calc(var(--r) - 2px);
    overflow: hidden;
    background: var(--bg, #fafaf9);
}

.mipb-crossdb-panel-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    background: transparent;
    transition: background 0.15s;
    user-select: none;
}
.mipb-crossdb-panel-hdr::-webkit-details-marker { display: none; }
.mipb-crossdb-panel-hdr::before {
    content: '▶';
    font-size: 9px;
    color: var(--ink-light);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.mipb-crossdb-panel[open] > .mipb-crossdb-panel-hdr::before {
    transform: rotate(90deg);
}
.mipb-crossdb-panel-hdr:hover {
    background: var(--hover-bg, rgba(0,0,0,0.03));
}

.mipb-crossdb-panel-title {
    flex: 1;
}

.mipb-crossdb-coverage {
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-light);
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    padding: 1px 7px;
}

.mipb-crossdb-panel-total {
    font-size: 13px;
    font-weight: 700;
    color: var(--green, #2d7a45);
    margin-left: auto;
    white-space: nowrap;
}

/* ── Panel body ─────────────────────────────────────────────────────────────── */

.mipb-crossdb-panel-body {
    padding: 0 0.9rem 0.75rem;
    border-top: 1px solid var(--border);
}

/* ── Data rows ───────────────────────────────────────────────────────────────── */

.mipb-crossdb-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
    border-bottom: 1px dashed rgba(0,0,0,0.05);
}
.mipb-crossdb-row:last-of-type {
    border-bottom: none;
}

.mipb-crossdb-row-label {
    color: var(--ink);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mipb-crossdb-row-sub {
    font-size: 11px;
    color: var(--ink-light);
    font-weight: 400;
}

.mipb-crossdb-row-val {
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── GI badges ───────────────────────────────────────────────────────────────── */

.mipb-gi-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    letter-spacing: .03em;
}
.mipb-gi-low    { background: #dcfce7; color: #166534; }
.mipb-gi-medium { background: #fef9c3; color: #854d0e; }
.mipb-gi-high   { background: #fee2e2; color: #991b1b; }

/* ── Footnotes ───────────────────────────────────────────────────────────────── */

.mipb-crossdb-caveat {
    font-size: 11px;
    color: var(--ink-light);
    margin: 0.4rem 0 0;
    line-height: 1.4;
}
.mipb-crossdb-caveat--serving {
    color: #b45309;
}

.mipb-crossdb-source {
    font-size: 10px;
    color: var(--ink-light);
    margin: 0.35rem 0 0;
    line-height: 1.4;
    opacity: 0.75;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 520px) {
    .mipb-crossdb-section {
        padding: 1rem 1rem;
    }
    .mipb-crossdb-panel-hdr {
        padding: 0.5rem 0.65rem;
    }
    .mipb-crossdb-panel-body {
        padding: 0 0.65rem 0.6rem;
    }
}
