/* Custom responsive styles for the BGG collection app */

/* Player-count badges: default (desktop) sizing; colors stay inline */
.player-badge {
    width: 22px;
    height: 22px;
    line-height: 22px;
    font-size: 11px;
    margin-right: 3px;
    display: inline-block;
    text-align: center;
    border-radius: 4px;
    font-weight: bold;
}

.player-badges-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
}

.game-thumb {
    height: 50px;
    border-radius: 5px;
}

.exp-thumb {
    height: 40px;
    border-radius: 5px;
}

.modal-game-img {
    width: 100%;
    border-radius: 8px;
}

/* Card-mode (portrait phones) */
.card-game-img {
    height: 64px;
    border-radius: 5px;
}

/* Expansion toggle: chevron + count (accordion affordance) */
.exp-toggle {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #8ab4f8;
    font-weight: 600;
    user-select: none;
    white-space: nowrap;
    margin-right: 6px;
}

.exp-toggle:hover {
    color: #b3ccf5;
}

.exp-toggle-label {
    font-size: 0.75em;
    color: #9aa0a6;
    min-width: 1em;
    text-align: center;
}

.exp-chevron {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 1.1em;
    line-height: 1;
}

.exp-toggle-placeholder {
    display: inline-block;
    width: 18px;
    margin-right: 6px;
}

/* Rotate the chevron while the expansion is open — no callback needed.
   Table mode: trigger row is immediately followed by the collapse row.
   Card mode: the collapse lives inside the same card. */
tr:has(+ tr .collapse.show) .exp-chevron,
tr:has(+ tr .collapsing) .exp-chevron,
.card:has(.collapse.show) .exp-chevron,
.card:has(.collapsing) .exp-chevron {
    transform: rotate(90deg);
}

/* In card mode the toggle is a full-width, obviously tappable button */
.exp-toggle-card {
    display: flex;
    justify-content: center;
    border: 1px solid rgba(138, 180, 248, 0.4);
    border-radius: 6px;
    padding: 6px 10px;
    margin: 8px 0 0 0;
    gap: 6px;
}

.exp-toggle-card .exp-toggle-label {
    font-size: 0.85em;
}

.exp-toggle-card:hover {
    background: rgba(138, 180, 248, 0.12);
}

/* Sticky sidebar / stats controls only make sense on desktop */
@media (min-width: 768px) {
    .sidebar-sticky {
        position: sticky;
        top: 2rem;
        z-index: 1;
    }
}

/* On phones the filter sidebar becomes a slide-in drawer */
@media (max-width: 767.98px) {
    .filters-drawer {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(85vw, 360px);
        z-index: 1045;
        transform: translateX(-105%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        background: #303030;
    }

    .filters-drawer.open {
        transform: none;
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
    }

    .filters-drawer > div {
        border-radius: 0;
        min-height: 100%;
    }
}

/* Between md and lg the player badges are too wide for their table cell:
   let them wrap onto two lines instead of overflowing */
@media (max-width: 1023.98px) {
    #table-container .player-badges-row {
        flex-wrap: wrap;
    }

    #table-container .player-badge {
        margin-bottom: 2px;
    }
}

@media (max-width: 767.98px) {
    .player-badge {
        width: 17px;
        height: 17px;
        line-height: 17px;
        font-size: 9px;
        margin-right: 2px;
    }

    .game-thumb {
        height: 34px;
    }

    .exp-thumb {
        height: 28px;
    }

    #table-container table {
        font-size: 0.8rem;
    }

    #table-container td, #table-container th {
        padding: 0.3rem 0.25rem;
    }

    .modal-game-img {
        max-height: 35vh;
        object-fit: contain;
    }
}
