
.course-challenge-content {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}


/* Row that holds the iframe and chatbot side by side */
.challenge-row {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

#step-content-3 .challenge-row > .cb-card:first-child { flex: 1 1 auto; }

.challenge-row #chatbot-dock {
    flex: 0 0 380px;
    max-width: 420px;
    width: 380px;
    height: 70vh;
    box-sizing: border-box;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    --mo-chatbot-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Chatbot typography: clean, readable system font stack */
#chatbot-dock,
#chatbot-dock .chatbot-container,
#chatbot-dock .chatbot-window {
    font-family: var(--mo-chatbot-font, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji") !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure nested elements inherit the chosen font */
#chatbot-dock .chatbot-window * {
    font-family: inherit !important;
}

#chatbot-dock .chatbot-container {
    position: static !important;
    bottom: auto !important;
    right: auto !important;
    width: 100% !important;
    height: 100% !important;
    z-index: auto !important;
}

#chatbot-dock .chatbot-window {
    position: static !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#chatbot-dock .chatbot-toggle {
    display: none !important;
}

/* Center unauthorized notice within the chatbot dock */
#chatbot-dock .chatbot-unauthorized {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    color: #555;
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.challenge-row .iframe-container {
    flex: 1 1 auto;
    height: 70vh;
    padding-bottom: 0;
    margin: 0;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}

/* Stub when iframe URL is not set (Step 1 fallback) */
.challenge-row .iframe-container .iframe-stub {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #555;
    background: #ffffff;
}
.challenge-row .iframe-container .iframe-stub-inner {
    padding: 20px 24px;
}
.challenge-row .iframe-container .iframe-stub-title {
    font-weight: 700;
    font-size: 18px;
    color: #334155;
    margin-bottom: 6px;
}
.challenge-row .iframe-container .iframe-stub-text {
    font-size: 14px;
    color: #475569;
}

/* While iframe is loading, block interactions/scroll inside it */
.iframe-container.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: transparent;
    z-index: 2;
}

.iframe-container.is-loading iframe {
    pointer-events: none; /* extra guard to prevent focus/scroll */
}

.iframe-container {
    width: 100%;
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.original-content {
    margin: 20px 0;
    line-height: 1.6;
}

.completion-section {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid rgba(0,0,0,0.06);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}

.completion-section p {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

#finish-button {
    padding: 12px 24px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

#finish-button:hover {
    background: #005a87;
}

#finish-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

#completion-message {
    color: #28a745;
    font-weight: 600;
    font-size: 1.1em;
}

/* Center the guest completion notice */
.completion-section.completion-guest {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.completion-section.completion-guest .completion-unauthorized {
    margin: 0;
    color: #555;
    font-weight: 600;
}

/* Steps header timeline */
.steps-header {
    --cs-line: #e5e7eb;
    --cs-accent: #2563eb;
    --cs-muted: #6b7280;
    --cs-card: #f9fafb;
    --cs-fg: #111827;
    margin: 12px 0 12px;
}
.steps-header .timeline-horizontal {
    --cs-gap: clamp(12px, 2vw, 24px);
    --timeline-pad: clamp(16px, calc(var(--cs-gap) + 8px), 48px);
    display: flex;
    justify-content: flex-start;
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.steps-header .timeline-track {
    --timeline-dot-offset: 15px;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: flex-start;
    gap: var(--cs-gap);
    padding: var(--timeline-dot-offset) 0 10px;
    position: relative;
    width: max-content;
    min-width: max-content;
}
.steps-header .timeline-track::before {
    content: "";
    position: absolute;
    top: calc(var(--timeline-dot-offset) + 10px - 1px);
    left: 0;
    width: calc(100% + 10vw);
    height: 2px;
    background: var(--cs-line);
    z-index: 0;
    pointer-events: none;
}
.steps-header .timeline-track.has-few-steps {
    width: 100%;
    min-width: 100%;
    justify-content: space-between;
    gap: clamp(20px, 4vw, 72px);
}
.steps-header .timeline-track.has-few-steps::before {
    width: 100%;
}
.steps-header .timeline-track.has-few-steps .step-indicator .head .badge {
    min-width: 90px;
}
.steps-header .timeline-horizontal::-webkit-scrollbar {
    display: none;
}
.steps-header .timeline-horizontal {
    -ms-overflow-style: none;
}

.steps-header .step-indicator {
    flex: 0 0 clamp(90px, 8vw, 140px);
    min-width: clamp(78px, 7vw, 128px);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    cursor: pointer;
    color: var(--cs-fg);
    transition: transform 0.18s ease, color 0.18s ease;
    scroll-snap-align: center;
}
.steps-header .timeline-horizontal:focus,
.steps-header .timeline-horizontal:focus-visible {
    outline: none;
    box-shadow: none;
}
.steps-header .step-indicator .dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--cs-line);
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.steps-header .step-indicator .head .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--cs-line);
    background: var(--cs-card);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cs-muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-block: 6px;
}
.steps-header .step-indicator .head {
    margin: 0;
}
.steps-header .step-indicator.active .dot {
    background: var(--cs-accent);
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12);
    transform: scale(1.1);
}
.steps-header .step-indicator.active .head .badge {
    border-color: var(--cs-accent);
    color: var(--cs-accent);
}
.steps-header .step-indicator.completed .dot {
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}
.steps-header .step-indicator.disabled {
    cursor: default;
    opacity: 0.6;
    color: var(--cs-muted);
    pointer-events: none;
}
.steps-header .step-indicator.disabled .dot {
    background: var(--cs-line);
    box-shadow: none;
}
.steps-header .timeline-horizontal::-webkit-scrollbar {
    height: 6px;
}
.steps-header .timeline-horizontal::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.6);
    border-radius: 999px;
}
.steps-header .timeline-horizontal::-webkit-scrollbar-track {
    background-color: transparent;
}
@media (max-width: 1024px) {
    .steps-header .timeline-horizontal {
        --cs-gap: clamp(10px, 2.4vw, 18px);
        --timeline-pad: clamp(14px, calc(var(--cs-gap) + 6px), 36px);
    }
    .steps-header .timeline-track {
        --timeline-dot-offset: 15px;
        padding: var(--timeline-dot-offset) 0 10px;
    }
    .steps-header .timeline-track.has-few-steps {
        gap: clamp(16px, 4vw, 56px);
    }
    .steps-header .timeline-track::before {
        width: calc(100% + 15vw);
    }
}

@media (max-width: 768px) {
    .steps-header {
        margin: 18px 0 28px;
    }
    .steps-header .timeline-horizontal {
        --cs-gap: clamp(10px, 3.6vw, 16px);
        --timeline-pad: clamp(12px, calc(var(--cs-gap) + 4px), 24px);
    }
    .steps-header .timeline-track {
        --timeline-dot-offset: 14px;
        padding: var(--timeline-dot-offset) 0 10px;
    }
    .steps-header .timeline-track.has-few-steps {
        gap: clamp(14px, 6vw, 32px);
    }
    .steps-header .step-indicator .head .badge {
        font-size: 0.78rem;
        padding: 3px 10px;
    }
    .steps-header .timeline-track::before {
        width: calc(100% + 25vw);
    }
}
@media (max-width: 520px) {
    .steps-header .timeline-track::before {
        width: calc(100% + 25vw);
    }
    .steps-header .timeline-track.has-few-steps .step-indicator .head .badge {
        min-width: 14px;
    }
}

.course-step-title {
    margin: 0 0 18px;
    font-size: 1.6rem;
    font-weight: 400;
    color: #0f172a;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .course-step-title {
        font-size: 1.35rem;
        margin-bottom: 16px;
    }
}

/* Step containers and form */
.step-content .cb-card {
    padding: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}
.form-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid label, .form-block label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    color: #333;
}
.form-grid input,
.form-block textarea,
.form-grid textarea,
.form-grid select,
.form-block input {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-weight: 400;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.form-grid label, .form-block label {
    min-width: 0;
}
.form-grid textarea, .form-block textarea {
    resize: vertical;
    min-height: 120px;
}
.form-block {
    margin-top: 12px;
}
.help-text {
    color: #6b7280;
}

.step-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}
.completion-section .step-controls {
    justify-content: space-between;
}
.completion-section .completed {
    text-align: center;
    font-weight: 600;
    font-size: 1.1em;
    margin: 0 auto;
}
.completion-section .step-controls .button {
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.completion-section .step-controls .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}
.completion-section .step-controls .button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.completion-section .step-controls .button.button-primary {
    background: linear-gradient(180deg, #2ea6d1, #0073aa);
    border-color: #0073aa;
    color: #fff;
}
.completion-section .step-controls .button.button-primary[disabled] {
    background: #89b9cf;
    border-color: #89b9cf;
    cursor: not-allowed;
    opacity: 0.7;
}

.button {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
}
.button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}
.button-primary {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

/* Busy/disabled state for Generate Report button */
#generate-draft[disabled],
#generate-draft[aria-disabled="true"] {
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
}

.muted {
    color: #6b7280;
}
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    .challenge-row {
        flex-direction: column;
    }
    .challenge-row #chatbot-dock {
        width: 100%;
        max-width: none;
        height: auto;
        max-height: 70vh;
        overflow: visible;
    }
    .challenge-row .iframe-container {
        height: 70vh;
        padding-bottom: 0 !important;
        margin: 20px 0;
    }

    #chatbot-dock .chatbot-window {
        height: auto !important;
        min-height: 420px !important;
        max-height: 70vh !important;
    }
    #chatbot-dock .chatbot-messages {
        min-height: 260px;
    }
}

/* Step-3 summarizer */
.mo-progress {
    display: none;
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0 12px 0;
}
.mo-progress.is-active {
    display: block;
}
.mo-progress .mo-progress-bar {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #0073aa 0%, #2ea6d1 50%, #0073aa 100%);
    background-size: 200% 100%;
    border-radius: inherit;
    animation: mo-progress-indeterminate 1.2s ease-in-out infinite;
}
@keyframes mo-progress-indeterminate {
    0% { transform: translateX(-50%); }
    50% { transform: translateX(75%); }
    100% { transform: translateX(200%); }
}

@media (max-width: 768px) {
    .challenge-row {
        flex-direction: column;
    }

    .challenge-row #chatbot-dock {
        width: 100%;
        max-width: none;
        height: auto;
        max-height: 70vh;
    }

    .challenge-row .iframe-container {
        height: 70vh;
        padding-bottom: 0 !important;
        margin: 20px 0;
    }

    /* Ensure window fits within auto-height dock on mobile */
    #chatbot-dock .chatbot-window {
        height: auto !important;
        min-height: 420px !important;
        max-height: 70vh !important;
    }

    #chatbot-dock .chatbot-messages {
        min-height: 300px;
    }

    .completion-section {
        padding: 15px;
        margin: 20px 0;
    }
    
    #finish-button {
        padding: 10px 20px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .completion-section {
        margin: 15px 0;
        padding: 12px;
    }
    
    #finish-button {
        width: 100%;
        padding: 12px;
    }
}

/* Step-4 certificate web-preview */
#certificate-preview {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 28px;
    max-width: 1000px;
    margin: 10px auto;
}
#certificate-preview .cert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
#certificate-preview .cert-header > div:first-child {
    font-size: 26px;
    font-weight: 700;
    color: #2c3e50;
}
#certificate-preview .logo-placeholder {
    width: 120px;
    height: 60px;
    background: #f5f5f5;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 12px;
}
#certificate-preview .cert-body-inner {
    text-align: center;
    margin: 28px 0;
}
#certificate-preview .cert-title {
    font-size: 44px;
    font-weight: 800;
    color: #2c3e50;
    letter-spacing: 0.4px;
    padding-top: 50px;
}
#certificate-preview .cert-subtitle {
    margin-top: 10px;
    color: #555;
    font-size: 16px;
}
#certificate-preview .cert-name {
    margin-top: 14px;
    font-size: 42px;
    font-weight: 700;
    color: #111;
}
#certificate-preview .cert-course {
    margin-top: 14px;
    font-size: 28px;
    font-weight: 600;
    color: #111;
}
#certificate-preview .cert-meta {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-top: 6mm;
}
#certificate-preview .cert-meta-left {
    text-align: left;
    vertical-align: top;
}
#certificate-preview .cert-meta-right {
    text-align: right;
    vertical-align: top;
}
#certificate-preview .cert-label {
    font-weight: 700;
    font-size: 15px;
    color: #222;
    display: block;
    line-height: 1.25;
}
#certificate-preview .cert-value {
    font-size: 18px;
    line-height: 1.25;
}
#certificate-preview .cert-spacer {
    height: 240px
}
main .entry-content {
    margin-top: 0;
}