body {
    font-family: Arial, sans-serif;
}
body::before {
  content: ""; /* Required for pseudo-element */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/images/bg.png');
  background-size: cover;
  opacity: 0.2; /* 0 = transparent, 1 = opaque */
  z-index: -1; /* Place behind content */
}
.font-sans{
	font-family:var(--font-sans),ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"
}

.container, .general-requirements {
    width: 85%;
    margin: 0 auto;
    position: relative;
    z-index: 0;
}
/* Ensure container properly contains the table */
.container {
    max-height: 750px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
//    background-color: #fafafa;
    border: none;
    margin: 0 auto;
    padding: 0; /* Remove any padding that might cause gaps */
    /* Add containing context for sticky positioning */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Update table styles to ensure proper border rendering */
table {
    width: 100%;
    background-color: transparent;
    border-collapse: separate;
    border-spacing: 0;
    position: relative;
    margin-top: 0;
}
/* Update thead styles to allow for mixed backgrounds */
thead {
    position: sticky;
    top: 0;
    z-index: 3;
    border: 4px solid #799d7f;
    margin: 0;
    padding: 0;
    display: table-header-group; /* Ensure proper table header behavior */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Add isolation to create a new stacking context */
    isolation: isolate;
    /* Remove background-color from thead to allow cell-specific backgrounds */
    background-color: transparent;
}

/* Remove any background transparency */
thead th,
thead td {
    background-color: #799d7f; /* Use solid color instead of transparent */
}
th, td {
    padding: 8px;
    text-align: center;
}
tbody {
    z-index: 2;
}
thead .order_head_0 th {
    color:            #799d7f;
    background-color: #fafafa;
    border-top: 2px solid #799d7f !important;
}
thead .order_head_right {
    border-right: 2px solid #799d7f !important;
}
thead .order_head_left {
    border-left: 2px solid #799d7f !important;
}
.order_sep {
    border-right: 2px dashed #799d7f !important;
}
.order_head_sep {
    border-right: 2px dashed #fafafa !important;
}
/* Clean up display element styles */
/*
#order_head_1r,
.order_head_1r th{
    background-color: #fafafa;
    color: black;
}
*/

div[style*="display"],
div[id^="disp-"],
#disp-r1c1 {
//    background-color: #fafafa;
    background-color: transparent;
    color: black;
}
/* Body rows - adjust spacing */
tbody tr {
    //    background-color: #fafafa;
    background-color: transparent;
}

/* Body cells - ensure proper alignment */
td {
    border: 1px solid #ddd;
    padding: 8px;
    vertical-align: middle;
//    background-color: #fafafa;
    background-color: transparent;
}
th,
#disp-r1 {
    /* background-color: #4CAF50;*/
    background-color: #799d7f;
    /*color: #b0f090;*/
    color: #fafafa;	    
}
/* Remove borders for specific header rows */
.order_head_1 th,
.order_head_1 td,
.order_head_2 th,
.order_head_2 td {
    border: none;
}

/* Remove all previous border styles */
tr.order_row_1,
tr.order_row_2,
.order_row_1 td,
.order_row_2 td {
    padding: 8px;
    text-align: center;
}

/* Add specific border styles with strong specificity */
.order_row_1 td{
    border: none;
    border-top: 2px solid #799d7f !important;
}
.order_head_1 th,
#order_head_1r,
.order_head_1 td {
    border: none;
    border-top: 4px solid #799d7f !important;
}
#order_head_1r,
.order_head_1r th,
.order_head_2r th,
.order_row_1r,
.order_row_2r {
    border-right: 4px solid #799d7f !important;
}
.order_head_1l,
.order_head_2l,
.order_row_1l,
.order_row_2l {
    border-left: 4px solid #799d7f !important;
}

.order_head_1r th{
    background-color: #fafafa;
}
.order_2_rows {
    height: 4em;  
}
td.order_2_rows,
.order_row_2 td{
    border: none;
    border-bottom: 2px solid #799d7f !important;
}
.order_2_rows td{
    border-top: 2px solid #799d7f !important;
}
* Update header row styles to prevent gaps */
/* Ensure header rows stay together */
.order_head_1,
.order_head_2 {
    position: relative;
    background-color: #799d7f;
    margin: 0;
    padding: 0;
    display: table-row;
    border: none;
    /* Add transform to create a new stacking context */
    transform: translateZ(0);
}

/* Reset other header cells to maintain green background */
.order_head_1 th,
.order_head_2 th,
.order_head_2 td,
.order_row_1l {
    background-color: #799d7f;
    color: white;
    padding: 8px;
    text-align: center;
    border: none;
    position: relative;
    vertical-align: middle;
    height: auto; /* Let content determine height */
    box-sizing: border-box;
}

/* Ensure tbody cells don't interfere with order row borders */
tbody td {
    position: relative;
    border: 1px solid #ddd;
    padding: 8px;
    vertical-align: middle;
}

.outline-row {
  display: inline-flex;
  align-items: center;     /* Vertically centers children, even when content wraps */
  gap: 0.3em;              /* Optional: spacing between text and icon */
  margin-right: 1.5em;
}

.info-icon {
    position:       absolute;
    font-size:      inherit;
    vertical-align: middle;
    right:          0.5em;
    margin-left:    0.5em;
    cursor:         pointer;
    color:          #ff00d0;
}

.dim-row .info-icon {
    position:       static;  /* Or just remove absolute positioning */
    display:        inline-block;
    //vertical-align: middle;
    margin-left:    0.3em;  /* Add some spacing */
    margin-bottom:  0.4em;
    cursor:         pointer;
    color:          #ff00d0;
  font-size:        inherit;
}


.info-popup {
    display:       none;
    position:      absolute;
    min-width:     250px;
    top:           25px;
    left:          50%;
    transform:     translateX(-50%);
    background:    #fafafa;
    color:         #000000;    
    padding:       10px;
    border:        1px solid #799d7f;
    border-radius: 8px;
    z-index:       100;
    text-align: center;
}

.info-icon:hover .info-popup {
    display: block;
}

.vertical-layout {
    display:         flex;
    flex-direction:  column;
    justify-content: space-between;
    height:          100%;
    box-sizing:      border-box;
    padding:         0.25em 0;
    text-align:      center;
}
/*
.vertical-layout > div {
    margin: 0;
}
*/
#quantity {
    width: 12ch;
}
#material-text {
    vertical-align: bottom;
}
/* Input field widths - only these should control input sizes */
.order_dim_wide,
#job_route,
#job_pcb_kerf,
#job_rail_kerf {
    width: 10ch;
}

.order_dim_narrow {
    width: 7ch;
}

#job_pcb_layers  {
    width: 4ch;
}

.text-input {
    width: 20ch;
}
.dim-row {
    position:      relative;
    display:       inline-flex;
    align-items:   center; /* aligns input and label vertically */
    margin-bottom: 0.2em;
    gap:           0.3em;
}

.dim-label {
  display: inline-block;
  width: 3.5em; /* fixed label width */
  text-align: right;
  margin-right: 0.5em;
}

.dim-label-wide {
  display: inline-block;
  width: 5em; /* fixed label width */
  text-align: right;
  margin-right: 0.5em;
}

.dim-label-wider {
  display: inline-block;
  width: 8em; /* fixed label width */
  min-width: 8em;
  text-align: right;
  margin-right: 0.5em;
}

/* Systematic Column Width Control - order_head_1 controls all columns below */
:root {
    --order-standard-width: 26ch;
}
.order_head_0 th:nth-child(1),
.order_head_1 th:nth-child(1) {  /* Order # */
    min-width: 14ch;
    width:     14ch;
}
.order_head_0 th:nth-child(2),
.order_head_1 th:nth-child(2) {  /* Project Name */
    min-width: var(--order-standard-width);
    width:     var(--order-standard-width);
}
.order_head_0 th:nth-child(3),
.order_head_1 th:nth-child(3) {  /* PCB Part Number */
    min-width: var(--order-standard-width);
    width:     var(--order-standard-width);
}
.order_head_0 th:nth-child(4),
.order_head_1 th:nth-child(4) {  /* Working Panel */
    min-width: var(--order-standard-width);
    width:     var(--order-standard-width);
}
.order_head_0 th:nth-child(5),
.order_head_1 th:nth-child(5) {  /* Conductive Layers */
    min-width: var(--order-standard-width);
    width:     var(--order-standard-width);
}
.order_head_0 th:nth-child(6),
.order_head_1 th:nth-child(6) {  /* Rail Size */
    min_width: var(--order-standard-width);
    width:     var(--order-standard-width);
}
.order_head_0 th:nth-child(7),
.order_head_1 th:nth-child(7) {  /* Stiffeners */
    width: auto;
}

/* Status cell colors - using attribute selectors since IDs are still in data rows */
#disp-found_savings {
    background-color: green;
    color: white;
}

#disp-found_no_savings {
    background-color: red;
    color: white;
}

#disp-incomplete {
    background-color: yellow;
    color: gray;
}

#disp-new {
    background-color: #fafafa;
    color: black;
}

.text-input {
    width: 20ch;
}

.inline-div {
    display: inline;
}

/* Input pair grid layout for Widthwise/Lengthwise inputs */
.input-pair-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5em;
    align-items: center;
    max-width: 100%;
}

.input-pair-grid span {
    text-align: right;
    white-space: nowrap;
    padding-right: 0.25em;
}

/* Hide main container scrollbar when popup is open */
.popup-open .container {
    overflow: hidden;
}

/* Popup container styles - similar to main container but with different class */
.popup-container {
    width: 80%;
    margin: 0 auto;
    position: relative;
    z-index: 0;
    max-height: 800px;
    overflow-y: auto;
    border: none;
    padding: 0;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Ensure popup content still scrolls */
.popup-open #tableModal,
.popup-open #pdfModal {
    overflow-y: auto;
}

.error-message {
    color:          red;
    font-size:      0.9em;
}

.order-btn {
    min-width: 12ch;
}

/* Distribute Remove and New buttons vertically within their cell */
/* Reset the cell to normal table cell behavior */
.order_row_2l {
    /* Keep normal table cell properties */
    padding: 0;
    vertical-align: middle;
    position: relative;
}

/* Create a flexbox wrapper inside the cell */
.order_row_2l .button-container {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    height: 100%;
    min-height: 4em; /* Ensure consistent height with other cells */
    padding: 0.5em;
    box-sizing: border-box;
}

.order_row_2l .order-btn {
    margin: 0.25em 0;
    flex: 1;
    max-height: 2.5em;
    min-height: 1.8em;
}

/* Add 2px white border between form_new and rest of table header */
#form_new tr:first-child th {
    border-top: 2px solid #fafafa !important;
}

/* Fix text color for 'Attach outline' and 'No file chosen' in form_new */
#form_new .dim-label-wider,
#form_new span[id^="chosen_"] {
    color: #fafafa !important;
}

/* Style readonly/disabled inputs in existing orders */
tbody input[readonly],
tbody select[disabled],
tbody button[disabled] {
    background-color: #f5f5f5 !important;
    color: #666 !important;
    border-color: #ccc !important;
    cursor: not-allowed;
}

/* Ensure readonly inputs still show their values clearly */
tbody input[readonly] {
    opacity: 0.8;
}

tbody select[disabled] {
    opacity: 0.8;
}

/* Header Attach Outline now uses standard outline-row class like PCB Outline and Panel Defaults */
/* The standard .info-icon and .outline-row CSS rules will handle positioning */

/* Additional spacing for attach controls */
.attach-controls {
    margin-top: 0.3em;
}
