/* =============================================================================
   MetaMorphe LMS — Reporting Admin Styles — same design system as structure-styles
   ============================================================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* -----------------------------------------------------------------------------
   Design tokens (mirrors structure-styles.css)
   ----------------------------------------------------------------------------- */
:root {
    --ink-900: #1c1a17;
    --ink-800: #2a2722;
    --ink-700: #3c3832;
    --ink-600: #5a544c;
    --ink-500: #807a72;
    --ink-400: #a8a39a;
    --ink-300: #cfcbc4;
    --ink-200: #e7e4df;
    --ink-150: #efece7;
    --ink-100: #f6f3ee;
    --ink-50:  #faf8f4;
    --bg:      #f4f1ec;
    --paper:   #ffffff;

    --c-green:  #8fcc5a;
    --c-cyan:   #4ec0d8;
    --c-pink:   #dc5f84;
    --c-yellow: #ecd84b;

    --ink-green:  #4d7a26;
    --ink-cyan:   #1d6e80;
    --ink-pink:   #9c2f51;
    --ink-yellow: #7a6411;

    --bg-green:  #ecf6dc;
    --bg-cyan:   #e0f1f5;
    --bg-pink:   #fae2e9;
    --bg-yellow: #faf3cf;

    --bd-green:  #cfe6a4;
    --bd-cyan:   #b4dde6;
    --bd-pink:   #efc1cf;
    --bd-yellow: #ead67e;

    --r-xs:   4px;
    --r-sm:   8px;
    --r-md:   12px;
    --r-lg:   16px;
    --r-pill: 999px;

    --sh-1: 0 1px 0 rgba(28,26,23,.04), 0 1px 2px rgba(28,26,23,.04);
    --sh-2: 0 2px 4px rgba(28,26,23,.04), 0 8px 24px -8px rgba(28,26,23,.08);
    --sh-3: 0 4px 12px rgba(28,26,23,.06), 0 16px 40px -12px rgba(28,26,23,.12);

    --font-sans: "Inter", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;

    --mm-transition: 0.18s ease;
}


/* =============================================================================
   Page wrapper
   ============================================================================= */
.mm-lms-reporting {
    font-family: var(--font-sans);
    color: var(--ink-900);
    background: var(--bg);
    margin: -10px -20px 0;
    padding: 28px 32px 48px;
    min-height: 80vh;
    max-width: none;
}

.mm-lms-reporting * {
    box-sizing: border-box;
}

.mm-lms-reporting h1 {
    font-family: var(--font-sans);
    font-size: 22px;
    font-weight: 700;
    color: var(--ink-900);
    margin: 0 0 20px;
    letter-spacing: -0.02em;
}


/* =============================================================================
   Toolbar
   ============================================================================= */
.mm-lms-reporting .mmlms-reporting-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}

.mm-lms-reporting .mmlms-reporting-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--r-pill);
    flex: 1;
    max-width: 420px;
}

.mm-lms-reporting .mmlms-reporting-search::before {
    /* dashicons-search via content */
    font-family: dashicons;
    content: '\f179';
    color: var(--ink-500);
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.mm-lms-reporting .mmlms-user-filter-input {
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--ink-800);
    flex: 1;
    min-width: 0;
    padding: 0;
    box-shadow: none;
    width: auto;
}

.mm-lms-reporting .mmlms-user-filter-input::placeholder {
    color: var(--ink-500);
}

.mm-lms-reporting .mmlms-filter-count {
    font-size: 12px;
    color: var(--ink-500);
    white-space: nowrap;
    font-family: var(--font-mono);
}

.mm-lms-reporting .mmlms-reporting-summary {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--r-pill);
    font-size: 12px;
    color: var(--ink-600);
    font-family: var(--font-mono);
    white-space: nowrap;
}


/* =============================================================================
   Main table
   ============================================================================= */
.mm-lms-reporting .mmlms-reporting-table.wp-list-table {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-1);
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-sans);
}

/* Remove WP default stripes */
.mm-lms-reporting .mmlms-reporting-table.striped > tbody > tr:nth-child(odd) td,
.mm-lms-reporting .mmlms-reporting-table.striped > tbody > tr:nth-child(odd) th {
    background: transparent;
}

.mm-lms-reporting .mmlms-reporting-table th {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-500);
    background: var(--ink-50);
    border-bottom: 1px solid var(--ink-200);
    padding: 10px 14px;
    font-family: var(--font-sans);
}

.mm-lms-reporting .mmlms-reporting-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ink-150);
    vertical-align: middle;
    font-size: 13px;
    color: var(--ink-800);
}

.mm-lms-reporting .mmlms-reporting-table tbody tr:last-child td {
    border-bottom: none;
}

/* User row hover */
.mm-lms-reporting .mmlms-user-row:hover td {
    background: var(--ink-50);
}

/* Toggle column */
.mm-lms-reporting .mmlms-reporting-table .mmlms-col-toggle {
    text-align: center;
    padding: 8px 4px;
    width: 40px;
}

.mm-lms-reporting .mmlms-toggle-detail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0 !important;
    min-height: unset !important;
    background: var(--paper) !important;
    border: 1px solid var(--ink-200) !important;
    border-radius: var(--r-sm) !important;
    color: var(--ink-600) !important;
    cursor: pointer;
    transition: background var(--mm-transition), border-color var(--mm-transition), transform 0.2s;
    box-shadow: none !important;
}

.mm-lms-reporting .mmlms-toggle-detail:hover {
    background: var(--ink-100) !important;
    border-color: var(--ink-300) !important;
}

.mm-lms-reporting .mmlms-toggle-detail.active {
    transform: rotate(90deg);
    background: var(--bg-cyan) !important;
    border-color: var(--bd-cyan) !important;
    color: var(--ink-cyan) !important;
}

.mm-lms-reporting .mmlms-toggle-detail .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Date column */
.mm-lms-reporting .mmlms-col-date {
    white-space: nowrap;
    color: var(--ink-500);
    font-size: 12px;
    font-family: var(--font-mono);
}

/* User name */
.mm-lms-reporting .mmlms-col-user strong {
    font-weight: 600;
    color: var(--ink-900);
}

/* Email */
.mm-lms-reporting .mmlms-col-email {
    color: var(--ink-600);
    font-size: 12px;
}

/* Modules count */
.mm-lms-reporting .mmlms-col-modules {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-600);
}


/* =============================================================================
   Progress bar
   ============================================================================= */
.mm-lms-reporting .mmlms-col-progress {
    white-space: nowrap;
}

.mm-lms-reporting .mmlms-reporting-progress-bar {
    display: inline-block;
    width: 100px;
    height: 6px;
    background: var(--ink-200);
    border-radius: var(--r-pill);
    overflow: hidden;
    vertical-align: middle;
    margin-right: 8px;
}

.mm-lms-reporting .mmlms-reporting-progress-fill {
    height: 100%;
    background: var(--c-cyan);
    border-radius: var(--r-pill);
    transition: width 0.4s ease;
}

.mm-lms-reporting .mmlms-reporting-progress-text {
    font-weight: 600;
    font-size: 12px;
    color: var(--ink-700);
    font-family: var(--font-mono);
}


/* =============================================================================
   Detail row
   ============================================================================= */
.mm-lms-reporting .mmlms-detail-row td {
    padding: 0 !important;
    background: var(--bg) !important;
    border-top: 2px solid var(--c-cyan);
}

.mm-lms-reporting .mmlms-detail-row .mmlms-detail-content {
    padding: 20px 24px;
}

.mm-lms-reporting .mmlms-detail-loading {
    padding: 20px 24px;
    color: var(--ink-500);
    font-size: 13px;
    font-family: var(--font-sans);
    font-style: normal;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mm-lms-reporting .mmlms-detail-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--ink-200);
    border-top-color: var(--c-cyan);
    border-radius: 50%;
    animation: mmlms-reporting-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes mmlms-reporting-spin {
    to { transform: rotate(360deg); }
}

.mm-lms-reporting .mmlms-no-data {
    color: var(--ink-500);
    font-size: 13px;
    font-style: normal;
    margin: 4px 0;
    font-family: var(--font-sans);
}


/* =============================================================================
   Expand/collapse controls
   ============================================================================= */
.mm-lms-reporting .mmlms-report-controls {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.mm-lms-reporting .mmlms-report-controls .button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px !important;
    background: var(--paper) !important;
    border: 1px solid var(--ink-200) !important;
    border-radius: var(--r-sm) !important;
    font-family: var(--font-sans) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: var(--ink-700) !important;
    height: auto !important;
    line-height: 1 !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: border-color var(--mm-transition), background var(--mm-transition);
}

.mm-lms-reporting .mmlms-report-controls .button:hover {
    background: var(--ink-50) !important;
    border-color: var(--ink-300) !important;
}

.mm-lms-reporting .mmlms-report-controls .button .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
}


/* =============================================================================
   Module card
   ============================================================================= */
.mm-lms-reporting .mmlms-report-module {
    margin-bottom: 10px;
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-1);
}

.mm-lms-reporting .mmlms-report-module-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ink-150);
    flex-wrap: wrap;
    cursor: default;
}

/* Status-based left rail via border-left */
.mm-lms-reporting .mmlms-report-completed .mmlms-report-module-header {
    background: linear-gradient(to right, var(--bg-green) 0%, var(--paper) 60px);
    border-left: 4px solid var(--c-green);
}

.mm-lms-reporting .mmlms-report-in-progress .mmlms-report-module-header {
    background: linear-gradient(to right, var(--bg-yellow) 0%, var(--paper) 60px);
    border-left: 4px solid var(--c-yellow);
}

.mm-lms-reporting .mmlms-report-not-started .mmlms-report-module-header {
    background: var(--ink-50);
    border-left: 4px solid var(--ink-300);
}

/* Module toggle button */
.mm-lms-reporting .mmlms-module-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--paper) !important;
    border: 1px solid var(--ink-200) !important;
    border-radius: var(--r-xs) !important;
    cursor: pointer;
    padding: 0 !important;
    flex-shrink: 0;
    color: var(--ink-600);
    transition: background var(--mm-transition);
    line-height: 1;
    box-shadow: none !important;
}

.mm-lms-reporting .mmlms-module-toggle:hover {
    background: var(--ink-100) !important;
    border-color: var(--ink-300) !important;
}

.mm-lms-reporting .mmlms-module-toggle .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Module icon */
.mm-lms-reporting .mmlms-report-module-icon .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.mm-lms-reporting .mmlms-report-completed .mmlms-report-module-icon .dashicons {
    color: var(--ink-green);
}

.mm-lms-reporting .mmlms-report-in-progress .mmlms-report-module-icon .dashicons {
    color: var(--ink-yellow);
}

.mm-lms-reporting .mmlms-report-not-started .mmlms-report-module-icon .dashicons {
    color: var(--ink-400);
}

/* Module title */
.mm-lms-reporting .mmlms-report-module-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-900);
    flex: 1;
    min-width: 180px;
    font-family: var(--font-sans);
}

/* Module progress */
.mm-lms-reporting .mmlms-report-module-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--ink-500);
    font-family: var(--font-mono);
}

.mm-lms-reporting .mmlms-report-module-progress .mmlms-reporting-progress-bar {
    width: 80px;
}

/* Reset button */
.mm-lms-reporting .mmlms-reset-module-progress {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 4px 8px !important;
    background: transparent !important;
    border: 1px solid var(--ink-200) !important;
    border-radius: var(--r-sm) !important;
    font-family: var(--font-sans) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    color: var(--ink-500) !important;
    height: auto !important;
    line-height: 1 !important;
    box-shadow: none !important;
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
}

.mm-lms-reporting .mmlms-reset-module-progress:hover {
    background: #fff0f0 !important;
    border-color: #fca5a5 !important;
    color: #c62828 !important;
}

.mm-lms-reporting .mmlms-reset-module-progress .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
}

/* Module content */
.mm-lms-reporting .mmlms-report-module-content {
    padding: 10px 14px;
    background: var(--ink-50);
    display: flex;
    flex-direction: column;
    gap: 6px;
}


/* =============================================================================
   Lesson row
   ============================================================================= */
.mm-lms-reporting .mmlms-report-lesson {
    padding: 8px 12px;
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--r-sm);
    border-left: 3px solid var(--ink-300);
}

.mm-lms-reporting .mmlms-report-lesson.mmlms-report-item-completed {
    border-left-color: var(--c-green);
}

.mm-lms-reporting .mmlms-report-lesson.mmlms-report-item-pending {
    border-left-color: var(--c-yellow);
}

.mm-lms-reporting .mmlms-report-lesson-header,
.mm-lms-reporting .mmlms-report-exercise-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--ink-700);
    font-family: var(--font-sans);
}

.mm-lms-reporting .mmlms-report-lesson-title,
.mm-lms-reporting .mmlms-report-exercise-title {
    font-weight: 600;
    color: var(--ink-800);
}

.mm-lms-reporting .mmlms-report-date {
    color: var(--ink-400);
    font-size: 11px;
    margin-left: auto;
    font-family: var(--font-mono);
}

.mm-lms-reporting .mmlms-report-exercise-count {
    color: var(--ink-500);
    font-size: 11px;
    font-family: var(--font-mono);
}

/* Status icons */
.mm-lms-reporting .mmlms-icon-ok {
    color: var(--ink-green);
    font-weight: bold;
    font-size: 13px;
    flex-shrink: 0;
}

.mm-lms-reporting .mmlms-icon-pending {
    color: var(--ink-yellow);
    font-size: 13px;
    flex-shrink: 0;
}

.mm-lms-reporting .mmlms-icon-wrong {
    color: var(--ink-pink);
    font-weight: bold;
    font-size: 13px;
    flex-shrink: 0;
}


/* =============================================================================
   Exercise rows
   ============================================================================= */
.mm-lms-reporting .mmlms-report-exercises {
    margin: 6px 0 2px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mm-lms-reporting .mmlms-report-exercise {
    padding: 6px 10px;
    background: var(--ink-50);
    border: 1px solid var(--ink-150);
    border-left: 2px solid var(--ink-300);
    border-radius: var(--r-xs);
}

.mm-lms-reporting .mmlms-report-exercise.mmlms-report-item-completed {
    border-left-color: var(--c-green);
}

.mm-lms-reporting .mmlms-report-exercise.mmlms-report-item-pending {
    border-left-color: var(--c-yellow);
}


/* =============================================================================
   Quiz in reporting
   ============================================================================= */
.mm-lms-reporting .mmlms-report-quiz {
    margin: 6px 0 2px 12px;
    padding: 8px 12px;
    background: var(--bg-pink);
    border-radius: var(--r-sm);
    border: 1px solid var(--bd-pink);
    border-left: 3px solid var(--c-pink);
}

.mm-lms-reporting .mmlms-report-quiz-pending {
    background: var(--ink-50);
    border-color: var(--ink-200);
    border-left-color: var(--ink-300);
}

.mm-lms-reporting .mmlms-report-quiz-badge {
    font-weight: 700;
    font-size: 11px;
    color: var(--ink-pink);
    letter-spacing: 0.04em;
    font-family: var(--font-sans);
}

.mm-lms-reporting .mmlms-report-quiz-pending .mmlms-report-quiz-badge {
    color: var(--ink-500);
}

.mm-lms-reporting .mmlms-report-quiz-status {
    font-size: 11px;
    color: var(--ink-400);
    font-family: var(--font-sans);
}

.mm-lms-reporting .mmlms-report-quiz-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 12px;
}

.mm-lms-reporting .mmlms-report-quiz-score {
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-700);
}

.mm-lms-reporting .mmlms-report-quiz-result {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-xs);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.4;
    font-family: var(--font-sans);
}

.mm-lms-reporting .mmlms-report-quiz-result.passed {
    background: var(--bg-green);
    color: var(--ink-green);
    border: 1px solid var(--bd-green);
}

.mm-lms-reporting .mmlms-report-quiz-result.failed {
    background: var(--bg-pink);
    color: var(--ink-pink);
    border: 1px solid var(--bd-pink);
}


/* =============================================================================
   Quiz answers table
   ============================================================================= */
.mm-lms-reporting .mmlms-report-answers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
    font-family: var(--font-sans);
    background: var(--paper);
    border-radius: var(--r-sm);
    overflow: hidden;
    border: 1px solid var(--ink-200);
}

.mm-lms-reporting .mmlms-report-answers-table th {
    background: var(--ink-50);
    padding: 7px 10px;
    text-align: left;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-500);
    border-bottom: 1px solid var(--ink-200);
}

.mm-lms-reporting .mmlms-report-answers-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--ink-150);
    vertical-align: middle;
    color: var(--ink-800);
    font-size: 12px;
}

.mm-lms-reporting .mmlms-report-answers-table tbody tr:last-child td {
    border-bottom: none;
}

.mm-lms-reporting .mmlms-answer-correct {
    background: var(--bg-green);
}

.mm-lms-reporting .mmlms-answer-wrong {
    background: var(--bg-pink);
}


/* =============================================================================
   Responsive
   ============================================================================= */
@media screen and (max-width: 782px) {
    .mm-lms-reporting {
        padding: 16px 16px 32px;
    }

    .mm-lms-reporting .mmlms-reporting-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .mm-lms-reporting .mmlms-reporting-search {
        max-width: none;
    }

    .mm-lms-reporting .mmlms-reporting-progress-bar {
        width: 60px;
    }

    .mm-lms-reporting .mmlms-report-module-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .mm-lms-reporting .mmlms-reset-module-progress {
        margin-left: 0;
    }

    .mm-lms-reporting .mmlms-report-date {
        margin-left: 0;
    }
}
