﻿/* ==========================================================================
   General & Base Styles
   ========================================================================== */

/* Custom properties for easy color management */
:root {
    --primary-bg-color: #f1f5f9;
    --secondary-bg-color: #ffffff;
    --border-color: #e2e8f0;
    --text-color-dark: #334155;
    --text-color-light: #475569;
    --pending-color: #f59e0b;
    --completed-color: #22c55e;
    --header-bg: #b0bec5;
    --card-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    --page-color: #f8f8f8;
    --border-roundness: 0.5em;
    --separator-size: 0.25em;
}

.round-all {
    border-radius: var(--border-roundness);
}
.round-tl {
    border-top-left-radius: var(--border-roundness);
}
.round-tr {
    border-top-right-radius: var(--border-roundness);
}
.round-bl {
    border-bottom-left-radius: var(--border-roundness);
}
.round-br {
    border-bottom-right-radius: var(--border-roundness);
}
.noborder {
    border: none;
}

.separator-row {
    border: none;
    background-color: var(--page-color);
    height: var(--separator-size);
    padding: 0;
}

table {
    th.separator-col, td.separator-col {
        border: none;
        background-color: var(--page-color) !important;
        width: var(--separator-size);
        padding: 0;
    }

    #routes-table {
        border-collapse: collapse;
        width: 100%;
        /* background-color: var(--primary-bg-color); */
        font-size: 0.875rem;

        th:last-child, td:last-child {
            text-align: center;
            min-width: 5em;
        }
    }

    #routes-table.table thead * {
        background-color: var(--header-bg);
        color: var(--text-color-dark);
        font-weight: 600;
        border: none !important;
    }

    #routes-table.table thead tr.header *, #routes-table.table thead tr.header th {
        padding: 1rem;
        text-align: left;
        border: none !important;
    }

    #routes-table tbody tr:hover {
        background-color: var(--primary-bg-color);
    }
}

.status-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}
.status-icon-svg {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
.status-completed-icon { background-image: url('css/checked.svg'); }
.status-pending-icon { background-image: url('css/clock.svg'); }

.action-icon-btn {
    background: none;
    border: none;
    color: var(--text-color-light);
    cursor: pointer;
    padding: 0;
    margin: 0 4px;
    font-size: 1.25rem;
    transition: color 0.2s ease;
}
.action-icon-btn:hover { color: var(--text-color-dark); }

.loader {
    display: none;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 2s linear infinite;
}

* {
    font-family: roboto, system-ui, arial, helvetica, sans-serif; /* Added sans-serif fallback */
    box-sizing: border-box; /* Modern standard for easier layout math */
}

br {
    clear: both;
}

body {
    background-color: var(--page-color);
    color: var(--text-color-light);
    padding: 0;
    margin: 0;
    color: #333;
}

.hidden {
    visibility: collapse;
}

.seperate.cost_table {
    border-left: solid 0px var(--page-color);
}

.main-card {
    background-color: var(--secondary-bg-color);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h4 {
    margin: 0;
    font-weight: bold;
    color: var(--text-color-dark);
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    color: var(--text-color-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

br { /* Ensure line breaks behave as expected */
    clear: both;
}

/* ==========================================================================
   Main Layout
   ========================================================================== */

.content {
    padding: 2em;
    max-width: 1710px;
    margin: 4ex auto;
}

    .content span { /* Specific to Default.aspx and userentries.aspx parameter spans */
        display: inline-grid; /* Kept for backward compatibility with existing layout */
    }

#drop-container {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--page-color);
}

#file-name-holder {
    /* This negative margin is fragile and used to pull the element up. */
    width: calc(100% - 4em);
    margin: -27ex 0 0 0;
    height: 26ex;
    overflow: auto;
    display: none;
}

#results-holder { /* Specific to Default.aspx and test.html results table */
    display: 100%;
    tbody {
        td {
            border: none;
            text-align:right;
        }
    }
    tbody {
        td:first-child,td:nth-child(12) {
            text-align:inherit;
        }
    }
    div {
        display: inline-flex;
        gap: 1rem;
        align-items: flex-start;
        width: 100%;
    }
}

/* ==========================================================================
   Components
   ========================================================================== */

/* --- Parameters Bar --- */
.paramscontent {
    background: #ECEFF1;
    padding: 0.5em 1em;
    margin: 0 0 2em 0;
    position: relative;
    z-index: 20; /* Higher than drop container */
    border-radius: 1.5ex;
}

.paramscontent > div {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    flex-direction: row;
}

.paramscontent span {
    margin: 0.5em 1em 0.5em 0;
}

#calculationparams {
    /* Original -4ex negative margin was fragile. Replaced with flex gap. */
    width: auto;
    margin-top: 0em;
    flex-direction: row;
    flex-wrap: nowrap;
}

/* --- Forms & Inputs --- */
.input {
    background-color: #CFD8DC;
    border: none;
    outline: none;
    padding: 0.5em;
    font-size: 1em;
    margin-left: 0.5em;
}

    .input:focus {
        background: #FAFAFA;
    }

    .input.disabled {
        background-color: transparent;
        cursor: not-allowed;
    }

/* --- File Upload --- */
#drop-files {
    border-radius: 10px;
    border: 4px dashed rgba(0, 0, 0, 0.2);
    padding: 3em 0 1em 0;
    text-align: center;
    font-size: 1.5em;
    margin: -1ex 0em;
    cursor: pointer;
    background: url('css/upload.svg') no-repeat center 1em rgba(222, 222, 222, 0.2);
}

#uploaded-files {
    padding: 0;
    margin: 0;
    color: #545454;
    display: none;
}

#uploaded-files li {
    font-family: "consolas", "courier new", "courier", monospace;
    padding: 10px;
    font-size: 10pt;
    line-height: 1em;
    color: #545454;
    list-style-type: none;
    border-bottom: 1px solid #eee;
}

/* --- Results & Tables --- */
table {
    border: 0;
    border-collapse: collapse;
}

#results-holder table {
    width: 100%;
}

td,
th {
    padding: 0.5ex 1ex;
}

thead th {
    text-align: center;
    background: #b0bec5 !important;
    color: #dedede; /* was rgba(222,222,222,1) */
}

thead td {
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    color: #333;
    vertical-align: bottom;
}

tbody th {
    text-align: left;
    background: #b0bec5 !important;
    color: #dedede;
}

#results-holder table tbody td {
    text-align: right;
}

/* First table in a result block */
#results-holder > div > div > table:first-of-type tbody td {
    background: #afeeff; /* was rgba(175,238,255,1) */
}

table.unstriped tbody tr.calculated-true {
    background: #A5D6A7;
    border-bottom: 2px solid #81c784;
}

table.unstriped tbody tr.calculated-false {
    background: #FFE082;
    border-bottom: 2px solid #ffd54f;
}

/* --- Toggle Switch --- */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    vertical-align: middle;
}

.content span .switch {
    margin-left: 0.5em;
    height: 40px;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .2s;
}

    .slider:before {
        position: absolute;
        content: "";
        height: 20px;
        width: 20px;
        left: 2px;
        bottom: 2px;
        background-color: white;
        transition: .2s;
    }

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 24px;
    height: 24px;
    width: 44px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Pagination styles from Default.aspx */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination a, .pagination span {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--text-color-light);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pagination a:hover {
    background-color: var(--primary-bg-color);
    color: var(--text-color-dark);
}

.pagination .active {
    background-color: var(--border-color);
    font-weight: bold;
    color: var(--text-color-dark);
}

.pagination-arrow {
    font-size: 1.5rem;
}

td.processing {
    text-align: center;
    padding: 10px;
    background-color: #dee2e6;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .paramscontent,
    #drop-container,
    #file-name-holder {
        display: none;
    }

    #results-holder {
        display: block; /* Reset flex for printing */
    }

    /* This class is not in the HTML, but kept in case it's used by JS */
    .item-result {
        font-size: 8pt;
        float: left;
        width: 29.5em;
    }

    #results-holder table {
        width: 100%;
        page-break-inside: avoid; /* Avoid breaking tables across pages */
        display: table;
        flex: none;
    }
}
.rightaligned {
    zoom: 0.9;
    table {
        th {
            color: black;
            font-weight:500;
        }
        td {
            text-align: right;
            font-family: ui-sans-serif, system-ui, Consolas, ui-monospace ;
        }
    }
}

#results-holder .btn.delete-result-btn {
    text-decoration:none;
    font-size: 1.4rem;
    line-height: 1;
    vertical-align: middle;
}


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

.modal-backdrop {width: 100%; height: 100%;}