/* ==========================================================================
   InternetProg - Missouri State maroon theme on Bootstrap 5
   ========================================================================== */

:root {
    --msu-maroon: #5e0009;
    --msu-maroon-light: #7a000c;
    --msu-maroon-dark: #410006;
    --msu-gold: #d1a344;
    --msu-surface: #f7f5f4;
    --msu-border: #e3dedd;
    --msu-ink: #221c1c;
}

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: var(--msu-ink);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

main {
    flex: 1 0 auto;
}

a {
    color: var(--msu-maroon);
}

a:hover {
    color: var(--msu-maroon-light);
}

/* --------------------------------------------------------------- buttons */

.btn-msu {
    color: #fff;
    background-color: var(--msu-maroon);
    border-color: var(--msu-maroon);
}

.btn-msu:hover,
.btn-msu:focus {
    color: #fff;
    background-color: var(--msu-maroon-light);
    border-color: var(--msu-maroon-light);
}

.btn-msu:focus,
.btn-msu.focus {
    box-shadow: 0 0 0 0.25rem rgba(94, 0, 9, 0.35);
}

.btn-msu:active,
.btn-msu:not(:disabled):not(.disabled):active {
    color: #fff;
    background-color: var(--msu-maroon-dark);
    border-color: var(--msu-maroon-dark);
}

.btn-msu:disabled,
.btn-msu.disabled {
    color: #fff;
    background-color: var(--msu-maroon);
    border-color: var(--msu-maroon);
    opacity: 0.55;
}

.btn-outline-msu {
    color: var(--msu-maroon);
    border-color: var(--msu-maroon);
}

.btn-outline-msu:hover {
    color: #fff;
    background-color: var(--msu-maroon);
    border-color: var(--msu-maroon);
}

.text-msu { color: var(--msu-maroon) !important; }
.bg-msu   { background-color: var(--msu-maroon) !important; }

.badge-msu {
    background-color: var(--msu-maroon);
    color: #fff;
}

/* ------------------------------------------------------------ navigation */

.navbar-msu {
    background-color: var(--msu-maroon);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.navbar-msu .navbar-brand,
.navbar-msu .nav-link {
    color: rgba(255, 255, 255, 0.92);
}

.navbar-msu .nav-link:hover,
.navbar-msu .nav-link.active {
    color: #fff;
    border-bottom: 2px solid var(--msu-gold);
}

.navbar-brand img {
    height: 34px;
    width: auto;
}

.navbar-msu .nav-user {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
}

/* Logout posts a form, but has to read as a nav link. */
.navbar-msu .nav-logout {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    border: 0;
    padding: 0.5rem 0.5rem;
    background: none;
}

.navbar-msu .nav-logout:hover {
    color: #fff;
    border-bottom: 2px solid var(--msu-gold);
}

/* -------------------------------------------------------------- landing
   The hero spans the full viewport width. The page layout deliberately does
   NOT wrap content in a .container - each section brings its own, so
   full-bleed sections like this one can reach both edges of the browser.    */

.hero {
    position: relative;
    width: 100%;
    background-image: url('/img/landing/hero-bg.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    padding: 7rem 0;
    color: #fff;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(40, 0, 4, 0.72), rgba(94, 0, 9, 0.78));
}

.hero > .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.hero .lead {
    font-size: 1.2rem;
    max-width: 46rem;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 767.98px) {
    .hero { padding: 4rem 0; }
    .hero h1 { font-size: 2rem; }
}

.features .fa-3x {
    color: var(--msu-maroon);
}

.courses .card {
    border: 1px solid var(--msu-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.courses .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.courses .card img {
    height: 180px;
    object-fit: cover;
}

.testimonials {
    background-color: var(--msu-maroon);
}

.testimonials .testimonial {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* ----------------------------------------------------------------- cards */

.stat-card {
    border: 1px solid var(--msu-border);
    border-left: 4px solid var(--msu-maroon);
    border-radius: 8px;
    background: #fff;
}

.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}

.page-header {
    background: #fff;
    border-bottom: 1px solid var(--msu-border);
    padding: 1.25rem 0;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

/* ---------------------------------------------------------------- tables */

.table thead th {
    background-color: var(--msu-surface);
    border-bottom: 2px solid var(--msu-border);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #555;
}

/* The copy/paste flag on a grader's roster. */
.flag-paste {
    color: #c1121f;
    font-size: 1.05rem;
}

.flag-clean {
    color: #cfd4d8;
}

/* --------------------------------------------------------------- editor
   Write-up occupies 4 of 12 columns on the left; the editor takes the rest. */

.assignment-workspace {
    height: calc(100vh - 56px);
    overflow: hidden;
}

.writeup-pane {
    height: 100%;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--msu-border);
    padding: 1.5rem;
}

.writeup-pane img {
    max-width: 100%;
}

.editor-pane {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
}

.editor-toolbar {
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    color: #ddd;
    padding: 0.4rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.editor-tabs {
    display: flex;
    background: #252526;
    border-bottom: 1px solid #3e3e42;
}

.editor-tab {
    padding: 0.45rem 1.1rem;
    color: #b8b8b8;
    cursor: pointer;
    border: none;
    background: transparent;
    border-right: 1px solid #3e3e42;
    font-size: 0.86rem;
}

.editor-tab.active {
    background: #1e1e1e;
    color: #fff;
    border-top: 2px solid var(--msu-gold);
}

.editor-surface {
    flex: 1 1 auto;
    position: relative;
    min-height: 0;
}

.editor-host {
    position: absolute;
    inset: 0;
}

.editor-host.hidden {
    display: none;
}

.output-pane {
    height: 38%;
    border-top: 2px solid #3e3e42;
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
}

.output-header {
    background: #2d2d30;
    color: #ccc;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.output-body {
    flex: 1 1 auto;
    overflow: auto;
    margin: 0;
    padding: 0.75rem;
    color: #d4d4d4;
    background: #1e1e1e;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

.output-body .err { color: #f48771; }
.output-body .ok  { color: #6a9955; }

#previewFrame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.save-state {
    font-size: 0.8rem;
    color: #9fd39f;
}

.save-state.dirty { color: var(--msu-gold); }
.save-state.error { color: #f48771; }

/* -------------------------------------------------------------- playback */

.playback-shell {
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
}

.playback-code {
    margin: 0;
    padding: 1rem;
    color: #d4d4d4;
    background: #1e1e1e;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    min-height: 420px;
    max-height: 60vh;
    overflow: auto;
    white-space: pre-wrap;
}

.playback-controls {
    background: #2d2d30;
    color: #ddd;
    padding: 0.6rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.playback-clock {
    font-family: Consolas, monospace;
    font-size: 0.9rem;
    color: var(--msu-gold);
    white-space: nowrap;
}

#playbackScrubber {
    flex: 1 1 220px;
    min-width: 160px;
}

.event-marker-paste { color: #ff6b6b; }
.event-marker-blur  { color: #ffd166; }

/* ---------------------------------------------------------------- footer */

.site-footer {
    flex-shrink: 0;
    margin-top: auto;   /* pins the footer to the bottom on short pages */
    background-color: #2b2b2b;
    color: #cfcfcf;
    padding: 2rem 0 1.25rem;
    font-size: 0.9rem;
}

.site-footer a {
    color: #e8e8e8;
    text-decoration: none;
}

.site-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* ------------------------------------------------------------------ misc */

.required::after {
    content: " *";
    color: #c1121f;
}

.form-help {
    font-size: 0.82rem;
    color: #6c757d;
}

.code-chip {
    font-family: Consolas, monospace;
    background: var(--msu-surface);
    border: 1px solid var(--msu-border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.85rem;
}

/* ============================================================== auth screens
   Sign-in and registration share one elevated split card: a branded maroon
   panel on the left, the form on the right. It collapses to a single column
   below the lg breakpoint, where the brand panel is trimmed to a header.     */

.auth-wrap {
    padding: 3rem 0;
    background:
        radial-gradient(1200px 400px at 50% -10%, rgba(94, 0, 9, 0.10), transparent 70%),
        var(--msu-surface);
}

.auth-card {
    border: 1px solid var(--msu-border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.13);
}

/* Left brand panel */
.auth-brand {
    position: relative;
    color: #fff;
    padding: 3rem 2.5rem;
    background-image: url('/img/landing/hero-bg.jpg');
    background-size: cover;
    background-position: center;
}

.auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(94, 0, 9, 0.93), rgba(40, 0, 4, 0.96));
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

.auth-brand img {
    height: 56px;
    width: 56px;
    /* The brand panel is a column flexbox, and its default align-items:stretch
       would pull this square logo out to the full panel width. Pinning the
       cross-axis alignment keeps it square. */
    align-self: flex-start;
    max-width: 100%;
    object-fit: contain;
    margin-bottom: 1.25rem;
}

.auth-brand h2 {
    font-weight: 700;
    font-size: 1.6rem;
    margin-bottom: 0.35rem;
}

.auth-brand .auth-tagline {
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 2rem;
}

.auth-points {
    list-style: none;
    padding: 0;
    margin: 0;
}

.auth-points li {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.5rem 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.95rem;
}

.auth-points i {
    color: var(--msu-gold);
    margin-top: 0.2rem;
}

/* Right form panel */
.auth-form {
    padding: 3rem 2.75rem;
}

.auth-form h1 {
    font-size: 1.55rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.auth-form .auth-sub {
    color: #6c757d;
    margin-bottom: 1.75rem;
}

.auth-form .form-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #555;
}

.auth-form .input-group-text {
    background: var(--msu-surface);
    border-right: 0;
    color: #8a8a8a;
}

.auth-form .form-control {
    padding: 0.65rem 0.85rem;
}

.auth-form .input-group .form-control {
    border-left: 0;
}

.auth-form .form-control:focus {
    border-color: var(--msu-maroon);
    box-shadow: none;
}

/* Keep the whole group highlighted while a field inside it has focus. */
.auth-form .input-group:focus-within {
    border-radius: 0.375rem;
    box-shadow: 0 0 0 0.2rem rgba(94, 0, 9, 0.16);
}

.auth-form .input-group:focus-within .input-group-text {
    border-color: var(--msu-maroon);
    color: var(--msu-maroon);
}

.auth-form .input-group:focus-within .form-control {
    border-color: var(--msu-maroon);
}

.auth-submit {
    padding: 0.7rem 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Reveal button on the password field */
.pw-toggle {
    border: 1px solid #dee2e6;
    border-left: 0;
    background: var(--msu-surface);
    color: #8a8a8a;
}

.pw-toggle:hover {
    color: var(--msu-maroon);
}

/* "or" rule between the form and the secondary action */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #9aa0a6;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 1.75rem 0 1.25rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--msu-border);
}

@media (max-width: 991.98px) {
    .auth-wrap { padding: 1.5rem 0; }
    .auth-brand { padding: 2rem 1.75rem; }
    .auth-brand img { height: 44px; width: 44px; margin-bottom: 0.75rem; }
    .auth-brand .auth-tagline { margin-bottom: 0; }
    .auth-points { display: none; }
    .auth-form { padding: 2rem 1.75rem; }
}

/* ------------------------------------------------------------ busy buttons
   A submit button that is working keeps its colour rather than fading out
   like an ordinary disabled control, so the spinner stays readable.        */

.btn[aria-busy="true"] {
    cursor: progress;
    opacity: 0.9;
}

.btn[aria-busy="true"] .spinner-border {
    vertical-align: -0.125em;
}

/* ---------------------------------------------------------------- WYSIWYG */

.wysiwyg {
    min-height: 260px;
    background: #fff;
}

.wysiwyg .ql-editor {
    min-height: 260px;
    font-size: 0.95rem;
}

/* The raw-HTML view, hidden until the HTML toggle is pressed. */
.wysiwyg-source {
    display: none;
}

.ql-toolbar.ql-snow,
.ql-container.ql-snow {
    border-color: var(--msu-border);
}

.ql-snow .ql-stroke { stroke: #555; }
.ql-snow .ql-picker { color: #555; }

.ql-toolbar.ql-snow .ql-formats button:hover .ql-stroke,
.ql-toolbar.ql-snow .ql-formats button.ql-active .ql-stroke {
    stroke: var(--msu-maroon);
}

/* ------------------------------------------------------- slide to confirm
   Turning in is irreversible, so it takes a deliberate drag rather than a
   click that could land by accident.                                       */

.slide-confirm {
    user-select: none;
    touch-action: none;
}

.slide-track {
    position: relative;
    height: 58px;
    border-radius: 30px;
    background: var(--msu-surface);
    border: 1px solid var(--msu-border);
    overflow: hidden;
    display: flex;
    align-items: center;
}

.slide-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    background: linear-gradient(90deg, var(--msu-maroon), var(--msu-maroon-light));
    border-radius: 30px;
}

.slide-label {
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
    font-weight: 600;
    color: #6c757d;
    pointer-events: none;
    font-size: 0.95rem;
}

.slide-handle {
    position: absolute;
    left: 4px;
    z-index: 2;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 0;
    background: var(--msu-maroon);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.slide-confirm.dragging .slide-handle { cursor: grabbing; }

.slide-handle:focus-visible {
    outline: 3px solid var(--msu-gold);
    outline-offset: 2px;
}

.slide-confirm.confirmed .slide-track { border-color: var(--msu-maroon); }
.slide-confirm.confirmed .slide-label { color: #fff; }
.slide-confirm.confirmed .slide-handle { background: var(--msu-maroon-dark); cursor: default; }

.slide-confirm.disabled { opacity: 0.55; pointer-events: none; }

/* ------------------------------------------------------- active course pill
   The course every screen belongs to, kept in the menu bar so it is never
   ambiguous which one is being administrated or viewed.                     */

.nav-course {
    margin-left: 0.75rem;
    margin-right: auto;
}

.nav-course-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-course-pill:hover,
.nav-course-pill:focus {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.nav-course-code { font-weight: 600; }

.nav-course-term {
    color: rgba(255, 255, 255, 0.75);
    margin-left: 0.4rem;
    font-size: 0.82rem;
}

.nav-course .dropdown-item.active {
    background-color: var(--msu-maroon);
    color: #fff;
}

@media (max-width: 991.98px) {
    .nav-course { margin: 0.5rem 0; }
}

/* ------------------------------------------------------- course chooser */

.course-card {
    background: #fff;
    border: 1px solid var(--msu-border) !important;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
    border-color: var(--msu-maroon) !important;
}

.course-card-active {
    border-color: var(--msu-maroon) !important;
    box-shadow: 0 0 0 2px rgba(94, 0, 9, 0.18);
}

/* --------------------------------------------------------- grade comments */

.comment-block {
    border-left: 3px solid var(--msu-border);
    padding: 0.5rem 0 0.5rem 0.85rem;
    margin-bottom: 0.75rem;
}

.comment-block.from-grader    { border-left-color: #6c757d; }
.comment-block.from-professor { border-left-color: var(--msu-maroon); }

.comment-who {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: #6c757d;
}

.comment-block.from-professor .comment-who { color: var(--msu-maroon); }

.comment-text {
    font-size: 0.92rem;
    white-space: pre-wrap;
}

/* --------------------------------------------------------------- quizzes
   A quiz is taken elsewhere, so the right-hand side of the workspace holds
   the way in rather than an editor.                                        */

.quiz-surface {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1e1e;
    padding: 2rem;
}

.quiz-panel {
    text-align: center;
    max-width: 32rem;
    color: #e6e6e6;
}

.quiz-icon {
    font-size: 2.75rem;
    color: var(--msu-gold);
}

.quiz-panel h2 { color: #fff; }

/* ------------------------------------------------------------ sortable columns */

.sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.sort-link:hover { color: var(--msu-maroon); }

.sort-icon { opacity: 0.35; font-size: 0.8em; }

.sort-link:hover .sort-icon { opacity: 0.7; }

.sort-link.sort-active { color: var(--msu-maroon); font-weight: 700; }
.sort-link.sort-active .sort-icon { opacity: 1; }

/* ------------------------------------------------------- email tracking
   Green once we know the student opened the message or looked at the
   assignment; grey until then.                                            */

.track-on  { color: #1a7f37; font-size: 1.05rem; }
.track-off { color: #cfd4d8; font-size: 1.05rem; }
