/* EducationGuard — Exam Results page (builds on courses.css design language) */

.eg-exam-results {
    --eg-success: #1f9d61;
    --eg-danger: #d64545;
}

/* Shared topbar link + empty CTA (kept self-contained for this page) */
.eg-mc-topbar-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding-block: 0.5rem;
    padding-inline: 0.55rem 1.15rem;
    background: var(--eg-primary-soft);
    color: var(--eg-secondary);
    border: 1.5px solid color-mix(in srgb, var(--eg-primary) 55%, transparent);
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: inherit;
    letter-spacing: 0.01em;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

/* sheen sweep on hover */
.eg-mc-topbar-link::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
    transform: translateX(-120%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

/* icon chip */
.eg-mc-topbar-link i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--eg-primary);
    color: #fff;
    font-size: 0.8rem;
    transition: transform 0.4s ease, background 0.25s ease;
}

html[data-bs-theme="dark"] .eg-mc-topbar-link {
    color: var(--eg-primary-light);
}

.eg-mc-topbar-link:hover {
    background: var(--eg-primary);
    color: #fff;
    border-color: var(--eg-primary);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(243, 147, 24, 0.38);
}

.eg-mc-topbar-link:hover i {
    background: rgba(255, 255, 255, 0.22);
    transform: rotate(60deg) scale(1.05);
}

.eg-mc-topbar-link:hover::after {
    transform: translateX(120%);
}

.eg-mc-topbar-link:active {
    transform: translateY(0);
}

.eg-mc-topbar-link:focus-visible {
    outline: 2px solid var(--eg-primary);
    outline-offset: 2px;
}

@media (max-width: 560px) {
    .eg-mc-topbar-link span {
        display: none;
    }

    .eg-mc-topbar-link {
        padding: 0.4rem;
    }
}

.eg-mc-empty-cta {
    position: relative;
    margin-top: 1.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.9rem 1.5rem 0.9rem 0.9rem;
    border: none;
    border-radius: 2rem;
    background: linear-gradient(135deg, var(--eg-primary-light, #f6a93c), var(--eg-primary) 45%, var(--eg-primary-dark));
    background-size: 180% 180%;
    background-position: 0% 50%;
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    font-family: inherit;
    letter-spacing: 0.01em;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 10px 26px rgba(243, 147, 24, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.22s ease, box-shadow 0.25s ease, background-position 0.5s ease;
    animation: eg-cta-glow 3.2s ease-in-out infinite;
}

/* soft idle glow pulse */
@keyframes eg-cta-glow {
    0%, 100% { box-shadow: 0 10px 26px rgba(243, 147, 24, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
    50% { box-shadow: 0 12px 32px rgba(243, 147, 24, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
}

/* shimmer sweep */
.eg-mc-empty-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.4) 50%, transparent 70%);
    transform: translateX(-130%);
    transition: transform 0.7s ease;
}

/* circular icon badge */
.eg-mc-empty-cta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    transition: transform 0.4s ease, background 0.3s ease;
}

.eg-mc-empty-cta-icon i {
    font-size: 1rem;
    transition: transform 0.5s ease;
}

.eg-mc-empty-cta-label {
    position: relative;
    z-index: 1;
}

.eg-mc-empty-cta-arrow {
    font-size: 1rem;
    transform: translateX(-2px);
    opacity: 0.85;
    transition: transform 0.35s ease, opacity 0.3s ease;
}

.eg-mc-empty-cta:hover {
    transform: translateY(-2px);
    background-position: 100% 50%;
    box-shadow: 0 16px 36px rgba(243, 147, 24, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation-play-state: paused;
}

.eg-mc-empty-cta:hover::before {
    transform: translateX(130%);
}

.eg-mc-empty-cta:hover .eg-mc-empty-cta-icon {
    background: rgba(255, 255, 255, 0.32);
}

.eg-mc-empty-cta:hover .eg-mc-empty-cta-icon i {
    transform: rotate(90deg) scale(1.1);
}

.eg-mc-empty-cta:hover .eg-mc-empty-cta-arrow {
    transform: translateX(4px);
    opacity: 1;
}

.eg-mc-empty-cta:active {
    transform: translateY(0) scale(0.98);
}

.eg-mc-empty-cta:focus-visible {
    outline: 2px solid var(--eg-primary-dark);
    outline-offset: 3px;
}

/* flip arrow for right-to-left layouts */
.eg-mc-empty-cta:dir(rtl) .eg-mc-empty-cta-arrow {
    transform: translateX(2px) scaleX(-1);
}

.eg-mc-empty-cta:dir(rtl):hover .eg-mc-empty-cta-arrow {
    transform: translateX(-4px) scaleX(-1);
}

@media (prefers-reduced-motion: reduce) {
    .eg-mc-topbar-link,
    .eg-mc-topbar-link i,
    .eg-mc-topbar-link::after,
    .eg-mc-empty-cta,
    .eg-mc-empty-cta i,
    .eg-mc-empty-cta::before,
    .eg-mc-empty-cta-icon,
    .eg-mc-empty-cta-arrow {
        transition: none;
        animation: none;
    }

    .eg-mc-topbar-link:hover,
    .eg-mc-topbar-link:hover i,
    .eg-mc-empty-cta:hover,
    .eg-mc-empty-cta:hover .eg-mc-empty-cta-icon i,
    .eg-mc-empty-cta:hover .eg-mc-empty-cta-arrow {
        transform: none;
    }
}

/* Animatable conic-gradient driver for the score ring */
@property --eg-exam-pct {
    syntax: "<number>";
    inherits: false;
    initial-value: 0;
}

/* ── Exam grid ── */
.eg-exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.6rem;
    margin-top: 0.5rem;
}

@media (max-width: 480px) {
    .eg-exam-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Exam card ── */
.eg-exam-card {
    --eg-exam-accent: var(--eg-primary);
    --eg-exam-accent-2: var(--eg-primary-light, var(--eg-primary));
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.35rem 1.35rem 1.4rem;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--eg-exam-accent) 6%, var(--eg-surface)),
            var(--eg-surface) 42%);
    border: 1.5px solid var(--eg-border);
    border-radius: calc(var(--eg-radius) + 4px);
    box-shadow: var(--eg-shadow);
    overflow: hidden;
    isolation: isolate;
    opacity: 0;
    transform: translateY(18px);
    animation: eg-exam-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

/* left accent rail with a soft gradient */
.eg-exam-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--eg-exam-accent-2), var(--eg-exam-accent));
    box-shadow: 0 0 18px -2px var(--eg-exam-accent);
}

/* top hairline highlight */
.eg-exam-card::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--eg-exam-accent) 55%, transparent), transparent);
    opacity: 0.7;
}

/* radial color aura, top-trailing corner */
.eg-exam-card-aura {
    position: absolute;
    z-index: -1;
    inset-block-start: -55px;
    inset-inline-end: -55px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--eg-exam-accent) 32%, transparent), transparent 68%);
    opacity: 0.55;
    transition: opacity 0.35s ease, transform 0.45s ease;
    pointer-events: none;
}

/* diagonal sheen that sweeps on hover */
.eg-exam-card-sheen {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(115deg, transparent 38%, color-mix(in srgb, #fff 55%, transparent) 50%, transparent 62%);
    transform: translateX(-130%);
    opacity: 0;
    pointer-events: none;
}

html[data-bs-theme="dark"] .eg-exam-card-sheen {
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.12) 50%, transparent 62%);
}

/* big faded tier icon watermark */
.eg-exam-card-watermark {
    position: absolute;
    z-index: -1;
    inset-block-start: -0.4rem;
    inset-inline-end: 0.4rem;
    font-size: 5.5rem;
    line-height: 1;
    color: var(--eg-exam-accent);
    opacity: 0.07;
    transform: rotate(-8deg);
    transition: transform 0.45s ease, opacity 0.35s ease;
    pointer-events: none;
}

.eg-exam-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--eg-shadow-lg), 0 18px 40px -18px var(--eg-exam-accent);
    border-color: color-mix(in srgb, var(--eg-exam-accent) 70%, transparent);
}

.eg-exam-card:hover .eg-exam-card-aura {
    opacity: 0.85;
    transform: scale(1.12);
}

.eg-exam-card:hover .eg-exam-card-watermark {
    opacity: 0.13;
    transform: rotate(-2deg) scale(1.05);
}

.eg-exam-card:hover .eg-exam-card-sheen {
    opacity: 1;
    transform: translateX(130%);
    transition: transform 0.85s ease, opacity 0.2s ease;
}

@keyframes eg-exam-rise {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.eg-exam-card--excellent { --eg-exam-accent: #1f9d61; --eg-exam-accent-2: #46c98a; }
.eg-exam-card--good      { --eg-exam-accent: #3a9ad9; --eg-exam-accent-2: #66bdf2; }
.eg-exam-card--fair      { --eg-exam-accent: #F39318; --eg-exam-accent-2: #ffb74d; }
.eg-exam-card--weak      { --eg-exam-accent: #d64545; --eg-exam-accent-2: #f06b6b; }

/* ── Card head ── */
.eg-exam-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.eg-exam-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.34rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    backdrop-filter: blur(2px);
}

.eg-exam-status i {
    font-size: 0.9rem;
}

.eg-exam-status.is-pass {
    background: rgba(31, 157, 97, 0.14);
    color: #1f9d61;
    border-color: rgba(31, 157, 97, 0.3);
}

.eg-exam-status.is-fail {
    background: rgba(214, 69, 69, 0.14);
    color: #d64545;
    border-color: rgba(214, 69, 69, 0.3);
}

.eg-exam-date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--eg-text-muted);
}

/* ── Card body ── */
.eg-exam-card-body {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

/* Score ring */
.eg-exam-ring {
    --eg-exam-pct: 0;
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background:
        conic-gradient(from -90deg,
            var(--eg-exam-accent-2) 0,
            var(--eg-exam-accent) calc(var(--eg-exam-pct) * 1%),
            color-mix(in srgb, var(--eg-border) 80%, transparent) 0);
    display: grid;
    place-items: center;
    position: relative;
    filter: drop-shadow(0 3px 8px color-mix(in srgb, var(--eg-exam-accent) 35%, transparent));
    animation: eg-ring-fill 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

/* animate the conic fill from 0 up to the inline-set value */
@keyframes eg-ring-fill {
    from { --eg-exam-pct: 0; }
}

/* pulsing colored halo behind the ring */
.eg-exam-ring-glow {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--eg-exam-accent) 40%, transparent), transparent 70%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.35s ease;
}

.eg-exam-card:hover .eg-exam-ring-glow {
    opacity: 0.9;
    animation: eg-ring-pulse 1.8s ease-in-out infinite;
}

@keyframes eg-ring-pulse {
    0%, 100% { transform: scale(1);    opacity: 0.55; }
    50%      { transform: scale(1.08); opacity: 0.9; }
}

.eg-exam-ring-inner {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: var(--eg-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--eg-exam-accent) 18%, transparent);
}

.eg-exam-ring-num {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--eg-exam-accent);
    line-height: 1;
    letter-spacing: -0.01em;
}

.eg-exam-ring-num small {
    font-size: 0.7rem;
    font-weight: 700;
    margin-inline-start: 1px;
}

.eg-exam-ring-tier {
    font-size: 0.58rem;
    font-weight: 800;
    color: var(--eg-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 2px;
}

/* Info column */
.eg-exam-info {
    flex: 1 1 auto;
    min-width: 0;
}

.eg-exam-lesson {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.6rem;
    font-size: 1rem;
    font-weight: 800;
    color: var(--eg-secondary);
    line-height: 1.35;
}

html[data-bs-theme="dark"] .eg-exam-lesson {
    color: var(--eg-text);
}

.eg-exam-lesson i {
    color: var(--eg-exam-accent);
    flex: 0 0 auto;
}

.eg-exam-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.7rem;
}

.eg-exam-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--eg-text-muted);
    padding: 0.2rem 0.55rem;
    border-radius: 0.6rem;
    background: color-mix(in srgb, var(--eg-exam-accent) 7%, transparent);
}

.eg-exam-meta-item i {
    color: var(--eg-exam-accent);
}

/* Progress bar */
.eg-exam-bar {
    position: relative;
    height: 9px;
    border-radius: 5px;
    background: color-mix(in srgb, var(--eg-border) 85%, transparent);
    overflow: hidden;
}

.eg-exam-bar-fill {
    position: relative;
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--eg-exam-accent-2), var(--eg-exam-accent));
    transform-origin: inset-inline-start center;
    animation: eg-bar-grow 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

@keyframes eg-bar-grow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* travelling shimmer along the filled bar */
.eg-exam-bar-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: translateX(-100%);
    animation: eg-bar-shimmer 2.4s ease-in-out 1.2s infinite;
}

@keyframes eg-bar-shimmer {
    0%   { transform: translateX(-100%); }
    60%, 100% { transform: translateX(180%); }
}

@media (prefers-reduced-motion: reduce) {
    .eg-exam-card,
    .eg-exam-ring,
    .eg-exam-bar-fill,
    .eg-exam-bar-fill::after,
    .eg-exam-card-sheen,
    .eg-exam-ring-glow {
        animation: none;
    }

    .eg-exam-card {
        opacity: 1;
        transform: none;
    }
}
