/* ==== MAIN CONTAINER ==== */
.form-field-container {
    padding: 0 15px 15px 15px;
    border-radius: 8px;
    background-color: #fff;
}

.field-title {
    font-family: 'Maax-Bold';
    margin-bottom: 8px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0;
    font-size: 14px;
    color: #000000;
}

.field-options {
    margin-bottom: 15px;
}

.field-option {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
}

.option-main {
    display: flex;
    align-items: flex-start;
    margin-bottom: 5px;
    min-height: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

/* ==== INPUT STYLING ==== */

/* Radio button styling */
.field-option input[type="radio"],
.sub-option input[type="radio"] {
    cursor: pointer;
    margin-right: 8px;
    margin-top: 0;
    margin-bottom: 0;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Checkbox styling with custom SVG images */
.field-option input[type="checkbox"],
.sub-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: none;
    cursor: pointer;
    margin-right: 8px;
    margin-top: 0;
    margin-bottom: 0;
    vertical-align: middle;
    flex-shrink: 0;
    position: relative;
    background: url(../images/Uncheckboxx_wm.svg) 0 0 no-repeat;
    background-position: 0px 0px;
    background-size: 20px 20px;
    transition: all 0.15s ease-in-out;
    outline-offset: 3px;
}

.field-option input[type="checkbox"]:checked,
.sub-option input[type="checkbox"]:checked {
    background: url(../images/Checked_wm.svg) 0 0 no-repeat;
    background-position: 0px 0px;
    background-size: 20px 20px;
    box-shadow: none;
    outline-offset: 3px;
}

.field-option input[type="checkbox"]:hover,
.sub-option input[type="checkbox"]:hover {
    opacity: 0.8;
}

/* Label styling */
.field-option label {
    cursor: pointer;
    color: #000000;
    font-family: 'Maax-Regular';
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 24px;
    margin: 0;
    vertical-align: middle;
    display: flex;
    align-items: center;
}

.sub-option label {
    cursor: pointer;
    color: #000000;
    font-family: 'Maax-Regular';
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 20px;
    margin: 0;
    vertical-align: middle;
    display: flex;
    align-items: center;
}

/* ==== SUB-OPTIONS STYLING ==== */

/* Main sub-options container - hidden by default */
.sub-options {
    display: none;
    margin-left: 30px;
    margin-top: 15px;
    padding: 5px 0 5px 20px;
    border-left: 2px solid #D1D1D1;
    border-radius: 0 8px 8px 0;
}

.sub-options-title {
    font-family: 'Maax-Bold';
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 12px;
    color: #000000;
    padding-bottom: 8px;
}

/* Sub-option container - CHANGED to column layout for vertical stacking */
.sub-option {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    min-height: 20px;
    flex-direction: column; /* CHANGED: Stack vertically instead of side-by-side */
    gap: 10px; /* Space between main option and nested options */
}

/* Sub-option main content (radio + label + textbox) */
.sub-option-main {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    width: 100%; /* Take full width */
}

/* Nested sub-options (sub-sub-options) - CHANGED to appear below parent */
.sub-sub-options {  
    display: none;
    width: 100%; /* Full width instead of flex: 1 */
    margin-left: 20px; /* Less indentation since we're already indented */
    margin-top: 0; /* No additional top margin */
    padding: 10px 0 15px 20px;
    border-left: 2px solid #D1D1D1;
    border-radius: 0 6px 6px 0;
    /* REMOVED: min-width and flex properties for side-by-side layout */
}

.sub-sub-options .sub-options-title {
    font-family: 'Maax-Bold';
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 10px;
    color: #000000;
    padding-bottom: 6px;
}

/* Sub-sub-option items - CHANGED to row layout (radio + label inline) */
.sub-sub-options .sub-option {
    margin-bottom: 10px;
    margin-left: 0;
    flex-direction: row; /* CHANGED: Keep sub-sub-options in row format */
    align-items: center;
    gap: 8px;
}

.sub-sub-options .sub-option-main {
    flex-direction: row;
    width: 100%;
}

.sub-sub-options .sub-option label {
    font-size: 16px;
    line-height: 18px;
    color: #000000;
}

/* ==== TEXTBOX STYLING ==== */

/* Main textbox section - hidden by default */
.textbox-section {
    display: none;
    flex-direction: column; 
    align-items: flex-start; 
    margin-left: 0;
}

.textbox-section input {
    padding: 8px 12px;
    border: 1px solid #C6C6C6;
    border-radius: 8px;
    width: 300px;
    font-size: 14px;
    line-height: 1.4;
    font-family: 'Maax-Regular';
    font-weight: 400;
}

.textbox-section input::placeholder {
    color: #888888;
    font-family: 'Maax-Regular';
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0;
    font-style: normal;
}

/* Sub-option textboxes - inline with sub-option */
.sub-option-main .textbox-section {
    display: none;
    margin-left: 0;
    margin-top: 0;
    flex-direction: column; 
    align-items: flex-start; 
}

/* Sub-sub-option textboxes */
.sub-sub-options .textbox-section {
    display: none;
    margin-left: 0;
    width: 100%;
    flex-direction: column; 
    align-items: flex-start;
}

.textbox-section .required {
    color: #d32f2f;
    font-size: 12px;
    white-space: nowrap;
}

.required {
    color: red;
}

/* ==== BULLETPROOF CSS VISIBILITY RULES ==== */

/* Show main textboxes when main option is checked */
input[type="checkbox"]:checked + label + .textbox-section,
input[type="radio"]:checked + label + .textbox-section {
    display: flex !important;
}

/* Show sub-options when main option is checked */
input[type="checkbox"]:checked + label ~ .sub-options,
input[type="radio"]:checked + label ~ .sub-options {
    display: block !important;
}

/* Show sub-option textboxes when sub-option is checked */
.sub-option-main input[type="checkbox"]:checked + label + .textbox-section,
.sub-option-main input[type="radio"]:checked + label + .textbox-section {
    display: flex !important;    
    width: 99% !important;
}

/* Alternative selector for sub-option textboxes */
.sub-option input[type="checkbox"]:checked + label + .textbox-section,
.sub-option input[type="radio"]:checked + label + .textbox-section {
    display: flex !important;
}

/* Show nested sub-options when sub-option is checked */
.sub-option input[type="checkbox"]:checked + label ~ .sub-sub-options,
.sub-option input[type="radio"]:checked + label ~ .sub-sub-options {
    display: block !important;
}

/* Alternative: Show nested sub-options when they are siblings */
.sub-option input[type="checkbox"]:checked ~ .sub-sub-options,
.sub-option input[type="radio"]:checked ~ .sub-sub-options {
    display: block !important;
}

/* Show sub-sub-option textboxes when sub-sub-option is checked */
.sub-sub-options .sub-option input[type="checkbox"]:checked + label + .textbox-section,
.sub-sub-options .sub-option input[type="radio"]:checked + label + .textbox-section {
    display: flex !important;
}

.sub-sub-options .sub-option-main input[type="checkbox"]:checked + label + .textbox-section,
.sub-sub-options .sub-option-main input[type="radio"]:checked + label + .textbox-section {
    display: inline-flex !important;
}

/* Hide sub-options when main option is not checked (important for radio groups) */
input[type="radio"]:not(:checked) + label ~ .sub-options {
    display: none !important;
}

input[type="checkbox"]:not(:checked) + label ~ .sub-options {
    display: none !important;
}

/* Hide nested sub-options when parent sub-option is not checked */
.sub-option input[type="radio"]:not(:checked) + label ~ .sub-sub-options {
    display: none !important;
}

.sub-option input[type="checkbox"]:not(:checked) + label ~ .sub-sub-options {
    display: none !important;
}

.sub-option input[type="radio"]:not(:checked) ~ .sub-sub-options {
    display: none !important;
}

.sub-option input[type="checkbox"]:not(:checked) ~ .sub-sub-options {
    display: none !important;
}

/* ==== ALTERNATIVE DATA ATTRIBUTE APPROACH ==== */

/* Alternative visibility control using data attributes (JavaScript fallback) */
.form-field-container[data-show-textbox] .textbox-section {
    display: inline-flex !important;
}

.form-field-container[data-show-subtextbox] .sub-options .textbox-section {
    display: inline-flex !important;
}

/* ==== TEXTAREA STYLING ==== */

.textarea-section textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #D1D1D1;
    border-radius: 8px;
    font-family: 'Maax-Regular';
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    box-sizing: border-box;
}

.textarea-section textarea::placeholder {
    color: #888888;
    font-family: 'Maax-Regular';
    font-weight: 400;
    font-size: 16px;
    line-height: 20px;
    letter-spacing: 0;
    font-style: normal;
}

.textarea-bottom-section{
    display: flex; 
    width: 100%;
    justify-content: space-between;
    align-items: center;
    flex-direction: row-reverse;
}

.character-count {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    width: 50%;
}

.character-count.near-limit {
    color: #ff6b35;
}

.character-count.at-limit {
    color: #d32f2f;
    font-weight: bold;
}

/* ==== NOTICE SECTION ==== */

.notice-section {
    background-color: #FFFCE7;
    padding: 12px;
    margin: 15px 0;
    color: #89490A;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 24px 1fr;
    grid-template-rows: auto auto;
    gap: 0 12px;
    align-items: start;
}

.notice-icon {
    width: 24px;
    height: 24px;
    grid-row: 1 / 3;
    grid-column: 1;
    margin-top: 2px;
}

.notice-title {
    font-family: 'Maax-Regular';
    font-weight: bold;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0px;
    grid-row: 1;
    grid-column: 2;
}

.notice-content {
    margin: 0;
    line-height: 1.4;
    font-size: 14px;
    grid-row: 2;
    grid-column: 2;
    margin-top: 8px;
}

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

.hide {
    display: none;
}


/* ==== VALIDATION ERROR STYLING ==== */
.validation-error {
    font-size: 14px;
    color: #C30000;
    font-family: 'Maax-Regular';
    margin-top: 2px;
    letter-spacing: 0;
    line-height: 20px;
    width: 100%; /* Ensure it takes full width */
}


.validation-error .warning-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    vertical-align: baseline !important;
}

.validation-error .error-text {
    flex: 1;
    word-wrap: break-word;
}

.radioError {
    background: url(../images/radio-unselected-validation-error.svg) left center no-repeat !important;
    border-radius: 50px;
}

.checkboxError {
    background: url(../images/unchecked-validation-checkbox.svg) left center no-repeat !important;
}

.textboxError {
    border: 2px solid #C30000 !important;
    border-radius: 4px;
}

/* ==== TEXTBOX VALIDATION STYLING ==== */

.textbox-section input:required:not(:placeholder-shown):invalid {
    border: 2px solid #C30000 !important;
}

/* Reset to normal when field has content */
.textbox-section input:required:not(:placeholder-shown):valid {
    border: 1px solid #C6C6C6 !important;
}

/* Focus style for textareas */
.textarea-section textarea:focus,
.textbox-section input:focus,
.sub-option-main .textbox-section input:focus,
.sub-sub-options .textbox-section input:focus{
    outline: none;
    border: 2px solid #000000;
    box-shadow: none;
}

@media (max-width: 768px) {
    .textbox-section input {
        width: 100%;
    }
}

@media (max-width: 425px) {
    .sub-option-main {
        flex-wrap: wrap;
    }
    .sub-options, .sub-sub-options{
        margin-left: 0px;
    }
    .textbox-section input {
        width: 100%;
    }
    .form-field-container{
        padding: 0px;
    }
}