/*-- scss:rules --*/

/* Overall page styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    font-size: 16px;
    background: #f8f9fa !important;
    min-height: 100vh;
}

/* RESPONSIVE WIDTH - adapts to screen size */
.quarto-container {
    max-width: min(95vw, 1600px); /* 95% of viewport width, max 1600px */
    width: 95vw;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 2rem auto; /* Center it */
    padding: 2rem;
}

.page-layout-article {
    max-width: min(95vw, 1600px);
    width: 95vw;
}

/* Header styling */
h1, h2, h3, h4, h5, h6 {
    color: #2c3e50;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h1 {
    color: #1a252f;
    border-bottom: 3px solid #2980b9;
    padding-bottom: 0.5rem;
    font-size: 2.2em;
}

h2 {
    font-size: 1.8em;
}

h3 {
    font-size: 1.5em;
}

/* Body text */
p, li, td {
    font-size: 1.05em;
    color: #2c3e50;
}

/* Links */
a {
    color: #2980b9;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #3498db;
    text-decoration: underline;
}

/* LHS Sidebar styling */
.sidebar {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%) !important;
    border-right: 3px solid #2980b9;
}

.sidebar .sidebar-navigation .nav-link {
    color: #ecf0f1 !important;
}

.sidebar .sidebar-navigation .nav-link:hover {
    color: #85c1e9 !important;
    background-color: rgba(133, 193, 233, 0.2) !important;
}

.sidebar .sidebar-navigation .nav-link.active {
    background-color: rgba(133, 193, 233, 0.25) !important;
    color: #85c1e9 !important;
    font-weight: 600 !important;
}

.sidebar .sidebar-title {
    color: #ecf0f1 !important;
}

.sidebar .sidebar-tools a {
    color: #ecf0f1 !important;
}

.sidebar .sidebar-tools a:hover {
    color: #85c1e9 !important;
}

.sidebar-navigation {
    color: #ecf0f1;
}

/* RHS Panel - PROPER styling without breaking layout */
#quarto-margin-sidebar,
.margin-sidebar,
nav[role="doc-toc"],
.toc-right {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%) !important;
    border-radius: 8px;
    padding: 1rem;
}

#quarto-margin-sidebar *,
.margin-sidebar *,
nav[role="doc-toc"] *,
.toc-right * {
    color: white !important;
}

#quarto-margin-sidebar a,
.margin-sidebar a,
nav[role="doc-toc"] a,
.toc-right a {
    color: #ecf0f1 !important;
    display: block;
    padding: 0.25rem 0.5rem;
}

#quarto-margin-sidebar a:hover,
.margin-sidebar a:hover,
nav[role="doc-toc"] a:hover,
.toc-right a:hover {
    color: #85c1e9 !important;
    background-color: rgba(133, 193, 233, 0.1) !important;
}

/* CORRECTED: RHS TOC active section highlighting (border only) */
#quarto-margin-sidebar .nav-link.active,
nav[role="doc-toc"] .nav-link.active,
#quarto-margin-sidebar a.active,
nav[role="doc-toc"] a.active {
    color: #85c1e9 !important;
    font-weight: bold !important;
    background-color: transparent !important; /* No background highlight */
    border-left: 3px solid #85c1e9 !important; /* Light blue border */
    padding-left: calc(0.5rem - 3px); /* Adjust padding for the border */
}

/* PAGINATION - Blue instead of orange */
.pagination .page-item .page-link {
    color: #2980b9 !important;
    border-color: #2980b9 !important;
}

.pagination .page-item.active .page-link {
    background-color: #2980b9 !important;
    border-color: #2980b9 !important;
    color: white !important;
}

/* SEARCH RESULTS DROPDOWN - DEFINITIVE FIX for orange background */
.search-results {
    border-color: #2980b9 !important;
}

/* This targets the hover state when using a mouse */
#quarto-search .aa-suggestion:hover {
    background-color: rgba(41, 128, 185, 0.15) !important;
    color: #2c3e50 !important;
}

/* THIS IS THE KEY FIX: A highly specific selector for the keyboard-selected item */
#quarto-search .aa-dropdown-menu .aa-suggestion.aa-cursor {
    background: rgba(41, 128, 185, 0.2) !important; /* Use 'background' shorthand to override everything */
    color: #2c3e50 !important; /* Ensure text remains dark and readable */
    border-left: 3px solid #2980b9 !important; /* The blue accent border */
}

/* Search results highlights */
.search-match,
mark {
    background-color: rgba(41, 128, 185, 0.3) !important;
    color: #2c3e50 !important;
}

/* Any other orange elements that might appear */
.btn-primary,
.bg-primary {
    background-color: #2980b9 !important;
    border-color: #2980b9 !important;
}

.btn-primary:hover {
    background-color: #3498db !important;
    border-color: #3498db !important;
}

.text-primary {
    color: #2980b9 !important;
}

.border-primary {
    border-color: #2980b9 !important;
}

/* Code blocks */
pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

code {
    background-color: #f1f3f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.95em;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

table td:nth-child(1),
table td:nth-child(2) {
    white-space: nowrap;
}

th, td {
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    text-align: left;
    color: #2c3e50;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:nth-child(odd) {
    background-color: #ffffff;
}

th {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    color: white !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.95em;
}

tbody tr:hover {
    background-color: #e3f2fd;
    transition: background-color 0.2s ease;
}

/* Cards/content blocks */
.card, .callout {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
    padding: 1.5rem;
    border-left: 4px solid #2980b9;
}

/* Navigation and buttons */
.btn, button {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover, button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Your existing title meta customization */
.quarto-title-meta-heading::before {
    content: "Due Date";
}

.quarto-title-meta-heading {
    visibility: hidden;
    position: relative;
}

.quarto-title-meta-heading::before {
    visibility: visible;
    position: absolute;
    left: 0;
    top: 0;
}

/* Footer styling */
footer, .page-footer {
    background: #2c3e50 !important;
    color: #ecf0f1 !important;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 3px solid #2980b9;
}

/* Fix for page bottom stripes */
html, body {
    background: #f8f9fa !important;
}

.page-layout-article {
    background: #f8f9fa !important;
}

/* Remove any unwanted alternating backgrounds */
.quarto-listing-container-default div,
.quarto-listing-container div,
.quarto-listing div,
.listing div {
    background: transparent !important;
}

/* ENHANCED MOBILE-FIRST RESPONSIVE DESIGN */
@media (max-width: 1400px) {
    .quarto-container {
        width: 92vw;
        max-width: 92vw;
    }
}

@media (max-width: 1200px) {
    .quarto-container {
        width: 90vw;
        max-width: 90vw;
    }
}

@media (max-width: 768px) {
    .quarto-container {
        margin: 1rem auto;
        padding: 1.5rem;
        border-radius: 4px;
        width: 95vw;
        max-width: 95vw;
    }
    
    /* Hide RHS TOC on tablets to save space */
    #quarto-margin-sidebar {
        display: none !important;
    }
    
    /* Better table display on tablets */
    table {
        font-size: 0.9em;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    th, td {
        padding: 8px 10px;
        min-width: 100px;
    }
    
    body {
        font-size: 15px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    h2 {
        font-size: 1.6em;
    }
}

/* MOBILE PHONES - Complete mobile optimization */
@media (max-width: 576px) {
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .quarto-container {
        width: 100vw;
        max-width: 100vw;
        padding: 1rem;
        margin: 0.5rem auto;
        border-radius: 4px;
    }
    
    /* Hide left sidebar completely on phones */
    #quarto-sidebar,
    .sidebar {
        display: none !important;
    }
    
    /* Hide right sidebar completely on phones */
    #quarto-margin-sidebar,
    .margin-sidebar,
    nav[role="doc-toc"] {
        display: none !important;
    }
    
    /* Make content take full width */
    .content,
    .page-layout-article {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Mobile-friendly headers */
    h1 {
        font-size: 1.8em;
        margin-top: 1rem;
        margin-bottom: 0.8rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5em;
        margin-top: 1rem;
        margin-bottom: 0.8rem;
    }
    
    h3 {
        font-size: 1.3em;
        margin-top: 0.8rem;
        margin-bottom: 0.6rem;
    }
    
    /* Mobile-friendly body text */
    p, li, td {
        font-size: 1em;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    /* Mobile-friendly tables */
    table {
        font-size: 0.8em;
        overflow-x: auto;
        display: block;
        max-width: 100%;
        border-radius: 4px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 0.85em;
        min-width: 80px;
    }
    
    /* Mobile-friendly cards */
    .card, .callout {
        padding: 1rem;
        margin: 0.8rem 0;
        border-radius: 4px;
    }
    
    /* Mobile-friendly code blocks */
    pre {
        padding: 0.8rem;
        font-size: 0.8em;
        overflow-x: auto;
    }
    
    code {
        font-size: 0.8em;
    }
    
    /* Larger touch targets for mobile */
    .btn, button {
        padding: 0.75rem 1.2rem;
        font-size: 1em;
        min-height: 44px; /* Apple's recommended minimum touch target */
    }
    
    /* Mobile navigation */
    .navbar-nav {
        flex-direction: column;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Mobile pagination */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination .page-link {
        padding: 0.5rem 0.75rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Very small screens (older phones) */
@media (max-width: 320px) {
    .quarto-container {
        padding: 0.5rem;
        margin: 0.25rem auto;
    }
    
    body {
        font-size: 13px;
    }
    
    h1 {
        font-size: 1.6em;
    }
    
    h2 {
        font-size: 1.4em;
    }
    
    h3 {
        font-size: 1.2em;
    }
    
    table {
        font-size: 0.75em;
    }
    
    th, td {
        padding: 6px 4px;
        min-width: 60px;
    }
}

.code-copy-button,
.clipboard-button,
button[title*="Copy"],
button[aria-label*="Copy"],
pre button,
div[class*="sourceCode"] button,
.sourceCode button {
    background-color: transparent !important;
    background-image: none !important;
    border: 1px solid #dee2e6 !important;
    color: #6c757d !important;
    transform: none !important;
    box-shadow: none !important;
    /* Make it smaller */
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    min-height: auto !important;
    width: auto !important;
    height: auto !important;
}

.code-copy-button:hover,
.clipboard-button:hover,
button[title*="Copy"]:hover,
button[aria-label*="Copy"]:hover,
pre button:hover,
div[class*="sourceCode"] button:hover,
.sourceCode button:hover {
    background-color: #f8f9fa !important;
    background-image: none !important;
    border-color: #adb5bd !important;
    color: #495057 !important;
    transform: none !important;
    box-shadow: none !important;
    /* Keep same smaller size on hover */
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
}

/* Mobile/narrow window top navigation bar */
.navbar,
.navbar-expand-lg,
.navbar-light,
.navbar-default,
.quarto-navbar,
.navbar-brand,
.navbar-toggler,
.navbar-nav,
.navbar-header {
    background-color: #2c3e50 !important;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    border-bottom: 3px solid #2980b9 !important;
}

/* Navigation links in the mobile bar */
.navbar .nav-link,
.navbar .navbar-nav .nav-link,
.navbar a,
.navbar-brand,
.navbar-toggler {
    color: #ecf0f1 !important;
}

.navbar .nav-link:hover,
.navbar .navbar-nav .nav-link:hover,
.navbar a:hover,
.navbar-brand:hover {
    color: #85c1e9 !important;
}

/* Mobile menu toggle button */
.navbar-toggler {
    border-color: #85c1e9 !important;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba%28236, 240, 241, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E") !important;
}