/* Only for GHP Index Mapping tool */

.ghp-map {
    --ghp-highlight-focus: var(--iw-text);
    --ghp-highlight-1: #c2410c;
    --ghp-highlight-2: #21855b;
    --ghp-highlight-3: #2563a9;
    --ghp-highlight-4: #a21caf;
    --ghp-table-border: #999999;
}

:root[data-theme="dark"] .ghp-map {
    --ghp-highlight-1: #ffb38a;
    --ghp-highlight-2: #8ee0ad;
    --ghp-highlight-3: #8db9ff;
    --ghp-highlight-4: #f0a0ff;
    --ghp-table-border: var(--iw-border-strong);
}

.ghp-map {
    display: flex;
    gap: 10px;

    /* No wrapping: wrapping ruins "fill remaining height" layouts */
    flex-wrap: nowrap;
}

/* Panels */
.ghp-map .panel {
    min-height: 0; /* critical */
    min-width: 0;  /* critical */

    padding: 10px;

    display: flex;
    flex-direction: column; /* header + scrollable content */
}

/* Left panel sizing */
.ghp-map .panel-left {
    flex: 0 0 35%;
}

/* Right panel sizing */
.ghp-map .panel-right {
    flex: 1 1 auto;
    gap: 10px;
}

/* Matrix sub-panels (right side) */
.ghp-map .matrix-panel {
    flex: 1 1 0;     /* split available height evenly */
    min-height: 0;   /* critical for inner scroll */
    min-width: 0;

    padding: 10px;

    display: flex;
    flex-direction: column;
}

/* Headings: avoid default big margins that steal vertical space */
.ghp-map h2 {
    margin: 0 0 10px 0;
    font-size: 16px;
    flex: 0 0 auto;
}

/* The ONLY things that should scroll: table hosts */
.ghp-map .table-host {
    flex: 1 1 auto;
    min-height: 0;  /* critical */
    min-width: 0;

    overflow: auto; /* scroll within panel */
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--iw-surface);
}

/* Table styling scoped to this tool */
.ghp-map table {
    width: 100%;
    border-collapse: collapse;
}

.ghp-map td,
.ghp-map th {
    border: 1px solid var(--ghp-table-border);
    text-align: center;
    padding: 5px;
}

.ghp-map .ghp-highlight-active {
    color: var(--ghp-active-highlight);
    font-weight: 800;
}

.ghp-map .ghp-highlight-focus {
    --ghp-active-highlight: var(--ghp-highlight-focus);
}

.ghp-map .ghp-highlight-1 {
    --ghp-active-highlight: var(--ghp-highlight-1);
}

.ghp-map .ghp-highlight-2 {
    --ghp-active-highlight: var(--ghp-highlight-2);
}

.ghp-map .ghp-highlight-3 {
    --ghp-active-highlight: var(--ghp-highlight-3);
}

.ghp-map .ghp-highlight-4 {
    --ghp-active-highlight: var(--ghp-highlight-4);
}

/* If your JS injects buttons into cells, this is ok, but beware huge tables */
.ghp-map button {
    width: 100%;
    height: 100%;
    font-weight: bold;
    cursor: pointer;
}

/* Responsive: stack panels on narrow screens */
@media (max-width: 900px) {
    .ghp-map {
        flex-direction: column;
    }

    .ghp-map .panel-left {
        flex: 0 0 auto; /* natural height, content scrolls inside left-table */
    }
}
