/* ============================================================
   HELP Campus Gradebook — Mobile-First Stylesheet
   ============================================================ */

/* ── Reset / Base ─────────────────────────────────────────── */
.hgb-wrapper *,
.hgb-wrapper *::before,
.hgb-wrapper *::after {
    box-sizing: border-box;
}

.hgb-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: #1a1a2e;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 0 40px;
}

.hgb-notice,
.hgb-empty {
    padding: 16px;
    background: #f0f4ff;
    border-radius: 8px;
    color: #555;
    font-size: 14px;
    text-align: center;
}

/* ── Course Block ─────────────────────────────────────────── */
.hgb-course {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    background: #fff;
}

.hgb-course-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #16213e;
    color: #fff;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 56px;
}

.hgb-course-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    flex: 1;
    padding-right: 12px;
}

/* ── Lesson Block ─────────────────────────────────────────── */
.hgb-lesson {
    border-bottom: 1px solid #eef0f5;
}

.hgb-lesson:last-child {
    border-bottom: none;
}

.hgb-lesson-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0f3460;
    color: #e2e8f0;
    padding: 13px 20px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}

.hgb-lesson-title {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    padding-right: 12px;
}

/* ── Topic Block ──────────────────────────────────────────── */
.hgb-topic {
    background: #f8faff;
    border-left: 3px solid #e94560;
    margin: 0 0 2px 0;
}

.hgb-topic-header {
    padding: 10px 16px 6px;
}

.hgb-topic-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #e94560;
}

/* ── Quiz Summary Row ─────────────────────────────────────── */
.hgb-quiz-block {
    border-bottom: 1px solid #f0f2f8;
}

.hgb-quiz-block:last-child {
    border-bottom: none;
}

.hgb-quiz-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #fff;
    gap: 8px;
    min-height: 56px;
}

.hgb-quiz-summary.hgb-expandable {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.hgb-quiz-summary.hgb-expandable:active {
    background: #f5f7ff;
}

.hgb-quiz-name {
    flex: 1;
    min-width: 0;
}

.hgb-quiz-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a2e;
    line-height: 1.4;
    word-break: break-word;
}

.hgb-attempt-badge {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
    background: #f0f2f8;
    border-radius: 20px;
    padding: 2px 8px;
}

.hgb-quiz-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hgb-best-score {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    min-width: 46px;
    text-align: right;
}

/* Status badges */
.hgb-status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    padding: 3px 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.hgb-status-pass    { background: #d1fae5; color: #065f46; }
.hgb-status-fail    { background: #fee2e2; color: #991b1b; }
.hgb-status-incomplete { background: #f3f4f6; color: #6b7280; }

.hgb-chevron {
    font-size: 20px;
    color: #9ca3af;
    transition: transform 0.25s ease;
    line-height: 1;
    display: inline-block;
}

.hgb-quiz-summary.hgb-open .hgb-chevron {
    transform: rotate(90deg);
}

/* ── Attempts Detail Table ────────────────────────────────── */
.hgb-attempts-detail {
    display: none;
    padding: 0 0 8px;
    background: #f8faff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hgb-attempts-detail.hgb-open {
    display: block;
}

.hgb-attempts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.hgb-attempts-table thead th {
    background: #e8ecf8;
    color: #374151;
    font-weight: 700;
    padding: 9px 12px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid #d1d5db;
}

.hgb-attempts-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.hgb-attempts-table tbody tr:last-child td {
    border-bottom: none;
}

.hgb-row-pass { background: #f0fdf4; }
.hgb-row-fail { background: #fff5f5; }

/* Score pill */
.hgb-score-pill {
    display: inline-block;
    font-weight: 700;
    font-size: 13px;
    border-radius: 6px;
    padding: 2px 8px;
}

.hgb-pill-pass { background: #d1fae5; color: #065f46; }
.hgb-pill-fail { background: #fee2e2; color: #991b1b; }

.hgb-pass-text { color: #059669; font-weight: 600; }
.hgb-fail-text { color: #dc2626; font-weight: 600; }

/* Toggle icons */
.hgb-toggle-icon {
    font-size: 14px;
    opacity: 0.7;
    transition: transform 0.25s ease;
    display: inline-block;
    flex-shrink: 0;
}

.hgb-course-header.hgb-open .hgb-toggle-icon,
.hgb-lesson-header.hgb-open .hgb-toggle-icon {
    transform: rotate(180deg);
}

/* ── Mobile: card-style table on small screens ────────────── */
@media (max-width: 600px) {
    .hgb-attempts-table thead {
        display: none;
    }

    .hgb-attempts-table tbody tr {
        display: block;
        margin: 8px 12px;
        border-radius: 8px;
        border: 1px solid #e5e7eb;
        overflow: hidden;
    }

    .hgb-attempts-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 9px 14px;
        border-bottom: 1px solid #f0f2f8;
        font-size: 13px;
    }

    .hgb-attempts-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex-shrink: 0;
        margin-right: 8px;
    }

    .hgb-attempts-table tbody td:last-child {
        border-bottom: none;
    }

    .hgb-quiz-title {
        font-size: 13px;
    }

    .hgb-best-score {
        font-size: 15px;
    }
}

@media (max-width: 400px) {
    .hgb-course-header {
        padding: 14px 14px;
    }
    .hgb-course-title {
        font-size: 15px;
    }
    .hgb-lesson-header {
        padding: 12px 14px;
    }
}


/* ── Hidden / Collapsed state ────────────────────────────────────────────── */
.hgb-hidden { display: none !important; }
.hgb-course-header, .hgb-lesson-header { cursor: pointer; user-select: none; }
.hgb-course-header .hgb-toggle-icon,
.hgb-lesson-header .hgb-toggle-icon { transition: transform 0.2s ease; display: inline-block; }
.hgb-course-header.hgb-collapsed .hgb-toggle-icon,
.hgb-lesson-header.hgb-collapsed .hgb-toggle-icon { transform: rotate(-90deg); }

/* ── Overall Grade Bar (two columns) ─────────────────────────────────────── */
.hgb-overall-grade-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.hgb-grade-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 120px;
    padding: 4px 8px;
}
.hgb-grade-divider {
    width: 1px;
    height: 52px;
    background: #e0e0e0;
    flex-shrink: 0;
    margin: 0 8px;
}
.hgb-grade-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 4px;
}
.hgb-grade-value {
    font-size: 26px;
    font-weight: 800;
    border-radius: 6px;
    padding: 2px 14px;
    margin-bottom: 4px;
    line-height: 1.2;
}
.hgb-grade-pass { color: #166534; background: #dcfce7; }
.hgb-grade-fail { color: #991b1b; background: #fee2e2; }
.hgb-grade-none { color: #9ca3af; background: #f3f4f6; }
.hgb-grade-meta { font-size: 11px; color: #9ca3af; }

@media (max-width: 480px) {
    .hgb-overall-grade-bar { padding: 12px 14px; }
    .hgb-grade-value { font-size: 22px; }
    .hgb-grade-divider { height: 44px; }
}

/* ── Gradebook section title ─────────────────────────────────────────────── */
.hgb-gradebook-header {
    padding: 10px 0 6px 2px;
}
.hgb-gradebook-title {
    font-size: 18px;
    font-weight: 800;
    color: #1d2327;
    letter-spacing: -0.01em;
}

/* ── Multi-Course Group Mode ──────────────────────────────── */
.hgb-multi-header {
    padding: 14px 20px 10px;
}

.hgb-multi-groups {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    margin-top: 0;
}

.hgb-group-item {
    border-bottom: 1px solid #e2e8f0;
}

.hgb-group-item:last-child {
    border-bottom: none;
}

.hgb-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #16213e;
    color: #fff;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 52px;
    gap: 10px;
}

.hgb-group-header:hover {
    background: #1e2d4e;
}

.hgb-group-title {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    line-height: 1.3;
}

.hgb-group-quick-stat {
    font-size: 13px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff !important;
    white-space: nowrap;
}

.hgb-group-body {
    background: #f8faff;
    padding: 0;
}

.hgb-group-stats-bar {
    display: flex;
    align-items: stretch;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 20px;
    gap: 0;
}

.hgb-group-quizzes {
    padding: 8px 0;
}

.hgb-group-cats {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.hgb-group-cats-title {
    font-size: 13px;
    font-weight: 700;
    color: #16213e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* ── Full Gradebook — 3-Section Layout ──────────────────────────────────────── */
.hgb-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    padding: 16px 22px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 56px;
    margin-top: 10px;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.hgb-section-header:first-of-type {
    margin-top: 0;
}

.hgb-section-header.hgb-collapsed .hgb-toggle-icon {
    transform: rotate(-90deg);
}

.hgb-section-header.hgb-open .hgb-toggle-icon {
    transform: rotate(0deg);
}

.hgb-section-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex: 1;
    text-transform: uppercase;
}

.hgb-section-body {
    background: #f4f6fb;
    border: 1px solid #e0e4ef;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 16px;
    margin-bottom: 16px;
}

/* Courses inside a section body get a tighter margin */
.hgb-section-body .hgb-course {
    margin-bottom: 10px;
}

.hgb-section-body .hgb-course:last-child {
    margin-bottom: 0;
}

/* Remove the inner "Gradebook" header when courses are inside a section */
.hgb-section-body .hgb-gradebook-header {
    display: none;
}

/* ── Time Spent column ─── */
.hgb-grade-time {
    font-size: 22px;
    font-weight: 700;
    color: #1e40af;
    background: #eff6ff;
    border-radius: 6px;
    padding: 2px 14px;
    margin-bottom: 4px;
    line-height: 1.2;
}
@media (max-width: 480px) {
    .hgb-grade-time { font-size: 18px; }
}

/* ── Progress Row ── */
.hgb-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.hgb-progress-bar-wrap {
    flex: 1;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    min-width: 100px;
}
.hgb-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 5px;
    transition: width 0.3s ease;
}
.hgb-progress-steps {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}
.hgb-progress-pct {
    font-size: 13px;
    font-weight: 700;
    color: #1e40af;
    white-space: nowrap;
}
.hgb-progress-time {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    margin-left: auto;
}
@media (max-width: 480px) {
    .hgb-progress-row {
        flex-wrap: wrap;
        gap: 8px;
    }
    .hgb-progress-bar-wrap {
        width: 100%;
        flex: none;
        order: -1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   GRADEBOOK LANDING PAGE — Card Layout (Mobile-First)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Wrapper — constrains width on desktop, centers content */
.hgb-landing-wrapper {
    max-width: 680px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Card Container (white card with shadow) ── */
.hgb-landing-card-container {
    background: #ffffff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ── PANCE Preparation Button ── */
.hgb-landing-pance-btn {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-radius: 10px;
    background: #16213e;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(22, 33, 62, 0.25);
}
.hgb-landing-pance-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(22, 33, 62, 0.35);
    color: #ffffff;
    text-decoration: none;
}
.hgb-landing-pance-btn:active {
    transform: translateY(0);
}
.hgb-pance-icon {
    font-size: 28px;
    margin-right: 14px;
    flex-shrink: 0;
}
.hgb-pance-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 2px;
}
.hgb-pance-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}
.hgb-pance-progress {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.8;
}
.hgb-pance-arrow {
    font-size: 26px;
    font-weight: 300;
    opacity: 0.7;
    margin-left: 12px;
    flex-shrink: 0;
}

/* ── EOR Courses Section ── */
.hgb-eor-heading {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 14px 0;
    padding: 0;
    letter-spacing: -0.01em;
}

/* ── EOR Grid — responsive ── */
.hgb-eor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* ── Individual EOR Button ── */
.hgb-eor-btn {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-radius: 10px;
    background: #0f3460;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 6px rgba(15, 52, 96, 0.2);
}
.hgb-eor-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(15, 52, 96, 0.3);
    color: #ffffff;
    text-decoration: none;
}
.hgb-eor-btn:active {
    transform: translateY(0);
}
.hgb-eor-icon {
    font-size: 22px;
    margin-right: 12px;
    flex-shrink: 0;
}
.hgb-eor-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 1px;
}
.hgb-eor-label {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}
.hgb-eor-progress {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.75;
}
.hgb-eor-arrow {
    font-size: 22px;
    font-weight: 300;
    opacity: 0.6;
    margin-left: 10px;
    flex-shrink: 0;
}

/* ── Responsive: Tablet (iPad, Surface Pro) — 3 columns ── */
@media (min-width: 900px) {
    .hgb-eor-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    .hgb-eor-btn {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 18px 12px;
    }
    .hgb-eor-icon {
        margin-right: 0;
        margin-bottom: 8px;
        font-size: 26px;
    }
    .hgb-eor-content {
        align-items: center;
    }
    .hgb-eor-arrow {
        display: none;
    }
    .hgb-eor-label {
        font-size: 14px;
    }
    .hgb-eor-progress {
        font-size: 11px;
    }
}

/* ── Responsive: Large tablet / small desktop ── */
@media (min-width: 768px) {
    .hgb-landing-wrapper {
        padding: 24px;
        gap: 24px;
    }
    .hgb-landing-card-container {
        padding: 24px;
    }
}

/* ── Responsive: Desktop — cap width ── */
@media (min-width: 1024px) {
    .hgb-landing-wrapper {
        max-width: 720px;
        padding: 32px;
    }
}

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

/* ── Loading indicator ── */
.hgb-loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}
.hgb-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: hgb-spin 0.8s linear infinite;
}
@keyframes hgb-spin {
    to { transform: rotate(360deg); }
}
.hgb-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.01em;
}

/* ─── Rapid Recall Scores Section ─── */
.hgb-rr-section {
  margin-bottom: 1rem;
  margin-top: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}
.hgb-rr-section-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f0f4f8;
  cursor: pointer;
  gap: 0.5rem;
}
.hgb-rr-section-title {
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
}
.hgb-rr-section-stat {
  font-size: 0.85rem;
  color: #555;
  font-weight: 500;
}
.hgb-rr-section-body {
  padding: 0;
}
.hgb-rr-lesson {
  border-top: 1px solid #e8e8e8;
}
.hgb-rr-lesson:first-child {
  border-top: none;
}
.hgb-rr-lesson-header {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  cursor: pointer;
  gap: 0.5rem;
  background: #fafafa;
}
.hgb-rr-lesson-header:hover {
  background: #f5f5f5;
}
.hgb-rr-lesson-title {
  font-weight: 500;
  font-size: 0.9rem;
  flex: 1;
}
.hgb-rr-lesson-stat {
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
  min-width: 40px;
  text-align: right;
}
.hgb-rr-lesson-body {
  padding: 0 0.5rem;
}
.hgb-rr-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}
.hgb-rr-topic-row:last-child {
  border-bottom: none;
}
.hgb-rr-topic-title {
  font-size: 0.85rem;
  color: #333;
  flex: 1;
}
.hgb-rr-topic-score {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 45px;
  text-align: right;
}
.hgb-rr-red { color: #dc3545; }
.hgb-rr-yellow { color: #f0ad4e; }
.hgb-rr-green { color: #28a745; }
.hgb-rr-none { color: #aaa; }
