/* Print-first responsive design */
@page {
    size: 8.5in 11in;
    margin: 0.3in;
}

/* Base styles */
.modern-form {
    font-family: Arial, sans-serif;
    font-size: 11px;
    line-height: 1.2;
    color: #000;
    background: #fff;
}

/* === GENERIC LAYOUT COMPONENTS === */

/* Headers */
.header-main {
    display: flex;
    align-items: center; /* Changed from flex-start to center */
    justify-content: space-between; /* Distribute space evenly */
    gap: 20px; /* Reduced gap for better spacing */
    margin-bottom: 8px;
    border-bottom: 1px solid #000;
    padding-bottom: 8px;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.button-group button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-section {
    background: #f5f5f5;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: #333;
}

.header-column {
    background: #e9e9e9;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    color: #333;
    margin-bottom: 2px;
}

.header-upgrade {
    background: #666;
    color: #fff;
    padding: 2px 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.header-subtext {
    font-size: 11px;
    font-weight: normal;
    text-transform: none;
    color: #666;
    margin-top: 2px;
    line-height: 1.2;
}

/* Form Title Display */
.form-title-display {
	margin-left: 20px;
	flex: 0 0 auto;
}
.form-title-display h2 {
	margin: 0;
	font-size: 24px;
	font-weight: bold;
	color: #333;
	letter-spacing: 0.5px;
	white-space: nowrap;
}

.version-footer {
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 10px;
    color: #000;
    z-index: 100;
}

/* Shipping address display (print only) */
.shipping-address-display {
    display: none; /* Hidden on screen */
}

.shipping-address-line {
    font-size: 11px;
    color: #333;
    text-align: center;
    font-weight: normal;
    line-height: 1.3;
}

/* Containers */
.container-flex {
    display: flex;
    gap: 12px;
}

.container-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.container-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.container-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.container-grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, auto)); gap: 6px; }

.container-grid-3colstack {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    align-content: start;
}

/* Boxes */
.box {
    border-radius: 3px;
    /*overflow: hidden;*/
    margin-bottom: 2px;
}

.box-bordered {
    border: 1px solid #ddd;
}

.box-section {
    border: 1px solid #000;
    background: #f9f9f9;
    padding: 8px;
    border-radius: 4px;
}

.box-upgrade {
    border: 1px solid #666;
    margin-bottom: 4px;
}

.box-content {
    padding: 4px;
    background: #fff;
}

.box-content-shaded {
    padding: 4px;
    background: #e9e9e9;
}

.box-content-compact {
    padding: 4px;
}

/* Columns */
.col { flex: 1; }
.col-narrow { flex: 0 0 200px; }
.col-medium { flex: 0 0 280px; }
.col-wide { flex: 0 0 500px; }
.col-auto { flex: 0 0 auto; }

.flex-column-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Alternate layout that will stack on mobile and use side by side (row) for wider screens */
.flex-column-row-center {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
}
/*
.flex-column-row-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
/*

.section-secondary {
    flex: 1 1 250px;
    min-width: 200px;
}

.section-primary {
    flex: 2 1 300px;
    min-width: 280px;
}

.section-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 0.9rem;
}

.stack-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stack-primary {
    margin-bottom: 0.5rem;
}


/* === FORM ELEMENTS === */

/* Fields */
.field-group {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.field {
    display: flex;
    flex-direction: column;
    position: relative;
}

.field input,
.field select {
    border: none;
    border-bottom: 1px solid #000;
    padding: 2px 0;
    font-size: 11px;
    background: transparent;
    min-width: 0;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-bottom: 2px solid #A50034;
}

.field-label {
    font-size: 11px;
    color: #000;
    margin-top: 2px;
    white-space: nowrap;
}

/* Input variations */
.input-degrees {
    width: 50px;
    padding: 2px 4px;
    border: 1px solid #ccc;
    border-radius: 2px;
    text-align: center;
    font-size: 11px;
}

.input-count {
    width: 35px;
    text-align: center;
    border: 1px solid #ccc;
    padding: 1px;
}

/* Checkboxes */
.check-group {
    display: flex;
    row-gap: 4px;
    column-gap: 8px;
    /*margin-bottom: 6px;*/
    flex-wrap: wrap;
}

.check-group-v { flex-direction: column; }
.check-group-h { flex-direction: row; }
.check-group-center { justify-content: center; }
.check-group.text-center {
    justify-content: center;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.check-item label {
    display: flex;
    align-items: center;
    line-height: 1;
    margin: 0;
}

.check-item-bordered {
    padding: 4px 6px;
    border-bottom: 1px solid #eee;
}

.check-item-bordered:last-child {
    border-bottom: none;
}

.check-item input[type="checkbox"],
.check-item input[type="radio"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: #A50034;
}

.check-item-highlight {
    background: #f0f8ff;
}

.check-item-highlight label {
    font-weight: bold;
    color: #007bff;
}

.text-center .check-item {
    justify-content: center;
}

.justify-center {
    justify-content: center;
}

.text-area {
    width: 100%;
    padding: 2px;
    font-size: 11px;
    font-family: Arial, sans-serif;
    resize: vertical;
    border: 1px solid #ccc;
    box-sizing: border-box;
}


/* Remove the disabled styling for enabled-by-dependency elements */
.enabled-by-dependency {
    opacity: 1 !important;
    cursor: text !important;
    pointer-events: auto !important;
}

.enabled-by-dependency:hover {
    cursor: text !important;
}

/* Only show disabled styling when actually disabled */
.disabled-by-dependency {
    opacity: 0.4;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.disabled-by-dependency:hover {
    cursor: not-allowed !important;
}

/* Enhanced disabled styling for unified system */
.disabled-by-conflict {
    opacity: 0.4;
    cursor: not-allowed !important;
    pointer-events: auto; /* Allow clicks for tooltips */
}

.disabled-by-conflict input[type="checkbox"],
.disabled-by-conflict input[type="radio"] {
    cursor: not-allowed !important;
}

.disabled-by-conflict label {
    cursor: not-allowed !important;
    color: #999;
}

/* Remove the visual indicator/caution icon */
.disabled-by-conflict::after {
    display: none;
}

/* Tooltip styling */
.disabled-tooltip {
    position: fixed;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    max-width: 250px;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    line-height: 1.4;
    z-index: 1000;
    white-space: normal;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Rigidity chart specific styling */
/*
.rigidity-chart.disabled-by-conflict {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: auto; 
}
.rigidity-chart.disabled-by-conflict .rigidity-item {
    cursor: not-allowed;
}
.rigidity-chart.disabled-by-conflict .rigidity-item input[type="radio"] {
    cursor: not-allowed;
}
*/







/* === SPECIFIC COMPONENTS === */

/* Logo */
.logo-container {
    flex-shrink: 0;
}

.logo-container img {
    max-width: 180px;
    height: auto;
}

/* Menu */
.menu-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px;
    background-color: white;
    border-bottom: 1px solid #ddd;
    width: 100%;
    z-index: 99;
    flex-wrap: wrap;
}

.menu-container #nosaving {
    color: #dc3545;
    font-weight: bold;
    font-size: 12px;
}

.menu-container .button {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.menu-container .button:hover {
    background: #e9ecef;
}

.menu-container .button.no-hover:hover {
    background: #f8f9fa;
}

/* Order options */
.order-options {
    background: #f5f5f5;
    padding: 6px;
    border: 1px solid #ccc;
}

.option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 10px;
}

/* Product selection */
.product-option {
    display: flex;
    flex-direction: column;
}

.product-description {
    font-size: 9px;
    color: #666;
    line-height: 1.2;
    margin-bottom: 4px;
}

#clear-form-btn {
    flex: 1; /* Take up available space */
    max-width: 150px; /* Limit button width */
    margin: 0 auto; /* Center the button horizontally */
    padding: 10px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    align-self: center; /* Ensure button is vertically centered */
}

#clear-form-btn:hover {
    background: #c82333;
}

/* Images */
/*
.img-option {
    max-width: 50px;
    height: auto;
    display: block;
    margin: 4px auto 0;
}
*/

.img-option {
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 4px auto 0;
}

.img-size-1 { max-width: 40px; }
.img-size-2 { max-width: 60px; }
.img-size-3 { max-width: 80px; }
.img-size-4 { max-width: 100px; }
.img-size-5 { max-width: 120px; }
.img-size-6 { max-width: 140px; }
.img-size-7 { max-width: 160px; }

.img-inline {
    width: 50px;
    height: auto;
    flex-shrink: 0;
}

.img-rotated-90 {
    transform: rotate(90deg);
    transform-origin: center;
    width: auto; 
    height: auto;
}
.img-rotated-180 {
    transform: rotate(180deg);
    transform-origin: center;
    width: auto;
    height: auto;
}
.img-rotated-270 {
    transform: rotate(270deg);
    transform-origin: center;
    width: auto; 
    height: auto;
}

/* Padding length image sprite */
.padding-length-sprite {
    background-image: url('../img/PadLengths.png');
    background-repeat: no-repeat;
    width: 32px;
    height: 90px;
    background-size: 165px auto; /* reduce size of original image (207px wide) */
    margin: 2px auto 0;
    display: block;
}

/* Sprite positions for each padding length option */
.padding-length-sprite.heel-to-mets {
    background-position: 0 0; /* First image */
}
.padding-length-sprite.heel-to-sulcus {
    background-position: -33px 0; /* Second image */
}
.padding-length-sprite.heel-to-toes {
    background-position: -66px 0; /* Third image */
}
.padding-length-sprite.distal-end-to-sulcus {
    background-position: -100px 0; /* Fourth image */
}
.padding-length-sprite.distal-end-to-toes {
    background-position: -133px 0; /* Fifth image */
}

/* Hide the sprite when no option is selected */
.padding-length-sprite:not(.heel-to-mets):not(.heel-to-sulcus):not(.heel-to-toes):not(.distal-end-to-sulcus):not(.distal-end-to-toes) {
    background-image: none;
}
/* End padding length sprite */



/* Rigidity chart */
.rigidity-chart {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.rigidity-option {
    position: relative;
}

/* Hide radio buttons but keep them accessible */
.rigidity-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Style the labels as buttons */
.rigidity-btn {
    display: block;
    text-align: center;
    font-size: 11px;
    padding: 4px 2px;
    border: 1px solid #ddd;
    border-radius: 2px;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.1s ease;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    user-select: none;
}

.rigidity-btn:hover {
    background: #e9e9e9;
}

/* Selected state - this should be rock solid */
.rigidity-radio:checked + .rigidity-btn {
    background: #A50034 !important;
    color: #fff !important;
    border-color: #A50034 !important;
}

/* Disabled styling */
.rigidity-chart.disabled-by-conflict .rigidity-btn {
    cursor: not-allowed !important;
    background: #f8f8f8 !important;
    color: #aaa !important;
    border-color: #ddd !important;
}

.rigidity-chart.disabled-by-conflict .rigidity-radio:checked + .rigidity-btn {
    background: #ccc !important;
    color: #888 !important;
    border-color: #bbb !important;
}
/* End rigidity chart */


/* triplet grid layout */
.triplet-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.triplet-header-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    text-align: center;
    font-weight: bold;
    font-size: 10px;
    color: #333;
    padding: 2px 4px 0 5px;
}

.triplet-header {
    white-space: nowrap;
}

.triplet-column-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
}

.triplet-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.triplet-labels label {
    display: flex;
    align-items: center; /* ensures vertical alignment with checkboxes */
    justify-content: center;
    height: 14px;         /* matches checkbox height */
    font-size: 11px;
    white-space: nowrap;
}
/* end triplet grid layout */

/* Special sections */
.hide-accommodative:has(input[data-val="soft-thermocork"]) {
    display: none !important;
}

/* === UTILITY CLASSES === */

/* Text */
.text-title {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.text-label {
    font-size: 11px;
    font-weight: bold;
    /*margin-bottom: 4px;*/
    text-transform: none;
    color: #333;
}

.text-bold { font-weight: bold; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-medium { font-size: 12px; }
.text-small { font-size: 11px; }
.text-xs { font-size: 8px; }

.text-gray { color: #666; }

.plus-symbol {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    vertical-align: middle;
}

/* Spacing */
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}
.m-0 { margin: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.ml-3 { margin-left: 12px; }
.ml-4 { margin-left: 18px; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.mr-3 { margin-right: 12px; }
.mr-4 { margin-right: 18px; }

.p-1 { padding: 4px; }
.p-2 { padding: 6px; }
.p-3 { padding: 8px; }
.pt-1 { padding-top: 4px; }
.pt-2 { padding-top: 8px; }
.pb-1 { padding-bottom: 4px; }
.pb-2 { padding-bottom: 8px; }
.pb-3 { padding-bottom: 12px; }
.pl-1 { padding-left: 4px; }
.pl-2 { padding-left: 8px; }

.gap-1 { gap: 2px; }
.gap-2 { gap: 4px; }
.gap-3 { gap: 8px; }
.gap-4 { gap: 12px; }
.gap-5 { gap: 16px; }
.gap-6 { gap: 20px; }

/* Width */
.w-xs { width: 40px; }
.w-sm { width: 60px; }
.w-md { width: 100px; }
.w-lg { width: 140px; }
.w-xl { width: 180px; }
.w-full { width: 100%; }

/* Horizontal separator */
.option-separator {
    border-left: 2px solid #ddd;
    padding-left: 8px;
    margin-left: 8px;
}

/* Display */
.hidden { display: none !important; }
.flex { display: flex; }
.block { display: block; }
.inline-flex { display: inline-flex; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

/* Misc */
.break-avoid { break-inside: avoid; }
.no-print { display: none !important; }
.bg-shaded { background: #f5f5f5; }
.bg-highlight { background: #f0f8ff; }
.border-top { border-top: 1px solid #ddd; }
.border-bottom { border-bottom: 1px solid #ddd; }
.border-left { border-left: 1px solid #ddd; }
.border-right { border-right: 1px solid #ddd; }

/* Print Buttons */
.print-button-container {
    width: 100%;
    text-align: center;
    padding: 6px 0;
}

.print-button {
    background: #A50034;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    /*
    display: inline-flex;
    align-items: center;
    gap: 6px;
    */
    transition: background-color 0.2s ease;
    margin: 4px 12px;
}

.print-button:hover {
    background: #8B0028;
}

.print-button:active {
    background: #6D001F;
}

.print-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.print-blank-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.print-blank-button:hover {
    background-color: #5a6268;
}

.print-blank-button {
    margin-right: 6px;
}

/* === PRINT OPTIMIZATIONS === */
@media print {

    /* Force backgrounds to print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .modern-form { 
        font-size: 10px !important; 
        line-height: 1.15 !important; 
    }
    
    .header-main {
        justify-content: flex-start;
        position: relative;
        gap: 8px !important;
        margin-bottom: 25px !important;
        padding-bottom: 1px !important;
    }

    /* Hide elements when printing */
    #menu,
    #clear-form-btn,
    .print-blank-button,
    .custom-modal-overlay,
    .print-button-container,
    #address_search_container
    {
        display: none !important;
    }

    /* Hide placeholders */
    input::placeholder,
    textarea::placeholder,
    select::placeholder {
        color: transparent !important;
        opacity: 0 !important;
    }

    .shipping-address-display {
        display: flex !important;
        flex-direction: column;
        position: absolute;
        right: 0;
        top: 0;
        width: 3.5in;
        height: 0.35in !important;
        align-items: flex-start;
        justify-content: left;
        flex-shrink: 0;
        padding: 2px;
    }
    
    .shipping-address-line {
        font-size: 16px !important;
        color: #000;
        text-align: left;
        line-height: 1.2;
        font-weight: 500;
    }

    /* Side-by-side to save vertical space */
    .flex-column-row-center {
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: center !important;
        gap: 4px !important; /* Reduced for tighter spacing */
    }

    /* Container spacing optimizations */
    .container-flex { gap: 3px !important; }
    .container-grid-2,
    .container-grid-3,
    .container-grid-4,
    .container-grid-auto { gap: 2px !important; }
    
    /* Box spacing optimizations */
    .box { margin-bottom: 1px !important; }
    .box-upgrade { margin-bottom: 1px !important; }
    .box-content { padding: 2px !important; }
    .box-content-compact { padding: 1px !important; }
    
    .box-content-shaded {
        margin-bottom: 0 !important;
        padding: 1px !important;
    }
    
    .box-content-shaded .container-flex {
        margin-bottom: 0 !important;
    }
    
    /* Field and check group spacing - normalize all check groups */
    .field-group { margin-bottom: 2px !important; gap: 2px !important; }
    .check-group { 
        margin-bottom: 2px !important; 
        row-gap: 1px !important; /* Force consistent vertical spacing */
        column-gap: 3px !important; /* Force consistent horizontal spacing */
    }
    
    /* Ensure all check groups have consistent spacing regardless of class */
    .check-group-v, .check-group-h, .check-group-center {
        row-gap: 1px !important;
        column-gap: 3px !important;
    }
    
    /* Keep topcover materials from wrapping to new line */
    .responsive-flex { gap: 0.25rem !important; }
    
    /* Stack container optimizations */
    .stack-container { gap: 0.25rem !important; }
    .stack-primary { margin-bottom: 0.25rem !important; }
    
    /* Tighten spacing in accommodation sections */
    .container-flex.gap-1 {
        gap: 1px !important;
        margin-bottom: 0 !important;
    }
    
    /* Remove bottom margin from last elements to eliminate empty space */
    .box:last-child { margin-bottom: 0 !important; }
    
    /* Shrink images to save space */
    .img-option.img-size-1,
    .img-option.img-size-2,
    .img-option.img-size-3,
    .img-option.img-size-4 {
        max-width: 26px !important;
        height: auto;
    }
    .img-option.img-size-6,
    .img-option.img-size-7 {
        max-width: 115px !important;
        height: auto;
    }
    
    /* Page break controls */
    .header-main,
    .container-flex.gap-2.border-bottom.p-2,
    .box.break-avoid,
    .triplet-wrapper,
    .rigidity-chart,
    .responsive-flex > div {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
    
    /* Allow breaks on the main container */
    body, .modern-form, .container-flex.gap-3.p-1 {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }
    
    /* Typography optimizations */
    .text-title { font-size: 11px; margin-bottom: 2px; }
    .header-section { 
        font-size: 10px !important; 
        padding: 1px 3px !important;
    }
    .header-column { font-size: 10px; padding: 1px 2px; margin-bottom: 1px; }
    .header-upgrade { font-size: 9px; padding: 1px 2px; }
    .header-subtext { 
        font-size: 9px; 
        margin-bottom: 0px;
    }
    
    .field input,
    .field select { font-size: 10px; padding: 1px 0; }
    .field-label { font-size: 9px; margin-top: 1px; }
    .check-item { 
        font-size: 10px !important; /* Force consistent size */
        gap: 1px !important; /* Force consistent gap */
    }
    .check-item label {
        font-size: 10px !important; /* Force consistent label size */
    }
    .text-label { font-size: 9px; margin-bottom: 1px; }
    .text-xs { font-size: 8px; }
    .text-small { font-size: 9px; }
    .text-medium { font-size: 10px; }
    .text-large { font-size: 14px; }
    
    .check-item input[type="checkbox"],
    .check-item input[type="radio"] { width: 12px; height: 12px; }
    
    .logo-container img { max-width: 130px; }
    .img-inline { width: 35px; }
    
    /* Keep triplet wrappers more compact - match simple check-group spacing */
    .triplet-wrapper {
        gap: 1px !important; /* Match check-group spacing */
    }
    
    .triplet-header-row {
        padding: 0 !important; /* Remove header padding */
        font-size: 9px !important; /* Smaller header text */
        margin-bottom: 1px !important;
    }
    
    .triplet-column-grid {
        gap: 3px !important; /* Match check-group column gap */
    }
    
    .triplet-col {
        gap: 1px !important; /* Match check-group row gap */
    }
    
    .triplet-labels label {
        height: 12px !important; /* Match checkbox height */
        font-size: 10px !important; /* Match check-item font size */
    }
    
    /* Reduce spacing in check groups within accommodation pads */
    .check-group.check-group-h.check-group-center {
        gap: 2px !important; /* Reduced from 3px */
    }

    .plus-symbol {
        font-size: 1.3em;
    }
    
     /* Shrink rigidity chart options */
    .rigidity-option {
        margin-bottom: 1px !important;
    }
    
    .rigidity-btn {
        padding: 2px 1px !important; /* Reduced from 4px 2px */
        font-size: 10px !important; /* Reduced from 11px */
        line-height: 1 !important;
    }
    
    .rigidity-chart {
        gap: 1px !important; /* Reduced from 2px */
    }
    /* End rigidity chart */

    .print-page-wrapper {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        -webkit-column-break-inside: avoid !important;
    }

    .version-footer {
        position: absolute;
        font-size: 9px;
        color: #000;
    }
}

/* Android-specific print styles (touch devices that are NOT iOS) */
@media print and (hover: none) and (pointer: coarse) {
    /* This targets all touch devices, but iOS rules below will override for iOS */
    
    @page {
        margin: 0.25in !important; /* Slightly tighter than default 0.3in */
    }
    
    /* Reduce notes section height on Android */
    #order-notes { 
        rows: 2 !important; 
        min-height: 22px !important;
        max-height: 22px !important;
        font-size: 9px !important;
        line-height: 1.1 !important;
    }
    
    /* Tighten up bottom sections */
    .box:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Reduce spacing in last few sections */
    .box-content:last-child {
        padding-bottom: 1px !important;
        margin-bottom: 0 !important;
    }
    
    /* Make call to consult text smaller */
    .text-area {
        font-size: 9px !important;
        line-height: 1.1 !important;
        padding: 1px !important;
    }
    
    /* Slightly reduce overall spacing */
    .container-flex { gap: 2px !important; }
    .box { margin-bottom: 1px !important; }
    .check-group { 
        margin-bottom: 1px !important; 
        row-gap: 1px !important;
    }
}

/* iOS-ONLY print styles using @supports detection */
@supports (-webkit-touch-callout: none) {
    @media print {
        @page {
            margin: 0.1in !important;
            size: 8.5in 11in;
            orphans: 4;
            widows: 2;
        }
        
        body {
            height: auto !important;
            max-height: none !important;
        }
        
        .print-page-wrapper {
            break-inside: avoid !important;
            page-break-inside: avoid !important;
            -webkit-column-break-inside: avoid !important;
            display: block !important;
            overflow: hidden !important;
        }
        
        .barcode-placeholder {
            height: 0.25in !important;
        }
        
        .barcode-text {
            font-size: 7px !important;
        }

        .header-main {
            margin-bottom: 0 !important;
            padding-bottom: 0 !important;
        }
        
        .container-flex.gap-3.border-bottom.p-2 {
            padding: 0 !important;
            margin-bottom: 0 !important;
            gap: 0 !important;
        }
        
        .field-group {
            margin-bottom: 0 !important;
            gap: 0 !important;
        }
        
        .box-content-shaded {
            padding: 0 !important;
            margin: 0 !important;
        }
        
        .field input,
        .field select {
            font-size: 8px !important;
            padding: 0 !important;
            line-height: 1 !important;
        }
        
        .field-label {
            font-size: 7px !important;
            margin-top: 0 !important;
            margin-bottom: 0 !important;
        }
        
        .logo-container img {
            max-width: 80px !important;
        }

        .container-flex { gap: 0 !important; margin: 0 !important; }
        .box { margin-bottom: 0 !important; padding: 0 !important; }
        .box-content { padding: 0 !important; margin: 0 !important; }
        .check-group { 
            margin-bottom: 0 !important; 
            row-gap: 0 !important; 
            column-gap: 1px !important; 
        }
        
        .box-upgrade { margin-bottom: 0 !important; padding: 0 !important; }
        .box-upgrade .box-content-shaded { padding: 0 !important; }
        
        .modern-form { font-size: 8px !important; line-height: 1 !important; }
        .check-item { font-size: 8px !important; }
        .check-item label { font-size: 8px !important; }
        .text-label { font-size: 7px !important; }
        .header-column { font-size: 8px !important; padding: 0 !important; margin: 0 !important; }
        .text-title { font-size: 9px !important; margin-bottom: 0 !important; }
        
        .img-option { max-width: 18px !important; }
        
        .triplet-wrapper { gap: 0 !important; margin: 0 !important; }
        .triplet-column-grid { gap: 1px !important; }
        .triplet-col { gap: 0 !important; }
        .triplet-header-row { padding: 0 !important; margin: 0 !important; font-size: 7px !important; }
        .triplet-labels label { font-size: 8px !important; height: 10px !important; }
        
        .check-item input[type="checkbox"],
        .check-item input[type="radio"] { width: 10px !important; height: 10px !important; }
        
        #order-notes { 
            rows: 3 !important; 
            min-height: 20px !important;
            max-height: 20px !important;
            font-size: 7px !important;
            line-height: 1 !important;
        }
    }
}



/* Screen-only styles */
@media screen {
    .modern-form {
        max-width: 900px;
        margin: 0 auto;
        padding: 5px;
    }
}

/* === VALIDATION STYLES === */
.field.error {
    position: relative;
}

.field.error input,
.field.error select {
    border-bottom-color: #dc3545;
    background-color: #fff5f5;
}

.field.error .field-label {
    color: #dc3545;
}

.field.valid input,
.field.valid select {
    border-bottom-color: #28a745;
}

/* Validation error positioning */
.field .error-message {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    color: #dc3545;
    font-size: 9px;
    padding: 2px 4px;
    /*border: 1px solid #dc3545;*/
    /*border-radius: 2px;*/
    margin-top: 1px;
    z-index: 10;
    white-space: nowrap;
}

/* Checkbox validation */
.check-item input.validation-error {
    outline: 2px solid #dc3545;
    outline-offset: 1px;
}

/* Toast notification */
#toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 300px;
    max-width: 500px;
    padding: 18px 28px;
    border-radius: 8px;
    z-index: 1000;
    display: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.5px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 16px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    white-space: pre-line;
    text-align: left;
}

/* Default toast (info) - Solid blue */
#toast,
#toast.toast-info {
    background: #2563eb;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Success toast - Solid green */
#toast.toast-success {
    background: #059669;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Error toast - Solid red */
#toast.toast-error {
    background: #dc2626;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Warning toast - Solid orange */
#toast.toast-warning {
    background: #f59e0b;
    color: #1f2937;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

/* Show animation */
#toast.show {
    display: block !important;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide animation */
#toast.hide {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Updated keyframe animations for center positioning */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
        display: none;
    }
}

/* ========================================================================
CUSTOM MODAL STYLES
======================================================================== */

.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.custom-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.2s ease-out;
}

.custom-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.custom-modal h3,
.custom-modal h4 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.custom-modal h3 {
    font-size: 1.25rem;
}

.custom-modal h4 {    
    font-size: 1.05rem;
    font-weight: 300;
}

.custom-modal-body {
    padding: 1.5rem;
}

.custom-modal-body p {
    margin: 0 0 1rem 0;
    color: #666;
    line-height: 1.5;
}

.custom-modal-body p:last-child {
    margin-bottom: 0;
    font-weight: 500;
}

.custom-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-btn {
    padding: 0.625rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-confirm {
    background: #f5f5f5;
    color: #333;
}

.modal-btn-confirm:hover {
    background: #e0e0e0;
}

.modal-btn-cancel {
    background: #A50034;
    color: white;
}

.modal-btn-cancel:hover {
    background: #8a002b;
}

.modal-btn:focus {
    outline: 2px solid #A50034;
    outline-offset: 2px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shipping address background styling */
#shipping_address {
    padding: 8px;
    border-radius: 4px;
}

#shipping_address.ship-to-patient-active {
    background: #e9e9e9;
}

/* Temporary to show container boundaries for debugging layout */
/*
.functional-form .container-flex > .col:first-child > .box {
    outline: 2px solid red;
}
*/