:root {
    --highlight: #0f9657;
    --highlight-dark: #0b7343;
    --red: #e84550;
}

body {
    background: #0A1930;
    font-family: arial;
    color: white;
    margin: 0;
}

.main {
    justify-content: space-evenly;
    margin-top: 10vh;
    display: flex;
}

/* nav bar */

.navBar {
    justify-content: center;
    align-items: center;
    position: absolute;
    user-select: none;
    color: #172A46;
    display: flex;
    width: 100vw;
    height: 7em;
    left: 0;
    top: 0;
}

.btn, .redbtn {
    background: var(--highlight);
    border-radius: .3em;
    text-align: center;
    user-select: none;
    padding: .5em 1em;
    cursor: pointer;
    color: white;
    margin: 1em;
}

.redbtn {
    background: #e83a46;
}

.btn:hover {
    background: var(--highlight-dark);
}

.redbtn:hover {
    background: #e32734;
}

/* styling both columns */

.sectionTitle {
    border-bottom: 1px solid #DDD;
}

/* Semester styles */

.semester {
    padding: 1em 1em .2em 1em;
    box-sizing: border-box;
    background: #172A46;
    border-radius: .75em;
    margin: 1em 0;
    width: 100%;
}

.semester h2 {
    margin-top: .5em;
}

.availableSemesters {
    width: max(35vw, 500px);
    border-radius: .75em;
    overflow-y: scroll;
    max-height: 65vh;
}

.summer {
    background: transparent;
    outline: .25em dashed #172A46;
    outline-offset: -.25em;
}

.removeSummer {
    background: transparent;
    outline: .12em dashed var(--red);
}

.removeSummer:hover {
    background: transparent;
    color: var(--red);
}

.courses {
    width: max(31.8vw, 500px);
    box-sizing: border-box;
}

.availableCourses {
    border-radius: .75em;
    overflow-y: scroll;
    height: 100%;
}

.course:nth-child(even) {
    background: #EFEFEF;
}

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

.coursesPlaceHolder p {
    text-align: center;
    color: #CCC;
}

.totalCredits {
    margin-top: .5em;
}

.coursesInformation {
    justify-content: space-between;
    font-weight: bold;
    margin-top: 1em;
    display: flex;
    color: #CCC;
}

.addSummerBtn {
    justify-content: space-around;
    align-items: center;
    text-align: center;
    user-select: none;
    transition: .2s;
    cursor: pointer;
    display: flex;
    color: #CCC;
}

.addSummerBtn:hover {
    color: var(--highlight);
}

.addSummerBtn p {
    white-space: nowrap;
    margin: 0;
}

.addSummerBtn div {
    background: currentColor;
    margin: 0 1em;
    height: 2px;
    content: "";
    width: 100%;
}

/* Course form */

.formsAndCourses {
    border-radius: .75em;
    position: relative;
    overflow-y: scroll;
    margin-top: 0.5em;
    height: 63vh;
}

.formsAndCoursesMenu {
    justify-content: space-between;
    box-sizing: border-box;
    position: absolute;
    background: #000;
    font-size: 1.125em;
    text-wrap: nowrap;
    user-select: none;
    cursor: pointer;
    display: flex;
    width: 100%;
    z-index: 9;
    top: 0;
}

.formsAndCoursesBtns {
    background: #172A46;
    padding: .75em .5em;
    text-align: center;
    transition: 0.125s;
    height: 100%;
    opacity: .70;
    width: 100%;
}

.formsAndCoursesMenu>input {
    display: none;
}

.formsAndCoursesMenu>input:checked + .formsAndCoursesBtns {
    opacity: 1;
}

.formsAndCoursesBtns:hover:not(.formsAndCoursesMenu>input:checked + .formsAndCoursesBtns) {
    cursor: pointer;
    opacity: .85;
}

.formsAndCoursesSections {
    position: relative;
    height: 100%;
}

.formsAndCoursesSections > div {
    box-sizing: border-box;
    position: absolute;
    display: none;
    height: 100%;
    width: 100%;
    left: 0;
    top: 0;
}

.newCourseForm, .searchCourseForm {
    justify-content: space-between;
    flex-direction: column;
}

/* DISPLAYING PANES DEPENDING ON THE MENU BUTTON WHICH IS CURRENTLY SELECTED */
.formsAndCoursesMenu:has(#availableCoursesBtn:checked) ~ .formsAndCoursesSections>.availableCoursesWrapper { display: block; }
.formsAndCoursesMenu:has(#searchCourseBtn:checked) ~ .formsAndCoursesSections>.searchCourseForm { display: flex; }
.formsAndCoursesMenu:has(#addCourseBtn:checked) ~ .formsAndCoursesSections>.newCourseForm { display: flex; }

.courseFormSection {
    justify-content: space-evenly;
    display: flex;
}

.formItem {
    margin: 0 5em;
    width: 100%;
}

.formsAndCoursesSections > div {
    border-radius: 0 0 .75em .75em;
    padding: 4em 1em 1em 1em;
    background: #172A46;
}

.newCourseFormTitle, .courseListTitle {
    margin: 0 0 0 .3em;
    user-select: none;
    font-size: 1.5em;
    cursor: pointer;
    display: none;
}

.courseSearchTerm, .courseSearchYear {
    border: 1px solid #CCC;
    background: transparent;
    color: white;
    padding: .2em;
}

.newCourseFormContent {
    justify-content: center;
    flex-direction: column;
    font-size: 1.125em;
    display: flex;
    height: 100%;
}

p:has(+select) {
    margin-bottom: .5em;
    /* margin-bottom: 7.5px; */
}

.newCourseForm input[type="text"],
.searchCourseForm input[type="text"],
.newCourseForm input[type="number"] {
    all: unset;
    border-bottom: 1px solid #CCC;
    display: block;
    width: 100%;
}

::placeholder {
    color: #AAA;
  }

.newCourseForm input:focus, .searchCourseForm input:focus {
    border-bottom: 1px solid var(--highlight);
}

.courseSearchYear, .courseSearchTerm {
    font-size: inherit;
    width: 100%;
}

.addCourse, .searchCourse {
    margin-bottom: 1.5em;
    margin-top: 3em;
}

.saveFileSection {
    display: flex;
    margin: 1em;
    gap: 2em;
}

.saveFileSection .btn {
    width: 100%;
    margin: 0;
}

#loadSaveFileBtn {
    display: none;
}

/* Course search results popup */

.courseSearchResultsBackdrop {
    background: rgba(0, 0, 0, 0.6);
    position: fixed;
    transition: .4s;
    height: 100vh;
    width: 100vw;
    z-index: 12;
    left: 0;
    top: 0;
}

.courseSearchResultsBackdrop.hidden {
    pointer-events: none;
    opacity: 0;
}

.courseSearchResults {
    transform: translate(-50%, -50%);
    background: #0A1930;
    border-radius: .75em;
    position: absolute;
    padding: 2.5em 5em;
    left: 50%;
    top: 50%;
}

.courseSearchLoading {
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    display: flex;
    gap: .5em;
}

.courseSearchLoading .loader {
    font-size: .4em;
}

.exitCourseSearchResultsBtn {
    position: relative;
    left: -3em;
}

.courseSearchResultsTitle {
    font-weight: normal;
    margin: 1em 0 1em 0;
    font-size: 2.5em;
}

.exitCourseSearchResultsBtn>div {
    position: absolute;
    background: white;
    border-radius: 1em;
    cursor: pointer;
    height: .27em;
    width: 2em;
    left: 0;
    top: 0;
}

.exitCourseSearchResultsBtn>div:first-child {
    transform: rotate(45deg);
}

.exitCourseSearchResultsBtn>div:last-child {
    transform: rotate(-45deg);
}

.courseSearchResultsList {
    width: min(80vw, 900px);
    border-radius: .75em;
    overflow-y: scroll;
    margin: 0 0 3em 0;
    font-size: 1.2em;
    max-height: 50vh;
}

.courseSearchResultsListItem {
    justify-content: space-between;
    align-items: baseline;
    position: relative;
    white-space: pre;
    cursor: pointer;
    display: flex;
    padding: 1em;
}

.courseSearchResultsListItem>div {
    overflow: hidden;
}

.courseSearchResultsListItem:nth-child(odd) {
    background: #1B2A41;
}

.courseSearchResultsListItem:hover {
    background: #2C3B52;
}

.courseAlreadyAvailable {
    pointer-events: none;
    color: #777;
}

.courseAlreadyAvailable::after {
    transform: translateY(-50%);
    background: var(--highlight);
    content: "available";
    border-radius: 1em;
    position: absolute;
    padding: .125em .75em;
    color: white;
    right: 1em;
    top: 50%;
}

/* Course styles */

.courseWrapper {
    justify-content: space-evenly;
    border: 2px solid #061935;
    border-radius: .75em;
    cursor: grabbing;
    overflow: hidden;
    margin: .25em 0;
    display: flex;
}

.courseWrapper div {
    align-items: center;
    overflow: hidden;
    display: flex;
    padding: 1em;
}

.courseCode {
    flex: 2;
}

.courseName {
    justify-content: space-between;
    gap: 1em;
    flex: 7;
}

.courseCode, .courseCredits {
    background: #061935;
}

.courseCredits {
    justify-content: center;
    flex: 0.75;
}

.removeCourseFromSemester, .removeCourseFromList {
    justify-content: center;
    flex: 1.75;
}

.courseWrapper:has(div:nth-child(4):hover) {
    border-color: var(--red);
    cursor: pointer;
}

.crossed {
    cursor: not-allowed;
    opacity: .45;
}

/* styles for course that is being repeated */
.courseWrapper.repeated>.courseName::after {
    background: #0A1930;
    border-radius: .5em;
    content: "Repeated";
    padding: 1em .25em;
    font-size: .9em;
    margin: -.5em;
}

.summer .courseWrapper.repeated>.courseName::after {
    background: #172A46;
}

/* course list items for summer the courses list */
.summer .courseCode, .summer .courseCredits {
    background: #172A46;
}

.summer .courseWrapper {
    border-color: #172A46;
}

.courseWrapper:hover  {
    border: 2px dashed #CCC;
    padding: 0;
}


/* loading animation */
.loader {
    border: .5em solid #084e2e;
    border-top-color: var(--highlight);
    box-sizing: border-box;
    border-radius: 5em;
    height: .25em;
    padding: 1em;
    width: .25em;

    animation: spin .75s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* responsive media queries */
@media only screen and (max-width: 1200px) {
    .availableSemesters, .courses {
        width: 45vw;
    }
}

@media only screen and (max-width: 1145px) {
    body {
        font-size: .85em;
    }
}

@media only screen and (max-width: 990px) {
    body {
        font-size: .75em;
    }

    .main {
        justify-content: space-between;
        flex-direction: column;
        align-items: center;
        margin-top: 3em;
        height: 85vh;
    }

    .semester:first-child {
        margin-top: 0;
    }

    .availableSemesters {
        max-height: initial;
        overflow: scroll;
        margin-top: 1em;
    }

    .formsAndCoursesSections > div {
        padding: 3.5em 1em .5em 1em;
    }

    .courseFormSection:first-child p {
        margin-top: 0em;
    }

    .navBar {
        height: 4em;
    }

    .sectionTitle {
        display: none;
    }

    .saveFileSection {
        margin-bottom: 0;
    }

    .courseSearchResultsList {
        font-size: .95em;
    }

    .courseSearchResultsTitle {
        font-size: 2em;
        margin-top: 0;
    }

    .courseSearchResults {
        padding: 1em;
    }

    .courseSearchResultsList {
        width: 85vw;
    }

    .exitCourseSearchResultsBtn>div {
        font-size: .75em;
        left: initial;
        right: -4em;
        top: 1em;
    }

    .courses, .availableSemesters { 
        width: 95vw;
    }

    .semester {
        transition: opacity .3s;
        will-change: opacity;
    }

    .courses, .semesters {
        flex-direction: column;
        overflow: hidden;
        transition: .3s;
        display: flex;
        height: 100%;
    }

    .courseName {
        overflow: scroll;
    }

    .semester h2 {
        font-size: 1.125em;
    }

    .courses {
        height: 38vh;
        flex: 38vh 0 0;
    }

    .main:has(#searchCourseBtn:checked) .semesters,
    .main:has(#addCourseBtn:checked) .semesters {
        pointer-events: none;
        opacity: .3;
    }

    .courses:has(#searchCourseBtn:checked), .courses:has(#addCourseBtn:checked) { 
        flex: 60vh 0 0;
        height: 60vh;
    }
}

@media only screen and (max-width: 600px) {
    .newCourseFormTitle, .courseListTitle {
        font-size: 1.5em;
    }

    .courseSearchResultsList {
        font-size: .85em;
    }

    .courseSearchResultsTitle {
        font-size: 1.75em;
    }
}

@media only screen and (max-width: 460px) {
    .courseWrapper {
        font-size: .95em;
    }

    .newCourseFormTitle, .courseListTitle {
        font-size: 1.25em;
    }

    .formItem {
        margin: 0 2.5em;
    }

    .courseSearchResultsTitle {
        font-size: 1.5em;
    }
}

@media only screen and (max-width: 400px) {
    .courseWrapper {
        font-size: .7em;
    }

    .courseSearchResultsList {
        font-size: .7em;
    }

    .courseSearchResultsTitle {
        font-size: 1.2em;
    }
}
