/* H5P LearnDash Bridge — Frontend v2.0 */

.hlb-embed-wrapper { position: relative; width: 100%; margin-bottom: 12px; }

.hlb-result-status { margin-top: 8px; padding: 10px 14px; border-radius: 4px; font-size: 14px; line-height: 1.5; }
.hlb-status-success { background: #edfaef; border: 1px solid #00a32a; color: #1a6e2e; }
.hlb-status-error   { background: #fcf0f1; border: 1px solid #d63638; color: #8a1f20; }
.hlb-error          { background: #fcf0f1; border: 1px solid #d63638; color: #8a1f20; padding: 8px 12px; border-radius: 4px; font-size: 13px; }

.hlb-score           { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 14px; }
.hlb-score-pass      { background: #edfaef; color: #1a6e2e; border: 1px solid #00a32a; }
.hlb-score-fail      { background: #fff8e5; color: #7a5900; border: 1px solid #dba617; }
.hlb-score-none      { color: #646970; font-style: italic; }
.hlb-score-tries     { font-size: 12px; opacity: 0.8; }

.hlb-score-table            { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0; }
.hlb-score-table th         { background: #f0f0f1; font-weight: 600; padding: 6px 10px; border: 1px solid #c3c4c7; text-align: left; }
.hlb-score-table td         { padding: 6px 10px; border: 1px solid #c3c4c7; }
.hlb-score-table tr.hlb-pass td { background: #f5fff6; }
.hlb-score-table tr.hlb-fail td { background: #fffdf0; }

/* ── Debug panel ── */
.hlb-debug-panel    { margin-top: 12px; border: 1px solid #2271b1; border-radius: 6px; overflow: hidden; font-family: ui-monospace,'Cascadia Code','Fira Mono',monospace; font-size: 12px; background: #0d1117; }
.hlb-debug-header   { display: flex; align-items: center; gap: 10px; background: #1c2333; border-bottom: 1px solid #2271b1; padding: 8px 12px; flex-wrap: wrap; }
.hlb-debug-title    { font-weight: 700; color: #58a6ff; font-size: 12px; white-space: nowrap; }
.hlb-debug-meta     { color: #8b949e; font-size: 11px; flex: 1; }
.hlb-debug-buttons  { display: flex; gap: 6px; margin-left: auto; }
.hlb-debug-btn      { background: transparent; border: 1px solid #30363d; color: #8b949e; border-radius: 4px; padding: 2px 10px; font-size: 11px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.hlb-debug-btn:hover { border-color: #58a6ff; color: #58a6ff; }
.hlb-debug-export   { border-color: #3fb950; color: #3fb950; }
.hlb-debug-export:hover { background: rgba(63,185,80,.1); }
.hlb-debug-log      { padding: 8px 0; max-height: 420px; overflow-y: auto; background: #0d1117; }
.hlb-debug-entry    { display: grid; grid-template-columns: 68px 110px 1fr; gap: 0 10px; padding: 3px 12px; border-left: 3px solid transparent; line-height: 1.5; }
.hlb-debug-entry:hover { background: #161b22; }
.hlb-debug-time     { color: #484f58; font-size: 11px; padding-top: 1px; }
.hlb-debug-verb     { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 5px; }
.hlb-debug-body     { color: #c9d1d9; font-size: 12px; word-break: break-word; }
.hlb-debug-score    { color: #f0e68c; font-weight: 600; }
.hlb-debug-detail   { color: #8b949e; font-size: 11px; margin-top: 2px; grid-column: 3; word-break: break-all; }
.hlb-debug-info     { grid-template-columns: 1fr; border-left-color: #2271b1; color: #8b949e; font-style: italic; padding: 6px 12px; }
.hlb-debug-timer    { color: #d29922; font-size: 11px; margin-left: 6px; font-style: italic; }

.hlb-verb-completed .hlb-debug-verb, .hlb-verb-passed .hlb-debug-verb { color: #3fb950; }
.hlb-verb-completed, .hlb-verb-passed { border-left-color: #3fb950; background: rgba(63,185,80,.06); }
.hlb-verb-failed { border-left-color: #f85149; background: rgba(248,81,73,.06); }
.hlb-verb-failed .hlb-debug-verb { color: #f85149; }
.hlb-verb-answered { border-left-color: #d29922; background: rgba(210,153,34,.05); }
.hlb-verb-answered .hlb-debug-verb { color: #d29922; }
.hlb-verb-answered-accumulated { border-left-color: #58a6ff; background: rgba(88,166,255,.08); }
.hlb-verb-answered-accumulated .hlb-debug-verb { color: #58a6ff; }
.hlb-verb-attempted .hlb-debug-verb, .hlb-verb-progressed .hlb-debug-verb, .hlb-verb-interacted .hlb-debug-verb { color: #484f58; }
.hlb-verb-server-ok { border-left-color: #3fb950; background: rgba(63,185,80,.04); }
.hlb-verb-server-ok .hlb-debug-verb { color: #3fb950; }
.hlb-verb-server-error { border-left-color: #f85149; background: rgba(248,81,73,.08); }
.hlb-verb-server-error .hlb-debug-verb { color: #f85149; }
.hlb-verb-server-raw { border-left-color: #d29922; background: rgba(210,153,34,.04); }
.hlb-verb-server-raw .hlb-debug-verb { color: #d29922; }
.hlb-verb-server-raw .hlb-debug-detail { color: #8b949e; font-size: 10px; font-family: ui-monospace,monospace; word-break: break-all; white-space: pre-wrap; max-height: 80px; overflow-y: auto; }

/* ── Profile page H5P scores section ───────────────────────────────────────── */

.hlb-profile-scores {
    margin: 12px 0 16px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    overflow: hidden;
    font-size: 14px;
}

.hlb-profile-scores-header {
    background: #f0f6fc;
    border-bottom: 1px solid #c3c4c7;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.hlb-profile-scores-icon {
    font-size: 16px;
}

.hlb-profile-scores-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.hlb-profile-scores-table th {
    background: #f6f7f7;
    padding: 7px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #50575e;
}

.hlb-profile-scores-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.hlb-profile-scores-table tr:last-child td {
    border-bottom: none;
}

.hlb-profile-scores-table .hlb-lesson-name a {
    color: #2271b1;
    text-decoration: none;
}

.hlb-profile-scores-table .hlb-lesson-name a:hover {
    text-decoration: underline;
}

.hlb-profile-scores-table .hlb-pass {
    color: #1a6e2e;
}

.hlb-profile-scores-table .hlb-fail {
    color: #7a5900;
}

.hlb-profile-scores-table .hlb-score-raw {
    color: #646970;
    font-size: 12px;
    margin-left: 4px;
}

.hlb-profile-scores-table .hlb-attempts {
    color: #50575e;
    font-size: 13px;
}

.hlb-profile-scores-table .hlb-last-taken {
    color: #646970;
    font-size: 12px;
    white-space: nowrap;
}

/* ── Lesson row score badge (course page + ld_profile) ─────────────────────── */

.hlb-lesson-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    vertical-align: middle;
    white-space: nowrap;
}

.hlb-badge-pass {
    background: #edfaef;
    border: 1px solid #00a32a;
    color: #1a6e2e;
}

.hlb-badge-fail {
    background: #fff8e5;
    border: 1px solid #dba617;
    color: #7a5900;
}

.hlb-badge-icon  { font-size: 11px; }
.hlb-badge-label { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.hlb-badge-best  { font-weight: 600; }
.hlb-badge-latest { opacity: 0.8; }
.hlb-badge-count { opacity: 0.65; font-size: 11px; }

/* Course summary badge on [ld_profile] */
.hlb-course-summary {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    color: #50575e;
    font-style: normal;
}

/* ── Bilingual status message ────────────────────────────────────────────────── */

.hlb-status-new-best {
    background: linear-gradient(135deg, #fff8e1, #fffde7);
    border: 1px solid #f9a825;
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #5c3a00;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hlb-best-arrow {
    font-size: 13px;
    font-weight: 400;
    color: #7a5900;
    margin-left: 6px;
}

.hlb-status-main {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.hlb-status-scores {
    font-size: 13px;
    color: #444;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.hlb-stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Inline bilingual text */
.hlb-en { /* ltr — no special treatment needed */ }
.hlb-he {
    font-family: 'David', 'Frank Ruehl', 'Arial Hebrew', Arial, sans-serif;
    direction: rtl;
    unicode-bidi: embed;
}

/* ── hlb_history shortcode ──────────────────────────────────────────────────── */

.hlb-history-wrap {
    margin: 14px 0;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    overflow: hidden;
    font-size: 14px;
}

.hlb-history-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f6f7f7;
    border-bottom: 1px solid #c3c4c7;
    padding: 8px 14px;
    flex-wrap: wrap;
}

.hlb-history-title {
    font-weight: 600;
    color: #1d2327;
    font-size: 13px;
}

.hlb-history-stat {
    color: #50575e;
    font-size: 12px;
}

.hlb-history-best {
    font-size: 13px;
    font-weight: 600;
    margin-left: auto;
}

.hlb-history-toggle {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}

.hlb-history-toggle:hover { background: #135e96; }

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

.hlb-history-table th {
    background: #f0f0f1;
    padding: 7px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #ddd;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #50575e;
}

.hlb-history-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.hlb-history-table tr:last-child td { border-bottom: none; }
.hlb-history-table tr.hlb-pass td  { background: #f5fff6; }
.hlb-history-table tr.hlb-fail td  { background: #fffdf0; }

.hlb-history-msg {
    color: #646970;
    font-style: italic;
    font-size: 13px;
    padding: 8px 0;
}

/* ── Inline history in completion status box ────────────────────────────────── */

.hlb-inline-history {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.hlb-history-inline-btn {
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 3px 12px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.hlb-status-success .hlb-history-inline-btn {
    color: #1a6e2e;
    border-color: #1a6e2e;
}

.hlb-history-inline-btn:hover { opacity: 1; }

.hlb-inline-hist-table {
    font-size: 12px;
    width: 100%;
}

.hlb-inline-hist-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #50575e;
    padding: 5px 8px;
    background: rgba(0,0,0,0.04);
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.hlb-inline-hist-table td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    vertical-align: middle;
}

.hlb-inline-hist-table tr:last-child td { border-bottom: none; }
.hlb-inline-hist-table tr.hlb-pass td  { background: rgba(0,163,42,0.05); }
.hlb-inline-hist-table tr.hlb-fail td  { background: rgba(255,184,0,0.05); }
