/*=====ADD TO ALL PAGES=====*/

:root {
    --background-color: #8E7CC3;
    --nav-background-color: #361C74;
    --main-cream-color: #FFF3CC;
    --main-yellow-color: #FFD966;
    --text-color: black;
    --arrow-tint-initial: invert(96%) sepia(25%) saturate(600%) hue-rotate(215deg) brightness(1500%) contrast(150%);
    --arrow-tint-hover: invert(96%) sepia(25%) saturate(400%) hue-rotate(215deg) brightness(1600%) contrast(150%);
}

[data-theme="dark"] {
    --background-color: #232323;
    --nav-background-color: #151515;
    --main-cream-color: #545454;
    --main-yellow-color: #838383;
    --text-color: white;
    --arrow-tint-initial: invert(86%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(85%);
    --arrow-tint-hover: invert(86%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(125%) contrast(85%);
}

[data-theme="high-contrast"] {
    --background-color: #000000;
    --nav-background-color: #7600A8;
    --main-cream-color: #D26CFE;
    --main-yellow-color: #ffee00;
    --text-color: rgb(0, 0, 0);
    --arrow-tint-initial: invert(0%) brightness(1000%);
    --arrow-tint-hover: invert(96%) sepia(10%) saturate(300%) hue-rotate(255deg) brightness(1200%) contrast(1000%);
}

body {
    background-color: var(--background-color);
    margin: 0;
    font-family: arial;
}


/*^^^ADD TO ALL PAGES^^^*/


/* WRAPPER */

.wrapper {
    display: flex;
    justify-content: center;
    padding-top: 8rem;
    /* below fixed navbar */
    color: var(--text-color);
}


/* WEEK NAV (desktop only) */

#week-nav {
    display: flex;
    position: sticky;
    top: 15rem;
    width: 15rem;
    height: 30rem;
    margin-right: 1rem;
}

#week-nav ul {
    padding: 0;
    list-style-type: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

#week-nav li {
    display: flex;
    flex: 1;
    justify-content: center;
    background-color: var(--main-yellow-color);
    border-radius: 15px;
    margin-bottom: 1rem;
    /*padding: 1.5rem 1rem;*/
    font-size: xx-large;
    font-weight: 700;
    text-align: center;
}

#week-nav a {
    width: 15rem;
    height: 6rem;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* MAIN SCHEDULE */

main {
    background-color: var(--main-cream-color);
    border-radius: 50px;
    padding: 2rem;
    width: 30rem;
    min-width: 300px;
    height: auto;
    margin-right: 5vw;
    margin-bottom: 4rem;
    margin-top: 0;
    position: relative;
}

form {
    position: relative;
    background-color: var(--nav-background-color);
    padding: 0 0 10em 0;
    border-radius: 20px;
    height: 22rem;
    /*margin-bottom: 2rem;*/
}

.class-name {
    height: 3.5rem;
    border-radius: 20px 20px 0 0;
    text-align: center;
    width: 100%;
    font-size: xx-large;
}


/* Location warning styling */

.location-wrapper {
    position: relative;
    width: 90%;
    margin: 0 5%;
}

.location-warning {
    border: 3px solid #ff9800 !important;
}

.location-warning:focus {
    border-color: #ff6f00 !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 152, 0, 0.3) !important;
}

.location-warning-message {
    background-color: #ff9800;
    color: white;
    padding: 0.5rem 0.3rem;
    margin: 0.5rem auto;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    max-width: 80%;
}

.prof-name {
    background-color: var(--nav-background-color);
    color: white;
    border: none;
    padding-left: 5%;
    margin: 5%;
    width: 90%;
    font-size: xx-large;
}

.location {
    background-color: var(--nav-background-color);
    color: white;
    border: none;
    padding-left: 5%;
    margin: 5%;
    width: 90%;
    font-size: xx-large;
}

form .time {
    margin: 3%;
    font-size: x-large;
    background-color: var(--nav-background-color);
    color: white;
}

main ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.delete-class {
    position: absolute;
    width: 2rem;
    height: 2rem;
    padding: 0;
    bottom: 0.5rem;
    right: 0.5rem;
    border-radius: 50px;
    font-weight: bolder;
    display: flex;
    justify-content: center;
    align-items: center;
}

#clear-classes {
    position: absolute;
    padding: 0;
    width: 25%;
    font-size: large;
    bottom: 1rem;
}


/* Travel mode and duration between individual classes */

#output-time {
    line-height: normal;
}

.mode-duration {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: var(--main-yellow-color);
    width: 8rem;
    height: 5rem;
    padding: 0.75rem;
    font-size: xx-large;
    font-weight: bold;
    border-radius: 10px;
    margin-top: 3rem;
    color: var(--text-color);
    border: none;
}

.mode-option {
    text-align: left;
    color: var(--text-color);
}

.mode-duration-wrapper {
    display: flex;
    justify-content: center;
}

#qr-code-btn {
    position: fixed;
    bottom: 2rem;
    right: 5rem;
    width: 4rem;
    height: 4rem;
    font-size: 1.5rem;
    z-index: 1000;
    background-color: var(--nav-background-color);
    border-color: var(--nav-background-color);
    transform: translateX(-50%);
    z-index: 999;
    transition: all 0.1s ease-in-out;
}

#qr-code-btn:hover {
    transform: translateX(-50%) scale(1.1);
}

#class-list img {
    width: 30%;
    height: 11rem;
    margin: 0.25rem 0 0.25rem 0;
    transition: filter 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    filter: var(--arrow-tint-initial);
}

#class-list img:hover {
    transform: scale(1.03);
    filter: var(--arrow-tint-hover);
}


/* MAP */

#map-background {
    position: sticky;
    top: 8rem;
    background-color: var(--main-cream-color);
    border-radius: 15px;
    padding: 1rem;
    width: 30rem;
    min-width: 20rem;
    height: 45rem;
}

#map {
    border: 1px dashed black;
    height: 90%;
}

#map-totals {
    margin: 1rem;
    display: flex;
    justify-content: space-evenly;
}

#route-time,
#route-dist {
    background-color: var(--main-yellow-color);
    padding: 0.75rem;
    font-size: 1.25rem;
    border-radius: 10px;
    width: 50%;
    text-align: center;
}

#route-time {
    margin-left: 0;
    margin-right: 0.5rem;
}

#route-dist {
    margin-right: 0;
    margin-left: 0.5rem;
}

#add-class {
    width: 60px;
    height: 60px;
    font-size: 24px;
    background-color: var(--nav-background-color);
    border-color: var(--nav-background-color);
    position: fixed;
    bottom: 30px;
    left: 57%;
    transform: translateX(-50%);
    z-index: 999;
    transition: all 0.1s ease-in-out;
}

#add-class:hover {
    transform: translateX(-50%) scale(1.1);
}


/* MODAL STYLING */

.modal-content {
    background-color: var(--main-cream-color);
    color: var(--text-color);
    border-radius: 15px;
}

.modal-header {
    background-color: var(--nav-background-color);
    color: white;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    background-color: var(--main-cream-color);
}

.modal-footer {
    background-color: var(--main-cream-color);
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    justify-content: center;
}


/* Modal choice buttons - solid and centered */

.modal-body .btn-outline-primary {
    background-color: var(--nav-background-color);
    border-color: var(--nav-background-color);
    color: white;
}

.modal-body .btn-outline-primary:hover {
    background-color: var(--main-yellow-color);
    border-color: var(--main-yellow-color);
    color: var(--text-color);
}


/* Center the button container */

.modal-body .d-grid {
    max-width: 400px;
    margin: 0 auto;
}


/* Footer buttons */

.modal-footer .btn-primary {
    background-color: var(--nav-background-color);
    border-color: var(--nav-background-color);
    color: white;
}

.modal-footer .btn-success {
    background-color: var(--main-yellow-color);
    border-color: var(--main-yellow-color);
    color: var(--text-color);
}

.modal-footer .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

#addClassModal .modal-body,
#manualInputModal .modal-footer {
    display: flex;
    justify-content: center !important;
}


/* Form inputs */

.modal .form-control {
    background-color: white;
    border: 2px solid var(--nav-background-color);
    color: var(--text-color);
}

.modal .form-control:focus {
    border-color: var(--main-yellow-color);
    box-shadow: 0 0 0 0.2rem rgba(142, 124, 195, 0.25);
}

.modal .form-label {
    color: var(--text-color);
    font-weight: bold;
}


/* PHONES + TABLETS (≤ 991.98px) */

@media (max-width: 991.98px) {
    .wrapper {
        display: flex;
        flex-direction: column;
        /* stack: dropdown, main, map */
        align-items: center;
        gap: 0.75rem;
    }

    /* Desktop week buttons off on these sizes */
    #week-nav {
        display: none !important;
    }

    #main-nav .navbar-collapse.show {
        position: relative;
        z-index: 5000;
        /* higher than .skip-link (3001) */
    }

    /* Weekdays dropdown block above main */
    #weekdays-mobile {
        /* changed to make width slimmer */
        width: min(35rem, 70vw);
        padding: 0 1rem;
        box-sizing: border-box;
        order: 0;
    }

    #weekdays-mobile .dropdown {
        width: 100%;
        margin: 0 auto;
    }

    /* Center Add-Class button horizontally on small screens */
    #add-class {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
    }

    #add-class {
    border: 4px solid var(--main-yellow-color);
    }

    [data-theme="dark"] #add-class {
        border-color: var(--main-yellow-color);
    }

    [data-theme="high-contrast"] #add-class {
        border-color: var(--main-yellow-color);
    }

    /* Main + map centered and stacked */
    main {
        margin: 0 1rem 1rem 1rem;
        /* changed to make width slimmer */
        width: min(35rem, 70vw);
        min-width: 25rem;
        order: 1;
    }

    #map-background {
        position: static;
        width: min(46rem, 92vw);
        order: 2;
    }

    #qr-container {
        display: flex !important;
        /* Force it to show for testing */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.9);
        z-index: 1001;
        justify-content: center;
        align-items: center;
        flex-direction: column;
    }

    #qr-container h1 {
        color: white;
        margin-bottom: 2rem;
    }

    #qr-container img {
        max-width: 80vmin;
        max-height: 80vmin;
    }

    /* hide the qr button on phones */
    #qr-code-btn {
        display: none;
    }

    .skip-link.skip-to-map {
        display: inline-block;
        position: fixed;
        top: 8rem;
        /* stays fully below the fixed navbar */
        left: 0.5rem;
        transform: none;
        width: auto;
        max-width: 92vw;
        z-index: 3001;
        /* below nav dropdown (rule below) */
    }

    /* Keep it left-aligned when focused/clicked */
    .skip-link.skip-to-map:focus,
    .skip-link.skip-to-map:active,
    .skip-link.skip-to-map:focus-visible {
        left: 0.5rem;
        transform: none;
    }
}

#weekdays-mobile .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    /* ~2.5x normal button height */
    min-height: 110px;
    /* scale the text with viewport but clamp it */
    font-size: clamp(2.25rem, 5vw, 5rem);
}

#weekdays-mobile .dropdown-menu .dropdown-item {
    text-align: center;
}


/* Active day highlight (desktop + mobile) */


/* Outline color that matches each theme */

:root {
    /* blend nav purple with button yellow */
    --active-day-outline: var(--nav-background-color);
    /* TODO: kinda ugly (default theme) */
}

[data-theme="dark"] {
    /* brighten on dark */
    --active-day-outline: color-mix(in srgb, var(--main-yellow-color) 70%, white 30%);
}

[data-theme="high-contrast"] {
    /* use the theme's purple so it stands out on the magenta/yellow surface */
    --active-day-outline: var(--nav-background-color);
}


/* Desktop sidebar buttons */

#week-nav li.is-active {
    transform: scale(1.08);
    transform-origin: center center;
    outline: 4px solid var(--active-day-outline);
    outline-offset: 2px;
    /* keeps alignment; outline doesn't affect layout */
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .08) inset, 0 10px 18px rgba(0, 0, 0, .14);
}

#week-nav li:hover {
    transform: scale(1.05);
    transform-origin: center center;
    background-color: color-mix(in srgb, var(--main-yellow-color) 90%, rgb(0, 0, 0));
}


/* Mobile/Tablet dropdown item */

#weekdays-mobile .dropdown-menu .dropdown-item.active,
#weekdays-mobile .dropdown-menu .dropdown-item[aria-current="true"] {
    font-weight: 800;
    background-color: var(--main-yellow-color);
    color: var(--text-color);
    box-shadow: inset 0 0 0 3px var(--active-day-outline);
    border-radius: 12px;
}


/* Skip links */

.skip-links {
    position: relative;
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: -9999px;
    background: var(--main-cream-color);
    color: var(--text-color);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 2px solid var(--nav-background-color);
    z-index: 3001;
    /* above fixed navbar */
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
}

.skip-link:focus {
    left: 0.5rem;
}


/* Only show "Skip to map" on tablet/phone */

.skip-link.skip-to-map {
    display: none;
}

@media (max-width: 991.98px) {
    .skip-link.skip-to-map {
        display: inline-block;
    }
}


/* Visually hidden utility */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
