/* Bowling Serie – frontend */
.bs-wrap {
    margin: 1.5em 0;
    font-size: 16px;
    color: var(--bs-text);
    --bs-text: #1a2233;
    --bs-muted: #6b7688;
    --bs-bg: #fff;
    --bs-hover: #eef3fb;
    --bs-primary: #1f2a44;
    --bs-accent: #e8531a;
    --bs-blue: #2f5bd0;
    --bs-win: #17974f;
    --bs-line: #e7ebf1;
    --bs-soft: #f5f7fa;
}
.bs-title {
    margin: 0 0 .7em;
    font-size: 1.4em;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--bs-primary);
}
.bs-round {
    margin: 1.3em 0 .5em;
    font-size: .8em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--bs-accent);
}
.bs-empty {
    color: #6b7688;
    background: var(--bs-soft);
    padding: 14px 16px;
    border-radius: 10px;
}

/* Tabeller */
.bs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0 0 1em;
    background: var(--bs-bg);
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--bs-line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(20, 30, 55, .04);
}
.bs-table th,
.bs-table td {
    padding: 11px 12px;
    text-align: left;
    font-size: 1em;
    border-bottom: 1px solid var(--bs-line);
}
.bs-table tbody tr:last-child td { border-bottom: 0; }
.bs-table thead th {
    background: var(--bs-primary);
    color: #fff;
    font-weight: 700;
    font-size: .82em;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.bs-table tbody tr:nth-child(even) { background: var(--bs-soft); }
.bs-table tbody tr:hover { background: var(--bs-hover); }

.bs-team-badge { display: inline-flex; align-items: center; gap: 8px; }
.bs-logo {
    height: auto;
    max-height: 40px;
    width: auto;
    max-width: 40px;
    object-fit: contain;
    background: none;
    border: 0;
    border-radius: 0;
    flex: none;
}
/* Kompaktare logga i tabeller (schema/tabell) */
.bs-schema .bs-logo,
.bs-tabell .bs-logo { max-height: 30px; max-width: 30px; }
.bs-team-name { font-weight: 600; }
.bs-table .bs-team { font-weight: 600; }
.bs-vs { text-align: center; color: #9aa4b5; font-style: italic; }
.bs-oil { color: var(--bs-accent); font-weight: 600; text-decoration: none; }
.bs-oil:hover { text-decoration: underline; }

/* Tabell-vyn */
.bs-tabell .bs-table td,
.bs-tabell .bs-table th { text-align: center; }
.bs-tabell .bs-table td.bs-team,
.bs-tabell .bs-table th.bs-team-col { text-align: left; }
.bs-tabell .bs-points {
    font-weight: 800;
    color: var(--bs-primary);
    background: var(--bs-hover);
}
.bs-tabell .bs-diff { font-weight: 700; font-variant-numeric: tabular-nums; }
.bs-diff-pos { color: #1f9d55; }
.bs-diff-neg { color: #d64545; }
.bs-legend {
    font-size: .8em;
    color: #7b8698;
    margin-top: -.3em;
}

/* Resultat – minimerad lista */
.bs-result-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bs-result-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    align-items: center;
    gap: 12px;
    background: var(--bs-bg);
    border: 1px solid var(--bs-line);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 1px 2px rgba(20, 30, 55, .04);
}
.bs-rr-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bs-rr-team .bs-team-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-rr-home { justify-content: flex-end; text-align: right; }
.bs-rr-home .bs-team-badge { flex-direction: row-reverse; }
.bs-rr-away { justify-content: flex-start; }
.bs-rr-score {
    font-weight: 800;
    font-size: 1.05em;
    color: var(--bs-primary);
    background: var(--bs-soft);
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.bs-result-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bs-primary);
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: .85em;
    padding: 7px 14px;
    border-radius: 999px;
    white-space: nowrap;
    transition: background .15s ease;
}
.bs-result-item:hover .bs-result-btn { background: var(--bs-blue); }
.bs-chevron {
    width: 8px; height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .2s ease;
    margin-top: -2px;
}
.bs-result-item[open] .bs-chevron { transform: rotate(-135deg); margin-top: 2px; }
.bs-back { margin: 0 0 12px; }
.bs-back a { color: var(--bs-blue); font-weight: 600; text-decoration: none; }
.bs-back a:hover { text-decoration: underline; }

/* Banpoäng-brytning */
.bs-breakdown { padding: 16px 18px 0; }
.bs-breakdown-title {
    margin: 0 0 10px;
    font-size: .8em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bs-accent);
}
.bs-serie-block { margin-bottom: 14px; }
.bs-serie-head {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--bs-primary);
}
.bs-bp-table th, .bs-bp-table td { padding: 8px 10px; font-size: .88em; }
.bs-bp-table td.bs-won { font-weight: 800; color: var(--bs-primary); }
.bs-serie-total td { background: var(--bs-soft); font-weight: 600; border-top: 2px solid var(--bs-line); }
.bs-bp {
    display: inline-block;
    font-size: .8em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}
.bs-bp-home { background: #e3f0ff; color: #1c5fb0; }
.bs-bp-away { background: #ffe9df; color: #c1461c; }
.bs-bp-tie  { background: #eef0f4; color: #6b7688; }

/* Resultat-kort */
.bs-result-card {
    border: 1px solid var(--bs-line);
    border-radius: 14px;
    background: var(--bs-bg);
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(20, 30, 55, .05);
}
.bs-result-head {
    padding: 16px 18px;
    background: linear-gradient(135deg, #1f2a44, #2c3c63);
    color: #fff;
}
.bs-result-teams {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
}
.bs-result-teams .bs-team-name { color: #fff; font-weight: 700; font-size: 1.05em; }
.bs-result-teams .bs-logo { max-height: 40px; max-width: 40px; }
.bs-rt-score {
    font-size: 1.35em;
    font-weight: 800;
    background: rgba(255,255,255,.14);
    padding: 4px 14px;
    border-radius: 999px;
    white-space: nowrap;
}
.bs-rt-home { flex-direction: row-reverse; }
.bs-result-meta {
    margin-top: 10px;
    text-align: center;
    font-size: .85em;
    color: #c7d0e2;
}
.bs-result-meta .bs-oil { color: var(--bs-blue); }
.bs-result-players {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px 18px;
}
.bs-pt-title { margin-bottom: 8px; font-weight: 700; }
.bs-pt-table { margin: 0; }
.bs-pt-table th, .bs-pt-table td { padding: 7px 9px; font-size: .9em; }
.bs-pt-table th:not(:first-child),
.bs-pt-table td:not(:first-child) { text-align: center; }
.bs-pt-name { font-weight: 600; }
.bs-pt-total { font-weight: 800; color: var(--bs-primary); }
.bs-pt-table tfoot td {
    background: var(--bs-soft);
    font-weight: 700;
    border-top: 2px solid var(--bs-line);
}

.bs-picker code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 4px;
}

@media (max-width: 720px) {
    .bs-result-players { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .bs-table th,
    .bs-table td { padding: 8px 8px; font-size: .9em; }
    .bs-logo { max-height: 16px; max-width: 16px; }
    .bs-rt-score { font-size: 1.15em; }
    .bs-result-row { grid-template-columns: 1fr auto 1fr; }
    .bs-result-row .bs-result-btn { grid-column: 1 / -1; justify-self: center; margin-top: 4px; }
}


/* Resultatprotokoll (per lag) */
.bs-result-sheets {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px 18px;
}
.bs-sheet-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--bs-primary);
}
.bs-sheet-role {
    font-size: .68em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #fff;
    background: var(--bs-primary);
    padding: 3px 9px;
    border-radius: 999px;
}
.bs-sheet-scroll { overflow-x: auto; }
.bs-sheet-table { margin: 0; min-width: 420px; }
.bs-sheet-table th,
.bs-sheet-table td {
    text-align: center;
    padding: 9px 8px;
    font-size: 1em;
}
.bs-sheet-table th.bs-c-name,
.bs-sheet-table td.bs-c-name { text-align: left; font-weight: 600; }
.bs-sheet-table .bs-c-total { font-weight: 800; color: var(--bs-primary); }
.bs-sheet-table .bs-c-hcp { color: #7b8698; }
/* Banpoäng-boxar (6-manna, mellan paren) */
.bs-sheet-6 .bs-banp {
    background: var(--bs-soft);
    font-weight: 800;
    color: #9aa4b5;
    border-left: 1px solid var(--bs-line);
    width: 34px;
}
.bs-sheet-6 .bs-banp-won {
    color: #fff;
    background: var(--bs-win);
}
/* Summarad */
.bs-sheet-sum td {
    background: var(--bs-soft);
    font-weight: 700;
    border-top: 2px solid #d7dee8;
}
/* Banpoäng-rad */
.bs-sheet-banp td {
    background: var(--bs-hover);
    font-weight: 800;
    color: var(--bs-primary);
}
.bs-banp-eq { font-size: 1.05em; }
.bs-banp-sum {
    background: var(--bs-win) !important;
    color: #fff !important;
}

@media (max-width: 640px) {
    .bs-sheet-table th,
    .bs-sheet-table td { padding: 8px 6px; font-size: .95em; }
}

/* =========================================================================
 * Resultat – dropdown (details/summary)
 * ====================================================================== */
.bs-result-item {
    background: var(--bs-bg);
    border: 1px solid var(--bs-line);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(20, 30, 55, .05);
    overflow: hidden;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.bs-result-item[open] {
    box-shadow: 0 6px 20px rgba(20, 30, 55, .10);
    border-color: #d5deec;
}
.bs-result-item > summary.bs-result-row {
    list-style: none;
    cursor: pointer;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    background: var(--bs-bg);
}
.bs-result-item > summary::-webkit-details-marker { display: none; }
.bs-result-item[open] > summary.bs-result-row { border-bottom: 1px solid var(--bs-line); }
.bs-result-item > summary.bs-result-row:hover { background: var(--bs-soft); }

.bs-result-body { padding: 4px 16px 16px; }
.bs-result-body .bs-result-meta {
    margin: 12px 0 4px;
    text-align: center;
    font-size: .85em;
    color: #6b7688;
    font-weight: 600;
}
.bs-result-body .bs-result-sheets {
    padding: 6px 0 0;
    gap: 22px;
}

/* Totalsumma-bonusrad (2-manna) */
.bs-sheet-bonus td {
    background: var(--bs-soft);
    font-weight: 700;
    color: #6b7688;
    border-top: 1px solid var(--bs-line);
}
.bs-sheet-bonus .bs-c-total { color: #9aa4b5; }
.bs-sheet-bonus .bs-bonus-won { color: var(--bs-win); }

@media (max-width: 640px) {
    .bs-result-body { padding: 4px 10px 12px; }
}

/* Flera divisioner i samma shortcode */
.bs-division-block + .bs-division-block { margin-top: 2em; padding-top: 1.5em; border-top: 2px solid var(--bs-line); }

/* Horisontell scroll för breda tabeller på mobil */
.bs-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1em; }
.bs-table-scroll .bs-table { margin-bottom: 0; }

/* Topplistor (högsta lag-/spelarslagning) */
.bs-topp-table th, .bs-topp-table td { text-align: center; }
.bs-topp-table th.bs-team-col, .bs-topp-table td.bs-team { text-align: left; }
.bs-topp-table .bs-topp-score { font-weight: 800; color: var(--bs-primary); }
.bs-topp-table .bs-topp-meta { font-size: .82em; color: #7b8698; }
.bs-tabell .bs-avg { font-weight: 700; }

@media (max-width: 640px) {
    .bs-topp-table .bs-topp-meta { font-size: .75em; }
}

/* Divisionsetikett när flera divisioner visas i samma lista */
.bs-div-tag{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  background:#e8eefc;
  color:#1f3b7a;
  font-size:.78em;
  font-weight:700;
  white-space:nowrap;
}
.bs-result-row .bs-div-tag{ margin-right:8px; }
@media (max-width:640px){
  .bs-result-row .bs-div-tag{ font-size:.72em; padding:1px 6px; }
}

/* Divisionsetikett i resultatlistan (flera divisioner i samma shortcode) */
.bs-result-row.bs-has-div { grid-template-columns: auto 1fr auto 1fr auto; }
.bs-result-row .bs-rr-div { justify-self: start; margin-right: 0; white-space: nowrap; }
@media (max-width: 640px) {
    .bs-result-row.bs-has-div { grid-template-columns: 1fr auto 1fr; }
    .bs-result-row.bs-has-div .bs-rr-div { grid-column: 1 / -1; justify-self: center; margin-bottom: 4px; }
}

/* Lagväljare på hemsidan */
.bs-team-picker {
    margin: 0 0 18px;
}
.bs-team-picker-box {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bs-bg);
    border: 1px solid var(--bs-line);
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(20, 30, 55, .05);
}
.bs-team-picker-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--bs-blue);
    background: var(--bs-hover);
    border-radius: 999px;
    flex: none;
}
.bs-team-picker-label {
    font-weight: 700;
    font-size: .95em;
    color: var(--bs-primary);
}
.bs-team-picker-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.bs-team-picker select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 9px 38px 9px 14px;
    border: 1px solid #d5dae2;
    border-radius: 10px;
    background: var(--bs-bg);
    color: var(--bs-primary);
    font-size: 15px;
    font-weight: 600;
    min-width: 200px;
    max-width: 100%;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.bs-team-picker select:hover {
    border-color: #b8c0ce;
}
.bs-team-picker select:focus {
    outline: none;
    border-color: var(--bs-blue);
    box-shadow: 0 0 0 3px rgba(47, 91, 208, .12);
}
.bs-team-picker-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #7b8698;
    display: inline-flex;
    align-items: center;
}
.bs-team-picker-btn {
    appearance: none;
    border: 0;
    background: var(--bs-primary);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 9px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s ease;
}
.bs-team-picker-btn:hover {
    background: var(--bs-blue);
}
.bs-result-meta .bs-div-tag {
    margin-right: 4px;
}
@media (max-width: 600px) {
    .bs-team-picker-box {
        display: flex;
        width: 100%;
    }
    .bs-team-picker-select-wrap {
        flex: 1 1 auto;
        min-width: 0;
    }
    .bs-team-picker select {
        width: 100%;
        min-width: 0;
    }
}

/* --- Väljare (säsong / lag) ------------------------------------------- */
.bs-pickers {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 14px;
}
.bs-pickers .bs-team-picker,
.bs-pickers .bs-season-picker {
    margin: 0;
}
.bs-season-picker .bs-team-picker-icon {
    background: #eef4ff;
    color: #2563eb;
}
@media (max-width: 640px) {
    .bs-pickers { flex-direction: column; }
    .bs-pickers > form { width: 100%; }
}

/* Reserver / inhopp */
.bs-reserve-row{background:rgba(37,99,235,.04)}
.bs-c-sub{color:#1d4ed8;font-weight:700}
.bs-sub-flag,.bs-reserve-tag{display:inline-block;margin-left:4px;padding:0 5px;border-radius:6px;background:#dbeafe;color:#1d4ed8;font-size:.7em;font-weight:700;line-height:1.5;vertical-align:middle}

/* ---- Lagpopup: spelare & snitt ---- */
.bs-team-open {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px dashed rgba(37, 99, 235, .5);
    transition: color .15s ease, border-color .15s ease;
}
.bs-team-open:hover { color: #2563eb; border-bottom-color: #2563eb; }
.bs-modal-toggle { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.bs-modal { display: none; }
.bs-modal-toggle:checked + .bs-modal {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.bs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    cursor: pointer;
}
.bs-modal-box {
    position: relative;
    background: var(--bs-bg);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
    width: min(680px, 100%);
    max-height: 84vh;
    overflow: auto;
    padding: 18px 18px 14px;
}
.bs-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
    font-size: 17px;
}
.bs-modal-close {
    cursor: pointer;
    line-height: 1;
    font-size: 24px;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 8px;
}
.bs-modal-close:hover { background: #f1f5f9; color: #0f172a; }
.bs-players-table td, .bs-players-table th { white-space: nowrap; }
@media (max-width: 600px) {
    .bs-modal-box { padding: 14px 12px 10px; max-height: 88vh; }
}


/* Ljust/mörkt läge */
.bs-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--bs-line);
    border-radius: 12px;
    background: var(--bs-bg);
    color: var(--bs-text);
    font-weight: 700;
    font-size: .85em;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(20, 30, 55, .05);
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.bs-theme-toggle:hover { border-color: var(--bs-blue); color: var(--bs-blue); }
.bs-theme-toggle .bs-icon-moon { display: none; }
.bs-dark .bs-theme-toggle .bs-icon-moon { display: inline-block; }
.bs-dark .bs-theme-toggle .bs-icon-sun { display: none; }

.bs-wrap.bs-dark {
    --bs-text: #e8ecf5;
    --bs-muted: #9aa6bd;
    --bs-bg: #161b26;
    --bs-hover: #202839;
        --bs-line: #2c3346;
    --bs-soft: #1c2231;
    --bs-blue: #7aa2ff;
    --bs-win: #45c184;
    color: var(--bs-text);
}
.bs-wrap.bs-dark { --bs-primary: #232b3d; }
.bs-dark .bs-title,
.bs-dark .bs-team-name,
.bs-dark .bs-table td { color: var(--bs-text); }
.bs-dark .bs-table thead th { background: #0f1420; color: #e8ecf5; }
.bs-dark .bs-tabell .bs-points { color: var(--bs-text); background: var(--bs-hover); }
.bs-dark .bs-empty,
.bs-dark .bs-legend,
.bs-dark .bs-vs { color: var(--bs-muted); }
.bs-dark .bs-table tbody tr:hover { background: var(--bs-hover); }
.bs-dark .bs-modal-box,
.bs-dark .bs-result-row,
.bs-dark .bs-team-picker-box { background: var(--bs-bg); color: var(--bs-text); }
.bs-dark select,
.bs-dark .bs-team-picker-label { color: var(--bs-text); }
.bs-dark select { background: var(--bs-soft); border-color: var(--bs-line); }
