/**
 * Boxscore Phase 6 — Production polish: mobile, a11y, skeletons, accordions
 */

.boxscore-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.boxscore-touch-btn {
    min-height: 48px;
    padding: 12px 20px;
    touch-action: manipulation;
}

.boxscore-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--ui-bg, #161616);
    border: 1px solid var(--ui-border, #2e2e2e);
    border-radius: 12px;
}

.boxscore-list-toolbar input[type="search"] {
    flex: 1 1 160px;
    min-width: 140px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--ui-border, #2e2e2e);
    background: #121212;
    color: #fff;
    font-family: inherit;
}

.boxscore-list-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.boxscore-list-pagination span {
    font-size: 0.85rem;
    color: var(--ui-text-muted, #bdbdbd);
}

.boxscore-skeleton {
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: boxscoreShimmer 1.2s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes boxscoreShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.boxscore-skeleton-card {
    height: 140px;
    border-radius: 14px;
}

.boxscore-skeleton-board {
    height: 280px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.boxscore-skeleton-feed {
    height: 120px;
    margin-top: 12px;
}

.boxscore-error-panel {
    text-align: center;
    padding: 32px 20px;
    border: 1px solid rgba(198, 40, 40, 0.35);
    border-radius: 14px;
    background: rgba(198, 40, 40, 0.08);
    margin: 20px 0;
}

.boxscore-error-panel p {
    margin: 0 0 16px;
    color: #ef9a9a;
}

.boxscore-accordion {
    margin-top: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
}

.boxscore-accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: none;
    background: rgba(255, 255, 255, 0.03);
    color: inherit;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    text-align: left;
    min-height: 48px;
    touch-action: manipulation;
}

.boxscore-accordion-trigger:hover,
.boxscore-accordion-trigger:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    outline: 2px solid rgba(198, 40, 40, 0.5);
    outline-offset: -2px;
}

.boxscore-accordion-trigger .fa-chevron-down {
    transition: transform 0.2s ease;
}

.boxscore-accordion.is-open .boxscore-accordion-trigger .fa-chevron-down {
    transform: rotate(180deg);
}

.boxscore-accordion-body {
    display: none;
    padding: 0 12px 12px;
}

.boxscore-accordion.is-open .boxscore-accordion-body {
    display: block;
}

.boxscore-accordion-body .bsp-panel,
.boxscore-accordion-body .bss-panel {
    margin-top: 0;
}

.boxscore-accordion-body .bsp-entry-section,
.boxscore-accordion-body .bss-entry-section {
    margin-top: 8px;
}

.bsp-load-more {
    width: 100%;
    margin-top: 10px;
    min-height: 44px;
}

.boxscore-detail-panel:focus-within {
    outline: none;
}

@media (max-width: 720px) {
    .bsb-table {
        min-width: 520px;
    }

    .bsb-table-wrap {
        margin: 0 -8px;
        padding: 0 4px;
    }

    .boxscore-list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .boxscore-category-select,
    .boxscore-list-toolbar input[type="search"] {
        width: 100%;
    }
}

@media (prefers-contrast: more) {
    .boxscore-game-card,
    .bsb-card,
    .bsp-entry-section,
    .bss-entry-section,
    .boxscore-accordion {
        border-color: #fff;
        border-width: 2px;
    }

    .boxscore-game-status,
    .bsb-pitcher-badge {
        border: 1px solid currentColor;
    }

    .bsp-play-item,
    .bss-sub-item {
        border-left-width: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .boxscore-skeleton,
    .boxscore-detail-panel {
        animation: none;
    }

    .boxscore-accordion-trigger .fa-chevron-down {
        transition: none;
    }
}
