/* Basic Reset and Global Styles */
body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7fa;
    color: #333;
    line-height: 1.6;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

#cover {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: white;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
}

/* --- Main Layout --- */
.banner {
    background-color: white;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.banner img {
    height: 50px;
    width: auto;
}

.main-container {
    display: flex;
    flex-direction: column; /* Stacks search and results on mobile */
    padding: 15px;
}

/* --- Search Panel --- */
.search-panel {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 15px;
}

.search-panel h4 {
    margin-top: 0;
    color: #003366;
}

.search-panel label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
    font-size: 0.9em;
}

.search-panel select,
.search-panel input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.search-panel .button {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background-color: #346094;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
}
.search-panel .button:hover {
    background-color: #284a75;
}

#new_search {
    text-align: center;
    margin-top: 10px;
}
#new_search a {
    color: #346094;
    text-decoration: none;
}

/* --- Course Attribute Checkbox Filters --- */
.tag-filters {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px 15px;
    margin-top: 20px;
}

.tag-filters legend {
    font-weight: bold;
    font-size: 0.9em;
    padding: 0 5px;
}

#tag-checkboxes-container,
#grad-req-checkboxes-container {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 5px 10px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center; /* Vertically centers the checkbox and text */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* FIX: New rule to specifically style the checkbox labels */
.checkbox-wrapper label {
    font-weight: normal; /* Removes bold */
    font-size: 0.8em;  /* Makes font smaller */
    margin-top: 0;     /* Resets the default label margin */
    margin-left: 4px;  /* Adds a little space next to the checkbox */
}

.checkbox-wrapper input[type="checkbox"] {
    flex-shrink: 0;
}


/* --- Results Panel --- */
.results-panel {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    min-height: 80vh;
}

.results-header {
    margin-bottom: 15px;
    font-weight: bold;
    color: #555;
}

#course_list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#course_list li {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

#course_list li:hover, #course_list li.selected {
    background-color: #eaf2f8;
}

/* --- Selected Course Detail View --- */
.course_crumbs img {
    cursor: pointer;
    vertical-align: middle;
}

.course_title {
    font-size: 1.5em;
    font-weight: bold;
    color: #003366;
    margin-bottom: 15px;
}
.darker {
    font-weight: bold;
}
.course_body {
    line-height: 1.7;
    margin-bottom: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
}
#result-wrap iframe {
    width: 100%;
    max-width: 560px;
    aspect-ratio: 16 / 9;
}


/* --- Responsive Breakpoint for Desktops --- */
@media (min-width: 768px) {
    .main-container {
        flex-direction: row;
        align-items: flex-start;
        gap: 20px;
    }

    .search-panel {
        flex: 1;
        max-width: 350px;
        margin-bottom: 0;
    }

    .results-panel {
        flex: 3;
    }
}

/* --- Mobile Swipe & Tab Navigation --- */
.mobile-tabs {
    display: flex;
    background: white;
    border-bottom: 2px solid #ddd;
    margin-bottom: 10px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.mobile-tab-btn {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    font-size: 1.1em;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-tab-btn.active {
    background: #346094;
    color: white;
}

.badge {
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-left: 5px;
}

/* Container enables native smooth swiping on mobile */
.swipe-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.swipe-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for a native app feel */
}

.panel-slide {
    flex: 0 0 100%; /* Each panel takes up exactly 100% of the screen width */
    scroll-snap-align: start;
    width: 100%;
    /* Remove margins that would break the 100% width swipe calculation */
    margin: 0; 
}


/* --- Responsive Breakpoint for Desktops --- */
@media (min-width: 768px) {
    .mobile-tabs {
        display: none; /* Hide tabs on desktop */
    }

    .main-container {
        display: block; /* Disable flex column from mobile */
    }

    .swipe-container {
        display: flex;
        overflow-x: visible; /* Disable scrolling */
        scroll-snap-type: none;
        gap: 20px; /* Add spacing between panels */
    }

    .panel-slide {
        flex: unset; /* Disable 100% width forcing */
    }

    .search-panel {
        flex: 1;
        max-width: 350px;
    }

    .results-panel {
        flex: 3;
        width: auto;
    }
}