/* Square radio buttons for profile dialogs */
#profileModal input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #054a63;
    border-radius: 3px;
    background: #fff;
    margin: 0 6px 0 0;
    vertical-align: middle;
    cursor: pointer;
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
#profileModal input[type="radio"]:checked {
    background: #000;
    border-color: #000;
}
#profileModal input[type="radio"].deselected {
    background: #fff !important;
    border-color: #054a63 !important;
}
/* Default button color for all new buttons */
button {
    background: #054a63;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
}
/* Hamburger menu action hover effect */
#menuTextBox > div:hover {
    color: black;
    text-decoration: underline;
    background: white;

}
#column1 {
    padding-left: 75px !important;
}
.collapse-header-title {
    flex: 1;
    text-align: center;
    font-size: 1.15em;
    font-weight: bold;
}
.collapse-header.collapsed {
    border-bottom-left-radius: 6px !important;
    border-bottom-right-radius: 6px !important;
}
#vehicleSpecs_content:not(.open) ~ .collapse-header {
    border-bottom-left-radius: 6px !important;
    border-bottom-right-radius: 6px !important;
}
#vehicleSpecs {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}
/* Dedicated top header area for page title */
.top-header-area {
    width: 100%;
    height: 7vh;
    min-height: 48px;
    background: linear-gradient(to bottom, var(--main-header-bg) 0%, var(--main-header-bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 0;
}
.page-title {
    margin: 0;
    font-size: 2.1em;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
    z-index: 2;
}
.section-label {
    font-weight: bold;
    background: #f3f3f3;
    text-align: left;
    padding: 6px 10px;
    font-size: 1em;
}

.right-value {
    text-align: right;
}

.right-value-input {
    width: 100%;
    box-sizing: border-box;
    border: none;
    padding: 2px 10px;
    font-size: 0.95em;
    background: transparent;
    text-align: right;
}
/* ============================
   GLOBAL COLOR VARIABLES
============================ */
:root {
    /*--main-header-bg: #086588;
    --column-header-bg: #0096CA;*/
    --main-header-bg: #054a63;
    --column-header-bg: #5f7880;   
    --header-text-color: #ffffff;
    --collapse-header-bg: #444;
    --collapse-header-hover: #ffd9b3;
    --collapse-header-text: #ffffff;
    --drop-highlight: #ffe9b3;
}

body {
    font-family: Arial, sans-serif;
    background: #fff;
    margin: 0;
    padding-top: calc(7vh + 25px);
    color: #333;
    overscroll-behavior-y: none;
}

h1 {
    color: #333;
    margin-bottom: 25px;
}

/* ============================
   3‑COLUMN RESPONSIVE GRID
============================ */
.table-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    align-items: start;
    padding-bottom: 40px;
    margin-top: 30px;
}

/* Column wrappers */
.column {
    display: flex;
    flex-direction: column;
    gap: 25px;
        padding-left: 75px;
        padding-right: 50px;
}



#column2 {
    padding-right: 75px !important;
    padding-left: 50px !important;
}

/* ============================
   COLLAPSIBLE TABLE WRAPPER
============================ */
.collapsible-table {
    width: 100%;
}

.collapse-header {
    background: var(--main-header-bg);
    color: var(--collapse-header-text);
    padding: 8px 10px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    user-select: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    position: relative;
    border: 0.25px solid #ccc;
    border-bottom: none;
}

.collapse-header:hover {
    background: var(--collapse-header-hover);
    color: #000;
}

.collapse-header.open {
    border-radius: 6px 6px 0 0;
}

.collapse-header:not(.open) {
    border-radius: 6px 6px 0 0;
}
.collapse-header.collapsed {
    border-radius: 6px 6px 6px 6px !important;
}

.collapse-icon {
    font-size: 0.9em;
    margin-left: auto;
    margin-right: 10px;
    position: static;
}

.collapse-content {
    display: none;
}

.collapse-content.open {
    display: block;
}

/* When collapsed, hide all rows except the sum row (total-row) using visibility: collapse for layout preservation */
.collapse-content:not(#vehicleSpecs_content):not(.open) {
  display: block !important;
}
.collapse-content:not(#vehicleSpecs_content):not(.open) .template-table tr:not(.total-row) {
  visibility: collapse !important;
  height: 0 !important;
}
.collapse-content:not(#vehicleSpecs_content):not(.open) .template-table tr.total-row {
  display: table-row !important;
  visibility: visible !important;
  height: auto !important;
}

/* Hide add/remove row buttons when table is collapsed (excluding vehicleSpecs) */
.collapse-content:not(#vehicleSpecs_content):not(.open) .icon-container {
  display: none !important;
}

/* Keep column widths the same when collapsed (excluding vehicleSpecs) */
.collapse-content:not(#vehicleSpecs_content):not(.open) .template-table {
  table-layout: fixed !important;
  width: 100% !important;
}

/* Enforce colgroup/col widths for all .template-table tables */
.template-table {
    table-layout: fixed !important;
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    overflow: hidden;
}

/* ============================
   TABLE BASE STYLES
============================ */
table {
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: #fff;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    border-width: 0.25px;
    border-style: solid;
    border-color: #ccc;
    font-size: clamp(8px, 1.6vw, 15px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.28);
}

th, td {
    border: 0.25px solid #ccc;
    padding: 0;
    text-align: left;
}

/* MAIN HEADER */
.main-header {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    background: var(--main-header-bg);
    color: var(--header-text-color);
    padding: 6px 0;
    letter-spacing: 1px;
}

/* COLUMN HEADER */
.column-header {
    background: var(--column-header-bg);
    color: var(--header-text-color);
    text-align: center;
    padding: 0 !important;
    white-space: normal;
    word-break: break-word;
    line-height: 1.2em;
}

.column-header input[type="checkbox"] {
    margin: auto !important;
    display: block;
    vertical-align: middle;
    border-width: 0.5px !important;
    padding: 0 !important;
}

/* Center column headers in theCalcs table only */
#theCalcs .column-header {
    text-align: center;
}


/* Center the three percentage cells */
#theCalcs td:has(#vehicleLoadCapacity),
#theCalcs td:has(#trailerLoadCapacity),
#theCalcs td:has(#combinedLoadCapacity) {
    text-align: center;
    padding: 0;
}

.checkbox-cell {
    text-align: center;
    width: 36px;
    position: relative;
    vertical-align: middle;
    padding-top: 0;
    padding-bottom: 0;
}
.grab-bar-icon {
    cursor: grab;
    font-size: 1.15em;
    color: #888;
    user-select: none;
    transition: color 0.2s;
    line-height: 1;
    font-size: inherit;
}

.drag-cell {
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
    height: 100%;
    min-height: 0 !important;
    box-sizing: border-box;
    text-align: center;
    vertical-align: middle;
    line-height: 1 !important;
}

td.drag-cell {
    padding: 0 !important;
    margin: 0 !important;
    height: 100%;
    vertical-align: middle !important;
    box-sizing: border-box;
    line-height: 1 !important;
}

.template-table {
    table-layout: fixed;
}
.grab-bar-icon:hover {
    color: #1976d2;
}


.center-label {
    text-align: center;
}

.left-label {
    text-align: left;
    padding-left: 10px;
}

/* Column widths */
.template-table th:last-child,
.template-table td:last-child {
    width: 66px;
}

.template-table td:nth-child(2),
.template-table th:nth-child(2) {
    width: 205px;
}

/* Editable tables: remove top bevel so they sit flush under headers */
.template-table {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Data table: remove top bevel */
#dataTable {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

td input[type="text"],
td input[type="number"],
.right-value-input {
    width: 100%;
    box-sizing: border-box;
    border: none;
    padding: 2px 10px;
    font-size: 0.95em;
    background: transparent;
    text-align: right;
    outline: none !important;
}

td input[type="text"]:focus,
td input[type="number"]:focus,
.right-value-input:focus,
td input[type="text"]:active,
td input[type="number"]:active,
.right-value-input:active {
    outline: none !important;
    box-shadow: none !important;
}

td input[type="number"] {
    text-align: right;
}

td input[type="text"]:not(.right-value-input) {
    text-align: left;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.zero-gray {
    color: #cccccc !important;
}

.placeholder {
    color: #cccccc;
}

.readonly {
    background: #e0e0e0;
    font-weight: bold;
    padding: 6px 10px;
    text-align: right;
}

/* ICON BUTTONS */
.icon-btn {
    background: var(--main-header-bg);
    color: var(--header-text-color);
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    padding: 2px 4px;
    margin: 0;
    border-radius: 3px;
    line-height: 1;
}

.icon-btn:hover {
    background: #064d66;
}

.icon-container {
    display: flex;
    justify-content: center;
    gap: 2px;
}

/* ============================
   DRAG & DROP STYLES
============================ */
.draggable-row {
    cursor: move;
}

.drop-target-highlight {
    background-color: var(--drop-highlight) !important;
}

.drag-over-above {
    border-top: 3px solid #ff9800 !important;
}

.drag-over-below {
    border-bottom: 3px solid #ff9800 !important;
}

.total-row {
    background: #d6d9dc;
}
.total-row td {
    background: #e5e8eb;
    z-index: 1;
    position: relative;
}

.total-row .center-label {
    font-weight: bold;
}

#menuContainer {
    right: 75px;
}

#calcsWrapper {
    background: #fff;
    border-bottom: 2px solid #ccc;
    padding-bottom: 15px;
    margin-bottom: 15px;
    position: sticky;
    top: max(7vh, 48px);
    z-index: 99;
}

#theCalcs {
    border-radius: 6px 6px 6px 6px !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.28);
}

#theCalcs tr td:nth-child(even) {
    display: none;
}

#theCalcs td.right-value, #theCalcs th.right-value {
    text-align: center;
    padding: 0;
}
#theCalcs td.right-value span {
    display: inline-block;
    text-align: right;
    min-width: 5ch;
    padding-right: 8px;
}

#vehicleSpecs tr {
    height: 24px;
}

#vehicleSpecs th:first-child,
#vehicleSpecs td:first-child {
    width: 75%;
}

#vehicleSpecs th:last-child,
#vehicleSpecs td:last-child {
    width: 25%;
}

#vehicleSpecs input[type="text"] {
    background: #fff !important;
}

#vehicleSpecs input.right-value-input,
#vehicleSpecs input[type="text"].right-value-input {
    background: #fff !important;
}

#vehicleSpecs input.right-value-input:focus,
#vehicleSpecs input.right-value-input:active {
    background: #fff !important;
}

#vehicleSpecs input.right-value-input:-webkit-autofill,
#vehicleSpecs input.right-value-input:-webkit-autofill:focus {
    background: #fff !important;
    -webkit-box-shadow: 0 0 0 30px #fff inset !important;
    color: #333 !important;
}

#vehicleSpecs input.right-value-input:-moz-autofill {
    background: #fff !important;
    box-shadow: 0 0 0 30px #fff inset !important;
    color: #333 !important;
}

table tr {
    height: 24px;
}

/* Tooltip container */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

/* Tooltip text */
.tooltip .tooltiptext {
  visibility: hidden;
  width: 320px;
  background-color: #333;
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 8px 10px;
  position: absolute;
  z-index: 1;
  top: 100%;
  left: 0;
  margin-left: 0;
  font-size: 11px;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Custom checkbox background color */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background-color: #e0e0e0;
    border: 1.5px solid #888;
    width: 14.4px;
    height: 14.4px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s, border 0.2s;
    margin: 0 !important;
    padding: 0 !important;
}
input[type="checkbox"]:checked {
    background-color: #fff !important;
    border-color: #888 !important;
    color: #000 !important;
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 0.5px;
    width: 3px;
    height: 6px;
    border: solid #000;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

tfoot .total-row td {
    background: #d6d9dc;
    z-index: 1;
    position: relative;
    background-clip: padding-box;
}

/* ============================
   MOBILE LAYOUT
============================ */
@media (max-width: 768px) {
    body {
        padding-top: calc(7vh + 15px);
    }

    .table-grid {
        grid-template-columns: 1fr !important;
    }

    #column1, #column2, .column {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    #calcsWrapper {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    #calcsWrapper.is-fixed {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    #specsWrapper {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    #menuContainer {
        right: 16px !important;
        left: auto !important;
    }

    #hamburgerMenu {
        padding: 1px 4px !important;
    }

    .template-table {
        font-size: 12px !important;
    }

    .grab-bar-icon {
        font-size: 18px !important;
    }

    .top-header-area {
        justify-content: flex-start;
    }

    .page-title {
        margin-left: 16px;
    }
}

