/* ========================================
   Wyniki zadań H5P
   ======================================== */

.tm-h5p-wrap {
    --tm-h5p-green: #2f9e45;
    --tm-h5p-green-dark: #247e37;
    --tm-h5p-ink: #334155;
    --tm-h5p-muted: #64748b;
    --tm-h5p-border: #e2e8f0;
    --tm-h5p-surface: #ffffff;
    max-width: 100%;
    color: var(--tm-h5p-ink);
    font-family: inherit;
}

.tm-h5p-wrap *,
.tm-h5p-wrap *::before,
.tm-h5p-wrap *::after {
    box-sizing: border-box;
}

.tm-h5p-overview {
    margin-bottom: 26px;
    padding: 0 0 24px;
    border-bottom: 1px solid #e2e8f0;
}

.tm-h5p-progress,
.tm-h5p-topic-bar {
    overflow: hidden;
    background: #e6f1e8;
}

.tm-h5p-progress {
    height: 8px;
    margin: 0 0 30px;
    border-radius: 4px;
}

.tm-h5p-progress > span,
.tm-h5p-topic-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--tm-h5p-green);
}

.tm-h5p-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    align-items: start;
}

.tm-h5p-stat {
    min-width: 0;
    padding: 0 16px;
    text-align: center;
}

.tm-h5p-stat__icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin: 0 auto 13px;
    place-items: center;
    border-radius: 14px;
    background: #eaf7ed;
    color: var(--tm-h5p-green);
}

.tm-h5p-stat__icon svg {
    width: 29px;
    height: 29px;
}

.tm-h5p-stat strong {
    display: block;
    color: #1e293b;
    font-size: 1.2rem;
    line-height: 1.2;
}

.tm-h5p-stat strong small {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
}

.tm-h5p-stat > span:not(.tm-h5p-stat__icon) {
    display: block;
    overflow: hidden;
    margin-top: 7px;
    color: var(--tm-h5p-muted);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.3;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-h5p-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid #e2e8f0;
}

.tm-h5p-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 260px;
    min-width: 180px;
}

.tm-h5p-search > svg {
    position: absolute;
    left: 13px;
    width: 17px;
    height: 17px;
    color: #94a3b8;
    pointer-events: none;
}

.tm-h5p-search__input {
    width: 100%;
    min-height: 40px;
    padding: 9px 38px 9px 39px;
    border: 1px solid #dbe2e9;
    border-radius: 4px;
    outline: 0;
    background: #fff;
    color: var(--tm-h5p-ink);
    font: inherit;
    font-size: 0.85rem;
}

.tm-h5p-search__input::placeholder {
    color: #9aa6b5;
}

.tm-h5p-search__input:focus {
    border-color: var(--tm-h5p-green);
    box-shadow: 0 0 0 2px rgba(47, 158, 69, 0.12);
}

.tm-h5p-search__clear {
    position: absolute;
    right: 8px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: #eef2f5;
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.tm-h5p-search__clear:hover {
    background: #e2e8f0;
}

.tm-h5p-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tm-h5p-filter {
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #64748b;
    font: inherit;
    font-size: 0.73rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.tm-h5p-filter span {
    display: inline-block;
    min-width: 18px;
    margin-left: 3px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.66rem;
    text-align: center;
}

.tm-h5p-filter:hover,
.tm-h5p-filter:focus-visible {
    border-color: #b8dcbf;
    background: #f8fcf9;
    color: var(--tm-h5p-green-dark);
}

.tm-h5p-filter.is-active {
    border-color: #b8dcbf;
    background: #f0fdf4;
    color: var(--tm-h5p-green-dark);
}

.tm-h5p-filter.is-active span {
    color: var(--tm-h5p-green-dark);
}

.tm-h5p-filter-status {
    min-height: 18px;
    margin: 0 0 8px;
    color: var(--tm-h5p-muted);
    font-size: 0.78rem;
}

.tm-h5p-filter-status:empty {
    display: none;
}

.tm-h5p-topics {
    display: grid;
    gap: 8px;
}

.tm-h5p-topic {
    overflow: hidden;
    border: 1px solid var(--tm-h5p-border);
    border-radius: 6px;
    background: var(--tm-h5p-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tm-h5p-topic[open] {
    border-color: #cfe4d3;
    box-shadow: none;
}

.tm-h5p-topic[hidden],
.tm-h5p-subtopic[hidden],
.tm-h5p-empty-filter[hidden] {
    display: none !important;
}

.tm-h5p-topic-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 82px;
    padding: 15px 18px;
    list-style: none;
    cursor: pointer;
}

.tm-h5p-topic-summary::-webkit-details-marker {
    display: none;
}

.tm-h5p-topic-summary:focus-visible {
    outline: 2px solid rgba(47, 158, 69, 0.35);
    outline-offset: -3px;
}

.tm-h5p-topic-ring {
    position: relative;
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid #b8dcbf;
    border-radius: 4px;
    background: #f0fdf4;
}

.tm-h5p-topic-ring::before {
    display: none;
}

.tm-h5p-topic-ring span {
    position: relative;
    z-index: 1;
    color: var(--tm-h5p-green-dark);
    font-size: 0.65rem;
    font-weight: 700;
}

.tm-h5p-topic-summary__main {
    display: block;
    min-width: 0;
    flex: 1;
}

.tm-h5p-topic-title {
    display: block;
    overflow: hidden;
    color: var(--tm-h5p-ink);
    font-size: 0.98rem;
    font-weight: 650;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-h5p-topic-meta {
    display: block;
    margin-top: 4px;
    color: var(--tm-h5p-muted);
    font-size: 0.76rem;
}

.tm-h5p-topic-bar {
    display: block;
    height: 4px;
    margin-top: 10px;
    border-radius: 2px;
}

.tm-h5p-topic-chevron {
    position: relative;
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    margin-left: 8px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: rotate(45deg) translateY(-3px);
    transition: transform 0.2s ease;
}

.tm-h5p-topic[open] .tm-h5p-topic-chevron {
    transform: rotate(225deg) translate(-2px, -2px);
}

.tm-h5p-topic-content {
    border-top: 1px solid #edf1f4;
    background: #fff;
}

.tm-h5p-topic-header,
.tm-h5p-subtopic {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(145px, 1.2fr) 0.6fr 0.6fr;
    align-items: center;
    gap: 16px;
}

.tm-h5p-topic-header {
    padding: 11px 20px;
    color: #94a3b8;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tm-h5p-topic-header > :nth-child(n+3),
.tm-h5p-subtopic > :nth-child(n+3) {
    text-align: right;
}

.tm-h5p-subtopic {
    min-height: 58px;
    padding: 13px 20px;
    border-top: 1px solid #edf1f4;
    color: #475569;
    font-size: 0.85rem;
}

.tm-h5p-subtopic__name {
    min-width: 0;
    overflow: hidden;
    color: #334155;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-h5p-subtopic__score strong {
    color: var(--tm-h5p-ink);
    font-size: 0.88rem;
}

.tm-h5p-subtopic__tasks {
    color: #64748b;
    white-space: nowrap;
}

.tm-h5p-mobile-label {
    display: none;
}

.tm-h5p-subtopic .tm-badge-lesson {
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    padding: 4px 9px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.tm-badge-lesson.tm-badge-completed {
    background-color: #dcfce7;
    color: #16a34a;
}

.tm-badge-lesson.tm-badge-progress {
    background-color: #fef9c3;
    color: #ca8a04;
}

.tm-badge-lesson.tm-badge-pending {
    background-color: #f1f5f9;
    color: #94a3b8;
}

.tm-h5p-empty-filter {
    padding: 48px 20px;
    border: 1px dashed #dbe2e9;
    border-radius: 6px;
    background: #fff;
    color: var(--tm-h5p-muted);
    text-align: center;
}

.tm-h5p-empty-filter > span {
    display: block;
    margin-bottom: 8px;
    color: #a7b2bf;
    font-size: 2rem;
    line-height: 1;
}

.tm-h5p-empty-filter strong {
    display: block;
    color: var(--tm-h5p-ink);
    font-size: 0.95rem;
}

.tm-h5p-empty-filter p {
    margin: 6px 0 0;
    font-size: 0.8rem;
}

.tm-h5p-wrap .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .tm-h5p-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .tm-h5p-search {
        flex-basis: auto;
    }

    .tm-h5p-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
}

@media (max-width: 680px) {
    .tm-h5p-overview {
        padding-bottom: 18px;
    }

    .tm-h5p-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .tm-h5p-stat {
        padding: 0 10px;
    }

    .tm-h5p-stat:nth-child(n+3) {
        padding-top: 10px;
        border-top: 1px solid #e2e8f0;
    }

    .tm-h5p-topic-summary {
        min-height: 86px;
        gap: 11px;
        padding: 14px;
    }

    .tm-h5p-topic-ring {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .tm-h5p-topic-title {
        font-size: 0.88rem;
    }

    .tm-h5p-topic-meta {
        font-size: 0.7rem;
    }

    .tm-h5p-topic-header {
        display: none;
    }

    .tm-h5p-subtopic {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 9px 12px;
        padding: 14px;
    }

    .tm-h5p-subtopic__name {
        grid-column: 1 / -1;
        font-size: 0.83rem;
        white-space: normal;
    }

    .tm-h5p-subtopic__status {
        grid-column: 1;
        grid-row: 2;
    }

    .tm-h5p-subtopic__score,
    .tm-h5p-subtopic__tasks {
        grid-row: 2;
        text-align: right;
    }

    .tm-h5p-subtopic__score {
        grid-column: 2;
    }

    .tm-h5p-subtopic__tasks {
        grid-column: 2;
        grid-row: 3;
        color: #64748b;
        font-size: 0.75rem;
    }

    .tm-h5p-mobile-label {
        display: inline;
        margin-right: 5px;
        color: #94a3b8;
        font-size: 0.72rem;
        font-weight: 500;
    }
}

@media (max-width: 420px) {
    .tm-h5p-stats {
        gap: 7px;
    }

    .tm-h5p-stat strong {
        font-size: 1.1rem;
    }

    .tm-h5p-stat > span:not(.tm-h5p-stat__icon) {
        font-size: 0.66rem;
    }
}
