/* 
 * MISC Lab Website - Main Stylesheet
 * University of Western Ontario
 */

/* ==========================================================================
   Theme variables and dark mode support
   ========================================================================== */
   :root {
    /* Light theme (default) */
    --background-color: #fff;
    --text-color: #000;
    --card-background: #fff;
    --card-shadow: rgba(79, 38, 131, 0.1);
    --card-shadow-hover: rgba(79, 38, 131, 0.2);
    --primary-color: #4F2683;
    --secondary-color: #e8e8e8;
    --border-color: #ddd;
}

[data-theme="dark"] {
    /* Dark theme */
    --background-color: #121212;
    --text-color: #f0f0f0;
    --card-background: #1e1e1e;
    --card-shadow: rgba(79, 38, 131, 0.3);
    --card-shadow-hover: rgba(79, 38, 131, 0.5);
    --primary-color: #9370DB; /* Light purple that goes well with the Western purple */
    --secondary-color: #333;
    --border-color: #444;
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 2px 5px var(--card-shadow);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px var(--card-shadow-hover);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
}

.moon-icon, .sun-icon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.5s ease;
}

[data-theme="dark"] .moon-icon {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .sun-icon {
    opacity: 1;
    transform: rotate(0);
}

[data-theme="light"] .moon-icon {
    opacity: 1;
    transform: rotate(0);
}

[data-theme="light"] .sun-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

/* ==========================================================================
   Base styles and reset
   ========================================================================== */
* {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -ms-box-sizing: border-box;
}

body {
    font-family: "Lato", sans-serif;
    font-weight: 400;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==========================================================================
   Typography
   ========================================================================== */
@font-face {
    font-family: "Lato";
    src: url("/css/Lato regular.ttf");
    src: local("Lato regular.ttf") format("truetype");
}

@font-face {
    font-family: "Lato";
    font-weight: 300;
    src: url("/css/Lato 300.ttf");
    src: local("Lato 300.ttf") format("truetype");
}

.lato-med {
    font-weight: 300;
}

.text-thin {
    font-weight: 300;
}

/* Section headers */
h3.description {
    text-align: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Make sure all headings follow the theme */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
}

/* Ensure inline-styled headings follow theme colors */
h5[style*="color:#000"] {
    color: var(--text-color) !important;
}

/* For headings with inline elements like badges */
h3.description.d-inline-block {
    display: inline-block;
    text-align: center;
}

/* Badge alignment within headings */
h3.description .label {
    position: relative;
    top: -3px;
}

/* ==========================================================================
   Layout and grid
   ========================================================================== */
.row {
    text-align: justify;
}

.app {
    display: flex;
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
}

.display {
    display: inline-flex;
}

.social-justify {
    justify-content: center;
}

.item {
    align-items: center;
}

/* ==========================================================================
   Spacing utilities
   ========================================================================== */
.space {
    margin-bottom: 7px;
}

.margin-extend {
    margin-bottom: 10px;
}

.margin-pull {
    margin-top: -4px;
}

.margin-pull-min {
    margin-top: -1px;
}

.margin-pull-max {
    margin-top: -8px;
}

.margin-push-micro {
    margin-top: 11px;
}

.margin-push-min {
    margin-top: 12px;
}

.margin-push {
    margin-top: 15px;
}

.margin-push-max {
    margin-top: 16px;
}

.margin-push-max1 {
    margin-top: 30px;
}

.margin-push-super {
    margin-top: 35px;
}

.margin-push-ultimate {
    margin-top: 5em;
}

.margin-push-banner {
    margin-top: 4.5vw;
}

.margin-push-thumbs {
    margin-top: 4em;
}

.margin-push-thumbs-10 {
    margin-top: 10em;
}

.margin-set {
    margin-top: -5px;
    margin-bottom: -5px;
}

.margin-end {
    margin-bottom: 15px;
}

.logo-v-margin-set {
    margin-top: 1px;
}

.logo-h-margin-set {
    margin-right: 12px;
}

.title-padding {
    padding-top: 10px;
    padding-right: 10px;
    padding-left: 10px;
}

/* ==========================================================================
   Image sizing and cropping
   ========================================================================== */
.banner {
    height: 300px;
}

.img-insert {
    width: 300px;
    height: 350px;
    object-fit: contain;
}

.crop-logo {
    position: relative;
    width: 10em;
    height: 10em;
}

.crop-logo-misc {
    position: relative;
    height: 20em;
}

.crop-bio {
    position: relative;
    width: 30px;
    height: 30px;
}

.crop-social {
    position: relative;
    width: 17px;
    height: 17px;
}

.crop-mail {
    position: relative;
    width: 20px;
    height: 20px;
}

.nav-crop {
    position: relative;
    width: 15px;
    height: 15px;
}

/* Handle SVG icons in dark mode */
[data-theme="dark"] .crop-social,
[data-theme="dark"] .crop-mail,
[data-theme="dark"] .nav-crop {
    filter: invert(1) brightness(1.5);
    transition: filter 0.3s ease;
}

/* Ensure smooth transition for images when switching themes */
.crop-social,
.crop-mail,
.nav-crop {
    transition: filter 0.3s ease;
}

/* ==========================================================================
   Interactive elements
   ========================================================================== */
/* Links and hover effects */
.txt:hover {
    padding: 0 0 5px 0;
    cursor: pointer;
    border-bottom: var(--primary-color) solid 1px;
}

.link:hover {
    padding: 0 0 1px 0;
    border-bottom: var(--primary-color) solid 1px;
}

.link {
    text-decoration: none;
    color: var(--primary-color);
}

/* Labels and badges */
.label-as-badge {
    border-radius: 1em;
}

#result.label-danger {
    background-color: var(--primary-color) !important;
}

/* ==========================================================================
   Scrollable content
   ========================================================================== */
.scrollable {
    height: 210px;
    padding-right: 12px;
    padding-left: 12px;
    overflow: auto;
}

.scrollable::-webkit-scrollbar {
    width: 0.3em;
}

.scrollable::-webkit-scrollbar-thumb {
    background-color: transparent;
}

#updates:hover::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
}

.kinetic {
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    display: block;
    padding: 1em;
    margin: 1em;
    background-color: var(--card-background);
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--card-shadow);
    height: 180px;
    transition: all 0.3s ease-in-out;
    text-align: left;
    align-content: center;
    overflow: auto;
}

.card:hover {
    box-shadow: 0 6px 12px var(--card-shadow-hover);
}

/* ==========================================================================
   Components
   ========================================================================== */
/* Progress bar */
.progress {
    background: linear-gradient(to right, var(--primary-color) var(--scroll), transparent 0);
    background-repeat: no-repeat;
    position: fixed;
    width: 100%;
    height: 4px;
    z-index: 1;
    box-sizing: content-box;
    overflow: hidden;
}

/* Scrollable content and scrollbars */
.scrollable::-webkit-scrollbar-thumb {
    background-color: transparent;
}

#updates:hover::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
}

/* Horizontal rule styling */
hr {
    border-top: 1px solid var(--border-color);
}

/* Style links consistently with theme */
a[style*="color:#000"] {
    color: var(--text-color) !important;
}

a[style*="color:#4F2683"] {
    color: var(--primary-color) !important;
}

/* Footer */
#credit {
    text-align: center;
}

/* ==========================================================================
   Media Queries
   ========================================================================== */
@media only screen and (max-width: 990px) {
    .nav-container .row {
        margin-bottom: 15px;
    }
    
    .nav-container h4 {
        font-size: 16px; /* Slightly smaller text on mobile */
        margin-top: 5px;
        margin-bottom: 5px;
    }
    
    .description {
        text-align: center;
    }
}

@media only screen and (min-width: 991px) {
    /* On larger screens (desktop), display as one row of six items */
    .nav-container {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        width: 100%;
    }
    
    .nav-container .row {
        display: contents; /* This removes the row containers from the layout flow */
    }
    
    .nav-container .col-md-4 {
        flex: 0 0 16.66%; /* Make each column take up approximately 1/6 of the width */
        width: 16.66%;
        float: none;
        display: inline-flex;
        justify-content: center;
    }

    .desktop {
        display: flex;
        display: -webkit-box;
        display: -moz-box;
        display: -ms-flexbox;
        display: -webkit-flex;
    }

    .margin-pull-mobile {
        margin-top: -1px;
    }
}

/* Navigation */
.nav-container {
    width: 100%;
    margin: 0 auto;
}

.nav-container .row {
    margin-left: 0;
    margin-right: 0;
}