/************************************************************
 * Site-specific styling choices
 */
 
/* Define custom CSS variable for the purple color */
:root {
    --bs-corpus-stmark-color: #093154;
    --bs-body-color: var(--bs-dark-text-emphasis);
}

[data-bs-theme="dark"] {
    --bs-link-hover-color-rgb: 90,170,255;
    --bs-link-color-rgb: 90,170,255;
}

html {
    font-size: 14px;
}

/* Global elements - this will prevent a dark theme from showing black background color */
body {
    background: url(https://devregistrar.corpuschristi.ca/static/img/fancy_deboss.png?b6d60745823e);
    scroll-padding-top: 70px;
}

html[data-bs-theme="dark"]>body {
    background: rgba(20,20,20,1);
}

.bg-cccsmc {
    background-color: var(--bs-corpus-stmark-color);
}

/* Dynamic background */
.my-bg {
    --bs-bg-opacity: 1;
    background-color: rgba(var(--bs-light-rgb),var(--bs-bg-opacity));
}

html[data-bs-theme="dark"] {
    .my-bg {
        --bs-bg-opacity: 0.9;
        background-color: rgba(var(--bs-dark-rgb),var(--bs-bg-opacity));
    }
}

.text-my-bg {
    color: var(--bs-dark);
}


html[data-bs-theme="dark"] {
    .text-my-bg {
        color: var(--bs-light);
    }
}

/* Ensure your navbar is fixed */
.navbar.fixed-top {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1030;
    /* Bootstrap's default z-index for fixed navbars */
}

h2 {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    /* NO underline by default */
}


.brand, h1, h2, h3, h4, h5, h6 {
    font-family: futura-pt, sans-serif;
}

/* Comment modal dialog */
.blockquote {
    border-radius: 25px 5px;
}

.blockquote-footer {
    font-size: 0.95rem;
}

.model-title {
    font-weight: bold;
}

#comments-modal-button {
    position: fixed;
    bottom: 0rem;
    right: 0.5rem;
    z-index: 1050;
}

#comments-modal-button.flash {
    animation: flash 1s ease-in-out;
}

/* Footer style */
footer {
    opacity: 0.7;
}

footer small a:hover {
    text-decoration: underline;
    /* Show underline on hover */
    color: var(--bs-link-color);
    /* You can also make it Bootstrap's default blue link color on hover for emphasis, or keep it muted with var(--bs-body-secondary) */
}

/* Custom CSS for Bootstrap 5 dl-horizontal equivalent */
/* Apply base styles for dt and dd globally or within your .dl-horizontal-custom container */
dt,
dd {
    line-height: 1.2;
    /* Equivalent to Bootstrap's default line-height for body text */
}

dt {
    font-weight: bold;
}

/* For small screens and below, dt and dd will stack by default due to flex-wrap on .row */
/* On medium screens and up (md breakpoint: 768px), apply horizontal layout */
@media (min-width: 768px) {

    /* Adjust 'md' breakpoint if needed, or use sm, lg, etc. */
    .dl-horizontal-custom dt {
        float: left;
        /* Keep float for now for consistency, but flexbox is preferred */
        width: 180px;
        /* Fixed width for the term */
        overflow: hidden;
        clear: left;
        text-align: right;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dl-horizontal-custom dd {
        margin-left: 200px;
        /* Adjust based on dt width + desired gap */
    }

    .dl-horizontal-custom dt:hover {
        min-width: 180px;
        width: auto;
        margin-right: 20px;
        white-space: normal;
    }
}

/* Polaroid effect from Bootstrap v2 */
.img-polaroid {
    padding: 4px;
    background-color: #fff;
    border: 1px solid #ccc;
    border: 1px solid rgba(0, 0, 0, 0.2);
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Navbar */
.navbar-brand {
    font-family: futura-pt, sans-serif;
    font-size: 1.75rem;
    padding: 0px;
    color: #ddd;
}

.navbar-brand strong {
    font-weight: bold;
    color: #fff;
}

/* sidebar */

/* This will apply to devices with a fine pointer (like a mouse) and hover capability */
.nav-pills .nav-link {
    padding-top: 0.5rem;
    /* Smaller top padding */
    padding-bottom: 0.5rem;
    /* Smaller bottom padding */
    line-height: 1.0;
}

/* Styles for touch devices (coarse pointer, often no hover) */
@media (pointer: coarse) and (hover: none) {
    .nav-pills .nav-link {
        padding-top: 1rem;
        /* Taller top padding for easier tapping */
        padding-bottom: 1rem;
        /* Taller bottom padding for easier tapping */
        line-height: 1.5;
        /* Default Bootstrap line-height */
    }
}

/* Alternatively, for any device with a coarse pointer (even if it has some hover like a trackpad) */
@media (pointer: coarse) {
    .nav-pills .nav-link {
        padding-top: 1rem;
        padding-bottom: 1rem;
        line-height: 1.5;
        /* Default Bootstrap line-height */
    }
}

/* For hover state of non-active pills */
.nav-pills .nav-item .nav-link.active:hover {
    color: var(--bs-nav-link-color);
}

.nav-pills .nav-item .nav-link:hover {
    background-color: var(--bs-gray-400);
    color: var(--bs-gray-700);
}

.sidebar-heading {
    font-size: 0.85rem;
    /* Smaller font size */
    font-weight: 700;
    /* Bold */
}

/* Forms */

.fld-req>.col-form-label {
    font-weight: bold;
    font-size: 0.95rem;
    &::after {
        content: " *";
        color: var(--bs-danger);
        font-weight: normal; 
    }
}

/*
 * This selector targets a label that is part of a
 * .row container which also contains a required input.
 */
.row:has(input[required]) label.form-label,
.row:has(.survey_question.required)>.col-form-label {
    font-weight: bold;
    font-size: 0.95rem;
}

/*
  * Use an ::after pseudo-element to add the asterisk.
  */
.row:has(input[required]) label.form-label::after,
.row:has(.survey_question.required)>.col-form-label::after {
    content: " *";
    color: var(--bs-danger);
}

.col-form-label {
    display: block !important;
}

/* For SelectDateWidget */
select.form-select-date,
select.form-select-time {
    /* Custom class for specific styling */
    width: auto;
    margin-left: 5px;
}

select:first-child.form-select-date,
select:first-child.form-select-time {
    margin-left: 0;
}

/* Set form controls theme */
.form-select,
.form-control {
    background-color: rgba(var(--bs-tertiary-bg-rgb, 1));
}

/* Set dropdown theme */
.dropdown-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 1);
    color: white;
}

.bi-check-circle-fill {
    color: var(--bs-success);
}

/* Set the "pressed" btn color */
.btn.btn-light.active {
    background-color: rgba(var(--bs-primary-rgb), 1);
    color: white;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    background-image: none;
}

/**** ========= ****/
.form-text {
    padding-left: 2px;
    --bs-bg-opacity: 1;
    color: rgba(var(--bs-secondary-color-rgb), var(--bs-bg-opacity));
}

.invalid-feedback {
    padding-left: 2px;
    display: inline-block;
}

/* For datepicker */
.input-group-text {
    cursor: pointer;
}

/* Gallery page */
.gallery-avatar {
    margin: 0 10px 10px 0;
    display: inline-block;
}

/* Weekday schedule */
.weekday-schedule {
    width: 100%;
}

.weekday-schedule th {
    width: 14%;
}

.weekday-schedule td {
    height: 396px;
    background-image: url(https://devregistrar.corpuschristi.ca/static/img/12px-horizontal-grid.png?b6d60745823e);
    background-position: 4px 7px;
}

html[data-bs-theme="dark"] {
    .weekday-schedule td {
        background-image: url(https://devregistrar.corpuschristi.ca/static/img/12px-horizontal-grid-dark.png?b6d60745823e);
    }
}

.weekday-schedule td>div {
    position: relative;
}

.weekday-schedule td>div>* {
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    min-height: 11px;
    opacity: 0.8;
    text-overflow: ellipsis;
    overflow: hidden;
}

.weekday-schedule td>div>*:hover {
    opacity: 1;
    z-index: 100;
}

/* Money */
.money,
.money a {
    font-family: monospace;
    white-space: nowrap;
}

td.money,
th.money {
    text-align: right;
}

/* Custom input field styles */
textarea#id_source,
textarea#id_variables {
    background: #000;
    color: #fff;
    font-family: monospace;
    font-size: 12px;
    white-space: normal;
    word-wrap: normal;
}

/* Choose File button style */
[data-bs-theme="dark"] {
    input[type="file"]::file-selector-button {
        background-color: rgba(var(--bs-primary-rgb), 1);
        color: white;
    }
}

/* Avatars */
.avatar {
    border-radius: 3px;
    /* Replaces .border-radius(3px) */
    max-width: 500px;
}

/* Consider using Bootstrap's background and border utilities with custom colors if these are semantic states. */
.avatar.avatar-alumni {
    border-color: #468847;
    background: hsl(121, 44%, 73%);
}

/* Lighten color */
.avatar.avatar-student {
    border-color: #468847;
    background: hsl(121, 44%, 73%);
}

.avatar.avatar-faculty {
    border-color: #3A87AD;
    background: hsl(200, 52%, 79%);
}

.avatar.avatar-staff {
    border-color: #F89406;
    background: hsl(34, 93%, 82%);
}

.avatar.avatar-superuser {
    border-color: #000;
    background: #444;
}

.btn .avatar {
    margin: 0 2px 2px 0;
}

/* Miscellaneous changes */

/* .table-striped in Bootstrap 5 already has a background. If you need specific cell styling, apply directly. */
.table thead th {
    white-space: nowrap;
}

search_form select {
    width: auto;
}

/************************************************************
 * Bootstrap fixes with explanations
 */

/* Definition lists sometimes have too much margin at the bottom */
/* Check Bootstrap 5's default dl styles; this might be resolved. */
dl>dd:last-child>*:last-child {
    margin-bottom: 0;
}

/* Excess margin from the first and last child of table cells, wells, and alerts should be removed. */
/* Bootstrap 5 uses utility classes for spacing. You might apply .mt-0 and .mb-0 directly to elements. */
td>*:first-child,
.card>*:first-child,
.alert>*:first-child {
    margin-top: 0;
}

/* .well is now .card */
td>*:last-child,
.card>*:last-child,
.alert>*:last-child {
    margin-bottom: 0;
}

/* Dropdown menu active selection should be white, not #333 */
.dropdown-item.active,
.dropdown-item:active {
    /* Correct Bootstrap 5 active class for dropdown items */
    color: #fff;
}

/* Tooltips should retain their font even when attached to other items. */
/* Bootstrap 5 tooltips have improved styling and use CSS variables. */
.tooltip {
    font-size: 11px !important;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    font-weight: normal !important;
    line-height: 15px !important;
    white-space: normal !important;
}

/* As per http://stackoverflow.com/questions/12366923/bootstrap-button-dropdown-in-tab-pane-causing-overflow */
.tab-content {
    overflow: visible;
}

/* btn-toolbars at the bottom of alerts need more margins */
/* Use Bootstrap 5 spacing utilities like .mb-1 (for 4px) or .mb-2 (for 8px). */
.alert .btn-toolbar {
    margin-bottom: 4px;
}

/************************************************************
 * Uncategorized changes
 */

.alert h4 {
    margin: 10px 0;
}

/* When removing excess margin, tooltipped items shouldn't count as the last child */
/* TODO: Generalize this CSS to all classes, but note that :not() syntax might not play nicely with :last-child */
td>.progress {
    margin-bottom: 0;
}

.order-by {
    margin-left: 5px;
}

.order-by .btn-sm {
    /* .btn-sm is now .btn-sm */
    padding: 1px 6px;
    line-height: 16px;
}

/* For messages in the top bar */
#messages .alert {
    margin-bottom: 5px;
}

#messages .alert:last-child {
    margin-bottom: 20px;
}

#comment-form textarea {
    /* box-sizing is generally global */
    box-sizing: border-box;
    width: 100%;
}

/* autocomplete.js */
.autoComplete_wrapper {
    /* display: inline-block; */
    position: relative;
}

.autoComplete_wrapper>input::placeholder {
    transition: all 0.3s ease;
}

.autoComplete_wrapper>ul {
    position: absolute;
    max-height: 500px;
    overflow-y: scroll;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0;
    margin: 0.5rem 0 0 0;
    border-radius: 0.6rem;
    color: var(--bs-light);
    background-color: var(--bs-dark);
    /* background-color: #fff; */
    box-shadow: 0 3px 6px rgba(149, 157, 165, 0.15);
    border: 1px solid rgba(33, 33, 33, 0.07);
    z-index: 1000;
    outline: none;
}

.autoComplete_wrapper>ul[hidden],
.autoComplete_wrapper>ul:empty {
    display: block;
    opacity: 0;
    transform: scale(0);
}

.autoComplete_wrapper>ul>li {
    margin: 0.3rem;
    padding: 0.3rem 0.5rem;
    list-style: none;
    text-align: left;
    font-size: 1rem;
    color: #212121;
    transition: all 0.1s ease-in-out;
    border-radius: 0.35rem;
    color: var(--bs-light);
    background-color: var(--bs-dark);
    /* background-color: rgba(255, 255, 255, 1); */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.autoComplete_wrapper>ul>li::selection {
    color: rgba(#ffffff, 0);
    background-color: rgba(#ffffff, 0);
}

.autoComplete_wrapper>ul>li:hover {
    cursor: pointer;
    background-color: var(--bs-gray-400);
    color: var(--bs-gray-700);
    /* background-color: rgba(123, 123, 123, 0.1); */
}

.autoComplete_wrapper>ul>li mark {
    background-color: transparent;
    color: var(--bs-success);
    font-weight: bold;
    padding: 0;
}

.autoComplete_wrapper>ul>li[aria-selected="true"] mark {
    color: var(--text-light);
}

.autoComplete_wrapper>ul>li mark::selection {
    color: rgba(#ffffff, 0);
    background-color: rgba(#ffffff, 0);
}

.input-group > .autoComplete_wrapper {
    flex: 1 1 auto;
    display: flex !important; /* Ensures the wrapper itself behaves like a flex container */
    width: 1%; /* Standard Bootstrap trick to ensure it expands correctly */
}

.autoComplete_wrapper > input {
    width: 100% !important;
}

@media only screen and (max-width: 600px) {
    .autoComplete_wrapper>input {
        width: 18rem;
    }
}

input[data-provide=typeahead] {
    background: #ffc;
}

html[data-bs-theme="dark"] {
    input[data-provide=typeahead] {
        --bs-bg-opacity: 0.1;
        background-color: rgba(var(--bs-secondary-color-rgb), var(--bs-bg-opacity));
    }
}

.markdown-readonly {
    display: inline-block;
    padding: 6px;
    padding-top: 6px;
    padding-bottom: 0px;
    vertical-align: middle;
    border-radius: 4px;
    margin-bottom: 0;
    margin-left: 0;
}

select[disabled] option {
    color: #333;
}

.bootstrap_form {
    width: 100%;
}

.dropdown-item,
.dropdown-menu {
    color: var(--bs-light);
    background-color: var(--bs-dark);
}

/* Configuration for bootstrap 5 off-canvas side bar with animation */
.sidebar-btn {
    position: fixed;
    // top: 6.8rem;
    // right: 1.2rem;
    top: 0.7rem;
    right: 5rem;
    z-index: 1050;
    /* higher than offcanvas backdrop */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(50, 163, 255, 0.15);
    /* semi-transparent black */
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    /* optional: adds a frosted glass effect */
    cursor: pointer;
}

.sidebar-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.menu-icon {
    width: 16px;
    height: 12px;
    position: relative;
}

.menu-icon span {
    position: absolute;
    height: 3px;
    width: 100%;
    background: white;
    left: 0;
    transition: all 0.3s ease;
}

.menu-icon span:nth-child(1) {
    top: 0;
}

.menu-icon span:nth-child(2) {
    top: 5px;
}

.menu-icon span:nth-child(3) {
    top: 10px;
}

.sidebar-btn.active .menu-icon span:nth-child(1) {
    transform: rotate(45deg);
    top: 5px;
}

.sidebar-btn.active .menu-icon span:nth-child(2) {
    opacity: 0;
}

.sidebar-btn.active .menu-icon span:nth-child(3) {
    transform: rotate(-45deg);
    top: 5px;
}

@keyframes flash {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    25% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }

    75% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.sidebar-btn.flash {
    animation: flash 1s ease-in-out;
}

/* Add some spacing when a button overflows into a second row */
.btn {
    margin-bottom: 0.5rem;
}

/* Add some spacing above h2 only if the section above has a toolbar */
.btn-toolbar+h2,
.btn-toolbar~div h2 {
    margin-top: 1.25rem;
}

.mode-menu {
    width: fit-content;
    min-width: 0px;
    li > a.active:after {
        content: ' \2713';
    }
}