:root {
    --saber-charcoal: #0f1219;
    --saber-slate: #1e2533;
    --saber-highlight: #f2c94c;
    --header-height: 290px;
    --sidebar-width: 240px;
    --status-new: #3b7dd8;
    --status-assigned: #7a4ddf;
    --status-accepted: #25b3a3;
    --status-enroute: #f3d452;
    --status-picked-up: #f59e42;
    --status-completed: #43c37a;
    --status-cancelled: #d74b4b;
    --status-failed: #a12828;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--saber-charcoal);
    color: #f5f5f5;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    background-color: #0d0d0d;
    border-bottom: 4px solid var(--saber-highlight);
    z-index: 1000;
    overflow: hidden;
}

header img {
    flex: 0 0 50%;
    height: 100%;
    width: 100%;
    max-width: none;
    object-fit: fill;
}

header h1 {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: 50px;
    font-family: "Orbitron", "Eurostile", "BankGothic", "Segoe UI", sans-serif;
    letter-spacing: 0.08em;
    background-color: #0d0d0d;
    color: #f6ff3b;
}

nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 1.5rem 1rem;
    background-color: #151a24;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    overflow-y: auto;
}

.sidebar-controls {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-button {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background-color: transparent;
    color: #f5f5f5;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.sidebar-button:hover,
.sidebar-button.active {
    border-color: var(--saber-highlight);
    color: var(--saber-highlight);
}

.view-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

main {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
}

section {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height));
}

.view-panels {
    flex: 1 1 auto;
}

footer {
    margin-top: auto;
    padding-top: 1.5rem;
}

#view-loads {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 1.5rem;
    align-items: start;
}

.trip-view-panel {
    grid-column: 1 / -1;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 1.25rem;
    font-size: 1rem;
}

.trip-view-header {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.trip-view-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.trip-view-column {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.03);
}

.trip-view-column div {
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.trip-view-column div:last-child {
    margin-bottom: 0;
}

#view-drivers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.drivers-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
    font-weight: 600;
}

.drivers-summary span {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.05);
}

.drivers-list table {
    width: 100%;
    border-collapse: collapse;
}

.drivers-list th,
.drivers-list td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drivers-list thead {
    background-color: var(--saber-slate);
}

.loads-map {
    width: 100%;
    min-height: 360px;
    background-color: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    display: block;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.loads-map .map-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #f5f5f5;
    background-color: rgba(10, 10, 10, 0.85);
    padding: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.loads-grid {
    overflow-x: auto;
    grid-column: 1;
    grid-row: auto;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    width: 100%;
}

.loads-grid table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.loads-grid thead {
    background-color: var(--saber-slate);
}

.loads-grid th {
    padding: 0.85rem 1rem;
    text-align: left;
    color: #f5f5f5;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.loads-grid tbody tr {
    cursor: pointer;
}

.loads-grid tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.loads-grid tbody tr.selected {
    background-color: rgba(242, 201, 76, 0.15);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.load-side-panel {
    display: none;
    grid-column: 1;
    grid-row: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 1rem;
}

.load-side-panel.active {
    display: block;
}

.modifications-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

.modifications-search {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modifications-search input {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
    color: #f5f5f5;
}

.mod-load-select {
    min-height: 320px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.25);
    color: #f5f5f5;
    padding: 0.5rem;
}

.modifications-details {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mod-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    font-size: 0.95rem;
}

.mod-summary span {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

.mod-address-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.mod-address-fields input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
    color: #f5f5f5;
}

.mod-price-summary {
    display: flex;
    gap: 2rem;
}

.mod-price-summary div {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.04);
    padding: 0.75rem 1rem;
    border-radius: 6px;
}

.mod-price-summary span {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

.mod-driver-assign {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mod-driver-assign label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

.mod-driver-assign-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.mod-assign-driver {
    flex: 1;
    min-width: 220px;
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
    color: #f5f5f5;
}

.mod-assign-driver-btn {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #f5f5f5;
}

.mod-assign-status {
    min-height: 1.2em;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
}

.mod-assign-status.error {
    color: #ff7b7b;
}

.mod-assign-status.success {
    color: #a8ffb3;
}

.mod-actions {
    display: flex;
    gap: 1rem;
}

.mod-actions button {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
}

.mod-save-addresses {
    background-color: #f2c94c;
    color: #0b0e17;
}

.mod-cancel-trip {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #f5f5f5;
}

.mod-reason textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
    color: #f5f5f5;
}

.drivers-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.drivers-summary span {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.05);
}

.driver-status-available {
    background-color: rgba(67, 195, 122, 0.12);
    color: #43c37a;
}

.driver-status-busy,
.driver-status-assigned {
    background-color: rgba(245, 158, 66, 0.15);
    color: #f59e42;
}

.driver-status-offline {
    background-color: rgba(255, 255, 255, 0.05);
    color: #b0b0b0;
}

.driver-status-suspended {
    background-color: rgba(215, 75, 75, 0.12);
    color: #d74b4b;
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 200px;
    }

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

    .mod-price-summary {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    nav {
        position: relative;
        width: 100%;
        height: auto;
        top: var(--header-height);
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    main {
        margin-left: 0;
        padding: 1.5rem;
    }
}
