/*
 * List pages (exercise lists, assignments, schools, DataTables lists) for the web and the phone app.
 * Pure CSS on top of the existing markup: nothing is renamed or moved, and a browser that does not know a selector (":has") just skips
 * that one rule. The colours people choose for the header, sidebar and logo in the settings panel are never touched here.
 */

/* ---------- row actions of the exercise lists: one colour per kind of action ---------- */
.exercise-catalog .catalog-actions .catalog-action {
    --act: #1572e8;
    --act-rgb: 21, 114, 232;
    border-radius: 12px;
    border-color: rgba(var(--act-rgb), .28);
    background: rgba(var(--act-rgb), .10);
    color: var(--act);
    transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}

/* solve / start */
.exercise-catalog .catalog-actions .catalog-action:has(.fa-play) { --act: #16a34a; --act-rgb: 22, 163, 74; }
/* assign to students */
.exercise-catalog .catalog-actions .catalog-action:has(.fa-user-plus) { --act: #7c4dff; --act-rgb: 124, 77, 255; }
/* statistics and results */
.exercise-catalog .catalog-actions .catalog-action:has(.fa-chart-bar) { --act: #0d9488; --act-rgb: 13, 148, 136; }
.exercise-catalog .catalog-actions .catalog-action:has(.fa-chart-line) { --act: #0d9488; --act-rgb: 13, 148, 136; }
.exercise-catalog .catalog-actions .catalog-action:has(.fa-poll) { --act: #0d9488; --act-rgb: 13, 148, 136; }
/* share */
.exercise-catalog .catalog-actions .catalog-action:has(.fa-share) { --act: #4f46e5; --act-rgb: 79, 70, 229; }
.exercise-catalog .catalog-actions .catalog-action:has(.fa-share-alt) { --act: #4f46e5; --act-rgb: 79, 70, 229; }
/* ownership */
.exercise-catalog .catalog-actions .catalog-action:has(.fa-user-shield) { --act: #475569; --act-rgb: 71, 85, 105; }
/* generate a similar one */
.exercise-catalog .catalog-actions .catalog-action:has(.fa-clone) { --act: #d97706; --act-rgb: 217, 119, 6; }
/* edit */
.exercise-catalog .catalog-actions .catalog-action:has(.fa-edit) { --act: #f97316; --act-rgb: 249, 115, 22; }
.exercise-catalog .catalog-actions .catalog-action:has(.fa-pen) { --act: #f97316; --act-rgb: 249, 115, 22; }
.exercise-catalog .catalog-actions .catalog-action:has(.fa-pencil-alt) { --act: #f97316; --act-rgb: 249, 115, 22; }
/* delete */
.exercise-catalog .catalog-actions .catalog-action--danger,
.exercise-catalog .catalog-actions .catalog-action:has(.fa-trash) { --act: #dc2626; --act-rgb: 220, 38, 38; }
.exercise-catalog .catalog-actions .catalog-action:has(.fa-trash-alt) { --act: #dc2626; --act-rgb: 220, 38, 38; }

.exercise-catalog .catalog-actions .catalog-action:hover,
.exercise-catalog .catalog-actions .catalog-action:focus {
    border-color: var(--act);
    background: var(--act);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 14px -8px var(--act);
}

.exercise-catalog .catalog-actions .catalog-action:disabled { opacity: .5; transform: none; box-shadow: none; }

/* On a phone there is no hover tooltip: the actions become a tidy two-column grid of tiles, each with its icon and its own (localized) name. */
@media (max-width: 767.98px) {
    .exercise-catalog--table .exercise-summary-table tbody td.catalog-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: .75rem !important;
        white-space: normal;
        text-align: left;
    }

    .exercise-catalog--table .exercise-summary-table .catalog-actions .catalog-action {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 9px;
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: 44px;
        margin: 0;
        padding: 8px 10px;
        border-radius: 12px;
        text-align: left;
        white-space: normal;
        overflow: hidden;
    }

    .exercise-catalog--table .exercise-summary-table .catalog-actions .catalog-action + .catalog-action { margin-left: 0; }

    .exercise-catalog--table .exercise-summary-table .catalog-actions .catalog-action > i {
        flex: 0 0 auto;
        width: 18px;
        text-align: center;
        font-size: 15px;
    }

    .exercise-catalog--table .exercise-summary-table .catalog-actions .catalog-action[title]::after {
        content: attr(title);
        flex: 1 1 auto;
        min-width: 0;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .exercise-catalog--table table.table,
    .exercise-catalog--listening.exercise-catalog--table table.table,
    .lf-responsive-surface .page-inner.exercise-catalog table.table { min-width: 0 !important; width: 100% !important; }
    .exercise-catalog--table .dataTables_wrapper > .row,
    .exercise-catalog--table .dataTables_wrapper > .dataTables_scroll,
    .exercise-catalog--table .dataTables_wrapper > table { min-width: 0; }
    .exercise-catalog--table .exercise-summary-table tbody td:not(.catalog-actions) { padding: .45rem .95rem !important; border-bottom: 0; }
    .exercise-catalog--table .exercise-summary-table tbody td:first-child { padding-top: .9rem !important; font-size: 1rem; }
    .exercise-catalog--table .exercise-summary-table tbody td:first-child .catalog-item-title { font-size: 1.02rem; font-weight: 700; color: #0f172a; }
    .exercise-catalog--table .exercise-summary-table tbody tr { border-radius: 16px; border-color: #e3e9f3; box-shadow: 0 8px 22px -12px rgba(20, 39, 76, .25); }
    .exercise-catalog--table .exercise-summary-table tbody tr > td { background: #fff !important; }
    .exercise-catalog--table .exercise-summary-table tbody tr > td.catalog-actions { background: #f6f8fd !important; border-top: 1px solid #edf0f6; }
    .exercise-catalog--table .exercise-summary-table tbody { max-width: 100%; box-sizing: border-box; }
    .exercise-catalog--table .exercise-summary-table tbody tr { max-width: 100%; }
}

/* ---------- link buttons of the other lists get an icon when the button has none ---------- */
.page-inner table a.btn:not(.catalog-action):not(:has(> i)):not(:has(> .fa)):not(:has(> .fas)):not(:has(> .la))::before,
.page-inner .card-footer a.btn:not(:has(> i)):not(:has(> .fa)):not(:has(> .fas)):not(:has(> .la))::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-inline-end: .45rem;
    font-size: .85em;
}

.page-inner table a.btn[href*="/details"]:not(:has(> i)):not(:has(> .fas))::before,
.page-inner .card-footer a.btn[href*="/details"]:not(:has(> i)):not(:has(> .fas))::before { content: "\f06e"; }
.page-inner table a.btn[href*="/results"]:not(:has(> i)):not(:has(> .fas))::before,
.page-inner table a.btn[href*="statistic"]:not(:has(> i)):not(:has(> .fas))::before,
.page-inner table a.btn[href*="/report"]:not(:has(> i)):not(:has(> .fas))::before,
.page-inner .card-footer a.btn[href*="/results"]:not(:has(> i)):not(:has(> .fas))::before { content: "\f080"; }
.page-inner table a.btn[href*="/edit"]:not(:has(> i)):not(:has(> .fas))::before { content: "\f303"; }
.page-inner table a.btn[href*="/assign"]:not(:has(> i)):not(:has(> .fas))::before { content: "\f234"; }
.page-inner table a.btn[href*="-test/"]:not(:has(> i)):not(:has(> .fas))::before,
.page-inner table a.btn[href*="/solve"]:not(:has(> i)):not(:has(> .fas))::before,
.page-inner .card-footer a.btn[href*="-test/"]:not(:has(> i)):not(:has(> .fas))::before { content: "\f04b"; }

.page-inner table .btn-sm,
.page-inner .card-footer .btn-sm {
    border-radius: 10px;
    font-weight: 600;
}

/* ---------- tables and DataTables ---------- */
.page-inner table.dataTable thead th,
.page-inner table.table:not(.exercise-summary-table) thead th {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #64748b;
    background: #f6f8fc;
    border-bottom: 1px solid #e2e8f0;
}

.page-inner table.table tbody tr { transition: background .12s ease; }
.page-inner table.table-hover tbody tr:hover,
.page-inner table.dataTable tbody tr:hover { background-color: rgba(29, 122, 243, .05); }

.dataTables_wrapper .dataTables_filter input {
    padding: .45rem 1rem;
    border: 1px solid #d6deeb;
    border-radius: 999px;
    background: #fff;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #d6deeb;
    border-radius: 10px;
}

.dataTables_wrapper .dataTables_info { color: #64748b; font-size: .85rem; }

.dataTables_wrapper .dataTables_paginate .page-item .page-link {
    margin: 0 2px;
    border: 0;
    border-radius: 10px;
    color: #334155;
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background: #1d7af3;
    color: #fff;
    box-shadow: 0 8px 14px -8px #1d7af3;
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link { color: #a8b3c4; background: transparent; }

/* ---------- cards, badges, titles of the list pages ---------- */
.page-inner .card { border-radius: 14px; }
.page-inner .badge { border-radius: 999px; padding: .38em .72em; font-weight: 600; }
.page-inner .page-title { font-weight: 700; letter-spacing: -.01em; }

@media (max-width: 767.98px) {
    .dataTables_wrapper .dataTables_filter { text-align: left; }
    .dataTables_wrapper .dataTables_filter label { display: block; width: 100%; }
    .dataTables_wrapper .dataTables_filter input { width: 100%; margin-left: 0; }
    .dataTables_wrapper .dataTables_length { margin-bottom: .5rem; }
    .dataTables_wrapper .dataTables_length select { width: auto; min-width: 76px; display: inline-block; }
    .dataTables_wrapper { max-width: 100%; overflow-x: hidden; }
    .dataTables_wrapper .dataTables_paginate .pagination { flex-wrap: wrap; justify-content: center; }
}

/* Other tables with several buttons in a cell (courses, schools, classrooms ...): the buttons wrap with an even gap instead of running off the card. */
@media (max-width: 767.98px) {
    .page-inner table td:has(> .btn-sm) { white-space: normal; }
    .page-inner table td > .btn-sm { margin: 0 6px 6px 0; }
}

/* ---------- student skill lists (reading, listening, writing, speaking): one card design ---------- */
.student-skill-list .student-skill-card {
    border: 1px solid #e3e9f3;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 26px -16px rgba(20, 39, 76, .35);
    transition: transform .15s ease, box-shadow .15s ease;
}

.student-skill-list .student-skill-card:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -16px rgba(20, 39, 76, .4); }

.student-skill-list .student-skill-card .card-header {
    padding: .9rem 1.1rem;
    background: #fff;
    border-bottom: 1px solid #edf0f6;
    border-left: 4px solid #1d7af3;
}

.student-skill-list .student-skill-card .card-header h5 { font-size: 1rem; font-weight: 700; color: #0f172a; overflow-wrap: anywhere; }
.student-skill-list .student-skill-card .card-body { padding: 1rem 1.1rem; }
.student-skill-list .student-skill-card .card-body p { margin-bottom: .55rem; color: #475569; }
.student-skill-list .student-skill-card .card-body p > i { width: 18px; text-align: center; color: #94a3b8; }
.student-skill-list .student-skill-card .card-footer { background: #f8faff; border-top: 1px solid #edf0f6; padding: .75rem 1rem; }
.student-skill-list .student-skill-card .card-footer .btn { border-radius: 12px; font-weight: 600; }

/* finished work: quieter card, green edge, nothing to start */
.student-skill-list .student-skill-card--done { background: #fbfcfe; }
.student-skill-list .student-skill-card--done .card-header { border-left-color: #16a34a; }
.student-skill-list .student-skill-card--done .card-header h5 { color: #475569; }

.student-skill-list .student-skill-divider {
    display: flex;
    align-items: center;
    margin: .5rem 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px dashed #cbd5e1;
    color: #16a34a;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

@media (max-width: 767.98px) {
    .student-skill-list .row { margin-left: 0; margin-right: 0; }
    .student-skill-list .col-12 { padding-left: 0; padding-right: 0; }
    .student-skill-list .student-skill-card .card-footer .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
}
