:root {
    --ucd-blue: #002855;
    --ucd-gold: #FFD100;
    --text-color: #333;
    --bg-color: #fff;
    --sidebar-bg: #f8f9fa;
    --header-bg: var(--ucd-blue);
    --link-color: #0077CC;
    --border-color: #e5e7eb;
    --code-bg: #f7f7f7;
    --table-border: #ddd;
    --table-header-bg: #f2f2f2;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

.dark-mode {
    --text-color: #e5e7eb;
    --bg-color: #121212;
    --sidebar-bg: #1e1e1e;
    --header-bg: #000;
    --link-color: #6ea8fe;
    --border-color: #4b5563;
    --code-bg: #2d2d2d;
    --table-border: #444;
    --table-header-bg: #333;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Source Sans Pro', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

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

a:hover {
    text-decoration: underline;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Header Styles */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--header-bg);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.header-left {
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    margin-right: 15px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-button {
    background: none;
    border: none;
    color: white;
    margin-left: 15px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.header-button i {
    margin-right: 5px;
}

/* Mobile Header Menu */
.mobile-menu-button {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.mobile-dropdown {
    display: none;
    position: fixed;
    top: 60px;
    right: 0;
    background-color: var(--header-bg);
    width: 200px;
    box-shadow: 0 8px 16px var(--shadow-color);
    z-index: 1000;
}

.mobile-dropdown-item {
    display: block;
    padding: 15px;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 50%;
    left: 360px;
    transform: translateY(-50%);
    background-color: var(--border-color);
    color: var(--text-color);
    border: none;
    width: 20px;
    height: 40px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 2px 0 4px var(--shadow-color);
}

.sidebar-toggle:hover {
    background-color: var(--ucd-gold);
    color: var(--ucd-blue);
}

.sidebar.collapsed {
    transform: translateX(-360px);
}

.sidebar.collapsed + .sidebar-toggle {
    left: 0;
}

.sidebar.collapsed + .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Sidebar Styles */
.sidebar {
    width: 360px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 900;
}

.sidebar-content {
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 25px;
}

.sidebar-heading {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav-item {
    margin-bottom: 5px;
}

.sidebar-nav-link {
    display: block;
    padding: 8px 10px;
    color: var(--text-color);
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 15px;
}

.sidebar-nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-left-color: var(--ucd-gold);
    text-decoration: none;
}

.sidebar-nav-link.active {
    background-color: rgba(0, 0, 0, 0.05);
    border-left-color: var(--ucd-gold);
    font-weight: 600;
}

.dark-mode .sidebar-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dark-mode .sidebar-nav-link.active {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 360px;
    margin-top: 60px;
    padding: 30px;
    max-width: none;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

.sidebar.collapsed ~ .footer {
    margin-left: 0;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--ucd-blue);
}

.page-subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.dark-mode .page-subtitle {
    color: #aaa;
}

.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--ucd-blue);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--ucd-gold);
}

.dark-mode .section-title,
.dark-mode .page-title {
    color: var(--ucd-gold);
}

.card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--ucd-blue);
}

.dark-mode .card-title {
    color: var(--ucd-gold);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Lab Card Styles */
.lab-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background-color: var(--bg-color);
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.lab-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.lab-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--ucd-blue);
}

.dark-mode .lab-card-title {
    color: var(--ucd-gold);
}

.lab-card-description {
    font-size: 14px;
    margin-bottom: 15px;
}

.lab-card-link {
    display: inline-block;
    color: var(--link-color);
    font-weight: 600;
    font-size: 14px;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--ucd-blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #001a3a;
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--ucd-gold);
    color: var(--ucd-blue);
}

.btn-secondary:hover {
    background-color: #e6bc00;
}

/* List Styles */
ul, ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

li {
    margin-bottom: 8px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th, td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--table-border);
}

th {
    background-color: var(--table-header-bg);
    font-weight: 600;
}

/* Code Block Styles */
pre {
    background-color: var(--code-bg);
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 20px;
}

code {
    font-family: 'Courier New', monospace;
}

/* Footer Styles */
.footer {
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    font-size: 14px;
    margin-left: 360px;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .footer {
    margin-left: 0;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--bg-color);
    min-width: 160px;
    box-shadow: 0 8px 16px var(--shadow-color);
    z-index: 1;
    border-radius: 4px;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
}

.dropdown-content a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dropdown:hover .dropdown-content {
    display: block;
}



/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1100;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .sidebar-toggle {
        left: 0;
        z-index: 1200;
    }

    .sidebar.active + .sidebar-toggle {
        left: 280px;
    }

    .main-content,
    .footer {
        margin-left: 0;
        transition: margin-left 0.3s ease;
    }

    .footer {
        width: 100vw;
        margin-left: 0 !important;
    }



    .menu-toggle {
        display: block;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .header-button {
        display: none;
    }

    .mobile-menu-button {
        display: block;
    }

    .mobile-dropdown.active {
        display: block;
    }

    .header-title {
        max-width: 200px;
    }

    /* Prevent any one element from forcing horizontal scrolling on mobile */
    img, iframe, table {
        max-width: 100%;
    }

    /* Keep aspect and avoid overflow for images/iframes */
    img, iframe {
        height: auto;
    }

    /* Make wide tables scroll within themselves instead of stretching the page */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Allow table cells to wrap text properly on mobile */
    table {
        table-layout: fixed;
        width: 100%;
    }
    th, td {
        word-wrap: break-word;
        overflow-wrap: anywhere;
        white-space: normal;
        vertical-align: top;
        padding: 8px 4px;
        line-height: 1.3;
    }
    
    /* Set column widths for better mobile display */
    th:first-child, td:first-child {
        width: 15%;
    }
    th:nth-child(2), td:nth-child(2) {
        width: 50%;
    }
    th:last-child, td:last-child {
        width: 35%;
    }

    /* Code/pre blocks can also cause width issues */
    pre, code {
        white-space: pre-wrap;
        word-break: break-word;
    }
}

/* UC Davis Logo */
.ucd-logo {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.ucd-logo-img {
    height: 80px;
    width: auto;
    margin-right: 10px;
    object-fit: contain;
}

.ucd-logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--ucd-blue);
    margin-left: 10px;
}

.dark-mode .ucd-logo-text {
    color: var(--ucd-gold);
}

/* Lab Content Specific Styles */
.lab-content {
    max-width: 800px;
    margin: 0 auto;
}

.lab-section {
    margin-bottom: 30px;
}

.lab-section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--ucd-blue);
}

.dark-mode .lab-section-title {
    color: var(--ucd-gold);
}

.step {
    margin-bottom: 20px;
    padding-left: 20px;
    border-left: 3px solid var(--ucd-gold);
}

.step-title {
    font-weight: 600;
    margin-bottom: 10px;
}

.learning-goals .lab-section-title,
.materials .lab-section-title {
    background-color: #008080;
    color: white;
    padding: 10px;
    margin: 0;
    border-radius: 5px 5px 0 0;
}

.learning-goals .card,
.materials .card {
    margin-top: 0;
    border-radius: 0 0 5px 5px;
}

.lab-image {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    display: block;
}

.highlight {
    background-color: #008080;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}

.image-container {
    margin: 20px 0;
    text-align: center;
}

.image-container img {
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.image-caption {
    margin-top: 8px;
    font-size: 14px;
    color: #666;
}

.dark-mode .image-caption {
    color: #aaa;
}

/* Instructor Card */
.instructor-card {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.instructor-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    flex-shrink: 0;
    overflow: hidden;
}

.instructor-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.instructor-avatar i {
    font-size: 40px;
    color: #666;
}

.instructor-info {
    flex: 1;
}

.instructor-name {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 5px;
}

.instructor-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.dark-mode .instructor-title {
    color: #aaa;
}

.instructor-contact {
    font-size: 14px;
}

/* Resource Link */
.resource-link {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.resource-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.dark-mode .resource-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.resource-icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-color: var(--ucd-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.resource-icon i {
    color: white;
    font-size: 20px;
}

.resource-info {
    flex: 1;
}

.resource-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.resource-description {
    font-size: 14px;
    color: #666;
}

.dark-mode .resource-description {
    color: #aaa;
}

/* Text alignment */
.text-center {
    text-align: center;
}

/* Print styles for PDF generation */
@media print {
    .header, .sidebar, .footer, .no-print {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    body {
        background-color: white;
        color: black;
    }

    .section {
        display: none;
    }

    .section.active-for-print {
        display: block !important;
    }

    a {
        color: black;
        text-decoration: none;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}