/**
 * Parlo Reports - panel nauczyciela i ranking.
 * Wszystko scoped do .ptr, zeby nie ruszac BuddyBoss ani reszty panelu WP.
 */

.ptr {
    --ptr-ink: #101828;
    --ptr-text: #344054;
    --ptr-muted: #667085;
    --ptr-border: #e4e7ec;
    --ptr-bg: #fff;
    --ptr-hover: #f7f9fc;
    --ptr-head: #f9fafb;
    --ptr-blue: #2a78d6;
    --ptr-green: #00875a;
    --ptr-amber: #8a5a00;
    --ptr-red: #b42318;

    color: var(--ptr-text);
    font-size: 14px;
    line-height: 1.5;
}

.ptr *,
.ptr *::before,
.ptr *::after {
    box-sizing: border-box;
}

/* --- Komunikaty --- */

.ptr-notice {
    background: var(--ptr-bg);
    border: 1px solid var(--ptr-border);
    border-left: 3px solid var(--ptr-blue);
    border-radius: 8px;
    padding: 16px 18px;
    color: var(--ptr-text);
}

.ptr-notice-admin {
    border-left-color: var(--ptr-amber);
    background: #fffaf0;
    margin-bottom: 18px;
}

/* --- Kafelki --- */

.ptr-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 0 0 20px;
}

.ptr-card {
    flex: 1 1 160px;
    background: var(--ptr-bg);
    border: 1px solid var(--ptr-border);
    border-top: 3px solid var(--ptr-muted);
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ptr-card.blue  { border-top-color: var(--ptr-blue); }
.ptr-card.ok    { border-top-color: var(--ptr-green); }
.ptr-card.warn  { border-top-color: var(--ptr-amber); }
.ptr-card.bad   { border-top-color: var(--ptr-red); }

.ptr-card .num {
    font-size: 26px;
    font-weight: 700;
    color: var(--ptr-ink);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.ptr-card .lbl {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ptr-muted);
}

/* --- Uklad: pasek + tresc --- */

.ptr-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.ptr-nonav .ptr-layout {
    display: block;
}

.ptr-sidebar {
    flex: 0 0 260px;
    background: var(--ptr-bg);
    border: 1px solid var(--ptr-border);
    border-radius: 10px;
    overflow: hidden;
}

.ptr-sidebar-head {
    padding: 12px 16px;
    background: var(--ptr-head);
    border-bottom: 1px solid var(--ptr-border);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ptr-muted);
}

.ptr-teamlist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ptr-teamlist li + li {
    border-top: 1px solid var(--ptr-border);
}

.ptr-teamlink {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s ease;
}

.ptr-teamlink:hover,
.ptr-teamlink:focus {
    background: var(--ptr-hover);
    text-decoration: none;
}

.ptr-teamlink.current {
    background: var(--ptr-hover);
    border-left-color: var(--ptr-blue);
}

.ptr-teamname {
    display: block;
    font-weight: 600;
    color: var(--ptr-ink);
    margin-bottom: 2px;
}

.ptr-teammeta {
    display: block;
    font-size: 12px;
    color: var(--ptr-muted);
}

.ptr-teampoints {
    display: inline-block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ptr-blue);
    font-variant-numeric: tabular-nums;
}

.ptr-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* --- Naglowek sekcji --- */

.ptr-tablehead {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 12px;
    clear: both;
}

.ptr-team + .ptr-team {
    margin-top: 32px;
}

.ptr-tablehead h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--ptr-ink);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ptr-count {
    display: inline-block;
    min-width: 22px;
    padding: 1px 7px;
    background: var(--ptr-head);
    border: 1px solid var(--ptr-border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ptr-muted);
    text-align: center;
}

.ptr-teamtotal {
    font-size: 13px;
    color: var(--ptr-muted);
}

.ptr-teamtotal strong {
    color: var(--ptr-ink);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.ptr-hint {
    font-size: 12px;
    color: var(--ptr-muted);
}

/* --- Chipy kategorii --- */

.ptr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.ptr-chip {
    display: inline-block;
    padding: 3px 10px;
    background: var(--ptr-head);
    border: 1px solid var(--ptr-border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ptr-text);
    white-space: nowrap;
}

/* --- Karta ucznia --- */

.ptr-students {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ptr-student {
    background: var(--ptr-bg);
    border: 1px solid var(--ptr-border);
    border-radius: 10px;
    overflow: hidden;
}

.ptr-student-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--ptr-head);
    border-bottom: 1px solid var(--ptr-border);
    flex-wrap: wrap;
}

.ptr-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ptr-blue);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .02em;
}

.ptr-student-id {
    flex: 1 1 180px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ptr-name {
    font-weight: 700;
    color: var(--ptr-ink);
    word-break: break-word;
}

.ptr-muted {
    color: var(--ptr-muted);
    font-size: 12px;
    word-break: break-all;
}

.ptr-student-stats {
    display: flex;
    gap: 22px;
    flex: 0 0 auto;
}

.ptr-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 62px;
}

.ptr-stat-num {
    font-size: 17px;
    font-weight: 700;
    color: var(--ptr-ink);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.ptr-stat-lbl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--ptr-muted);
}

/* --- Kursy z paskiem postepu --- */

.ptr-courses {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ptr-course {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px 46px 60px;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
}

.ptr-course + .ptr-course {
    border-top: 1px solid var(--ptr-border);
}

.ptr-course:hover {
    background: var(--ptr-hover);
}

.ptr-course-title {
    color: var(--ptr-text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ptr-bar {
    display: block;
    height: 8px;
    background: #eef1f5;
    border-radius: 999px;
    overflow: hidden;
}

.ptr-bar > span {
    display: block;
    height: 100%;
    background: var(--ptr-blue);
    border-radius: 999px;
    transition: width .3s ease;
}

.ptr-bar.done > span {
    background: var(--ptr-green);
}

.ptr-course-pct {
    font-weight: 700;
    color: var(--ptr-ink);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ptr-course-steps {
    font-size: 12px;
    color: var(--ptr-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ptr-nocourses,
.ptr-empty {
    margin: 0;
    padding: 14px 16px;
    color: var(--ptr-muted);
    font-style: italic;
}

.ptr-empty {
    background: var(--ptr-bg);
    border: 1px dashed var(--ptr-border);
    border-radius: 10px;
    font-style: normal;
}

.ptr-dash {
    color: #98a2b3;
}

/* --- Tabela rankingu (panel admina) --- */

.ptr-tablecard {
    background: var(--ptr-bg);
    border: 1px solid var(--ptr-border);
    border-radius: 10px;
    overflow: hidden;
}

.ptr-tablecard-scroll {
    overflow-x: auto;
}

table.ptr-list {
    width: 100%;
    border-collapse: collapse;
    background: var(--ptr-bg);
}

table.ptr-list th {
    background: var(--ptr-head);
    border-bottom: 1px solid var(--ptr-border);
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ptr-muted);
    white-space: nowrap;
}

table.ptr-list td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ptr-border);
    vertical-align: middle;
    color: var(--ptr-text);
}

table.ptr-list tbody tr:last-child td {
    border-bottom: 0;
}

table.ptr-list tbody tr:hover {
    background: var(--ptr-hover);
}

.ptr-cellname {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ptr-cellname .ptr-name,
.ptr-cellname .ptr-muted {
    display: block;
}

.ptr-mono {
    font-variant-numeric: tabular-nums;
}

.ptr-points {
    color: var(--ptr-blue);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.ptr-place {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ptr-head);
    border: 1px solid var(--ptr-border);
    font-weight: 700;
    color: var(--ptr-muted);
    font-variant-numeric: tabular-nums;
}

.ptr-place.top {
    background: #fff7e6;
    border-color: #f0d9a8;
    color: var(--ptr-amber);
}

.ptr-empty-cell {
    text-align: center;
    color: var(--ptr-muted);
    padding: 26px 14px;
}

/* --- Panel admina: naglowek i zakladki --- */

.ptr-admin h1.wp-heading-inline {
    font-size: 21px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ptr-admin h1 .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--ptr-blue);
}

.ptr-admin .subsubsub.ptr-tabs {
    float: none !important;
    clear: both !important;
    margin: 0 0 12px;
}

/* --- Mobile --- */

@media (max-width: 900px) {
    .ptr-layout {
        flex-direction: column;
    }

    .ptr-sidebar {
        flex: 1 1 auto;
        width: 100%;
    }

    .ptr-course {
        grid-template-columns: minmax(0, 1fr) 44px;
        grid-template-areas:
            "title pct"
            "bar   steps";
        gap: 6px 10px;
    }

    .ptr-course-title { grid-area: title; white-space: normal; }
    .ptr-bar          { grid-area: bar; }
    .ptr-course-pct   { grid-area: pct; }
    .ptr-course-steps { grid-area: steps; }

    .ptr-student-stats {
        gap: 16px;
        width: 100%;
        justify-content: space-between;
    }

    .ptr-stat {
        align-items: flex-start;
    }
}
