/* ═══════════════════════════════════════════════════
   PANCE Prep Gradebook – Fixed Stylesheet
   Matches PHP class names exactly
   ═══════════════════════════════════════════════════ */

/* ─── Page Wrapper ─── */
.hgb-pance-prep {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─── Back Link ─── */
.hgb-back-link {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}
.hgb-back-link:hover {
    text-decoration: underline;
}

/* ─── Overall Progress Card ─── */
.hgb-pp-overall {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    text-align: center;
}
.hgb-pp-overall-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.hgb-pp-overall-pct {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1b2e4a;
    margin-bottom: 8px;
}
.hgb-pp-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: visible;
}
.hgb-pp-progress-fill {
    height: 100%;
    background: #1b2e4a;
    border-radius: 3px;
    transition: width 0.3s;
}
.hgb-pp-overall-time {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 10px;
}

/* ═══════════════════════════════════════════════════
   MAIN ACCORDION (System Quiz Scores / PANCE Simulations)
   ═══════════════════════════════════════════════════ */
.hgb-pp-accordion {
    margin-bottom: 8px;
}

/* Main accordion toggle button */
.hgb-pp-acc-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1b2e4a;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.hgb-pp-acc-toggle:hover {
    background: #243b5c;
}
.hgb-pp-acc-chevron {
    font-size: 0.7rem;
    transition: transform 0.25s;
}
.hgb-pp-acc-toggle[aria-expanded="true"] .hgb-pp-acc-chevron {
    transform: rotate(180deg);
}

/* Main accordion panel — HIDDEN by default via .hgb-pp-closed */
.hgb-pp-acc-panel {
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.hgb-pp-acc-panel.hgb-pp-closed {
    max-height: 0 !important;
    overflow: hidden;
}
.hgb-pp-acc-panel:not(.hgb-pp-closed) {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════
   SYSTEM ITEMS (inside System Quiz Scores accordion)
   ═══════════════════════════════════════════════════ */
.hgb-pp-system-item {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}
.hgb-pp-system-item:last-child {
    border-bottom: none;
}
.hgb-pp-system-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}
.hgb-pp-system-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1b2e4a;
    flex: 1;
    min-width: 140px;
}
.hgb-pp-system-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}
.hgb-pp-system-pct {
    font-weight: 700;
    color: #1b2e4a;
}
.hgb-pp-system-time {
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
}
.hgb-pp-label {
    font-weight: 400;
    color: #64748b;
}

/* ═══════════════════════════════════════════════════
   SUB-TOGGLE (Best Score, View attempt history, Category Performance)
   ═══════════════════════════════════════════════════ */
.hgb-pp-sub-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.78rem;
    color: #475569;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.2s;
}
.hgb-pp-sub-toggle:hover {
    background: #f8fafc;
}
.hgb-pp-sub-chevron {
    font-size: 0.55rem;
    transition: transform 0.25s;
}
.hgb-pp-sub-toggle[aria-expanded="true"] .hgb-pp-sub-chevron {
    transform: rotate(180deg);
}
.hgb-pp-sub-stat {
    font-weight: 600;
    margin-left: 4px;
}

/* Sub panel — HIDDEN by default via .hgb-pp-closed */
.hgb-pp-sub-panel {
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.hgb-pp-sub-panel.hgb-pp-closed {
    max-height: 0 !important;
    overflow: hidden;
}
.hgb-pp-sub-panel:not(.hgb-pp-closed) {
    padding: 8px 0 4px 0;
}

/* ═══════════════════════════════════════════════════
   RAPID RECALL SCORE ROWS
   ═══════════════════════════════════════════════════ */
.hgb-pp-rr-list {
    padding: 4px 0;
}
.hgb-pp-rr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 0.82rem;
    border-bottom: 1px solid #f8fafc;
}
.hgb-pp-rr-row:last-child {
    border-bottom: none;
}
.hgb-pp-rr-topic {
    color: #333;
    flex: 1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
    padding-right: 8px;
}
.hgb-pp-rr-score {
    font-weight: 700;
    min-width: 36px;
    text-align: right;
}
.hgb-pp-rr-none {
    color: #94a3b8;
}
.hgb-pp-rr-red {
    color: #991b1b;
}
.hgb-pp-rr-yellow {
    color: #92400e;
}
.hgb-pp-rr-green {
    color: #065f46;
}

/* ═══════════════════════════════════════════════════
   SIMULATION GROUP (inside PANCE Simulations accordion)
   ═══════════════════════════════════════════════════ */
.hgb-pp-mock-group {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.hgb-pp-mock-group:last-child {
    border-bottom: none;
}

/* Group toggle button (PANCE Simulation 1, 2, etc.) */
.hgb-pp-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1b2e4a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.hgb-pp-group-toggle:hover {
    background: #243b5c;
}
.hgb-pp-group-name {
    flex: 1;
    text-align: left;
}
.hgb-pp-group-score {
    font-weight: 700;
    margin-right: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}
.hgb-pp-group-score.hgb-pp-score-green {
    background: #d1fae5;
    color: #065f46;
}
.hgb-pp-group-score.hgb-pp-score-yellow {
    background: #fef3c7;
    color: #92400e;
}
.hgb-pp-group-score.hgb-pp-score-red {
    background: #fee2e2;
    color: #991b1b;
}
.hgb-pp-group-status {
    font-style: italic;
    opacity: 0.8;
    margin-right: 8px;
    font-size: 0.85rem;
}
.hgb-pp-group-chevron {
    font-size: 0.6rem;
    transition: transform 0.25s;
}
.hgb-pp-group-toggle[aria-expanded="true"] .hgb-pp-group-chevron {
    transform: rotate(180deg);
}

/* Group panel — HIDDEN by default via .hgb-pp-closed */
.hgb-pp-group-panel {
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.hgb-pp-group-panel.hgb-pp-closed {
    max-height: 0 !important;
    overflow: hidden;
}
.hgb-pp-group-panel:not(.hgb-pp-closed) {
    padding: 10px 4px 4px 4px;
}

/* ═══════════════════════════════════════════════════
   MOCK ITEMS (Mock 1–5 inside each simulation group)
   ═══════════════════════════════════════════════════ */
.hgb-pp-mock-list {
    /* container for all mocks in a group */
}
.hgb-pp-mock-item {
    padding: 10px 0;
    border-bottom: 1px solid #f4f6f8;
}
.hgb-pp-mock-item:last-child {
    border-bottom: none;
}
.hgb-pp-mock-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.hgb-pp-mock-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1b2e4a;
    margin-right: 8px;
}
.hgb-pp-mock-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.hgb-pp-mock-best,
.hgb-pp-mock-avg {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}
.hgb-pp-mock-best.hgb-pp-badge-green,
.hgb-pp-mock-avg.hgb-pp-badge-green {
    color: #065f46;
    background: #d1fae5;
}
.hgb-pp-mock-best.hgb-pp-badge-yellow,
.hgb-pp-mock-avg.hgb-pp-badge-yellow {
    color: #92400e;
    background: #fef3c7;
}
.hgb-pp-mock-best.hgb-pp-badge-red,
.hgb-pp-mock-avg.hgb-pp-badge-red {
    color: #991b1b;
    background: #fee2e2;
}
.hgb-pp-mock-avg {
    font-weight: 600;
    border-radius: 4px;
}
.hgb-pp-mock-attempts {
    font-size: 0.72rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
}
.hgb-pp-mock-not-started {
    font-size: 0.82rem;
    font-style: italic;
    color: #94a3b8;
}

/* ═══════════════════════════════════════════════════
   ATTEMPT HISTORY ROWS
   ═══════════════════════════════════════════════════ */
.hgb-pp-attempt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.82rem;
}
.hgb-pp-attempt-row:last-child {
    border-bottom: none;
}
.hgb-pp-attempt-num {
    font-weight: 600;
    color: #64748b;
    min-width: 28px;
}
.hgb-pp-attempt-date {
    color: #475569;
    flex: 1;
    padding: 0 8px;
}
.hgb-pp-attempt-score {
    font-weight: 700;
}
.hgb-pp-score-pass {
    color: #065f46;
}
.hgb-pp-score-fail {
    color: #991b1b;
}

/* ═══════════════════════════════════════════════════
   CATEGORY PERFORMANCE CARDS
   ═══════════════════════════════════════════════════ */
.hgb-pp-cat-section {
    margin-top: 8px;
}
.hgb-pp-cat-heading {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 6px;
    margin-top: 10px;
}
.hgb-pp-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px 0;
    width: 100%;
}
.hgb-pp-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    border-radius: 6px;
    text-align: center;
    min-height: 42px;
    min-width: 0;
    overflow: hidden;
}
.hgb-pp-cat-abbrev {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-bottom: 1px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    width: 100%;
    line-height: 1.3;
}
.hgb-pp-cat-pct {
    font-size: 0.82rem;
    font-weight: 800;
}
.hgb-pp-cat-green {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}
.hgb-pp-cat-yellow {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}
.hgb-pp-cat-red {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (min-width: 600px) {
    .hgb-pp-cat-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .hgb-pp-cat-card {
        padding: 8px 4px;
        min-height: 48px;
    }
    .hgb-pp-cat-abbrev {
        font-size: 0.72rem;
    }
    .hgb-pp-cat-pct {
        font-size: 0.88rem;
    }
}
@media (max-width: 400px) {
    .hgb-pp-system-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .hgb-pp-mock-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ═══ Inline Simulation Gradebook on Lesson Pages ═══ */
.hgb-pp-sim-inline {
    margin: 2rem 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}
.hgb-pp-sim-inline .hgb-pp-mock-group {
    border: none;
    margin: 0;
}
.hgb-pp-group-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    color: #fff;
    padding: 14px 18px;
    border-radius: 8px 8px 0 0;
}
.hgb-pp-group-header-inline .hgb-pp-group-name {
    font-weight: 700;
    font-size: 1rem;
}
.hgb-pp-group-header-inline .hgb-pp-group-score {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.hgb-pp-group-header-inline .hgb-pp-group-status {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ═══ Inline Accordion Toggle Button ═══ */
.hgb-pp-group-toggle-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: #1e293b;
    color: #fff;
    padding: 14px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: border-radius 0.2s;
}
.hgb-pp-group-toggle-inline[aria-expanded="true"] {
    border-radius: 8px 8px 0 0;
}
.hgb-pp-group-toggle-inline .hgb-pp-group-name {
    font-weight: 700;
}
.hgb-pp-group-toggle-inline .hgb-pp-group-score {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.hgb-pp-group-toggle-inline .hgb-pp-group-status {
    font-size: 0.85rem;
    opacity: 0.7;
}
.hgb-pp-group-toggle-inline .hgb-pp-group-chevron {
    font-size: 0.7rem;
    margin-left: 8px;
    transition: transform 0.3s;
}
.hgb-pp-group-toggle-inline[aria-expanded="true"] .hgb-pp-group-chevron {
    transform: rotate(180deg);
}
.hgb-pp-sim-panel {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
}
.hgb-pp-sim-panel.hgb-pp-closed {
    display: none;
}

/* Inline Gradebook Heading */
.hgb-pp-inline-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 10px 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
