:root {
    /*
     * MedExam primary brand colours
     * aligned to the holding website artwork.
     */

    --navy-950: #041d43;
    --navy-900: #062654;
    --navy-800: #0b3566;
    --navy-700: #10447f;

    --aqua-500: #16a5a3;
    --aqua-400: #58b8b2;
    --aqua-200: #c7eeea;
    --aqua-100: #e7f8f6;

    --sky: #5bb8f0;

    --page: #eef8fb;
    --surface: #ffffff;

    --text: #10213b;
    --text-soft: #536a82;
    --text-muted: #7a8899;

    --border: #d8e1e8;
    --border-soft: #e9eef2;

    --success: #2f8e6d;
    --danger: #b85252;
}


/* ============================================================= */
/* GENERAL                                                       */
/* ============================================================= */

html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;

    background: var(--page);

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

#authoring-app {
    width: 100%;
    height: 100vh;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

button,
input,
textarea,
select {
    font: inherit;
}


/* ============================================================= */
/* HEADER                                                        */
/* ============================================================= */

.app-header {
    flex: 0 0 68px;
    height: 68px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 22px;

    background: var(--navy-900);

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}


/* ============================================================= */
/* BRANDING                                                      */
/* ============================================================= */

.brand-block {
    height: 100%;

    display: flex;
    align-items: center;

    gap: 15px;
}

.header-logo {
    display: block;

    width: auto;
    height: 47px;

    /*
     * The supplied SVG contains the full MedExam
     * wordmark and strapline.
     */
}

.studio-divider {
    width: 1px;
    height: 31px;

    background: rgba(255, 255, 255, 0.22);
}

.studio-name {
    color: var(--aqua-200);

    font-size: 13px;
    font-weight: 700;

    letter-spacing: 0.7px;
    text-transform: uppercase;

    white-space: nowrap;
}


/* ============================================================= */
/* HEADER ACTIONS                                                */
/* ============================================================= */

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.save-status {
    color: var(--aqua-200);

    font-size: 13px;
}

.user-badge {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--navy-700);

    color: #fff;

    font-size: 13px;
    font-weight: 800;
}

.btn-aqua {
    border-color: var(--aqua-500);
    background: var(--aqua-500);

    color: #fff;

    font-weight: 800;
}

.btn-aqua:hover,
.btn-aqua:focus {
    border-color: var(--aqua-400);
    background: var(--aqua-400);

    color: var(--navy-900);
}


/* ============================================================= */
/* WORKSPACE                                                     */
/* ============================================================= */

.workspace {
    flex: 1 1 auto;

    min-width: 0;
    min-height: 0;

    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);

    overflow: hidden;
}


/* ============================================================= */
/* SIDEBAR                                                       */
/* ============================================================= */

.content-sidebar {
    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: var(--navy-950);

    border-right: 1px solid var(--navy-800);
}

.sidebar-heading {
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 17px 13px;
}

.sidebar-title {
    color: #fff;

    font-weight: 800;
    font-size: 15px;
}

.sidebar-subtitle {
    margin-top: 2px;

    color: var(--aqua-200);

    font-size: 12px;
}

.icon-button {
    width: 30px;
    height: 30px;

    border: 0;
    border-radius: 7px;

    background: var(--navy-800);

    color: var(--aqua-200);

    font-size: 20px;
    line-height: 1;
}

.icon-button:hover {
    background: var(--navy-700);
}

.search-wrapper {
    flex: 0 0 auto;

    padding: 0 13px 13px;
}

.tree-search {
    border: 1px solid var(--navy-700);

    background: var(--navy-900);

    color: #fff;

    font-size: 13px;
}

.tree-search:focus {
    border-color: var(--aqua-500);

    background: var(--navy-900);

    color: #fff;

    box-shadow: 0 0 0 0.2rem rgba(22, 165, 163, 0.17);
}

.tree-search::placeholder {
    color: #8da7c7;
}

.content-tree {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 5px 8px 20px;

    scrollbar-gutter: stable;
}

.tree-section {
    margin-bottom: 5px;
}

.tree-heading {
    display: flex;
    align-items: center;

    width: 100%;

    padding: 8px;

    border: 0;
    border-radius: 6px;

    background: transparent;

    color: #b7c9dd;

    font-size: 12px;
    font-weight: 800;

    text-align: left;

    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tree-heading:hover {
    background: rgba(255, 255, 255, 0.04);
}

.tree-chevron {
    width: 18px;

    color: var(--aqua-500);
}

.tree-node {
    display: flex;
    align-items: center;

    width: 100%;

    min-height: 34px;

    padding: 5px 9px 5px 28px;

    border: 0;
    border-radius: 6px;

    background: transparent;

    color: #d9e5f2;

    text-align: left;

    font-size: 13px;
}

.tree-node:hover {
    background: rgba(255, 255, 255, 0.06);
}

.tree-node.active {
    background: var(--navy-800);

    color: #fff;
}

.tree-node-dot {
    width: 7px;
    height: 7px;

    flex: 0 0 auto;

    margin-right: 9px;

    border-radius: 50%;

    background: var(--aqua-500);
}

.tree-node.manifest .tree-node-dot {
    border-radius: 2px;

    background: #9ab5d6;
}

.tree-node.topic .tree-node-dot {
    background: transparent;

    border: 1.5px solid var(--aqua-400);
}

.tree-count {
    margin-left: auto;

    color: #7893b4;

    font-size: 11px;
}


/* ============================================================= */
/* MAIN EDITOR                                                   */
/* ============================================================= */

.editor-workspace {
    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: var(--page);
}

.document-header {
    flex: 0 0 auto;

    min-height: 88px;

    display: flex;
    align-items: center;

    padding: 16px 28px 14px;

    border-bottom: 1px solid var(--border);

    background: #fff;
}

.document-type {
    color: var(--aqua-500);

    font-size: 11px;
    font-weight: 900;

    letter-spacing: 1.5px;
}

.document-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.document-title {
    margin: 3px 0 0;

    color: var(--navy-900);

    font-size: 21px;
    font-weight: 800;
}

.document-path {
    margin-top: 3px;

    color: var(--text-muted);

    font-size: 12px;
}

.dirty-indicator {
    display: none;

    width: 9px;
    height: 9px;

    border-radius: 50%;

    background: var(--aqua-500);
}

.dirty-indicator.visible {
    display: block;
}


/* ============================================================= */
/* TABS                                                          */
/* ============================================================= */

.document-tabs {
    flex: 0 0 48px;
    height: 48px;

    display: flex;
    align-items: flex-end;

    gap: 3px;

    padding: 0 27px;

    border-bottom: 1px solid var(--border);

    background: #fff;
}

.document-tab {
    height: 48px;

    padding: 0 18px;

    border: 0;
    border-bottom: 3px solid transparent;

    background: transparent;

    color: var(--text-soft);

    font-size: 14px;
    font-weight: 700;
}

.document-tab:hover {
    color: var(--navy-900);
}

.document-tab.active {
    border-bottom-color: var(--aqua-500);

    color: var(--navy-900);
}

.tab-panel {
    display: none;

    flex: 1 1 auto;

    min-width: 0;
    min-height: 0;

    overflow-y: scroll;
    overflow-x: hidden;

    scrollbar-gutter: stable;
}

.tab-panel.active {
    display: block;
}


/* ============================================================= */
/* EDITOR                                                        */
/* ============================================================= */

.editor-panel {
    width: min(900px, calc(100% - 50px));

    margin: 25px auto 50px;
}

.form-section {
    margin-bottom: 20px;

    padding: 21px;

    border: 1px solid var(--border-soft);
    border-radius: 14px;

    background: var(--surface);

    box-shadow: 0 3px 10px rgba(5, 29, 67, 0.025);
}

.section-heading {
    margin-bottom: 16px;

    color: var(--navy-900);

    font-size: 15px;
    font-weight: 850;
}

.section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 16px;
}

.section-heading-row .section-heading {
    margin-bottom: 0;
}

.form-label {
    color: var(--text);

    font-size: 13px;
    font-weight: 700;
}

.form-control,
.form-select {
    border-color: var(--border);

    font-size: 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--aqua-500);

    box-shadow: 0 0 0 0.2rem rgba(22, 165, 163, 0.12);
}

.form-check-input:checked {
    border-color: var(--aqua-500);

    background-color: var(--aqua-500);
}


/* ============================================================= */
/* TOPICS                                                        */
/* ============================================================= */

.topic-editor {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;
}

.topic-chip {
    display: inline-flex;
    align-items: center;

    padding: 6px 9px 6px 11px;

    border-radius: 999px;

    background: var(--aqua-100);

    color: var(--navy-800);

    font-size: 13px;
    font-weight: 650;
}

.topic-remove {
    margin-left: 7px;

    border: 0;

    background: transparent;

    color: var(--text-muted);

    line-height: 1;
}

.topic-remove:hover {
    color: var(--danger);
}


/* ============================================================= */
/* OPTIONS                                                       */
/* ============================================================= */

.option-editor-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 80px 36px;

    align-items: center;

    gap: 10px;

    margin-bottom: 10px;
}

.option-id {
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--page);

    color: var(--navy-900);

    font-weight: 850;
}

.correct-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-option {
    width: 34px;
    height: 34px;

    border: 0;
    border-radius: 7px;

    background: transparent;

    color: var(--text-muted);
}

.remove-option:hover {
    background: #fff0f0;

    color: var(--danger);
}


/* ============================================================= */
/* MEDIA                                                         */
/* ============================================================= */

.media-item {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 36px;

    gap: 13px;

    align-items: start;

    margin-bottom: 12px;

    padding: 12px;

    border: 1px solid var(--border);
    border-radius: 10px;
}

.media-thumb {
    width: 80px;
    height: 68px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border-radius: 8px;

    background: var(--navy-900);

    color: var(--aqua-200);

    font-size: 11px;
}

.media-thumb img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.media-fields {
    display: grid;
    gap: 8px;
}


/* ============================================================= */
/* MANIFEST                                                      */
/* ============================================================= */

.manifest-question-item {
    display: flex;
    align-items: center;

    min-height: 42px;

    margin-bottom: 7px;

    padding: 8px 11px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--page);
}

.manifest-order {
    width: 26px;

    color: var(--text-muted);

    font-size: 12px;
}

.manifest-question-title {
    color: var(--text);

    font-size: 14px;
    font-weight: 650;
}


/* ============================================================= */
/* PREVIEW                                                       */
/* ============================================================= */

.preview-container {
    min-height: 100%;

    padding: 35px;
}

.learner-frame {
    width: min(570px, 100%);

    margin: 0 auto;

    overflow: hidden;

    border-radius: 26px;

    background: #fff;

    box-shadow:
        0 16px 45px rgba(6, 38, 84, 0.15);
}

.learner-topbar {
    padding: 20px 22px;

    background: var(--navy-900);
}

.learner-progress-label {
    display: flex;
    justify-content: space-between;

    margin-bottom: 8px;

    color: var(--aqua-200);

    font-size: 12px;
    font-weight: 650;
}

.learner-progress {
    height: 6px;

    overflow: hidden;

    border-radius: 999px;

    background: var(--navy-700);
}

.learner-progress-fill {
    width: 20%;
    height: 100%;

    background: var(--aqua-500);
}

.learner-content {
    padding: 24px;
}

.preview-topic-row {
    display: flex;
    flex-wrap: wrap;

    gap: 6px;

    margin-bottom: 18px;
}

.preview-topic {
    padding: 4px 7px;

    border-radius: 999px;

    background: var(--aqua-100);

    color: var(--navy-800);

    font-size: 11px;
    font-weight: 700;
}

.preview-stem {
    color: var(--text);

    font-size: 15px;
    line-height: 1.55;
}

.preview-image {
    width: 100%;

    margin: 18px 0;

    border-radius: 13px;

    background: var(--navy-900);
}

.preview-leadin {
    margin: 18px 0;

    color: var(--navy-900);

    font-size: 17px;
    font-weight: 850;

    line-height: 1.4;
}

.preview-option {
    display: flex;
    align-items: center;

    min-height: 56px;

    margin-bottom: 9px;

    padding: 10px 12px;

    border: 1.5px solid var(--border);
    border-radius: 13px;

    color: var(--text);

    font-size: 14px;
}

.preview-option-id {
    width: 31px;
    height: 31px;

    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-right: 11px;

    border-radius: 50%;

    background: var(--page);

    color: var(--navy-900);

    font-weight: 850;
}

.preview-submit {
    width: 100%;

    margin-top: 12px;

    padding: 13px;

    border: 0;
    border-radius: 13px;

    background: var(--navy-900);

    color: var(--aqua-200);

    font-weight: 850;
}

.manifest-preview {
    width: min(760px, 100%);

    margin: 0 auto;

    padding: 25px;

    border-radius: 18px;

    background: #fff;

    box-shadow: 0 8px 30px rgba(6, 38, 84, 0.08);
}


/* ============================================================= */
/* SOURCE                                                        */
/* ============================================================= */

.source-panel.active {
    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.source-toolbar {
    flex: 0 0 52px;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 18px;

    border-bottom: 1px solid var(--border);

    background: #fff;
}

.source-status {
    font-size: 12px;
    font-weight: 750;
}

.source-status.valid {
    color: var(--success);
}

.source-status.invalid {
    color: var(--danger);
}

#source-editor {
    flex: 1 1 auto;

    min-width: 0;
    min-height: 0;
}

.source-error {
    flex: 0 0 auto;

    padding: 10px 15px;

    border-top: 1px solid #f4c8c8;

    background: #fff0f0;

    color: var(--danger);

    font-family: monospace;
    font-size: 12px;
}


/* ============================================================= */
/* SCROLLBARS                                                    */
/* ============================================================= */

.tab-panel::-webkit-scrollbar,
.content-tree::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.tab-panel::-webkit-scrollbar-track {
    background: #e9eef2;
}

.tab-panel::-webkit-scrollbar-thumb {
    min-height: 40px;

    border: 2px solid #e9eef2;
    border-radius: 999px;

    background: #9aabb9;
}

.tab-panel::-webkit-scrollbar-thumb:hover {
    background: #788d9e;
}

.content-tree::-webkit-scrollbar-track {
    background: var(--navy-950);
}

.content-tree::-webkit-scrollbar-thumb {
    min-height: 40px;

    border: 2px solid var(--navy-950);
    border-radius: 999px;

    background: var(--navy-700);
}

.content-tree::-webkit-scrollbar-thumb:hover {
    background: var(--aqua-500);
}

.tab-panel {
    scrollbar-width: auto;
    scrollbar-color: #9aabb9 #e9eef2;
}

.content-tree {
    scrollbar-width: auto;
    scrollbar-color: var(--navy-700) var(--navy-950);
}


/* ============================================================= */
/* RESPONSIVE                                                    */
/* ============================================================= */

@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 250px minmax(0, 1fr);
    }

    .header-logo {
        height: 40px;
    }

    .studio-name {
        display: none;
    }

    .studio-divider {
        display: none;
    }

    .editor-panel {
        width: calc(100% - 30px);
    }
}