/* M16 Specyfikacja — przycisk + popup z tabelą wymiarów */

.m16spec { }

/* --- przycisk --- */
.m16spec-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 12px;
    line-height: 1.6;
    font-weight: 600;
    color: #43611b;
    background: transparent;
    border: 1px solid #7a9d3f;
    border-radius: 20px;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.m16spec-btn:hover,
.m16spec-btn:focus {
    background: #7a9d3f;
    color: #fff;
    outline: none;
}

/* przyciski wstrzyknięte do nagłówka „Inne modele:” — razem, w prawym górnym rogu */
.m16bv-title.m16spec-has-btn {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.m16bv-title.m16spec-has-btn .m16spec-btn {
    flex: 0 0 auto;
    margin-left: 0;
}
/* pierwszy przycisk odpycha grupę do prawej krawędzi, kolejne trzymają się go */
.m16bv-title.m16spec-has-btn .m16spec-btn:first-of-type {
    margin-left: auto;
}
/* wariant bez bloku wariantów — przycisk sam pod opisem */
.m16spec--standalone {
    margin: 0 0 15px;
    text-align: right;
}

/* --- popup --- */
.m16spec-modal[hidden] { display: none; }
.m16spec-modal {
    position: fixed;
    inset: 0;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.m16spec-backdrop {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0, 0, 0, .55);
}
.m16spec-dialog {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
    width: 100%;
    max-width: 860px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.m16spec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #565655;
    color: #fff;
}
.m16spec-heading {
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.m16spec-close {
    background: none;
    border: 0;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}
.m16spec-close:hover { color: #92c23b; }
.m16spec-body {
    padding: 16px;
    overflow: auto;
    color: #333;
}

/* tabela w popupie */
.m16spec-body .table-wrapper { overflow-x: auto; }
.m16spec-body table {
    width: auto !important;
    min-width: 100%;
    max-width: none !important;
    height: auto !important;
    margin: 0 auto !important;
    border-collapse: collapse;
    font-size: 14px;
}
/* ujednolicenie typografii — część tabel niesie własne font-family/size z wklejek */
.m16spec-body table,
.m16spec-body tr,
.m16spec-body th,
.m16spec-body td,
.m16spec-body th span,
.m16spec-body td span {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: 1.5 !important;
    height: auto !important;
}
/* inline color:#000000 z importu — kolor tekstu ma być jeden dla całej tabeli */
.m16spec-body th span,
.m16spec-body td span,
.m16spec-body th font,
.m16spec-body td font,
.m16spec-body th b,
.m16spec-body td b { color: inherit !important; }
.m16spec-body th p,
.m16spec-body td p { margin: 0 !important; }
.m16spec-body th,
.m16spec-body td {
    border: 1px solid #e2e2e2;
    padding: 7px 10px;
    text-align: center;
}
.m16spec-body thead th {
    background: #7a9d3f;
    color: #fff;
    font-weight: 600;
    border-color: #7a9d3f;
}
/* tabele bez <thead> — pierwszy wiersz pełni rolę nagłówka (klasa nadawana w JS) */
.m16spec-body table.m16spec-nothead > tbody > tr:first-child > td {
    background: #7a9d3f;
    border-color: #7a9d3f;
    color: #fff;
    font-weight: 600;
}
.m16spec-body table.m16spec-nothead > tbody > tr:first-child > td b,
.m16spec-body table.m16spec-nothead > tbody > tr:first-child > td strong,
.m16spec-body table.m16spec-nothead > tbody > tr:first-child > td span { color: #fff; }
.m16spec-body table.m16spec-nothead > tbody > tr:nth-child(odd):not(:first-child) { background: #f7f7f7; }
.m16spec-body table:not(.m16spec-nothead) tbody tr:nth-child(even) { background: #f7f7f7; }
.m16spec-body tbody tr:hover { background: #eef3e4; }
/* zielone pogrubienie = wyróżniony wariant w tabeli WYMIARÓW; w tabeli materiałów
   etykiety wierszy bywają w <strong> i mają być zwykłym tekstem */
.m16spec-body table:not(.m16spec-rowhead) tbody td strong { color: #43611b; }
.m16spec-body table.m16spec-rowhead strong,
.m16spec-body table.m16spec-rowhead b,
.m16spec-body th strong,
.m16spec-body th b { color: inherit; font-weight: 600; }

/* tabela materiałów: etykiety w pierwszej kolumnie (<th> w każdym wierszu) */
.m16spec-body table.m16spec-rowhead tr > th:first-child {
    background: #f4f4f4;
    color: #333;
    border-color: #e2e2e2;
    text-align: left;
    font-weight: 600;
}
.m16spec-body table.m16spec-rowhead tbody tr > th:not(:first-child) {
    background: transparent;
    color: #333;
    text-align: center;
    font-weight: 600;
}
/* zielony pasek tylko dla wiersza uznanego w JS za nagłówek kolumn (.m16spec-hrow) */
.m16spec-body table.m16spec-rowhead tr.m16spec-hrow > th,
.m16spec-body table.m16spec-rowhead tr.m16spec-hrow > td {
    background: #7a9d3f !important;
    border-color: #7a9d3f !important;
    color: #fff;
    font-weight: 600;
    text-align: center;
}
.m16spec-body table.m16spec-rowhead tr.m16spec-hrow span,
.m16spec-body table.m16spec-rowhead tr.m16spec-hrow strong { color: #fff !important; }
/* narożnik nad kolumną etykiet zostaje pusty i biały */
.m16spec-body table.m16spec-rowhead tr.m16spec-hrow > th:first-child:empty {
    background: #fff !important;
    border-color: #e2e2e2 !important;
}
.m16spec-body table.m16spec-rowhead tbody tr:nth-child(even) { background: #f9f9f9; }

/* GOTCHA: posthemeoptions ma `.whitebackground{background:white!important;border:none!important}`,
   przez co losowe wiersze traciły ramkę i tło. Ramkę dostają WSZYSTKIE komórki poza wierszami,
   które są w całości puste (te zostają przerwą między sekcjami — klasa z front.js). */
.m16spec-body tr:not(.m16spec-sep) > th,
.m16spec-body tr:not(.m16spec-sep) > td {
    border: 1px solid #e2e2e2 !important;
}
.m16spec-body tr.m16spec-sep > th,
.m16spec-body tr.m16spec-sep > td {
    border: none !important;
    background: transparent !important;
    padding: 4px 0 !important;
}
.m16spec-body table.m16spec-rowhead tr:not(.m16spec-sep) > th.whitebackground {
    background-color: #f4f4f4 !important;
}
/* wartości w takim wierszu zostają BIAŁE (bez zebry) — szare jest tylko pole etykiety */
.m16spec-body tr:not(.m16spec-sep) > td.whitebackground {
    background-color: #fff !important;
}

/* szerokie tabele (adaptery: kilkanaście kolumn) — drobniejszy skład */
.m16spec-body table.m16spec-wide { font-size: 12px; }
.m16spec-body table.m16spec-wide th,
.m16spec-body table.m16spec-wide td { padding: 4px 7px; }
/* (bez sticky pierwszej kolumny — przy wąskich etykietach nachodziła na dane) */

/* etykiety wierszy: część ma w źródle <span style="font-weight:bold">, część nie —
   grubość ma być jedna dla całej kolumny */
.m16spec-body table.m16spec-rowhead th span,
.m16spec-body table.m16spec-rowhead th strong,
.m16spec-body table.m16spec-rowhead th b { font-weight: inherit !important; }

.m16spec-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #7a9d3f;
    text-align: right;
    position: sticky;
    left: 0;
}

body.m16spec-lock { overflow: hidden; }

@media (max-width: 575px) {
    .m16spec-modal { padding: 10px; }
    .m16spec-body { padding: 10px; }
    .m16spec-body table { font-size: 13px; }
    .m16spec-body th, .m16spec-body td { padding: 5px 6px; }
}
