body {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

.top-nav {
    background-color: white;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px calc((100% - 1200px) / 2);
}

/* the row of buttons at the bottom of a page */
.local-nav {
    padding-top: 40px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.logo-container {
    /*padding-left: 20px;*/
    /*padding-right: 20px;*/
}

.logo-container img {
    height: 30px;
    vertical-align: middle;
}

.logo {
    max-width: 200px;
    height: auto;
}

.nav-buttons {
    display: flex;
    gap: 15px;
}

.btn {
    display: inline-block;
    font-weight: 400;
    color: #212529;
    text-align: center;
    vertical-align: middle;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: .25rem;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary, .btn-secondary, .btn-file, .btn-danger {
    color: #333;
}

/* Button colours say what a button does (a working rule, from 1.5):
   green (primary) - choosing: an option to go on with, or the scenarios to compare
   lavender (file) - doing something: exporting or saving to your computer, loading from it, saving, renaming
   yellow (secondary) - moving around: to another page, back, home
   red (danger) - something that can't easily be undone, such as deleting
   blue (user) - the user's own settings, in the navigation bar
   grey (inactive) - not available */
.btn-primary {
    background-color: #D6F6D1;
    border-color: #c7e7c2;
}

.btn-primary:hover {
    background-color: #c7e7c2;
    border-color: #b8d8b3;
}

.btn-secondary {
    background-color: #FDECC0;
    border-color: #eeddb1;
}

.btn-secondary:hover {
    background-color: #eeddb1;
    border-color: #dfcea2;
}

.btn-file {
    background-color: #E0D0F4;
    border-color: #d1c1e5;
}

.btn-file:hover {
    background-color: #d1c1e5;
    border-color: #c2b2d6;
}

.btn-danger {
    background-color: #F6D1D1;
    border-color: #e7c2c2;
}

.btn-danger:hover {
    background-color: #e7c2c2;
    border-color: #d8b3b3;
}

.btn:disabled {
    background-color: #e0e0e9;
    border-color: #e0e0e9;
    opacity: 0.65;
    cursor: not-allowed;
}

/* a page's heading, with buttons for the whole page on the right, lined up with the buttons in a table's last
   column (inside its cells' padding) */
.title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.title-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-right: .75rem;
    margin-left: auto;  /* stays on the right if it wraps below the heading */
}

/* a table cell that ticks its checkbox wherever it's clicked */
.table td.select-cell {
    padding: 0;
}

.select-cell label {
    display: block;
    padding: .75rem;
    text-align: center;
    cursor: pointer;
}

/* when the most scenarios that can be compared are ticked, the others can't be */
.select-cell label:has(input:disabled) {
    cursor: not-allowed;
}

/* Saved Scenarios: the span around Compare Selected and Delete Selected, which shows why one is disabled in the
   site's tooltip, below it - the disabled button lets the pointer through to it */
.button-tip {
    display: inline-block;
    position: relative;
}

.button-tip .btn:disabled {
    pointer-events: none;
}

.button-tip .button-why {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
}

.button-tip:hover .button-why:not(:empty) {
    display: block;
}

/* the column headers that sort the list */
.sort-button {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: bold;
    color: inherit;
    cursor: pointer;
}

/* a deleted scenario, which only admins see */
.deleted-row td {
    color: #999;
}

.deleted-badge {
    margin-left: 0.5rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0.2rem;
    font-size: 0.8rem;
    background-color: #e0e0e9;
    color: #666;
}

/* for screen readers only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Scenario Summary: Rename, after the scenario's name, and the box the name is edited in, in its place */
.rename-button {
    margin-left: 0.5rem;
}

.rename-editor {
    margin-bottom: 1rem;      /* as the paragraph it replaces */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.rename-label {
    margin: 0;
    font-weight: bold;
}

.rename-input {
    flex: 1 1 14rem;
    width: auto;
}

.rename-error {
    font-size: 0.875rem;
    color: darkred;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

.btn-user {
    background-color: #dff3f6;
}

.btn-inactive {
    background-color: #e0e0e9;
}

.confirm {
    background-color: #b8d8b3;
    color: green;
}

.error {
    background-color: #ccaaaa;
    color: darkred;
}

/* errors and confirmations, at the top of the page: close to the content below them, each in a box of its own */
.messages {
    padding-bottom: 0;
}

.messages > div {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
}

.messages > div + div {
    margin-top: 0.5rem;
}

.messages p {
    margin: 0;
    white-space: pre-line;    /* a message's own line breaks, e.g. an unknown page's */
}

/* Scenario Summary: taking a different route from a step's choice, after it */
.take-route-button {
    margin-left: 0.5rem;
}

/* a step's options: the one chosen now, and those chosen before - see markChoices in detail.js */
.choice-marks {
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

.choice-mark {
    padding: 0.1rem 0.4rem;
    border-radius: 0.2rem;
}

.your-choice {
    background-color: #b8d8b3;
    color: #1e5c1e;
}

.chosen-before {
    background-color: #e0e0e9;
    color: #666;
}

/* a time, shown friendly on screen and in full when printed - see dates.js */
.full-time {
    display: none;
}

.disclaimer {
    font-size: small
}

.app-version {
    color: #999;
    margin-left: 1em;
    white-space: nowrap;
}

textarea {
    width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    color: #444;
}

.form-control {
    display: block;
    width: 100%;
    height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    margin: 0;
    font-family: inherit;
    overflow: auto;
    resize: vertical;
}

.input-form {
    width: 50%;
}

textarea.form-control {
    height: auto;
}

.table-responsive {
    /*overflow-x: auto;*/
}

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

.half-width-table {
    width: 50%;
    border-collapse: collapse;
}

.table th,
.table td,
.table td {
    word-wrap: break-word;
    /*overflow-wrap: break-word;*/
    max-width: 400px; /* Adjust this value as needed */
    padding: .75rem;
    border-top: 1px solid #dee2e6;
}

table thead th {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    text-align: left;
}



.table td .cell-content {
    /*max-height: 120px; !* Approximately 5 lines of text *!*/
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: unset; /* Default to no line clamping */
    -webkit-box-orient: vertical;
}

.table td:hover .cell-content {
    max-height: none;
    -webkit-line-clamp: unset;
}

.tooltip-container {
    display: inline-block;
    position: relative;
    font-weight: normal;
}

.tooltip {
    display: none;
    min-width: 12rem;
    background-color: black;
    color: white;
    border: 1px solid black;
    font-size: smaller;
    padding: 5px;
    border-radius: 5px;
    text-align: center;
    font-weight: normal;
    z-index: 20;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #fff;
}


/* Animation styles */
.table td {
    transition: all 0.3s ease;
    opacity: 1;
}

/* Keep the cell content styles but remove fixed widths */
.cell-content {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Optional: Add hover effect to see full content */
.cell-content:hover {
    white-space: normal;
    word-wrap: break-word;
}

.ltv-table {
    width: 100%;
    max-width: none;
}

.ltv-table-container {
    width: 50%;
    margin-bottom: 2rem;
}

.step-box {
    flex: 1;
    padding: 10px 20px;
    border-radius: 5px;
    background-color: #F0E8F8; /* Light version of #E0D0F4 */
    text-align: center;
    position: relative;
    transition: background-color 0.3s ease;
    /*cursor: pointer;*/
}

.step-box.active {
    background-color: #D6F6D1;
    font-weight: 500;
}

.progress-tracker {
    display: flex;
    justify-content: space-between;
    padding: 10px calc((100% - 1200px) / 2);
    gap: 10px;
    background-color: #f8f9fa;
    margin-top: 20px; /* Add space after nav */
}

.loading-message {
    position: relative;
    padding: .75rem 1.25rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
    border: 1px solid #bee5eb;
    border-radius: .25rem;
    color: #0c5460;
    background-color: #d1ecf1;
}

.statistics {
    position: relative;
    padding: .75rem 1.25rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
    border: 1px solid #bee5eb;
    border-radius: .25rem;
    color: #0c5460;
    background-color: #d1ecf1;
    display: none;
}

.detailpop {
    background-color: #FFFFFF;
    border: 1px solid #999999;
    border-top: 0 none black;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    padding: inherit;
    cursor: default;
    display: none;
    position: absolute;

    text-align: left;
    z-index: 5;
}


.card {
    position: relative;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 0.75rem 1.25rem;
    margin-bottom: 0;
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.card-summary {
    padding: 0 1.25rem;
}

.card-body {
    padding: 0 1.25rem;
}

.card-close {
    display: none;
}

.detailpop .card-header {
    display: none
}

.detailpop .card-summary {
    display: none
}

.detailpop .card-close {
    display: inline;
    float: right;
    position: relative;
    cursor: pointer;
    font-weight: bold;
    border-radius: 2px;
    background-color: #cccccc;
    padding: 2px;
}

/* Printing, used by the scenario summary's Export PDF: leave out the page controls and keep each card whole */
/* Compare Scenarios: one column per scenario, field labels down the left */
/* the comparison grid scrolls sideways within the page when it's wider than it, with the row labels and section
   titles staying in view on the left, and a shadow at an edge that has more beyond it */
.compare-frame {
    position: relative;
}

.compare-scroll {
    overflow-x: auto;
}

.compare-frame::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 24px;
    pointer-events: none;
    background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
    opacity: 0;
    transition: opacity .2s;
}

.compare-frame.more-right::after {
    opacity: 1;
}

.compare-frame.more-left .compare-table th[scope="row"],
.compare-frame.more-left .compare-table th[scope="rowgroup"] {
    box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.2);
}

.scroll-note {
    color: #666;
    font-size: 0.875rem;
    text-align: right;
    margin: 0 0 0.5rem;
}

.compare-table {
    background-color: #fff;
}

.compare-table th {
    text-align: left;
}

.compare-table th[scope="row"], .compare-table th[scope="rowgroup"] {
    position: sticky;
    left: 0;
    z-index: 1;
}

.compare-table th[scope="row"] {
    width: 14rem;
    min-width: 12rem;
    font-weight: 600;
    vertical-align: top;
    background-color: #fff;
}

.compare-table td {
    min-width: 14rem;
    vertical-align: top;
    white-space: normal;
}

.compare-table .compare-section th, .compare-table .compare-section td {
    background-color: #FDECC0;
    font-size: 1.1rem;
}

/* Printing (and Export PDF) - last, so that these override the rules above, which have the same specificity */
@media print {
    body {
        background-color: white;
    }

    .top-nav {
        padding: 0 0 10px 0;
    }

    .nav-buttons, .progress-tracker, .local-nav, .tooltip-container, .messages, .error, .confirm, .friendly-time,
    .take-route-button {
        display: none !important;
    }

    .full-time {
        display: inline;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .card {
        break-inside: avoid;
        overflow-wrap: anywhere;   /* long source URLs would otherwise run off the page */
    }

    .table-responsive, .compare-scroll {
        overflow: visible;
    }

    .scroll-note, .compare-frame::after {
        display: none;
    }

    .compare-table tr {
        break-inside: avoid;
    }

    /* the grid fits the page's width: columns share it equally, in smaller text, with long words wrapping, and the
       row labels and section titles aren't fixed in place */
    .compare-table {
        table-layout: fixed;
        width: 100%;
        font-size: 9pt;
    }

    .compare-table td, .compare-table th[scope="row"], .compare-table th[scope="rowgroup"] {
        min-width: 0;
        overflow-wrap: anywhere;
        position: static;
        box-shadow: none;
    }

    .compare-table th[scope="row"], .compare-table th[scope="rowgroup"] {
        width: 9rem;
    }

    .compare-table .compare-section th, .compare-table .compare-section td {
        font-size: 10pt;
    }

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