/*
 * The training completion tables are used on the phone (the completions are recorded there): below the md breakpoint
 * a table with the "training-cards" class turns into a list of cards, one per row, the cells stacked with their label
 * (data-label). The status and star buttons get bigger touch targets.
 */
@media (max-width: 767.98px) {
    table.training-cards,
    table.training-cards tbody,
    table.training-cards tr,
    table.training-cards td {
        display: block;
        width: 100%;
    }

    table.training-cards thead {
        display: none;
    }

    table.training-cards tbody.form-collection-entry {
        border: 1px solid var(--bs-border-color, #dee2e6);
        border-radius: 0.5rem;
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.75rem;
        background: var(--bs-body-bg, #fff);
    }

    table.training-cards tbody.form-collection-entry tr {
        border: 0;
        border-radius: 0;
        margin: 0;
        padding: 0;
    }

    table.training-cards tr {
        border: 1px solid var(--bs-border-color, #dee2e6);
        border-radius: 0.5rem;
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.75rem;
        background: var(--bs-body-bg, #fff);
    }

    table.training-cards td {
        border: 0 !important;
        padding: 0.3rem 0 !important;
        text-align: left !important;
        background: transparent !important;
        min-width: 0 !important;
    }

    table.training-cards td:empty,
    table.training-cards td.tc-empty {
        display: none !important;
    }

    table.training-cards td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--bs-secondary-color, #6c757d);
    }

    /* short values (time, distance) next to each other */
    table.training-cards td[data-inline] {
        display: inline-block;
        width: auto;
        margin-right: 1.25rem;
    }

    table.training-cards td[data-inline]::before {
        display: inline;
        margin-right: 0.35rem;
    }

    table.training-cards td.tc-date {
        font-weight: 600;
        padding-bottom: 0 !important;
    }

    table.training-cards td.tc-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
    }

    table.training-cards td.tc-actions::before {
        flex: 0 0 100%;
    }

    table.training-cards .btn[data-training-completion-target="statusButton"] {
        min-width: 56px;
        min-height: 44px;
        font-size: 1.15rem;
    }

    table.training-cards .btn[data-training-completion-target="starButton"] {
        min-width: 40px;
        min-height: 44px;
        font-size: 1.5rem;
    }

    table.training-cards textarea,
    table.training-cards input[type="url"] {
        width: 100%;
        font-size: 1rem; /* no zoom on focus in iOS */
    }
}

/*
 * The comments of a completion: the line breaks of the text are kept, long words and links wrap instead of widening the
 * row (on a phone it would run out of the screen on the right); on a phone the author and the type / icons / date are
 * on separate lines.
 */
.tc-comments {
    min-width: 0;
    max-width: 100%;
}

.tc-comments .tc-comment-text {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

.tc-comments .tc-comment-meta {
    overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
    table.training-cards td[data-label="Megjegyzések"] {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .tc-comments .tc-comment-author,
    .tc-comments .tc-comment-info {
        display: block;
    }

    .tc-comments .select2-container {
        max-width: 100%;
    }
}
