/* Import base HTML element styles (app css) */
@import url('html.css');
@import url('utility.css');
@import url('icons.css');

/* Survey container styling */
.ot-survey-container {
    max-width: 1000px;
    margin: 16px auto;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 32px); /* Account for 32px top and bottom margins */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Survey in popup: fill body so scroll area is calculated correctly (no fixed 90vh – that caused clipping) */
.popupBox-body .ot-survey-container {
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    height: 100%;
    min-height: 0;
    max-width: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.popupBox-body .ot-survey-container .ot-survey-header {
    border-radius: 0;
}
.popupBox-body .ot-survey-container .ot-survey-contentbody {
    border-radius: 0;
    min-height: 0;
}
.popupBox-body .ot-survey-container .ot-survey-content-container {
    min-height: 0;
}

/* Survey complete: fullscreen wrapper matching legacy survey_open.php (max-width 1000px container) */
#survey-complete-wrapper.ot-survey-complete-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--background-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 0;
    box-sizing: border-box;
}
.ot-survey-complete-fullscreen .ot-survey-container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    height: auto;
}

/* Add darker background to body for survey pages */
body.survey-page {
    background-color: var(--background-color);
    min-height: 100vh;
}
.ot-survey-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
}
.ot-survey-header > div:first-child {
    flex: 0 0 auto;
    min-width: 0;
}
.ot-survey-header .survey-complete-back {
    margin-left: auto;
    flex-shrink: 0;
}

/* Survey-specific classes copied from app.css */
.ot-survey-divider {
    border: none;
    border-bottom: 1px solid var(--border-color);
    margin: 0 0 .5rem 0;
    width: 100%;
}

.ot-survey-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ot-survey-details {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 1;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.ot-survey-details .details {
    flex: 1;
    min-width: 0;
}
.ot-survey-details .scores {
    flex-shrink: 0;
    margin-left: auto;
}

.ot-survey-contentbody {
    font-size: 14px;
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border-radius: 0 0 12px 12px;
}

/* Completed survey: disallow input while keeping the same visual appearance */
.ot-survey-contentbody.survey-completed-lock input:not([type="hidden"]),
.ot-survey-contentbody.survey-completed-lock select,
.ot-survey-contentbody.survey-completed-lock textarea,
.ot-survey-contentbody.survey-completed-lock label,
.ot-survey-contentbody.survey-completed-lock [onclick],
.ot-survey-contentbody.survey-completed-lock .survey-slider,
.ot-survey-contentbody.survey-completed-lock .noUi-handle,
.ot-survey-contentbody.survey-completed-lock button {
    pointer-events: none;
}

.ot-survey-footer {
    text-align: center;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    position: relative;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.06);
}

#surveySubmitButton {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

#surveySubmitButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* Icons/images for survey elements */

.ot-field-checkbox {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #333;
    border-radius: 4px;
    background: white;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 4px;
}

.ot-field-checkbox.checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 2px;
    width: 12px;
    height: 8px;
    border: 3px solid #333;
    border-top: none;
    border-right: none;
    transform: rotate(-45deg);
}

.survey-base-label {
    font-weight: 400;
    font-size: 1.1em;
    margin-bottom: 0.375rem; /* Reduced by 25% from 0.5rem */
}

/* Required indicator: asterisk to the left of the label, between number and label (no layout shift) */
.survey-base-label.survey-required {
    position: relative;
}
/* Red asterisk when required and empty (default or .survey-unsaved); normal when .survey-saved */
.survey-base-label.survey-required::before {
    content: '*';
    position: absolute;
    left: -0.6em;
    color: var(--error-color);
}
.survey-base-label.survey-required.survey-saved::before {
    color: var(--text-color);
}

.survey-readonly .survey-base-label.survey-required::before {
    content: '';
}

.ot-survey-contentbody.survey-completed-lock .survey-base-label.survey-required::before {
    content: '';
}



/* Print styles - remove scrolling restrictions and ensure full content is printable */
@media print {
    html, body {
        height: auto !important;
        overflow: visible !important;
        background: white !important;
        font-size: 10px;
    }
    
    body.survey-page {
        background: white !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    .ot-survey-container {
        max-width: none !important;
        margin: 0 !important;
        height: auto !important;
        overflow: visible !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: white !important;
    }
    
    .ot-survey-content-container {
        overflow: visible !important;
        height: auto !important;
        flex: none !important;
    }
    
    .ot-survey-contentbody {
        overflow: visible !important;
        height: auto !important;
        padding: 1rem !important;
    }
    
    /* Hide non-printable elements */
    .no-print {
        display: none !important;
    }
    
    /* Ensure all content is visible */
    .survey-hide {
        display: block !important;
    }
}

/* Shared survey styles (not portal-specific) */
.ot-contentbody .batchtable {
    width: 100%;
    border: 1px solid darkgray;
}

.ot-survey-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: center;
}

/* Collapsible description and summary: hide default details marker, header row, chevron */
.survey-description-block summary,
.survey-summary-block summary {
	list-style: none;
	display: flex;
	align-items: center;
	cursor: pointer;
}
.survey-description-block summary::-webkit-details-marker,
.survey-description-block summary::marker,
.survey-summary-block summary::-webkit-details-marker,
.survey-summary-block summary::marker {
	display: none;
}
.survey-description-block summary .icon-chevron-down,
.survey-summary-block summary .icon-chevron-down {
	margin-left: auto;
	flex-shrink: 0;
	transition: transform 0.2s ease;
}
.survey-description-block[open] summary .icon-chevron-down,
.survey-summary-block[open] summary .icon-chevron-down {
	transform: rotate(180deg);
}

.survey-description-block {
	margin: 10px 0;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	overflow: hidden;
}
.survey-description-label {
	text-align: left;
	border: none;
	border-bottom: 1px solid var(--border-color);
	background: var(--background-color);
	font-weight: bold;
	padding: 0.35rem 0.5rem;
}

.ot-survey-description {
	text-align: left;
	margin: 0;
	background: none;
	border: none;
	border-radius: 0;
	padding: 10px;
	position: relative;
}
.ot-survey-description ol,ul,li {
	margin: 2px 10px;
}

.survey-required-notice {
	margin: -0.5rem 0.25rem 0 0.5rem;
	font-size: 0.95em;
	color: var(--text-color);
}

.survey-complete-later {
    font-size: .8em;
    position: absolute;
    left: 1.5em;
    bottom: 1.5em;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
}
.survey-completed-date {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 2em;
    align-self: center;
}
.survey-completed-date .survey-control-date {
    width: 120px !important;
}
.survey-completed-date .survey-icon-wrapper {
    width: 120px;
}

.survey-missing-required-notice {
    display: none;
    font-size: 0.8em;
    color: var(--error-color);
    position: absolute;
    right: 1.5em;
    bottom: 1.5em;
    text-align: right;
    cursor: pointer;
    text-decoration: underline;
}

/* Survey-specific classes */

.survey-header {
	vertical-align: bottom;
	min-height: 1.75em;
	font-size: 1.2em;
	font-weight: bold;
	border-bottom: 1px solid black;
	overflow-wrap: break-word;
}

/* Survey module table styles */
.survey-item-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.survey-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.survey-number-cell {
    min-width: 30px;
    text-align: right;
    white-space: nowrap;
    flex: 0 0 auto;
}

.survey-question-cell {
    text-align: left;
    flex: 1 1 auto;
    min-width: 0;
}

.survey-field-line {
    display: block;
}

.survey-header-label {
    font-weight: bold;
}

.survey-header-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Survey grid table styles */
.survey-grid-table {
    width: 100%;
}

.survey-spacerRow {
    height: .75em;
    line-height: .75em;
}

.survey-hide {
    display: none;
}

.survey-saved {
    color: var(--text-color);
}
.survey-required.survey-unsaved::before {
    color: var(--error-color);
}
/* Required label text stays normal; only the asterisk indicates required/unsaved */
.survey-base-label.survey-required.survey-unsaved {
    color: var(--text-color);
}
.survey-unsaved {
    color: var(--error-color);
}
/* Prevent text selection on question labels and static text */
.survey-rendered-content {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Allow text selection only in text fields */
.survey-rendered-content input[type="text"],
.survey-rendered-content input[type="number"],
.survey-rendered-content input[type="email"],
.survey-rendered-content input[type="date"],
.survey-rendered-content input[type="time"],
.survey-rendered-content textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

.survey-selector {
    cursor: pointer;
}

/* Shared form control styling */
.survey-control {
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    box-sizing: border-box;
    border-radius: 4px;
}

/* Select boxes size to fit their option content */
.survey-control-select {
    width: fit-content;
    min-width: 3em;
    max-width: 100%;
}

.survey-control-text {
    width: 98%;
    padding: 0 .3em;
    height: 28px !important;
}

.survey-control-textarea {
    min-height: 6em;
    width: 98%;
}

.survey-control-date,
.survey-control-time {
    width: 90px;
}

.survey-control-with-icon {
    padding-right: 24px;
}

/* Date/Time field icon wrapper */
.survey-icon-wrapper {
    position: relative;
    display: inline-block;
}

.survey-icon-wrapper .icon-calendar,
.survey-icon-wrapper .icon-clock {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.survey-readonly .survey-icon-wrapper .icon-calendar,
.survey-readonly .survey-icon-wrapper .icon-clock {
    display: none;
}


.survey-option {
    cursor: pointer;
    position: relative;
    top: -10px;
}

.survey-stack {
    left: -20px;
}

.survey-stack2 {
    left: -25px;
}

.survey-stack3 {
    left: -30px;
}

.survey-nowrap {
    white-space: nowrap;
}

.survey-gridChecked {
    background: var(--border-color);
}

.survey-checked {
    background: var(--border-color);
}

.survey-unchecked {
    background: #fff;
}

.survey-bold, .bold {
    font-weight: bold;
}

.survey-small {
    font-size: small;
}

.survey-red {
    color: var(--error-color);
}

.survey-ac {
    text-align: center;
}

.survey-al {
    text-align: left;
}

.survey-l {
    text-align: left;
}

/* Control cell that contains the tip (has position relative so tip is positioned below it) */
.survey-question-cell.survey-has-tip {
    position: relative;
}

/* Anchor for dynamic tooltip (tip DOM created on first hover); hidden from layout */
.survey-tip-anchor {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

/* Tip container: overlays the control cell for positioning; tip is positioned below the cell */
.survey-tip-container {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
    overflow: visible;
}

/* Tip: hidden by default; shown on hover via JS (.survey-tooltip-visible); 0.5rem below the control cell, scrolls with page */
.survey-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.05rem;
    z-index: 20;
    padding: 6px 8px;
    font-size: 0.9em;
    line-height: 1.2em;
    background: #e8f0fe;
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    max-width: 280px;
}
.survey-tooltip.survey-tooltip-visible {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 5px;
}

.survey-rlLabel {
    font-size: 0.9em;
    color: #666;
    margin: 0 0.5em;
}

/* Left/Right label containers for sliders and checkboxes */
.survey-label-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0;
}

.survey-label-left {
    flex: 0 1 25%;
    max-width: 25%;
    min-width: 0;
    display: flex;
    align-items: center;
    text-align: right;
    padding-right: 2em;
    justify-content: flex-end;
}

.survey-label-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    text-align: left;
    padding-left: 2em;
    justify-content: flex-start;
}

.survey-label-content {
    flex: 0 1 auto;
    min-width: 0;
}

/* Flexbox layout for checkbox labels */
.survey-label-checkbox-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1em;
}

.survey-label-checkbox-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    text-align: right;
    justify-content: flex-end;
    white-space: nowrap;
}

.survey-label-checkbox-content {
    flex: 0 1 auto;
    min-width: 0;
}

/* Allow button groups to fit content in flex containers */
.survey-label-checkbox-content .ot-button-group,
.survey-label-content .ot-button-group {
    flex: 0 0 auto;
    width: fit-content;
}

.survey-label-checkbox-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    text-align: left;
    justify-content: flex-start;
    white-space: nowrap;
}

/* Legend (low/mid/high range labels) above or below control; width matches control so left/right align */
.survey-legend-control-wrapper {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
}
.survey-legend-wrapper {
    width: 100%;
    color: var(--text-muted-dark);
    font-size: 0.9em;
}
.survey-legend-above {
    margin-bottom: 0.35em;
}
.survey-legend-below {
    margin-top: 0.35em;
}
.survey-legend-horizontal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
}
.survey-legend-horizontal .survey-legend-item {
    flex: 1;
    min-width: 0;
}
.survey-legend-horizontal .survey-legend-first {
    text-align: left;
}
.survey-legend-horizontal .survey-legend-middle {
    text-align: center;
}
.survey-legend-horizontal .survey-legend-last {
    text-align: right;
}
.survey-legend-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}
.survey-legend-vertical .survey-legend-first,
.survey-legend-vertical .survey-legend-last {
    text-align: left;
}
.survey-legend-item span {
    display: inline-block;
}
/* Consistent legend label size for both below and inline (overrides wrapper/inline item classes) */
.survey-legend-control-wrapper .survey-legend-item span {
    font-size: 0.9em;
    color: #777;
    font-weight: bold;
}

/* Legend position: inline = first left of control, last right; middle items below with empty first/last placeholders */
.survey-legend-inline .survey-legend-inline-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1.25em;
    width: 100%;
}
/* Vertically align legend labels with the radio buttons (same baseline/center as option row) */
.survey-legend-inline .survey-legend-inline-row .survey-legend-item.survey-legend-first,
.survey-legend-inline .survey-legend-inline-row .survey-legend-item.survey-legend-last {
    display: flex;
    align-items: center;
}
/* Legend labels (first/last) can wrap; take only needed space so options area stays wide */
.survey-legend-inline .survey-legend-inline-row .survey-legend-item.survey-legend-first,
.survey-legend-inline .survey-legend-inline-row .survey-legend-item.survey-legend-last {
    flex: 0 1 auto;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}
.survey-legend-inline .survey-legend-inline-row .survey-legend-item.survey-legend-first span,
.survey-legend-inline .survey-legend-inline-row .survey-legend-item.survey-legend-last span {
    display: block;
}
/* Options area gets remaining space and is wide enough so radios don't wrap (no legend styling applied here) */
.survey-legend-inline .survey-legend-inline-row .survey-legend-options-area {
    flex: 1 1 0;
    min-width: min-content;
}
/* Keep radio/checkbox options on one line when legend is inline */
.survey-legend-inline .survey-legend-options-area .survey-options-container.survey-options-horizontal {
    white-space: nowrap;
    display: inline-block;
}
.survey-legend-inline .survey-legend-middle-row {
    margin-top: 0.35em;
}
.survey-legend-inline .survey-legend-middle-row .survey-legend-item {
    flex: 1;
    min-width: 0;
}

.survey-qNumCircle {
    border: 1px solid black;
    border-radius: 5px;
    padding: 0 3px;
}

.survey-slider {
    margin: 10px auto;
    width: 100%;
    min-width: 120px;
    text-align: center;
}

/* Extra bottom margin when slider has showTicks (pips/labels) so they don't overlap content below */
.survey-slider.survey-slider-with-pips {
    margin-bottom: 3em;
}

/* Keep pip labels within slider bounds: first label left-aligned, last right-aligned */
.survey-slider.survey-slider-with-pips .noUi-pips-horizontal {
    width: 100%;
    left: 0;
    box-sizing: border-box;
}
/* First pip value (min/L_LABEL): pin to left edge; override library's translate(-50%) so label doesn't overflow left */
.survey-slider.survey-slider-with-pips .noUi-value-horizontal.slider-pip-first {
    left: 0 !important;
    right: auto !important;
    -webkit-transform: translate(0, 50%) !important;
    transform: translate(0, 50%) !important;
    text-align: left;
}
/* Last pip value (max/R_LABEL): pin to right edge */
.survey-slider.survey-slider-with-pips .noUi-value-horizontal.slider-pip-last {
    left: auto !important;
    right: 0 !important;
    -webkit-transform: translate(0, 50%) !important;
    transform: translate(0, 50%) !important;
    text-align: right;
}
/* Allow long end labels to wrap so they stay within bounds */
.survey-slider.survey-slider-with-pips .noUi-value-horizontal.slider-pip-first,
.survey-slider.survey-slider-with-pips .noUi-value-horizontal.slider-pip-last {
    max-width: 48%;
    white-space: normal;
    word-break: break-word;
}

/* Pip/label size (only when showTicks is true) */
.survey-slider.survey-slider-pips-small .noUi-value {
    font-size: 0.75rem;
}
.survey-slider.survey-slider-pips-small .noUi-marker-horizontal.noUi-marker {
    height: 4px;
}
.survey-slider.survey-slider-pips-large .noUi-value {
    font-size: 1rem;
}
.survey-slider.survey-slider-pips-large .noUi-marker-horizontal.noUi-marker {
    height: 8px;
}
.survey-slider.survey-slider-pips-large .noUi-marker-horizontal.noUi-marker-large {
    height: 12px;
}

/* noUiSlider styling - dark blue background */
.survey-slider .noUi-connect {
    background: var(--primary-hover);
}

.survey-slider .noUi-handle {
    background: var(--primary-hover);
    border: 2px solid #fff;
    border-radius: 25%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.survey-slider .noUi-handle:hover {
    background: #1557b0;
}

.survey-slider .noUi-handle:active {
    background: #0f4a8f;
}

/* Greyed out styling for sliders that haven't been set by user */
.survey-slider.slider-not-set .noUi-handle {
    background: #999 !important;
    border-color: #ccc !important;
    cursor: pointer;
}

.survey-slider.slider-not-set .noUi-handle:hover {
    background: #888 !important;
}

.survey-slider.slider-not-set .noUi-connect {
    background: #ccc !important;
}

/* Survey checkbox and option alignment */
.survey-option-item {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* Vertical layout: align items to flex-start for multi-line labels */
.survey-options-vertical .survey-option-item {
    align-items: flex-start;
    vertical-align: top;
}

.survey-option-item input[type="checkbox"] {
    margin: 0;
    transform: none !important;
    vertical-align: middle;
    flex-shrink: 0;
    width: 1.5em;
    height: 1.5em;
    min-width: 1.5em;
    min-height: 1.5em;
    box-sizing: border-box;
}

.survey-option-item input[type="checkbox"]:checked {
    transform: none !important;
}

/* Radio checkbox styling - round appearance */
.survey-option-item input[type="checkbox"].survey-radio-checkbox,
.survey-option-numeric input[type="checkbox"].survey-radio-checkbox {
    border-radius: 50% !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: #fff !important;
    border: 1px solid rgb(130, 130, 130) !important;
    position: relative !important;
    display: inline-block !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    /* Override grid display from html.css */
    display: inline-block !important;
    place-content: unset !important;
}

.survey-option-item input[type="checkbox"].survey-radio-checkbox::before,
.survey-option-numeric input[type="checkbox"].survey-radio-checkbox::before {
    display: none !important;
}

.survey-option-item input[type="checkbox"].survey-radio-checkbox:checked,
.survey-option-numeric input[type="checkbox"].survey-radio-checkbox:checked {
    background-color: #fff !important;
    border-color: var(--primary-hover) !important;
}

.survey-option-item input[type="checkbox"].survey-radio-checkbox:checked::after,
.survey-option-numeric input[type="checkbox"].survey-radio-checkbox:checked::after {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: auto !important;
    width: 0.65em !important;
    height: 0.65em !important;
    border-radius: 50% !important;
    background-color: var(--primary-hover) !important;
    display: block !important;
    transform: none !important;
}

.survey-option-item input[type="checkbox"].survey-radio-checkbox:hover,
.survey-option-numeric input[type="checkbox"].survey-radio-checkbox:hover {
    border-color: var(--primary-hover) !important;
}

.survey-option-item .survey-option {
    position: static !important;
    top: auto !important;
    margin-left: 0.5rem;
    vertical-align: middle;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
}

/* Horizontal layout option items */
.survey-options-horizontal .survey-option-item {
    display: inline-flex;
    align-items: flex-start;
    vertical-align: top;
}

/* Numeric option labels (centered below checkbox) */
.survey-option-numeric .survey-option {
    display: block;
    text-align: center;
    margin-top: 0.25rem;
}

.survey-option-row {
    display: flex;
    align-items: center;
    vertical-align: middle;
}

/* Vertical layout: align items to flex-start for multi-line labels and add spacing */
.survey-options-vertical .survey-option-row {
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

/* Remove margin from last row in vertical layout */
.survey-options-vertical .survey-option-row:last-child {
    margin-bottom: 0;
}

/* Numeric option items (label below checkbox) */
.survey-option-numeric {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start;
    margin-right: 1.25rem; /* 25% more spacing than default (~1rem * 1.25) */
    width: auto;
    min-width: fit-content;
}

.survey-options-horizontal .survey-option-numeric:last-child {
    margin-right: 0;
}

.survey-option-numeric input[type="checkbox"] {
    margin: 0 0 0.25rem 0 !important;
    align-self: center;
    flex-shrink: 0;
}

.survey-option-numeric .survey-option {
    position: static !important;
    top: auto !important;
    left: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
    text-align: center !important;
    width: auto;
    min-width: 1.5em;
}

/* Survey Button Group Styles */
.survey-button-group {
    display: inline-flex;
    flex-wrap: nowrap; /* buttons stay side by side, don't wrap to new rows */
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
    background: none;
    width: max-content; /* group width matches content when space is available */
    max-width: 100%; /* respect parent container constraints - triggers wrapping when constrained */
    align-items: stretch; /* all buttons have equal height (match tallest button) */
}

.survey-button-group .survey-button {
    flex: 0 1 auto; /* buttons can shrink to allow wrapping when container is constrained */
    padding: 0.5rem 0.75rem; /* vertical padding for wrapped content */
    min-height: 28px; /* minimum height, can grow for wrapped content */
    height: auto !important; /* override html.css height: 28px to allow growth for wrapped content */
    min-width: 0; /* allow button to shrink below content width when constrained */
    /* No max-width - buttons use available space, but wrap when container is constrained */
    /* height determined by content and align-items: stretch on parent makes all buttons equal height */
    display: flex;
    align-items: center; /* center content vertically within button */
    justify-content: center; /* center content horizontally within button */
    border: none;
    background: none;
    color: #222;
    font-weight: 500;
    font-size: 1.08em;
    transition: background 0.15s, color 0.15s;
    box-shadow: none;
    border-radius: 0;
    outline: none;
    overflow: visible; /* ensure all text is visible */
}

/* Text wrapper inside button - allows proper wrapping */
.survey-button-group .survey-button > span {
    display: block; /* make span block-level for proper wrapping */
    word-wrap: normal; /* don't break words, even if long */
    overflow-wrap: normal; /* don't break words, even if long */
    word-break: normal; /* don't break words in the middle */
    white-space: normal; /* allow text wrapping at spaces only */
    text-align: center; /* center text */
    line-height: 1.4; /* better line height for wrapped text */
    min-width: 0; /* allow span to shrink when button is constrained */
    max-width: 100%; /* respect button width constraints - triggers wrapping when button is constrained */
}

/* Ensure button groups don't expand in flex containers */
.survey-response-block .survey-button-group,
.survey-label-checkbox-content .survey-button-group,
.survey-label-content .survey-button-group {
    width: fit-content !important;
    max-width: 100%;
    flex-shrink: 0; /* prevent flex containers from forcing expansion */
}

/* Border between buttons - only on right side, not on last item */
.survey-button-group .survey-button:not(:last-child) {
    border-right: 1px solid #ccc;
}

.survey-button-group .survey-button.active,
.survey-button-group .survey-button:focus {
    background: rgba(66, 133, 244, 0.25);
    color: var(--primary-hover);
    z-index: 1;
}

.survey-button-group .survey-button:hover:not(.active) {
    background: var(--primary-bg-light);
    color: var(--primary-hover);
}

/* Border radius on corners - first and last buttons */
.survey-button-group .survey-button:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.survey-button-group .survey-button:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}


.survey-p10 {
    padding: 10px;
}

.survey-chunky td {
    padding: 5px 0;
} 

.survey-scores-table {
    border-collapse: collapse;
    border-radius: 4px;
}

/* Right-justify score table in both survey_open and preview */
.scores .survey-scores-table {
    margin-left: auto;
}

.survey-scores-table td,
.survey-scores-table th {
    padding: 0.1rem 0.25rem;
}

.survey-subscale-label {
    text-align: center;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    font-weight: bold;
}

.survey-subscale-value {
    text-align: center;
    border: 1px solid var(--border-color);
    min-width: 25px;
    max-width: 200px;
    width: 1%;
}

/* Overall score column: same style as subscales but slightly larger value */
.survey-score-overall {
    font-size: 1.75em;
    font-weight: bold;
    min-width: 40px;
    max-width: 200px;
    width: 1%;
}

/* Survey summary block: in main content area above survey content (collapsible) */
.survey-summary-block {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.survey-summary-block .survey-summary-label {
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
    font-weight: bold;
    padding: 0.35rem 0.5rem;
}

.survey-summary-content-main {
    margin: 0;
    padding: 10px;
    background-color: #fff;
    font-weight: normal;
    line-height: 1.5;
    border: none;
}

/* subscales[].summary.header: bold, underlined, 1.25em (main summary and score summary) */
.survey-summary-content-main .survey-summary-header,
.survey-summary-content .survey-summary-header {
    font-weight: bold;
    text-decoration: underline;
    font-size: 1.25em;
    margin-bottom: 0.5em;
}

/* subscales[].summary.tag: chip/pill next to subscale description */
.survey-summary-tag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15em 0.6em;
    font-size: 0.85em;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
    background: #e8e8e8;
    border: 1px solid #c0c0c0;
    border-radius: 4px;
}

.survey-scorebox,
.scorebox {
	background:#fff;
	border:1px solid darkgray;
    font-weight: bold;
	text-align:center;
	vertical-align:middle;
	font-size: 2.2em;
}
.survey-scorebox2,
.scorebox2 {
	background:#fff;
	border:1px solid darkgray;
	text-align:center;
	vertical-align:middle;
	font-size: 1.5em;
}

/* Application survey preview (e.g. Settings > Library): smaller font so it fits the popup */
#survey-preview-container .ot-survey-contentbody {
	font-size: 1em;
}
#survey-preview-container .ot-survey-details {
	display: flex;
	flex-shrink: 0;
}
#survey-preview-container .ot-survey-details .scores {
	min-width: 8rem;
}
#survey-preview-container .survey-base-label {
	font-size: 1em;
}
#survey-preview-container .survey-header {
	font-size: 1em;
}
#survey-preview-container .survey-item-wrapper {
	font-size: 0.95em;
}

