/* UCR Course Catalog - Bootstrap-inspired styles */

/* === Base Reset & Typography === */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, "Noto Sans",
        sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* === Navbar === */
.navbar {
    background-color: #003da5;
    padding: 0.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.3125rem 0;
    margin-right: 1rem;
}

.navbar-brand:hover {
    color: #ffb81c;
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    flex-direction: row;
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    display: block;
    transition: color 0.15s ease-in-out;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
    color: #fff;
    text-decoration: none;
}

.navbar-nav .nav-link.active {
    color: #ffb81c;
}

.navbar-toggler {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.75);
    padding: 0.25rem 0.75rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 0.25rem;
}

.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

.navbar-collapse {
    display: flex;
    align-items: center;
}

@media (max-width: 767.98px) {
    .navbar-toggler {
        display: block;
    }
    .navbar-collapse {
        display: none;
        width: 100%;
        flex-basis: 100%;
    }
    .navbar-collapse.show {
        display: flex;
    }
    .navbar-nav {
        flex-direction: column;
        width: 100%;
    }
    .navbar-nav .nav-link {
        padding: 0.5rem 0;
    }
}

/* === Container === */
.container {
    width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 576px) {
    .container { max-width: 540px; }
}
@media (min-width: 768px) {
    .container { max-width: 720px; }
}
@media (min-width: 992px) {
    .container { max-width: 960px; }
}
@media (min-width: 1200px) {
    .container { max-width: 1140px; }
}

.main-content {
    flex: 1;
    padding: 1.5rem 0;
}

/* === Course title bar with year nav === */
.course-titlebar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.course-titlebar h1 {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
}

h1 { font-size: 2rem; color: #003da5; }
h2 {
    font-size: 1.5rem;
    color: #003da5;
    border-bottom: 2px solid #ffb81c;
    padding-bottom: 0.25rem;
    margin-top: 1.5rem;
}
h3 { font-size: 1.25rem; color: #003da5; }

p { margin-top: 0; margin-bottom: 1rem; }

a { color: #003da5; text-decoration: none; }
a:hover {
    color: #003184;
    text-decoration: underline;
}

strong, b { font-weight: 700; }

/* === Cards === */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.card-body {
    flex: 1 1 auto;
    padding: 1rem;
}

.card-body.course-details {
    padding: 0.5rem 1rem;
}

.card-body.course-details p {
    margin-bottom: 0.25rem;
}

.card-body.course-details p:last-child {
    margin-bottom: 0;
}

.card-title {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* === Page note === */
.pagenote {
    color: #6c757d;
    font-size: 0.85em;
}

/* === Disclaimer / Footer === */
.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
    margin-top: auto;
    font-size: 0.85em;
    color: #6c757d;
}

.footer a {
    color: #003da5;
}

/* === Requirements and content formatting === */
.subcontent {
    line-height: 1.6;
}

.subcontent p {
    margin: 10px 0;
}

.subcontent ul.reqlist {
    list-style: none;
    padding-left: 20px;
}

.subcontent ul.reqlist li {
    margin: 4px 0;
}

/* === Lists === */
ul { padding-left: 2rem; }
li { padding: 2px 0; }


/* === Search box === */
.searchbox {
    margin: 1.5rem 0;
}

.searchbox input {
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    width: 100%;
    max-width: 400px;
    border: 2px solid #003da5;
    border-radius: 0.25rem;
    color: #212529;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out;
}

.searchbox input:focus {
    outline: 0;
    border-color: #ffb81c;
    box-shadow: 0 0 0 0.25rem rgba(255, 184, 28, 0.25);
}

.results {
    margin: 10px 0;
}

.results a {
    display: block;
    padding: 4px 0;
    color: #003da5;
}

.results a:hover {
    color: #ffb81c;
}

/* === Section index items === */
.slist {
    margin: 1rem 0;
}

.sitem {
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid #003da5;
}

.sitem a {
    font-weight: 700;
    color: #003da5;
}

.sitem a:hover {
    color: #ffb81c;
}

.sitem .info {
    color: #6c757d;
    font-size: 0.85em;
}

/* === Derived information section === */
.derived {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background-color: #fafafa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}

.derived h2 {
    color: #6c757d;
    border-bottom-color: #dee2e6;
}

.derived a {
    display: inline-block;
    margin-right: 0.75rem;
}

/* === Subsections === */
.subsection {
    margin: 1.5rem 0;
}

.courselist {
    margin: 1.5rem 0;
}

.appearsin li {
    padding: 1px 0;
    font-size: 0.9em;
}

.appearsin ul {
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

/* === Buttons === */
.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out,
        background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #003da5;
    border-color: #003da5;
}

.btn-primary:hover {
    color: #fff;
    background-color: #00348c;
    border-color: #003184;
}

.btn-secondary {
    color: #000;
    background-color: #ffb81c;
    border-color: #ffb81c;
}

.btn-secondary:hover {
    color: #000;
    background-color: #ffc33e;
    border-color: #ffbf33;
}

/* === Section links on course pages === */
.sectionlinks a {
    display: inline-block;
    margin-right: 0.75rem;
}

/* === Course layout with enrollment sidebar === */
.course-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.course-main {
    flex: 1;
    min-width: 0;
}

.course-sidebar {
    flex: 0 0 310px;
    position: sticky;
    top: 1rem;
}

@media (max-width: 991.98px) {
    .course-layout {
        flex-direction: column;
    }
    .course-sidebar {
        flex: none;
        width: 100%;
        position: static;
    }
}

/* === Enrollment panel (collapsible) === */
.enrollment-panel {
    border: 1px solid #dee2e6;
    border-left: 4px solid #6c757d;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
}

.enrollment-panel summary {
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.95em;
    color: #495057;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.enrollment-panel summary::-webkit-details-marker {
    display: none;
}

.enrollment-panel summary::before {
    content: "\25b6";
    display: inline-block;
    margin-right: 0.4rem;
    font-size: 0.65em;
    transition: transform 0.15s ease;
}

.enrollment-panel[open] summary::before {
    transform: rotate(90deg);
}

.enrollment-panel summary:hover {
    color: #003da5;
}

.enrollment-source {
    font-weight: 400;
    font-size: 0.75em;
    color: #6c757d;
    display: block;
}

.enrollment-codes {
    padding: 0.25rem 0.75rem 0.4rem;
    font-size: 0.8em;
    color: #6c757d;
    font-style: italic;
    border-bottom: 1px solid #eee;
    margin-bottom: 0.25rem;
}

.enrollment-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8em;
    margin: 0;
    padding: 0 0.5rem 0.5rem;
}

.enrollment-table thead th {
    text-align: center;
    padding: 0.2rem 0.3rem;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
    font-weight: 500;
}

.enrollment-table thead th:first-child {
    text-align: left;
}

.enrollment-table tbody td {
    text-align: right;
    padding: 0.2rem 0.3rem;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    font-family: "SFMono-Regular", "Menlo",
        "Consolas", monospace;
    font-size: 0.85em;
}

.enrollment-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: #495057;
    font-family: inherit;
    font-size: 1em;
}

.enr-count {
    color: inherit;
}

.enr-cap {
    color: #adb5bd;
}

.enr-curr {
    color: #003da5;
    font-size: 0.85em;
    font-style: italic;
    text-decoration: none;
}

.enr-curr:hover {
    color: #ffb81c;
    text-decoration: underline;
}

.enrollment-table .col-summer {
    color: #6c757d;
}

.enrollment-table .col-summer .enr-cap {
    color: #adb5bd;
}

.enrollment-table .col-total {
    border-left: 1px solid #dee2e6;
}

.enrollment-table .col-total .enr-count {
    font-weight: 600;
    color: #212529;
}

.enrollment-table .col-total .enr-cap {
    color: #adb5bd;
}

.enrollment-table tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 991.98px) {
    .enrollment-panel summary {
        font-size: 1.05em;
        padding: 0.75rem 1rem;
    }
    .enrollment-source {
        display: inline;
    }
    .enrollment-table {
        font-size: 0.9em;
        max-width: 500px;
        padding: 0 1rem 1rem;
    }
    .enrollment-table thead th,
    .enrollment-table tbody td {
        padding: 0.3rem 0.75rem;
    }
}

/* === Prerequisite graphs === */
.graphcontainer {
    overflow-x: auto;
    padding: 1rem 0;
}

.coursegraph {
    display: block;
    max-width: 100%;
    height: auto;
}


/* === Year selector in navbar === */
.nav-yearselect {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    margin-left: 0.5rem;
}

.nav-yearselect:focus {
    outline: 0;
    border-color: #ffb81c;
}

.nav-yearselect option {
    background-color: #003da5;
    color: #fff;
}

/* === Navbar search === */
.nav-search {
    position: relative;
}

.nav-searchinput {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    font-family: inherit;
    width: 140px;
    margin-left: 0.5rem;
}

.nav-searchinput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.nav-searchinput:focus {
    outline: 0;
    border-color: #ffb81c;
    background-color: rgba(255, 255, 255, 0.25);
}

.nav-searchresults {
    position: absolute;
    top: 100%;
    left: 0.5rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    min-width: 250px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-searchresults a {
    display: block;
    padding: 4px 8px;
    color: #003da5;
    font-size: 0.85em;
    text-decoration: none;
}

.nav-searchresults a:hover {
    background-color: #f0f0f0;
}

/* === Derived information banner === */
.derived-banner {
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-left: 4px solid #ffb81c;
    border-radius: 0.25rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    color: #495057;
    font-size: 0.9em;
}

/* === Course year navigation table === */
.coursenav-table {
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.85em;
}

.coursenav-table td {
    padding: 0.1rem 0.25rem;
}

.coursenav-table .coursenav-prev {
    text-align: right;
    min-width: 5.5rem;
}

.coursenav-table .coursenav-center {
    text-align: center;
    min-width: 5rem;
}

.coursenav-table .coursenav-next {
    text-align: left;
    min-width: 5.5rem;
}

.coursenav-table .coursenav-center strong {
    color: #212529;
}

.coursenav-table a {
    color: #003da5;
    text-decoration: none;
}

.coursenav-table a:hover {
    color: #ffb81c;
    text-decoration: underline;
}

.coursenav-changes {
    font-size: 0.9em;
    color: #6c757d;
}

.coursenav-changes a {
    color: #6c757d;
}

.coursenav-changes a:hover {
    color: #ffb81c;
}

/* Show change links by default, hide edit links.
   html.strict class (set by #strict hash) reverses. */
.editlink {
    display: none;
}
html.strict .changelink {
    display: none;
}
html.strict .editlink {
    display: inline;
}

/* === Year navigation (sections/index pages) === */
.yearnav {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

.yearnav-prev, .yearnav-next {
    flex: 1;
}

.yearnav-prev {
    text-align: left;
}

.yearnav-next {
    text-align: right;
}

.yearnav strong {
    color: #212529;
    padding: 0 1rem;
}

.yearnav a {
    color: #003da5;
    text-decoration: none;
}

.yearnav a:hover {
    color: #ffb81c;
    text-decoration: underline;
}

.changetoggle {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.changetoggle:hover {
    color: #ffb81c;
}

.toggletext {
    display: inline-block;
    min-width: 9.5em;
    text-align: center;
}

.togglestrict {
    display: none;
}

html.strict .togglelax {
    display: none;
}

html.strict .togglestrict {
    display: inline-block;
}

.togglecaret {
    font-size: 0.7em;
    opacity: 0.5;
}

@media (max-width: 575.98px) {
    .course-titlebar {
        flex-direction: column;
    }
    .coursenav-table {
        align-self: flex-start;
    }
}
