/* Analytical Reports shared styles */

.ar-filter-panel {
    background: #f5f5f5;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.ar-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Report header info row */
.ar-header-info {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

    .ar-header-info span strong {
        margin-right: 4px;
    }

/* Report table */
.ar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

    .ar-table thead tr {
        background: #1565C0;
        color: #fff;
    }

    .ar-table thead th {
        padding: 8px 10px;
        text-align: center;
        font-weight: 600;
        white-space: nowrap;
    }

    .ar-table tbody tr:nth-child(even) {
        background: #E3F2FD;
    }

    .ar-table tbody tr:hover {
        background: #BBDEFB;
    }

    .ar-table tbody td {
        padding: 6px 10px;
        text-align: center;
        border-bottom: 1px solid #BBDEFB;
    }

        .ar-table tbody td:first-child {
            text-align: left;
        }

    /* Distractor highlight */
    .ar-table tbody tr.ar-distractor-alert td {
        background: #fff3cd;
    }

/* Summary stat tiles */
.ar-stat-tile {
    border-radius: 6px;
    padding: 16px;
    color: #fff;
    text-align: center;
    min-width: 140px;
}

    .ar-stat-tile .ar-stat-pct {
        font-size: 2rem;
        font-weight: 700;
        line-height: 1;
    }

    .ar-stat-tile .ar-stat-label {
        font-size: 0.75rem;
        margin-top: 4px;
        opacity: 0.9;
    }

    .ar-stat-tile .ar-stat-sub {
        font-size: 0.8rem;
        opacity: 0.85;
    }

/* Performance summary tiles */
.ar-tile-avg {
    background: #1976D2;
}

.ar-tile-low {
    background: #D32F2F;
}

.ar-tile-high {
    background: #388E3C;
}

.ar-tile-kr20 {
    background: #5E35B1;
    min-width: 180px;
}

.ar-tile-label {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 4px;
}

.ar-tile-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

/* KR-20 gauge bar */
.ar-kr20-bar-bg {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin: 4px 0;
}

.ar-kr20-bar-fill {
    height: 100%;
    background: linear-gradient(to right, #d32f2f, #ffa000, #388e3c);
    border-radius: 6px;
}

.ar-kr20-marker {
    position: absolute;
    top: -4px;
    width: 12px;
    height: 28px;
    background: #333;
    border-radius: 3px;
    transform: translateX(-50%);
}

/* Horizontal bar chart */
.ar-hbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    width: 100%;
}

.ar-hbar-label {
    width: 220px;
    min-width: 220px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.ar-hbar-track {
    flex: 1;
    height: 28px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    direction: ltr;
    display: flex;
    justify-content: flex-start;
}

.ar-hbar-fill {
    height: 100%;
    background: #1976d2;
    border-radius: 6px;
    min-width: 6px;
    flex-shrink: 0;
}

.ar-hbar-count {
    width: 90px;
    min-width: 90px;
    text-align: left;
    white-space: nowrap;
    font-weight: 500;
}

/* Section titles */
.ar-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 20px 0 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #1976D2;
}

/* Print styles */
@media print {

    @page {
        size: A4 landscape;
        margin: 8mm;
    }

    .ar-no-print,
    .mud-appbar,
    .mud-navmenu,
    .mud-drawer,
    .mud-toolbar,
    nav,
    header,
    footer {
        display: none !important;
        visibility: hidden !important;
    }

    html, body {
        width: 100%;
        height: auto;
        overflow: visible !important;
        font-size: 11px;
        background: white !important;
    }

    .mud-main-content,
    .mud-container,
    .mud-container-maxwidth-lg,
    [class*="mud-container"] {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    .overflow-auto,
    [class*="overflow"],
    .mud-paper,
    .mud-table-container {
        overflow: visible !important;
        max-width: none !important;
        width: 100% !important;
        box-shadow: none !important;
    }

    /* ── 4. Report sections: no clipping, no page breaks inside ── */
    .ar-header-info,
    .ar-hbar-container,
    .ar-section-title {
        overflow: visible !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .ar-table {
        width: 100% !important;
        table-layout: auto !important;
        font-size: 0.65rem !important;
        overflow: visible !important;
        border-collapse: collapse !important;
    }

        .ar-table th,
        .ar-table td {
            padding: 3px 4px !important;
            font-size: 0.65rem !important;
            white-space: normal !important;
            word-break: break-word !important;
            max-width: 80px !important;
        }

        .ar-table thead tr {
            background: #1565C0 !important;
            color: #fff !important;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
        }

        .ar-table thead {
            display: table-header-group;
        }

        .ar-table tbody tr {
            page-break-inside: avoid;
            break-inside: avoid;
        }

            .ar-table tbody tr:nth-child(even) {
                background: #E3F2FD !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }

    .ar-hbar-container {
        width: 100%;
    }

    .ar-hbar-row {
        display: flex;
        align-items: center;
        gap: 8px;
        page-break-inside: avoid;
        min-height: 24px;
        margin-bottom: 6px;
    }

    .ar-hbar-label {
        width: 160px;
        min-width: 160px;
        font-size: 0.72rem;
        text-align: right;
        font-weight: 600;
        white-space: nowrap;
    }

    .ar-hbar-track {
        flex: 1;
        min-width: 150px;
        height: 18px;
        border: 1px solid #bdbdbd;
        background: #eeeeee !important;
        overflow: visible;
        direction: ltr;
        border-radius: 4px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ar-hbar-fill {
        background: #1976d2 !important;
        height: 18px;
        display: block;
        border-radius: 4px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ar-hbar-count {
        width: 70px;
        min-width: 70px;
        font-size: 0.72rem;
        font-weight: 600;
        text-align: left;
        white-space: nowrap;
    }

    /* ── 7. SVG histogram ── */
    svg {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ── 8. Stat tiles (Score Distribution) ── */
    .mud-paper {
        page-break-inside: avoid;
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
