/* ── Structür AGP Registry — Public Styles ──
 *
 * This stylesheet is intentionally color-neutral. It does not impose any
 * foreground color, background color, or link color. All such values are
 * inherited from the active WordPress theme.
 *
 * Technique notes:
 *  - color:inherit and background:transparent are set explicitly on all
 *    containers, table parts, and cards so theme resets cannot re-introduce
 *    browser-default or theme-default white backgrounds.
 *  - border-color:currentColor is used instead of border-color:inherit.
 *    currentColor always resolves to the element's own computed text color,
 *    which is reliable even when the color cascade is partially interrupted
 *    by theme stylesheets.
 *  - rgba(127,127,127,N) at very low opacity is used only where a subtle
 *    structural tint is needed (row hover, dt label column). At ~7–8% opacity
 *    this is perceptually neutral in both light and dark schemes.
 *
 * Fixed colors used (justified):
 *  - Status badge bg/fg pairs: semantic meaning requires self-contained contrast.
 *  - Notice border-left accents (#ca8a04 amber, #0284c7 blue): single decorative
 *    lines indicating caution vs. info; no background or text color is forced.
 * ── */

:root {
    --sagp-radius: 6px;
}

/* ── Root containers ──
 * Explicit color:inherit + background:transparent establishes a clean
 * inheritance root even when theme wrappers set conflicting values.
 * ── */
.sagp-registry,
.sagp-detail {
    color: inherit;
    background: transparent;
    line-height: 1.6;
    max-width: 100%;
}

/* ── Search / filter form ── */
.sagp-search-form {
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: var(--sagp-radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    opacity: .9;
}

.sagp-search-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    align-items: center;
}

.sagp-sort-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    font-size: .875em;
}

/* Inputs and selects: inherit text color; use transparent background so the
   theme's input styles show through. Native browser chrome remains intact. */
.sagp-search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid currentColor;
    border-radius: var(--sagp-radius);
    font-size: 1em;
    line-height: 1.4;
    color: inherit;
    background: transparent;
}

.sagp-select {
    padding: 6px 10px;
    border: 1px solid currentColor;
    border-radius: var(--sagp-radius);
    font-size: .875em;
    color: inherit;
    background: transparent;
}

.sagp-label {
    font-size: .8125em;
    opacity: .7;
    white-space: nowrap;
}

/* ── Buttons ── */
.sagp-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--sagp-radius);
    font-size: .875em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.4;
    white-space: nowrap;
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
}
.sagp-btn:hover {
    opacity: .7;
    color: inherit;
}
.sagp-btn-primary {
    font-weight: 700;
}
.sagp-btn-secondary {
    opacity: .75;
}
.sagp-btn-secondary:hover {
    opacity: 1;
}

/* ── Results info ── */
.sagp-results-info {
    font-size: .8125em;
    opacity: .7;
    margin-bottom: 12px;
}

/* ── Status badges ──
 * Fixed foreground+background pairs. Semantic colors (green/neutral/red) must
 * be legible independently of the theme palette, so they use self-contained
 * contrast ratios within the pill rather than inheriting from the page.
 * ── */
.sagp-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .6875em;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.sagp-status-active     { background: #166534; color: #dcfce7; }
.sagp-status-inactive   { background: #44403c; color: #d6d3d1; }
.sagp-status-deprecated { background: #991b1b; color: #fee2e2; }
.sagp-status-lg         { font-size: .875em; padding: 4px 12px; }

/* ── Cert ID code ── */
.sagp-cert-id {
    font-family: ui-monospace, "Courier New", monospace;
    font-size: .8125em;
    color: inherit;
    background: transparent;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid currentColor;
    opacity: .85;
}
.sagp-cert-id-lg {
    font-size: 1em;
    padding: 4px 10px;
}

/* ── Desktop table ──
 * Every table element gets explicit background:transparent and color:inherit
 * to defeat any theme or browser UA rule that would paint table rows white.
 * ── */
.sagp-table-wrap {
    overflow-x: auto;
    margin-bottom: 20px;
}

.sagp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875em;
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: var(--sagp-radius);
    overflow: hidden;
    opacity: .95;
}

.sagp-table thead,
.sagp-table tbody,
.sagp-table tfoot,
.sagp-table tr {
    color: inherit;
    background: transparent;
}

.sagp-table thead {
    border-bottom: 2px solid currentColor;
    opacity: .9;
}

.sagp-table th {
    color: inherit;
    background: transparent;
    padding: 12px 14px;
    text-align: left;
    font-size: .75em;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.sagp-table td {
    color: inherit;
    background: transparent;
    padding: 11px 14px;
    border-bottom: 1px solid currentColor;
    vertical-align: middle;
    opacity: .95;
}

.sagp-table tbody tr:hover td {
    background: rgba(127, 127, 127, .08);
}
.sagp-table tbody tr:last-child td {
    border-bottom: none;
}

.sagp-table a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}
.sagp-table a:hover { opacity: .7; }

/* ── Mobile cards (hidden on desktop) ── */
.sagp-cards { display: none; }

/* ── Pagination ── */
.sagp-pagination {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 20px;
    align-items: center;
}

.sagp-page-link {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid currentColor;
    border-radius: var(--sagp-radius);
    font-size: .8125em;
    text-decoration: none;
    color: inherit;
    background: transparent;
    transition: opacity 0.15s;
}
.sagp-page-link:hover {
    opacity: .7;
    color: inherit;
}
.sagp-page-current {
    border-width: 2px;
    font-weight: 700;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
    .sagp-table-wrap { display: none; }
    .sagp-cards      { display: block; }

    .sagp-card {
        color: inherit;
        background: transparent;
        border: 1px solid currentColor;
        border-radius: var(--sagp-radius);
        padding: 16px;
        margin-bottom: 12px;
        opacity: .95;
    }
    .sagp-card-title {
        font-size: 1em;
        font-weight: 700;
        margin-bottom: 8px;
    }
    .sagp-card-title a {
        color: inherit;
        text-decoration: underline;
        text-underline-offset: 2px;
    }
    .sagp-card-meta {
        font-size: .8125em;
        opacity: .85;
        margin-bottom: 4px;
    }
    .sagp-card-label {
        font-weight: 600;
        margin-right: 4px;
    }

    .sagp-search-row   { flex-direction: column; }
    .sagp-search-input { min-width: 100%; }
}

/* ── Detail page ── */
.sagp-detail {
    max-width: 720px;
}

.sagp-back-link {
    display: inline-block;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-size: .875em;
    margin-bottom: 16px;
}
.sagp-back-link:hover { opacity: .7; }

.sagp-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.sagp-detail-product-name {
    margin: 0;
    font-size: 1.5em;
    font-weight: 700;
    color: inherit;
}

/* ── Notices ──
 * Only a left-border accent is colored. Background and text inherit from theme.
 * ── */
.sagp-notice {
    color: inherit;
    background: transparent;
    padding: 12px 16px;
    border-radius: var(--sagp-radius);
    margin-bottom: 16px;
    font-size: .875em;
    border-left: 4px solid #ca8a04;
}
.sagp-notice-info {
    border-left-color: #0284c7;
}

/* ── Detail field list ── */
.sagp-detail-fields {
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: var(--sagp-radius);
    margin: 0 0 24px;
    overflow: hidden;
}

.sagp-detail-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    border-bottom: 1px solid currentColor;
}
.sagp-detail-row:last-child { border-bottom: none; }

.sagp-detail-row dt {
    color: inherit;
    background: rgba(127, 127, 127, .07);
    padding: 12px 16px;
    font-weight: 600;
    font-size: .8125em;
    opacity: .8;
    border-right: 1px solid currentColor;
    display: flex;
    align-items: center;
}

.sagp-detail-row dd {
    color: inherit;
    background: transparent;
    padding: 12px 16px;
    margin: 0;
    font-size: .875em;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.sagp-not-found {
    color: inherit;
    text-align: center;
    padding: 40px 20px;
}

@media (max-width: 600px) {
    .sagp-detail-row {
        grid-template-columns: 1fr;
    }
    .sagp-detail-row dt {
        border-right: none;
        border-bottom: 1px solid currentColor;
    }
}
