/* Custom styles for AGLPTx */

:root {
    --primary-color: #0969da;
    --secondary-color: #57606a;
    --light-gray: #f6f8fa;
    --dark-gray: #24292f;
    --white: #ffffff;
    --border-color: #d0d7de;
    --shadow-sm: 0 .125rem .25rem rgba(0,0,0,.075);
    --shadow-md: 0 .5rem 1rem rgba(0,0,0,.15);
    --border-radius: .375rem;
    --font-family-sans-serif: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background-color: #ffffff;
    color: #24292f;
    margin: 0;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

/* Ensure light theme is always applied */
html[data-bs-theme],
html[data-bs-theme="light"],
html {
    color-scheme: light;
    --bs-body-bg: #ffffff;
    --bs-body-color: #24292f;
    --bs-border-color: #d0d7de;
}

body > .container {
    flex: 1 0 auto;
}

/* Card styles */
.card {
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--white);
    transition: all 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 20px 24px;
}

.card-body {
    padding: 24px;
}

/* Table styles */
.table {
    font-size: 0.9rem;
    border-collapse: separate;
    border-spacing: 0;
}

    .table th {
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.8px;
        background-color: var(--light-gray);
        border-bottom: 2px solid var(--primary-color);
        color: var(--dark-gray);
        padding: 14px 16px;
    }

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(56, 139, 253, 0.08);
    box-shadow: inset 3px 0 0 #388bfd;
    transform: translateX(2px);
}

.table td, .table th {
    vertical-align: middle;
}

.table td {
    padding: 14px 16px;
}

/* Form styles */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Button styles */
.btn {
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
    box-shadow: var(--shadow-sm);
}

    .btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 .25rem .5rem rgba(0,0,0,.15);
    }

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

    .btn-primary:hover {
        background-color: #0069d9;
        border-color: #0062cc;
    }

/* Custom smaller button size */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Badge styles */
.badge {
    border-radius: var(--border-radius);
}

.badge.bg-success,
.badge.bg-success[class*="bg-"] {
    background: linear-gradient(135deg, #238636 0%, #2ea043 100%) !important;
    border: 1px solid rgba(35, 134, 54, 0.4);
    box-shadow: 0 2px 4px rgba(35, 134, 54, 0.2);
    color: #fff !important;
}

.badge.bg-danger,
.badge.bg-danger[class*="bg-"],
.badge[class*="late"] {
    background: linear-gradient(135deg, #da3633 0%, #f85149 100%) !important;
    border: 1px solid rgba(218, 54, 51, 0.4);
    box-shadow: 0 2px 4px rgba(218, 54, 51, 0.2);
    color: #fff !important;
}

/* Navbar styles */
.navbar {
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 600;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--primary-color);
}

/* Footer styles */
.footer {
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
    background-color: #ffffff;
    border-top: 1px solid #d0d7de;
    color: #57606a;
}

/* Responsive styles */
@media (max-width: 767.98px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Custom utility classes */
.mb-3 {
    margin-bottom: 1rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.text-muted {
    color: #6c757d !important;
}

/* Custom animations */
.fade-in {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.d-flex-column-main-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.d-flex-column-main-layout > .container {
    flex: 1 0 auto;
}

/* Carton Details Page Styles */
.collapse-header {
    cursor: pointer;
    user-select: none;
}

    .collapse-header:hover {
        background-color: #f8f9fa !important;
    }

/* Dark mode styles */
html[data-bs-theme="dark"] {
    color-scheme: dark;
    --bs-body-bg: #0d1117;
    --bs-body-color: #c9d1d9;
    --bs-border-color: #30363d;
    --primary-color: #58a6ff;
    --secondary-color: #8b949e;
    --light-gray: #161b22;
    --dark-gray: #c9d1d9;
    --white: #0d1117;
    --border-color: #30363d;
}

html[data-bs-theme="dark"] body {
    background-color: #0d1117;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .card {
    background-color: #161b22;
    border-color: #30363d;
}

html[data-bs-theme="dark"] .card-header {
    background-color: #161b22;
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .table th {
    background-color: #161b22;
    color: #c9d1d9;
    border-bottom-color: #58a6ff;
}

html[data-bs-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.03);
}

html[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(88, 166, 255, 0.1);
}

html[data-bs-theme="dark"] .footer {
    background-color: #0d1117;
    border-top-color: #30363d;
    color: #8b949e;
}

html[data-bs-theme="dark"] .top-navbar {
    background-color: transparent;
}

html[data-bs-theme="dark"] .content-area {
    background-color: #0d1117;
}

html[data-bs-theme="dark"] .collapse-header:hover {
    background-color: #161b22 !important;
}

html[data-bs-theme="dark"] .text-muted {
    color: #8b949e !important;
}

html[data-bs-theme="dark"] .card-body,
html[data-bs-theme="dark"] .card-body span:not(.text-muted) {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] h4,
html[data-bs-theme="dark"] h5 {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length,
html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter,
html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info,
html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input,
html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #c9d1d9 !important;
}

html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #21262d;
    border-color: #30363d;
    color: #c9d1d9 !important;
}

html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

html[data-bs-theme="dark"] .load-details-page {
    background: #0d1117;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .header {
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .summary {
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .route-id,
html[data-bs-theme="dark"] .info-value,
html[data-bs-theme="dark"] .time-value,
html[data-bs-theme="dark"] .stop-name {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .info-label,
html[data-bs-theme="dark"] .time-label,
html[data-bs-theme="dark"] .stop-id,
html[data-bs-theme="dark"] .load-id {
    color: #8b949e;
}

html[data-bs-theme="dark"] .stop-item {
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .stop-details {
    border-top-color: #30363d;
}

html[data-bs-theme="dark"] .cartons-table thead {
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .cartons-table th {
    color: #8b949e;
}

html[data-bs-theme="dark"] .cartons-table td {
    color: #c9d1d9;
    border-bottom-color: #161b22;
}

html[data-bs-theme="dark"] .cartons-table tbody tr:hover {
    background: #161b22;
}

html[data-bs-theme="dark"] .loads-dashboard {
    background: #0d1117;
}

html[data-bs-theme="dark"] .loads-dashboard .header {
    background: #0d1117;
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .page-title,
html[data-bs-theme="dark"] .day-title,
html[data-bs-theme="dark"] .section-title {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .header-metric-label,
html[data-bs-theme="dark"] .section-metric-label {
    color: #8b949e;
}

html[data-bs-theme="dark"] .header-metric-value,
html[data-bs-theme="dark"] .section-metric-value {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .day-header {
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .section-header {
    background: #0d1117;
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .load-row {
    border-bottom-color: #161b22;
}

html[data-bs-theme="dark"] .load-row:hover {
    background: #161b22;
}

html[data-bs-theme="dark"] .load-row.highlighted {
    background: rgba(88, 166, 255, 0.1) !important;
    border-left-color: #58a6ff;
}

html[data-bs-theme="dark"] .route-id,
html[data-bs-theme="dark"] .variance-value,
html[data-bs-theme="dark"] .stops-value,
html[data-bs-theme="dark"] .metric-value {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .metric-metric-value {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .metric-metric-value.good {
    color: #3fb950;
}

html[data-bs-theme="dark"] .metric-metric-value.poor {
    color: #f85149;
}

html[data-bs-theme="dark"] .route-time,
html[data-bs-theme="dark"] .variance-label,
html[data-bs-theme="dark"] .stops-label,
html[data-bs-theme="dark"] .ontime-label,
html[data-bs-theme="dark"] .metric-label {
    color: #8b949e;
}

html[data-bs-theme="dark"] .load-details-overlay {
    background: rgba(0, 0, 0, 0.85);
}

html[data-bs-theme="dark"] .load-details-panel {
    background: #0d1117;
}

html[data-bs-theme="dark"] .load-details-header {
    background: #0d1117;
    border-bottom-color: #30363d;
}

html[data-bs-theme="dark"] .load-details-header h4 {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .load-details-close {
    background: #161b22;
    border-color: #30363d;
    color: #8b949e;
}

html[data-bs-theme="dark"] .load-details-close:hover {
    background: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .load-details-content {
    background: #0d1117;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: #30363d;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .dropdown-menu {
    background-color: #161b22;
    border-color: #30363d;
}

html[data-bs-theme="dark"] .dropdown-item {
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #21262d;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .dropdown-item.active {
    background-color: #21262d;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .dropdown-divider {
    border-top-color: #30363d;
}

/* Status item badges for carton status display */
.status-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-item.status-received {
    background: rgba(13, 202, 240, 0.15);
    color: #0dcaf0;
}

.status-item.status-staged {
    background: rgba(132, 141, 151, 0.15);
    color: #848d97;
}

.status-item.status-dock-staged {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
}

.status-item.status-loaded {
    background: rgba(188, 140, 255, 0.15);
    color: #bc8cff;
}

.status-item.status-delivered {
    background: rgba(46, 160, 67, 0.15);
    color: #2ea043;
}

.status-item i {
    font-size: 10px;
}

/* Timeline carton status display */
.timeline-time-cartons {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.timeline-item-carton-statuses {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================================
   LOAD DETAILS PAGE STYLES
   Shared styles from LoadDetails.cshtml
   ============================================ */

.load-details-page {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #ffffff;
    color: #24292f;
    font-size: 14px;
    line-height: 1.6;
}

.load-details-page *,
.load-details-page *::before,
.load-details-page *::after {
    box-sizing: border-box;
}

.load-details-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.container .load-details-container {
    padding: 0;
}

.header {
    padding: 20px 40px;
    border-bottom: 1px solid #d0d7de;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-btn {
    background: none;
    border: none;
    color: #57606a;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
}

.back-btn:hover {
    color: #24292f;
}

.close-btn {
    background: none;
    border: none;
    color: #57606a;
    cursor: pointer;
    font-size: 24px;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #24292f;
}

.summary {
    padding: 48px 40px;
    border-bottom: 1px solid #d0d7de;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 48px;
}

.title-group {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.route-id {
    font-size: 28px;
    font-weight: 300;
    letter-spacing: -1px;
    color: #24292f;
}

.load-id {
    font-size: 14px;
    color: #57606a;
    font-weight: 400;
}

.status-text {
    font-size: 14px;
    color: #1a7f37;
    font-weight: 500;
}

.status-text.with-warning {
    display: flex;
    align-items: center;
    gap: 12px;
}

.warning-badge {
    background: #fff8c5;
    color: #bf8700;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

.info-row {
    display: flex;
    gap: 64px;
    margin-bottom: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid #d0d7de;
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-label {
    font-size: 12px;
    color: #57606a;
    font-weight: 400;
}

.info-value {
    font-size: 16px;
    color: #24292f;
    font-weight: 400;
}

.workflow-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.workflow-segment {
    flex: 1;
    height: 4px;
    background: #d0d7de;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.workflow-segment.completed {
    background: #1a7f37;
}

.workflow-labels {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.workflow-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.workflow-label.completed {
    color: #1a7f37;
    font-weight: 500;
}

.workflow-count {
    font-size: 18px;
    font-weight: 300;
}

.stops-section {
    padding: 48px 40px;
}

.section-title {
    font-size: 14px;
    color: #57606a;
    font-weight: 400;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stop-item {
    padding: 32px 0;
    border-bottom: 1px solid #d0d7de;
}

.stop-item:last-child {
    border-bottom: none;
}

.stop-main {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 48px;
    align-items: start;
    margin-bottom: 24px;
}

.stop-name {
    font-size: 16px;
    font-weight: 400;
    color: #24292f;
    margin-bottom: 4px;
}

.stop-id {
    font-size: 12px;
    color: #57606a;
}

.stop-time {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.time-label {
    font-size: 11px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-value {
    font-size: 16px;
    color: #24292f;
    font-weight: 300;
}

.time-value.late {
    color: #cf222e;
}

.late-indicator {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #ffebe9;
    color: #cf222e;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    border-radius: 3px;
}

.late-reason {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff8c5;
    border-left: 3px solid #bf8700;
    font-size: 13px;
    color: #24292f;
    display: flex;
    align-items: start;
    gap: 8px;
}

.reason-icon {
    color: #bf8700;
    font-size: 16px;
    flex-shrink: 0;
}

.reason-text {
    flex: 1;
}

.stop-workflow {
    display: flex;
    gap: 16px;
    font-size: 13px;
    flex-wrap: wrap;
}

.stage-item {
    color: #57606a;
}

.stage-item.completed {
    color: #1a7f37;
}

.stage-label-inline {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stage-count-inline {
    font-size: 16px;
    font-weight: 300;
    margin-left: 6px;
}

.expand-btn {
    background: none;
    border: none;
    color: #57606a;
    cursor: pointer;
    font-size: 13px;
    padding: 8px 0;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.expand-btn:hover {
    color: #24292f;
}

.stop-details {
    display: none;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid #d0d7de;
}

.stop-item.expanded .stop-details {
    display: block;
}

.stop-item.expanded .expand-btn .arrow {
    transform: rotate(180deg);
}

.arrow {
    transition: transform 0.2s;
}

.details-row {
    display: flex;
    gap: 64px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 11px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: #24292f;
}

.cartons-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 32px;
}

.cartons-table thead {
    border-bottom: 1px solid #d0d7de;
}

.cartons-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    color: #57606a;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cartons-table td {
    padding: 16px;
    font-size: 13px;
    color: #24292f;
    border-bottom: 1px solid #f6f8fa;
}

.cartons-table tbody tr:hover {
    background: #f6f8fa;
}

.carton-num {
    color: #57606a;
    width: 40px;
}

.carton-link {
    color: #0969da;
    text-decoration: none;
}

.carton-link:hover {
    text-decoration: underline;
}

.timestamp {
    color: #57606a;
    font-size: 12px;
}

@media (max-width: 768px) {
    .header {
        padding: 16px 20px;
    }

    .summary {
        padding: 32px 20px;
    }

    .stops-section {
        padding: 32px 20px;
    }

    .info-row {
        gap: 32px;
    }

    .stop-main {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .details-row {
        gap: 32px;
    }
}

/* ============================================
   LOADS LIST PAGE STYLES (Index.cshtml)
   Shared styles for loads list view
   ============================================ */

.loads-dashboard {
    background: #ffffff;
    min-height: 100vh;
}

/* Search Bar in Navbar */
.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 600px;
    width: 100%;
    min-width: 300px;
}

html[data-bs-theme="dark"] .search-bar-container {
    background: #0d1117;
    border-bottom-color: #30363d;
}

.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: #57606a;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
}

html[data-bs-theme="dark"] .search-icon {
    color: #8b949e;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    font-size: 14px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #ffffff;
    color: #24292f;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

html[data-bs-theme="dark"] .search-input {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

html[data-bs-theme="dark"] .search-input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.search-input::placeholder {
    color: #8b949e;
}

html[data-bs-theme="dark"] .search-input::placeholder {
    color: #6e7681;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #57606a;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.search-clear-btn:hover {
    background: #f6f8fa;
    color: #24292f;
}

html[data-bs-theme="dark"] .search-clear-btn {
    color: #8b949e;
}

html[data-bs-theme="dark"] .search-clear-btn:hover {
    background: #21262d;
    color: #c9d1d9;
}

@media (max-width: 768px) {
    .search-bar-wrapper {
        min-width: 100%;
        max-width: 100%;
    }
}

/* Sort button styling */
#sortButton {
    white-space: nowrap;
    min-width: auto;
}

#sortButton #sortText {
    margin-left: 4px;
}

/* Search Results View */
.search-results-header {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #d0d7de;
}

.search-results-title {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: -0.5px;
    color: #24292f;
    margin: 0 0 8px 0;
}

html[data-bs-theme="dark"] .search-results-title {
    color: #c9d1d9;
}

.search-results-count {
    font-size: 14px;
    color: #57606a;
}

html[data-bs-theme="dark"] .search-results-count {
    color: #8b949e;
}

.search-results-content {
    padding: 0;
}

.search-results-date-group {
    margin-bottom: 48px;
}

.search-results-date-group:last-child {
    margin-bottom: 0;
}

.search-results-date-header {
    font-size: 18px;
    font-weight: 400;
    color: #24292f;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f6f8fa;
}

html[data-bs-theme="dark"] .search-results-date-header {
    color: #c9d1d9;
    border-bottom-color: #21262d;
}

.search-results-date-count {
    font-size: 14px;
    font-weight: 400;
    color: #57606a;
}

html[data-bs-theme="dark"] .search-results-date-count {
    color: #8b949e;
}

.search-results-loads-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

html[data-bs-theme="dark"] .search-result-row {
    background: #161b22;
    border-color: #30363d;
}

.search-result-row:hover {
    background: #f6f8fa;
    border-color: #0969da;
    box-shadow: 0 2px 8px rgba(9, 105, 218, 0.1);
    transform: translateY(-1px);
}

html[data-bs-theme="dark"] .search-result-row:hover {
    background: #21262d;
    border-color: #58a6ff;
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.1);
}

.search-result-main {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.search-result-route {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.search-result-route-id {
    font-size: 16px;
    font-weight: 500;
    color: #24292f;
}

html[data-bs-theme="dark"] .search-result-route-id {
    color: #c9d1d9;
}

.search-result-date-time {
    font-size: 13px;
    color: #57606a;
}

html[data-bs-theme="dark"] .search-result-date-time {
    color: #8b949e;
}

.search-result-status {
    flex-shrink: 0;
}

.search-result-metrics {
    display: flex;
    gap: 32px;
    align-items: center;
    flex-shrink: 0;
}

.search-result-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    min-width: 80px;
}

.search-result-metric-label {
    font-size: 11px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

html[data-bs-theme="dark"] .search-result-metric-label {
    color: #8b949e;
}

.search-result-metric-value {
    font-size: 14px;
    font-weight: 400;
    color: #24292f;
}

html[data-bs-theme="dark"] .search-result-metric-value {
    color: #c9d1d9;
}

.search-result-metric-value.good {
    color: #1a7f37;
}

html[data-bs-theme="dark"] .search-result-metric-value.good {
    color: #3fb950;
}

.search-result-metric-value.fair {
    color: #bf8700;
}

html[data-bs-theme="dark"] .search-result-metric-value.fair {
    color: #d29922;
}

.search-result-metric-value.poor {
    color: #cf222e;
}

html[data-bs-theme="dark"] .search-result-metric-value.poor {
    color: #f85149;
}

.search-loading-more {
    padding: 20px;
    text-align: center;
    color: #57606a;
    font-size: 14px;
}

html[data-bs-theme="dark"] .search-loading-more {
    color: #8b949e;
}

.search-loading-more i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
    .search-result-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .search-result-main {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .search-result-metrics {
        width: 100%;
        justify-content: space-around;
    }
}

/* Index page header - sticky positioning */
/* CSS custom properties for dynamic sticky offsets */
.loads-dashboard {
    --sticky-header-height: 0px;
    --navbar-height: 60px; /* Navbar height (includes search bar) */
}

.loads-dashboard .header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    padding: 24px 40px;
    border-bottom: 1px solid #d0d7de;
}

.header-content {
    display: flex;
    align-items: baseline;
    gap: 48px;
    margin-bottom: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: -0.5px;
    color: #24292f;
    margin: 0;
    flex-shrink: 0;
}

.header-metrics {
    display: flex;
    gap: 48px;
    align-items: baseline;
    flex: 1;
}

.header-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

/* Shared metric label styles (for main metric columns) */
.header-metric-label,
.section-metric-label {
    font-size: 11px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Shared metric value styles (for main metric columns) */
.header-metric-value,
.section-metric-value {
    font-weight: 400;
    color: #24292f;
}

.header-metric-value {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: -0.5px;
}

.section-metric-value {
    font-size: 16px;
}

.header-metric-value.good,
.section-metric-value.good {
    color: #1a7f37;
}

.header-metric-value.poor,
.section-metric-value.poor {
    color: #cf222e;
}

.section-metric-value.fair {
    color: #bf8700;
}

.header-metric-value.empty,
.section-metric-value.empty {
    color: #24292f;
}

/* Shared metric item styles (for grid-based headers) */
.header-metric-item .header-metric-label,
.section-metric-item .section-metric-label {
    font-size: 10px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.header-metric-item .header-metric-value,
.section-metric-item .section-metric-value {
    font-size: 14px;
    font-weight: 400;
    color: #24292f;
    letter-spacing: 0;
}

.header-metric-item .header-metric-value.good,
.section-metric-item .section-metric-value.good {
    color: #1a7f37;
}

.header-metric-item .header-metric-value.empty,
.section-metric-item .section-metric-value.empty {
    color: #24292f;
}

.header-loads-count {
    flex-shrink: 0;
    font-size: 13px;
    color: #57606a;
}

.header-location {
    margin-top: 8px;
}

.location-badge {
    font-size: 12px;
    color: #57606a;
    padding: 4px 12px;
    background: #f6f8fa;
    border-radius: 12px;
}

.content {
    padding: 24px 40px 40px 40px;
}

.day-section {
    display: block;
    width: 100%;
    margin-bottom: 80px;
    clear: both;
}

.day-section:last-child {
    margin-bottom: 0;
}

.day-header {
    display: block;
    width: 100%;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #d0d7de;
}

.day-header.sticky {
    position: sticky;
    top: var(--navbar-height); /* Below navbar (which includes search bar) */
    z-index: 100;
    background: #ffffff;
    padding-top: 16px;
    margin-top: -16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

html[data-bs-theme="dark"] .day-header.sticky {
    background: #0d1117;
}

.day-header .header-content {
    margin-bottom: 0;
}

/* Header grid - matches load-row structure exactly for alignment */
.header-grid {
    display: grid;
    grid-template-columns: 100px 120px 120px 100px 120px 1fr auto;
    gap: 24px;
    align-items: baseline;
}

.header-title-col {
    /* Column 1 - matches Status column (100px), title can overflow */
    overflow: visible;
    vertical-align: middle;
}

.header-empty-col {
    /* Columns 2-3 - matches Route and Variance columns */
}

.header-metric-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.header-metrics-col {
    display: flex;
    gap: 16px;
}

.header-metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Shared title styles */
.day-title,
.section-title {
    font-weight: 300;
    letter-spacing: -0.5px;
    color: #24292f;
    margin: 0;
    flex-shrink: 0;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.day-title {
    font-size: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: 400;
}

.time-section {
    margin-bottom: 64px;
}

.time-section:last-child {
    margin-bottom: 0;
}

.section-header {
    position: sticky;
    top: var(--sticky-header-height);
    z-index: 50;
    background: #ffffff;
    margin-bottom: 24px;
    padding: 16px 0 12px 0;
    border-bottom: 1px solid #d0d7de;
    margin-left: 0;
    margin-right: 0;
}

.section-header.sticky {
    position: sticky;
    top: calc(var(--navbar-height) + 100px); /* Account for navbar + day header height (approximately) */
    z-index: 90; /* Lower than day header (100) but still sticky */
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding-top: 12px;
    margin-top: -12px;
}

html[data-bs-theme="dark"] .section-header.sticky {
    background: #0d1117;
}

.section-header-content {
    display: flex;
    align-items: baseline;
    gap: 24px;
}

/* Section grid - matches load-row structure exactly for alignment */
.section-grid {
    display: grid;
    grid-template-columns: 100px 120px 120px 100px 120px 1fr auto;
    gap: 24px;
    align-items: baseline;
}

.section-title-col {
    /* Column 1 - matches Status column (100px), title can overflow */
    overflow: visible;
}

.section-empty-col {
    /* Columns 2-3 - matches Route and Variance columns */
}

.section-metric-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.section-metrics-col {
    display: flex;
    gap: 16px;
}

.section-metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Section title styles now in shared .day-title, .section-title above */

.section-metrics {
    display: flex;
    gap: 32px;
    align-items: baseline;
    flex: 1;
}

.section-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

/* Section metric label/value styles now in shared classes above */

/* Section metric item styles now in shared classes above */

.section-loads-count {
    flex-shrink: 0;
    font-size: 13px;
    color: #57606a;
}

.load-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.load-row {
    padding: 20px 0;
    border-bottom: 1px solid #f6f8fa;
    cursor: pointer;
    transition: background 0.15s;
}

.load-row:hover {
    background: #f6f8fa;
}

.load-row.highlighted {
    background: rgba(9, 105, 218, 0.1) !important;
    border-left: 3px solid #0969da;
    padding-left: 13px; /* 16px - 3px border */
}

.status-col {
    font-size: 12px;
}

.status-text.completed {
    color: #1a7f37;
}

.status-text.in-progress {
    color: #0969da;
}

.status-text.draft {
    color: #bf8700;
}

.route-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.route-id {
    font-size: 16px;
    font-weight: 500;
    color: #24292f;
}

.route-time {
    font-size: 12px;
    color: #57606a;
}

.variance-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.variance-label {
    font-size: 11px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.variance-value {
    font-size: 14px;
    font-weight: 400;
}

.variance-value.early {
    color: #1a7f37;
}

.variance-value.late {
    color: #cf222e;
}

html[data-bs-theme="dark"] .variance-value.early {
    color: #3fb950;
}

html[data-bs-theme="dark"] .variance-value.late {
    color: #f85149;
}

.stops-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stops-label {
    font-size: 11px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stops-value {
    font-size: 14px;
    font-weight: 400;
    color: #24292f;
}

.ontime-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ontime-label {
    font-size: 11px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ontime-value {
    font-size: 14px;
    font-weight: 400;
}

.ontime-value.good {
    color: #1a7f37;
}

.ontime-value.fair {
    color: #bf8700;
}

.ontime-value.poor {
    color: #cf222e;
}

.metrics-col {
    display: flex;
    gap: 16px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 10px;
    color: #57606a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.metric-value {
    font-size: 14px;
    color: #24292f;
    font-weight: 400;
}

.metric-value.completed {
    color: #1a7f37;
}

.metric-value.partial {
    color: #bf8700;
}

.metric-value.good {
    color: #1a7f37;
}

.metric-value.poor {
    color: #cf222e;
}

.metric-value.empty {
    color: #24292f;
}

.metric-metric-value.good {
    color: #1a7f37;
}

.metric-metric-value.poor {
    color: #cf222e;
}

.metric-metric-value.empty {
    color: #24292f;
}

.now-indicator {
    position: relative;
    padding: 20px 0;
    margin: 8px 0;
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.now-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: #ff8c00;
    z-index: 10;
    transform: translateY(-50%);
}

.now-badge {
    position: relative;
    display: inline-block;
    padding: 4px 12px;
    background: #ff8c00;
    color: white;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    margin-left: 16px;
    z-index: 11;
}

.today-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    padding: 12px 24px;
    background: #0969da;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    z-index: 1000;
}

.today-btn:hover {
    background: #0550ae;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.empty-message {
    padding: 48px 0;
    text-align: center;
    color: #57606a;
    font-size: 14px;
}

.loading-message {
    padding: 48px 0;
    text-align: center;
    color: #57606a;
    font-size: 14px;
}

.loading-message i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Loading indicators for next/previous day loading */
.loading-indicator {
    position: sticky;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

html[data-bs-theme="dark"] .loading-indicator {
    background: rgba(22, 27, 34, 0.95);
    border-bottom-color: #30363d;
}

.loading-indicator-top {
    top: 0;
    border-bottom: 1px solid var(--border-color);
}

.loading-indicator-bottom {
    bottom: 0;
    border-top: 1px solid var(--border-color);
    border-bottom: none;
}

.loading-indicator-content {
    padding: 12px 20px;
    text-align: center;
    color: #57606a;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

html[data-bs-theme="dark"] .loading-indicator-content {
    color: #8b949e;
}

.loading-indicator-content i {
    animation: spin 1s linear infinite;
}

.timeline-container {
    display: none;
}

.timeline-loading {
    text-align: center;
    padding: 40px 20px;
    color: #57606a;
    font-size: 0.9rem;
}

.timeline-loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

.load-details-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.load-details-overlay.show {
    opacity: 1;
    visibility: visible;
}

.load-details-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 90%;
    max-width: 1200px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 2001;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.load-details-overlay.show .load-details-panel {
    transform: translateX(0);
    will-change: auto;
}

.load-details-header {
    background: #ffffff;
    border-bottom: 1px solid #d0d7de;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.load-details-header h4 {
    margin: 0;
    color: #24292f;
    font-size: 1.25rem;
    font-weight: 600;
}

.load-details-close {
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    color: #57606a;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.load-details-close:hover {
    background: #e9ecef;
    border-color: #d0d7de;
    color: #24292f;
}

.load-details-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #ffffff;
    color: #24292f;
}

.load-details-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #57606a;
    font-size: 0.9rem;
}

.load-details-loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
    .load-details-panel {
        width: 100%;
        max-width: 100%;
    }
}
