/* ==========================================================
   fame-system-detail.css
   Styles for system-detail.blade.php and its sub-components.
   All rules are scoped under .fame-system-layout.
   ========================================================== */

/* ── 1. Top performance section ── */

/* The outer fame-performance-bottmsec is just a wrapper here;
   reset its own padding/gap so the inner fame-system-metrics
   handles the layout. */


/* Inner metrics wrapper (rendered by quiz-performance.blade.php) */
.fame-system-metrics {
    display: flex;
    width: 100%;
    align-items: stretch;
    padding: 0px 22px 0px 22px;
    gap: 20px;
    flex-wrap: wrap;
}
.fame-system-metrics__left  { flex: 1; min-width: 0; }
.fame-system-metrics__right { display: none; } /* handled by separate Statistics card */

.fame-system-metrics__summary {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.fame-system-metrics__cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    flex: 1;
    min-width: 180px;
}
.fame-system-metric-card {
    display: flex;
    padding: 11px 13px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 2px 2px 25px rgba(8, 20, 102, 0.08);
    border-left: 5px solid #0084C5;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
}
.fame-system-metric-cardinn {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}
.fame-system-metric-card__label {
    font-size: 17px;
    color: #181818;
    font-weight: 500;
    line-height: 22px;
}
.fame-system-metric-card__value {
    font-size: 20px;
    font-weight: 400;
    color: #333333;
    line-height: 36px;
    letter-spacing: 0.02em;
    width: 100%;
}
.fame-system-metric-card__hint {
    font-size: 12px;
    font-weight: 400;
    color: #475467;
    line-height: 1.3;
}
.fame-system-metric-card i {
    display: inline-flex;
    min-width: 45px;
    height: 45px;
    border-radius: 100%;
    justify-content: center;
    align-items: center;
    padding-top: 5px;
    font-size: 20px;
}

/* ── 2. Statistics mini-card (top-grid right column) ── */

.fame-system-layout .fame-mini-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    padding-bottom: 10px;
}
.fame-system-layout .fame-mini-card > strong {
    font-size: 16px;
    font-weight: 700;
    color: #10213b;
    display: block;
}
.fame-system-layout .fame-mini-card > small {
    font-size: 12px;
    color: #7B7E8F;
    display: block;
    margin-bottom: 2px;
}

.fame-mini-bars {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-top: 10px;
    /* Fixed height so bars are visible even when one value dominates */
    height: 100px;
    overflow: hidden;
}
.fame-mini-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    height: 100%;
    justify-content: flex-end;
}
.fame-mini-bar > span {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    /* Fixed chart area height so height:X% on inner i resolves correctly */
    height: 76px;
    overflow: hidden;
}
.fame-mini-bar > span > i {
    display: block;
    width: 65%;
    border-radius: 4px 4px 0 0;
    /* Clamp bars: min 6px visible, max 100% of span */
    min-height: 6px;
    max-height: 100%;
    font-style: normal;
    transition: height .5s ease;
}
.fame-mini-bar > small {
    font-size: 11px;
    color: #7B7E8F;
    font-weight: 500;
    font-style: normal;
    line-height: 1;
}

/* ── 3-A. Filterbar — keep chips on same row as buttons ── */

.fame-system-layout .fame-filterbar .fame-orthopedic-desc {
    flex-wrap: nowrap;
    overflow: hidden;
    min-width: 0;
}
.fame-system-layout .fame-filterbar .fame-chip,
.fame-system-layout .fame-filterbar .fame-filter-trigger {
    white-space: nowrap;
    flex-shrink: 0;
}
.fame-system-layout .fame-filterbar .fame-bredcrum-con {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

/* ── 4. Question panel ── */

/* Reset the generic 18px padding so paneltitle can span full width */
.fame-system-layout .fame-panel {
    padding: 0 !important;
    overflow: hidden;
}
.fame-panel.fame-system-navigator-panel {
    background: #EAF4FF;
    box-shadow: 2px 2px 25px rgba(8, 20, 102, 0.08);
    border-radius: 10px;
    padding: 20px;
}
.fame-panel > h3 {
    font-size: 15px;
    font-weight: 700;
    color: #081466;
    margin: 0;
    padding: 14px 18px 10px;
}

/* Remove double-card shadow on fame-quiz-questions-con inside panel */
.fame-system-layout .fame-panel .fame-quiz-questions-con {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}
.fame-quiz-questions-holder {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ── 4. Answer list – letter label ── */

.fame-ansritm-textwrap {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
}
.fame-ansritm-label {
    display: inline-flex;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e8eaf6;
    color: #081466;
    font-size: 12px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    box-shadow: 0px 0px 15px 1px rgba(0, 0, 0, 0.08);
}
.fame-question-ansrs-list .fame-question-ansr-itm.fame-correct-answer .fame-ansritm-label { background: #dbf4e9; color: #008b20; }
.fame-question-ansrs-list .fame-question-ansr-itm.fame-wrong-answer   .fame-ansritm-label { background: #fee5e6; color: #d50015; }

/* ── 5. Questions Navigator ── */

.fame-navmeta {
    display: flex;
    gap: 16px;
    margin: 10px 18px 12px;
    font-size: 13px;
    justify-content: space-between;
    color: #7B7E8F;
}
.fame-navmeta span {
    display: inline-flex;
    align-items: center;
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    color: #6D6E79;
    gap: 2px;
    cursor: pointer;
}
.fame-navmeta span.is-active {
    font-weight: 700;
}
.fame-navmeta span:before {
    content: '';
    display: inline-flex;
    min-width: 12px;
    height: 12px;
    background-color: #49C192;
    border-radius: 4px;
    margin-right: 5px;
}
.fame-navmeta span.fame-wrong:before {
    background-color: #F67C88;
}
.fame-navmeta span.fame-skipped:before {
    background-color: #F8B81F;
}
.fame-navmeta span.fame-unanswered:before {
    background-color: #081466;
}
.fame-navmeta span.fame-total:before {
    background-color: #49C192;
}
.fame-navmeta strong { color: #333333; }
.fame-navfilter-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    background-color: #DF4B59;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    line-height: 1;
    border: 1px solid #DF4B59;
    cursor: pointer;
    transition: all 0.2s ease-in;
}
.fame-navfilter-reset-btn:hover {
    background-color: #ffffff;
    color: #DF4B59;
}
.fame-navfilter-reset-btn i {
    font-size: 14px;
    line-height: 0;
    padding-top: 2px;
}
.fame-navgrid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 18px 18px;
}
.fame-system-navigator-panel h3 {
    font-style: normal;
    font-weight: 600;
    font-size: 18px;
    display: flex;
    width: 100%;
    color: #181818;
}
.fame-navitem {
    display: inline-flex;
    position: relative;
    max-width: 180px;
    min-width: 57px;
    flex-grow: 1;
    padding: 5px 7px;
    height: 40px;
    border-radius: 7px;
    background: #ffffff;
    color: #6D6E79;
    font-size: 16px;
    font-weight: 400;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #E2E3EB;
    line-height: 1;
    transition: background .15s, color .15s;
    user-select: none;
}
.fame-navitem.is-filter-hidden { display: none; }
.fame-navitem:hover           { background: #dbe0ff; }
.fame-navitem.is-current      { background: #081466; color: #fff;    border-color: #081466; }
.fame-navitem.is-correct      { background: #49C192; color: #ffffff; border-color: #49C192; }
.fame-navitem.is-wrong        { background: #F67C88; color: #ffffff; border-color: #F67C88; }
.fame-navitem.is-skipped      { background: #F8B81F; color: #ffffff; border-color: #F8B81F; }
.fame-navitem.is-flagged::after {
    content: "\e92e";
    font-family: 'fame-icon' !important;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 50%;
    color: #081466;
    box-shadow: 0 2px 6px rgba(8, 20, 102, 0.18);
    font-size: 9px;
    line-height: 1;
}

/* ── 6. Explanation panel ── */

.fame-explanation-stage {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── 7. Study Recommendations ── */

.fame-system-recommendations {
    background: #fff;
    border: 1px solid #e2e8f2;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(8,20,102,.08);
    overflow: hidden;
}
.fame-system-recommendations__head {
    padding: 13px 18px;
    font-weight: 700;
    font-size: 15px;
    color: #081466;
    border-bottom: 1px solid #e2e8f2;
    background: #f8fbff;
}
.fame-system-recommendations__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-bottom: 1px solid #f0f2ff;
    flex-wrap: wrap;
}
.fame-system-recommendations__item:last-child { border-bottom: none; }
.fame-system-recommendations__item > span {
    flex: 1;
    font-size: 13px;
    color: #22344f;
    font-weight: 500;
    min-width: 0;
}
.fame-system-recommendations__meta {
    font-size: 11px;
    color: #7B7E8F;
    white-space: nowrap;
}
.fame-system-recommendations__link {
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    color: #0084c5;
    text-decoration: none;
    background: #eef7ff;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid #d0eaff;
    transition: background .2s;
    white-space: nowrap;
}
.fame-system-recommendations__link:hover { background: #d0eaff; }
.fame-system-recommendations__loadmore {
    display: block;
    margin: 14px auto;
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: #0084c5;
    border: 1px solid #0084c5;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: .2px;
    transition: background .2s, box-shadow .2s, transform .1s;
    box-shadow: 0 4px 12px rgba(0,132,197,.18);
}
.fame-system-recommendations__loadmore:hover {
    background: #006ea6;
    border-color: #006ea6;
}
.fame-system-recommendations__loadmore:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0,132,197,.18);
}
.fame-system-recommendations__loadmore.is-loading,
.fame-system-recommendations__loadmore:disabled {
    opacity: .7;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── 9. Filter overlay & sidebar – heading ── */

.fame-system-layout .fame-topic-overlay__panel > h3,
.fame-system-layout .fame-topic-sidebar > h3 {
    font-size: 20px;
    font-weight: 600;
    color: #181818;
    margin: 0;
    padding: 20px 30px;
    border-bottom: 1px solid #DCDDEA;
}



/* ── 10. Login required ── */

.fame-login-required-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: #f8fbff;
    border-radius: 14px;
    border: 1px dashed #c5cce8;
    color: #7B7E8F;
    width: 100%;
}

/* ── 11. Donut chart sizing inside system metrics ── */

.fame-system-metrics .fame-donut-chart.minsm {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

/* ── 12. Responsive ── */

@media (max-width: 1200px) {
    .fame-system-metrics__summary { gap: 14px; }
    .fame-system-metric-card__value { font-size: 17px; }
}

@media (max-width: 900px) {
    .fame-system-layout .fame-top-grid { grid-template-columns: 1fr; }
    .fame-system-metrics__summary { flex-direction: column; align-items: flex-start; }
    .fame-system-metrics .fame-donut-chart.minsm { width: 110px; height: 110px; }
    .fame-mini-bars { height: 90px; }
    .fame-mini-bar > span { height: 68px; }
    .fame-system-metrics__cards { grid-template-columns: repeat(2,1fr); }
    /* Allow filterbar to wrap on small screens */
    .fame-system-layout .fame-filterbar .fame-orthopedic-desc { flex-wrap: wrap; }
}

@media (max-width: 600px) {
    .fame-system-metrics { padding: 14px; }
    .fame-system-metrics__cards { grid-template-columns: 1fr; gap: 15px; }
    .fame-system-metric-card { padding: 9px 10px; }
}

/* ── Subscription products list (system detail, non-purchased) ── */
.fame-sub-products {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0;
}
.fame-sub-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.fame-sub-card__info {
    flex: 1 1 260px;
    min-width: 0;
}
.fame-sub-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f1940;
    margin: 0 0 4px;
    line-height: 1.3;
}
.fame-sub-card__desc {
    color: #6b7280;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.4;
}
.fame-sub-card__aside {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.fame-sub-card__old {
    color: #f47834;
    text-decoration: line-through;
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}
.fame-sub-card__price {
    color: #0f1940;
    font-weight: 700;
    font-size: 1.15rem;
    white-space: nowrap;
}
.fame-sub-card__buy {
    background: #4ac77b;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, transform 0.15s ease;
}
.fame-sub-card__buy:hover,
.fame-sub-card__buy:focus {
    background: #3fb36e;
    color: #fff;
    text-decoration: none;
}
.fame-sub-card__buy:active {
    transform: translateY(1px);
}
.fame-sub-card__buy-icon {
    flex-shrink: 0;
}

@media (max-width: 700px) {
    .fame-sub-card {
        padding: 16px 18px;
        align-items: flex-start;
    }
    .fame-sub-card__info {
        flex: 1 1 100%;
    }
    .fame-sub-card__aside {
        width: 100%;
        justify-content: flex-start;
    }
    .fame-sub-card__title {
        font-size: 1.1rem;
    }
}

/* ── 13. Comprehensive responsive overrides ── */

/* Tablet landscape (≤ 992px): stack top grid + tighten metrics */
@media (max-width: 992px) {
    .fame-system-layout .fame-top-grid { grid-template-columns: 1fr; }
    .fame-system-metrics { padding: 16px; gap: 14px; }
    .fame-system-metrics__cards { grid-template-columns: repeat(3, 1fr); }
    .fame-system-metrics__summary { gap: 14px; flex-wrap: wrap; }
    .fame-system-metrics .fame-donut-chart.minsm { width: 120px; height: 120px; }
    .fame-mini-bars { height: 96px; }
    .fame-mini-bar > span { height: 72px; }
}

/* Tablet portrait / large mobile (≤ 768px) */
@media (max-width: 768px) {
    .fame-system-layout .fame-filterbar .fame-orthopedic-desc {
        flex-wrap: wrap;
        overflow: visible;
    }
    .fame-system-layout .fame-filterbar .fame-bredcrum-con { flex: 1 1 100%; }

    .fame-system-metrics { padding: 14px; }
    .fame-system-metrics__cards { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .fame-system-metric-card { padding: 9px 10px; gap: 10px; }
    .fame-system-metric-card__label { font-size: 14px; line-height: 18px; }
    .fame-system-metric-card__value { font-size: 16px; line-height: 24px; }
    .fame-system-metric-card i { min-width: 36px; height: 36px; font-size: 16px; padding-top: 3px; }

    /* Question panel paddings shrink */
    .fame-panel > h3 { padding: 12px 14px 8px; font-size: 14px; }
    .fame-panel.fame-system-navigator-panel { padding: 14px; }
    .fame-navmeta { margin: 8px 14px 10px; gap: 10px; flex-wrap: wrap; font-size: 12px; }
    .fame-navmeta span { font-size: 13px; }
    .fame-navgrid { padding: 0 14px 14px; gap: 4px; }
    .fame-navitem { font-size: 14px; height: 36px; max-width: 64px; min-width: 44px; }

    .fame-explanation-stage { padding: 12px 14px 14px; gap: 10px; }

    /* Overlay / sidebar headings */
    .fame-system-layout .fame-topic-overlay__panel > h3,
    .fame-system-layout .fame-topic-sidebar > h3 {
        font-size: 17px;
        padding: 14px 18px;
    }

    /* Recommendations list */
    .fame-system-recommendations__head { padding: 10px 14px; font-size: 14px; }
    .fame-system-recommendations__item { padding: 9px 14px; gap: 6px; }
    .fame-system-recommendations__link { font-size: 11px; padding: 3px 8px; }
}

/* Mobile portrait (≤ 575px) */
@media (max-width: 575px) {
    .fame-system-metrics { padding: 12px; gap: 10px; }
    .fame-system-metrics__cards { grid-template-columns: 1fr; gap: 15px; }
    .fame-system-metrics__summary { flex-direction: column; align-items: stretch; gap: 10px; }
    .fame-system-metrics .fame-donut-chart.minsm { width: 100px; height: 100px; align-self: center; }

    /* Navigator: tighter chip grid + breathing room around the meta legend */
    .fame-navmeta {
        margin: 8px 12px 8px;
        gap: 6px 12px;
        justify-content: flex-start;
    }
    .fame-navmeta span { font-size: 12px; }
    .fame-navfilter-reset-btn { padding: 6px 10px; font-size: 12px; }
    .fame-navgrid { padding: 0 12px 12px; gap: 4px; }
    .fame-navitem {
        font-size: 13px;
        height: 34px;
        max-width: 48px;
        min-width: 40px;
        padding: 4px 5px;
    }

    /* Question panel headings + nav-panel padding */
    .fame-panel > h3 { padding: 10px 12px 6px; font-size: 13px; }
    .fame-panel.fame-system-navigator-panel { padding: 12px; }

    /* Login-required prompt + sub-cards stay readable */
    .fame-login-required-box { padding: 28px 14px; font-size: 14px; }

    /* Filter overlay heading */
    .fame-system-layout .fame-topic-overlay__panel > h3,
    .fame-system-layout .fame-topic-sidebar > h3 {
        font-size: 15px;
        padding: 12px 14px;
    }

    /* Mock test summary stat boxes (rendered above the question area) */
    .fame-mock-test-boxes { gap: 8px; }
    .fame-mock-test-resbox { flex: 1 1 calc(50% - 4px); min-width: 0; }
}

/* Very small phones (≤ 380px) */
@media (max-width: 380px) {
    .fame-system-metrics__cards { grid-template-columns: 1fr; }
    .fame-system-metric-card { padding: 8px 10px; }
    .fame-navitem { font-size: 12px; height: 32px; min-width: 36px; max-width: 44px; }
}
