/* TUHH colors as CSS variables */
:root {
    --tuhh-dark-blue: #005e73;
    --tuhh-light-blue: #00C1D4;
    --link-color: #4a148c;       /* dark purple */
    --link-hover-color: #7b1fa2; /* lighter purple on hover */
}

/* Links in dark purple (1uk-extend.css loads after the UIkit CDN css,
   so these same-specificity rules win) */
a,
.uk-link {
    color: var(--link-color);
}

a:hover,
a:focus,
.uk-link:hover,
.uk-link:focus {
    color: var(--link-hover-color);
}


/* Progress bars (vignette footers) in TUHH dark blue */
progress.uk-progress::-webkit-progress-value {
    background-color: var(--tuhh-dark-blue);
}
progress.uk-progress::-moz-progress-bar {
    background-color: var(--tuhh-dark-blue);
}
progress.uk-progress::-ms-fill {
    background-color: var(--tuhh-dark-blue);
}

/* Notifications (e.g. "Copied to clipboard") with TUHH light blue font */
.uk-notification-message-primary {
    color: var(--tuhh-dark-blue);
}

.answer-card {
    border-radius: 10px;
    border: 2px solid #D0D0CE; /* Set secondary color for border */
    margin-bottom: 10px;
    cursor: pointer;
    color: #000; /* Set secondary color for font color */
    font-size: 1.1em;
    overflow-wrap: break-word;
    word-break: break-word;
}

.navbar-logo {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-image: url('/favicon.ico');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

.header-card {
    margin-bottom: 25px;
    font-size: 1.15em;
}

.answer-title {
    font-size: 1.5rem;
    line-height: 1.2;
    text-align: center;
}

.right-answer {
    background-color: #2caf69;
}

.wrong-answer {
    background-color: #b7584a;
}

.answer-card.selected {
    border-color: var(--tuhh-dark-blue); /* Set secondary color for selected border */
}

.uk-button-primary {
    background-color: var(--tuhh-light-blue); /* Set primary color for button */
    color: #FFFFFF; /* Set font color for button */
}

.uk-button-primary:hover {
    background-color: var(--tuhh-dark-blue);
}

/* CDN UIkit uppercases buttons and shrinks them to 0.875rem; original had none and 1rem */
.uk-button {
    text-transform: none;
    font-size: 1rem;
}

.uk-dropnav {
    background-color: #fff;
}

.uk-card-header, .uk-card-header:hover {
    color: #fff;
}

/* Slightly reduce the height of the question card header (teal bar) */
#answerChoicesCard .uk-card-header {
    padding: 10px 30px;
}

@media (min-width: 960px) {
    #answerChoicesCard .uk-card-header {
        padding: 12px 40px;
    }
}

.uk-accordion-title::before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2213%22%20height%3D%2213%22%20viewBox%3D%220%200%2013%2013%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Crect%20fill%3D%22%23ffffff%22%20width%3D%2213%22%20height%3D%221%22%20x%3D%220%22%20y%3D%226%22%20%2F%3E%0A%20%20%20%20%3Crect%20fill%3D%22%23ffffff%22%20width%3D%221%22%20height%3D%2213%22%20x%3D%226%22%20y%3D%220%22%20%2F%3E%0A%3C%2Fsvg%3E");
}

.uk-open > .uk-accordion-title::before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2213%22%20height%3D%2213%22%20viewBox%3D%220%200%2013%2013%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Crect%20fill%3D%22%23ffffff%22%20width%3D%2213%22%20height%3D%221%22%20x%3D%220%22%20y%3D%226%22%20%2F%3E%0A%3C%2Fsvg%3E");
}

.uk-accordion-content {
    background-color: #fff;
}

/* Match original site: heading sizes, weight, and list spacing */
h1, .uk-h1 { text-align: center; font-size: 1.7rem; line-height: 1.3; }
h2, .uk-h2 { font-size: 1.7rem; line-height: 1.3; }
h3, .uk-h3 { font-size: 1.5rem; line-height: 1.4; }
h4, .uk-h4 { font-size: 1.25rem; line-height: 1.4; }
h5, .uk-h5 { font-size: 16px; line-height: 1.4; }
h6, .uk-h6 { font-size: 0.875rem; line-height: 1.4; }

h1, .uk-h1, h2, .uk-h2, h3, .uk-h3, h4, .uk-h4, h5, .uk-h5, h6, .uk-h6 {
    font-family: inherit;
    font-weight: bold;
}

h1 { color: var(--tuhh-dark-blue); }

em { color: var(--tuhh-dark-blue); }

p, ul, ol, dl, pre, address, fieldset, figure {
    margin: 0 0 10px 0;
}

* + p, * + ul, * + ol, * + dl, * + pre, * + address, * + fieldset, * + figure {
    margin-top: 10px;
}

ul, ol {
    padding-left: 30px;
}

.session-answer-stats {
    margin-left: 10px;
    font-size: 1em;
}

.navbar-base {
    border-bottom: 2px solid #d2d2d2;
    font-weight: bold;
    height: 60px;
    max-height: 65px;
    display: flex;
    align-items: center;
}

/* Keep navbar nav items within the height cap and vertically centered */
.uk-navbar-nav > li > a,
.uk-navbar-item,
.uk-navbar-toggle {
    min-height: 0;
    max-height: 60px;
    display: flex;
    align-items: center;
}

/* A bit of right margin on the small-screen navbar toggle (hamburger) */
.navbar-base .uk-navbar-toggle {
    margin-right: 8px;
}

.uk-card-body {
    padding: 20px;
}

.navbar-base .uk-navbar-nav {
    align-items: center;
    /* CDN UIkit sets gap:15px/30px here; the original vendored UIkit uses 0,
       the spacing comes from the li padding below */
    gap: 0;
}

.navbar-base .uk-navbar-nav > li {
    /* 7.5px on each side -> 15px gap between buttons, same as the
       top/bottom margin inside the 60px navbar (was 15px per side = 30px) */
    padding: 0 7.5px;
    display: flex;
    align-items: center;
}

.navbar-base .uk-navbar-center {
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-base .uk-navbar-center h1 {
    margin: 0 !important;
    line-height: 1.2;
}

/* Navbar buttons: identical font metrics in the top navbar (large screens)
   and in the offcanvas sidebar (small screens, which lives outside
   .navbar-base and would otherwise fall back to the global 1rem .uk-button
   and normal weight -- .navbar-base sets font-weight: bold, which the
   .uk-button font:inherit picks up in the navbar but not in the offcanvas) */
.navbar-base .uk-button,
#navbar-offcanvas .uk-button {
    font-family: var(--font-main);
    line-height: 30px;
    padding: 0 12px;
    font-size: 0.9em;
    font-weight: bold;
}

.navbar-links {
    text-transform: none !important;
    font-size: 1.2em !important;
}

@media (max-width: 639px) {
    .navbar-links {
        font-size: 0.9em !important;
        word-break: break-word;
    }

    .navbar-base h1 {
        font-size: 1.1rem;
        margin: 0;
    }
}

.index-description {
    margin-top: 20px !important;
    margin-bottom: 20px !important;
}

.question-list-title {
    margin-top: 20px !important;
    margin-bottom: 0 !important;
    font-weight: bold;
    text-align: center;
    font-size: 1.1em;
}

.vignette-block {
    border-radius: 8px;
	border: 2px solid #acacac;
}

.vignette-header {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    background-color: var(--tuhh-light-blue);
    color: #fff !important;
    font-weight: bold;
}

.vignette-title {
    color: var(--tuhh-dark-blue);
    font-weight: bold;
    font-size: 1.3rem;
    padding: 0px 10px;
}

.vignette-content {
    text-align: left;
    padding: 20px 20px;
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* Stats page: the level doughnuts live in a uk-grid that is a direct child
   of .vignette-content; let it take the full width so levels spread horizontally */
.vignette-content > [uk-grid] {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
}

.vignette-text {
    min-width: 0;
    word-break: break-word;
}
/* no ::after clearfix here: it would become a third flex item and prevent
   justify-content: space-between from pushing .vignette-buttons to the right */

.vignette-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.vignette-buttons a {
    float: none !important;
}

.vignette-buttons .uk-button {
    float: none !important;
    margin: 0 !important;
}

.progress-label {
    text-align: left;
}

/* Question list : small vignettes per question, showing the last local
   result and the server-side success rate in the footer */
.question-vignette {
    border-radius: 8px;
    border: 2px solid #acacac;
}

.question-vignette-header {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    background-color: var(--tuhh-light-blue);
    color: #fff !important;
    font-weight: bold;
    font-size: 1rem;
    padding: 8px 12px;
}

.question-vignette-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.question-local-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: bold;
}

.question-server-stats {
    color: #666;
    white-space: nowrap;
}

/* Stats page: make the question-statistics modal wider (still capped by viewport) */
.stats-modal-dialog {
    width: 900px;
}

/* Smaller title in modals (stock UIkit uses 2rem) */
.uk-modal-title {
    font-size: 1.5rem;
}

.uk-tooltip {
    font-size: 0.95rem;
    padding: 6px 10px;
    max-width: 480px;
    width: max-content;
}

.versionInfo {
    color: var(--tuhh-dark-blue);
    cursor: pointer;
}

/* MathJax: prevent overflow on small screens */
mjx-container {
    max-width: 100%;
}

/* Display math: scroll horizontally if too wide */
mjx-container[display="true"] {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    margin: 0.5em 0;
}

/* Inline math: wrap as inline-block so long formulas can scroll */
mjx-container:not([display="true"]) {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    vertical-align: middle;
}

@media (max-width: 639px) {
    mjx-container {
        font-size: 0.9em;
    }
}

blockquote {
    border-left: 4px solid #acacac;
    border-radius: 5px;
    margin: 0;
    padding: 5px;
    font-size: 1.0rem;
    font-style: normal;
    line-height: 1.6;
    color: var(--tuhh-dark-blue);
    background: #e1e1e1;
}

* + blockquote {
    margin-top: 20px;
}

blockquote + * {
    margin-top: 16px;
}

blockquote p:last-of-type {
    margin-bottom: 0;
}

/* Vignette improvements on small screens (< 640px) */
@media (max-width: 639px) {
    .vignette-content {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .vignette-buttons {
        flex-direction: row;
        gap: 8px;
    }

    .vignette-content .uk-button {
        font-size: 0.85rem;
        padding: 0 10px;
    }

    .vignette-title {
        font-size: 1rem;
    }

    .vignette-header {
        font-size: 0.9rem;
        word-break: break-word;
        padding: 8px 12px;
    }

    .vignette-block .uk-card-footer {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        justify-content: flex-end;
    }

    .vignette-block .uk-card-footer a {
        float: none !important;
        margin: 0 !important;
    }

    .vignette-block .uk-card-footer .uk-button {
        font-size: 0.85rem;
        padding: 0 10px;
    }

    /* Question list items on small screens */
    .question-link {
        white-space: normal;
        word-break: break-word;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        line-height: 1.3;
    }

    .questionItem {
        min-width: 0;
    }

    /* Action buttons in modal footers (question page after answering, test
       start/results pages) on small screens: wrap in rows and let each button
       grow to fill its share of the row, instead of floating with fixed
       margins and overlapping each other */
    .uk-modal-footer {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-start;
    }

    .uk-modal-footer a {
        float: none !important;
        margin: 0 !important;
        flex: 1 1 40%;
        min-width: 0;
    }

    .uk-modal-footer .uk-button {
        float: none !important;
        margin: 0 !important;
        width: 100%;
        font-size: 0.85rem;
        padding: 0 10px;
        white-space: normal;
    }
}

/* ------------------------------------------------------------------
   Overview page (teacher view of the question database)
   ------------------------------------------------------------------ */

/* Horizontal scroll instead of squashing on small screens */
.overview-table-wrap {
    overflow-x: auto;
}

.overview-table th,
.overview-table td {
    padding: 8px 10px;
    vertical-align: middle;
}

/* UIkit's .uk-table th { text-align:left } overrides the table's uk-text-center
   for <th> cells, so tfoot numbers render left-aligned while tbody <td> are
   centered. Force tfoot th to center like the rest. */
.overview-table tfoot th {
    text-align: center;
}

/* Clickable topic / level / cell entries in the main table */
.overview-topic-link,
.overview-level-head,
.overview-cell,
.overview-series-row {
    cursor: pointer;
}

.overview-level-head:hover,
.overview-cell:hover,
.overview-series-row:hover {
    background-color: #f0f0f0;
}

.overview-topic-link {
    color: var(--tuhh-dark-blue);
    font-weight: bold;
}

/* Overview modal: wide dialog, scrollable body */
.overview-modal-dialog {
    width: 900px;
}

.overview-modal-body {
    max-height: 65vh;
    overflow-y: auto;
}

.overview-modal-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-top: 8px;
}

.overview-search {
    max-width: 280px;
}

.overview-count-label {
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Highlighted search matches in the overview modal */
mark.overview-hit {
    background: #ffe9a8;
    color: inherit;
    padding: 0;
    border-radius: 2px;
}

.overview-details-toggle {
    margin-left: auto;
    font-size: 0.95rem;
    font-weight: normal;
    cursor: pointer;
}

.overview-group {
    margin-top: 20px;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.overview-level-head {
    color: var(--tuhh-dark-blue);
    font-weight: bold;
    margin: 10px 0 2px 0;
}

.overview-q {
    margin-bottom: 4px;
}

/* Full question (header + answers) is always shown in the modal */
.overview-q-full {
    margin: 2px 0 12px 15px;
}

/* The details section (explanations) is hidden unless the toggle is on */
.overview-q-extra {
    display: none;
    margin-top: 5px;
    padding: 8px 12px;
    background: #f8f8f8;
    border-left: 3px solid var(--tuhh-light-blue);
    color: #444;
    font-size: 0.95em;
}

.show-details .overview-q-extra {
    display: block;
}

/* "Details" title in light grey on top of the details block */
.overview-details-title {
    color: #999;
    font-size: 0.85em;
    font-weight: bold;
    margin-bottom: 3px;
}

.overview-answers {
    list-style: none;
    /* vertical bar on the left + light gray background, to distinguish the
       answers from the question text (the details section keeps the teal bar) */
    border-left: 3px solid #d2d2d2;
    background: #f8f8f8;
    padding: 5px 10px;
    margin-bottom: 5px;
}

/* Keep each answer on one line with the check icon to its right, not below.
   Baseline alignment keeps the enumeration number on the text's baseline. */
.overview-answers li {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.overview-answers li > p {
    margin: 0;
}

.overview-answers li > [uk-icon] {
    flex-shrink: 0;
}

/* Small enumeration number in front of each answer */
.overview-answer-num {
    flex-shrink: 0;
    min-width: 1.2em;
    text-align: right;
    font-size: 0.75em;
    font-weight: bold;
    color: var(--tuhh-dark-blue);
}

.overview-answer-correct {
    color: green;
    font-weight: bold;
}

@media (max-width: 640px) {
    .overview-modal-dialog {
        width: 95vw;
    }

    .overview-modal-body {
        max-height: 75vh;
    }
}

/* Tables rendered from markdown (e.g. concepts.md), as opposed to the
   UIkit tables which carry the uk-table class and are already styled */
table:not(.uk-table) {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

table:not(.uk-table) th,
table:not(.uk-table) td {
    border: 1px solid #d8d8d8;
    padding: 6px 10px;
    text-align: left;
}

table:not(.uk-table) th {
    background-color: #f5f5f5;
}

table:not(.uk-table) tr:nth-child(even) {
    background-color: #fafafa;
}

/* "Concepts" pill in the navbar: border with slightly rounded corners
   around the icon and the label; same line style as the navbar bottom
   border (.navbar-base border-bottom) */
.concepts-link {
    border: 2px solid #d2d2d2;
    border-radius: 6px;
    padding: 7px 7px;
    margin-left: 8px;
    color: var(--tuhh-dark-blue);
    font-size: 0.8em;
    white-space: nowrap;
}

.concepts-link:hover {
    background-color: #eef6f8;
    text-decoration: none;
}
