.resp-form-container {
    max-width: 900px;
    min-width: 230px;
    margin: 10px auto;
    padding: 0px 10px 10px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: 'Roboto', sans-serif !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.resp-form-section {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.resp-form-section:not(:last-child) {
    margin-bottom: 10px;
}

.resp-form-group {
    margin-bottom: 5px;
    display: flex;
}

.resp-form-group label {
    margin-right: 10px;
    flex-shrink: 0;
    color: #999A9A;
    height: 26px;
    padding: 0 4px 0 0;
    font-weight: bold;
    text-align: right;
    position: relative;
    top: 2px;
    margin-left: 10px;
}

.resp-form-group label:first-of-type {
    width: 110px;
    margin-left: 0px;
}

.resp-form-group label:has(input[type="checkbox"]) {
    width: auto;
    margin-right: 10px;
    flex-shrink: 0;
    color: black;
    height: 26px;
    padding: 0 4px 0 0;
    font-weight: normal;
    text-align: right;
    position: relative;
    top: -3px;
    display: inline-flex;
    align-items: center;
    float: left;
    margin-left: 0px;
}

.resp-form-group input,
.resp-form-group textarea {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    min-width: 10px;
}

.resp-form-group textarea {
    resize: vertical;
    height: 100px;
    padding-left: 4px;
    font-family: 'Roboto', sans-serif !important;
}

.resp-form-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
    position: relative;
    max-width: 900px; 
}

.resp-form-header h2 {
    margin: 0;
    font-size: 24px;
    flex: 0 1 auto;
}

.buttons-placeholder {
    position: absolute;
    right: 0px;
    display: flex;
    gap: 4px;
}

.buttons-placeholder-left {
    position: absolute;
    left: 0px;
    display: flex;
    gap: 4px;
}

.resp-form-header .button {
    padding: 6px 8px;
    background-color: rgb(6,  141, 205);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.resp-form-header .button:hover {
    background-color: rgb(6, 174, 241);
}

.resp-form-header .button:active {
    background-color: rgb(98, 211, 255);
}

.resp-form-header .button.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.resp-form-header-left {
    display: flex;
    justify-content: left;
    align-items: center;
    margin-bottom: 5px;
}

.resp-form-header-left label {
    font-weight: bold;
}

.resp-form-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.resp-section-buttons {
    flex: 1;
    text-align: left;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: #999A9A;
}

.resp-section-buttons .resp-grid-action-btn {
    margin-left: 5px;
    position: relative;
    top: -1px;
}

.resp-form-section .resp-form-group label {
    width: 90px;
}

@keyframes flashHighlight {
    from { background-color: rgba(255, 255, 0, 1); }
    to { background-color: rgba(255, 255, 0, 0); }
}

.item-highlight {
    animation: flashHighlight 1s linear;
}

.resp-form-error {
    background-color: #ffe6e6;
    border: 1px dotted red;
    padding: 8px;
}

#modalError {
    margin: auto;
}

/* Grid Section Styles */
.resp-grid-container {
    max-width: 900px;
    margin: 20px auto;
    font-family: Roboto, sans-serif;
}

.resp-with-overflow {
    overflow-x: auto;
}

.resp-grid-header, .resp-grid-row {
    display: flex;
    border-bottom: 1px solid #ccc;
}

.resp-grid-row.selected {
    border: 2px solid #4a90e2 !important;      
    background: #e8f1ff !important;            
    color: #003c8f !important;                 
}

.resp-grid-header {
    font-weight: bold;
    background-color: #f8f9fa;
}

.resp-grid-cell {
    flex: 1;
    padding: 10px;
    text-align: left;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.resp-grid-cell.question {
    flex: 2;
}

.resp-grid-cell.answer {
    flex: 0 0 auto;
    white-space: nowrap; 
}

.resp-grid-cell.text {
    width: 40%;
}

.resp-grid-cell.seqNo {
    max-width: 60px;
}

.resp-grid-cell.actions {
    flex: 0 0 354px; 
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: flex-start;
    cursor: default;
}

.resp-grid-header .resp-grid-cell.actions {    
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.resp-grid-action-btn {
    padding: 5px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    color: white;
    min-width: 20px; 
    max-width: 60px;
    text-align: center;
    background-color: rgb(6,  141, 205);
    background-repeat: no-repeat;
    background-position: center;
}

.resp-grid-action-btn:hover {
    background-color: rgb(6, 174, 241);
}

.resp-grid-action-btn:active {
    background-color: rgb(98, 211, 255);
}

.resp-grid-action-btn.up,
.resp-grid-action-btn.down,
.resp-grid-action-btn.auto-arrange {      
    min-width: 10px;
    max-width: 10px;
}

.resp-grid-action-btn.edit {
    max-width: min-content;
}

.resp-grid-action-btn.delete {
    max-width: min-content;
}

.resp-grid-action-btn.add {
    max-width: max-content;
}

.resp-grid-action-btn.move {
    max-width: min-content;
}

.resp-grid-action-btn.auto-arrange {    
    background-image: url('../images/arrange.png');
}

.resp-grid-action-btn.up {    
    background-image: url('../images/arrow_up.png');
}

.resp-grid-action-btn.down {
    background-image: url('../images/arrow_down.png');
}

.resp-grid-action-btn.left {    
    background-image: url('../images/arrow_left.png');
}

.resp-grid-action-btn.right {
    background-image: url('../images/arrow_right.png');
}

.resp-grid-action-btn.all-left {    
    background-image: url('../images/arrow_all_left.png');
}

.resp-grid-action-btn.all-right {
    background-image: url('../images/arrow_all_right.png');
}

.resp-grid-action-btn.color-settings {
    background-image: url('../images/color-selection.png');
}

.resp-grid-action-btn.delete,
#cancel-test-button {
    background-color: #dc3545;
}

.resp-grid-action-btn.delete:hover,
#cancel-test-button:hover {
    background-color: #fa5061;
}

.resp-grid-action-btn.delete:active,
#cancel-test-button:active {
    background-color: #fc7a87;
}

.resp-grid-action-btn.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.full-width {
    width: 100%;
}

.flex-gap-layout {
    display: flex;
    gap: 4px;
}

label:has(input[disabled]) {
    color: #ccc !important;
}

/* Modal Styles */
.resp-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.resp-modal-content {
    background-color: white;
    padding: 10px;
    border-radius: 5px;
    max-width: 556px;
    width: 90%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative; 
    margin: 10px;
}

.resp-modal-content h3 {
    margin: 0 0 20px;
    font-size: 20px;
    text-align: center;
}

.resp-modal-content .form-group {
    margin-bottom: 15px;
}

.resp-modal-content .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.resp-modal-content .form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.resp-modal-content .form-buttons {
    justify-content: flex-end;
}

.modal-header {
    background: linear-gradient(to bottom, #f7fcff 0%, #caeef7 100%);
    border: 1px solid #ccc;
    margin: -11px -11px 10px -11px;
    padding: 4px;
    border-radius: 4px 4px 0px 0px;
    font-weight: bold;
}

.modal-sub-header {
    background: #f4f4f4;
    border: 1px solid gray;
    padding: 4px;
    border-radius: 4px 4px 0px 0px;
    font-weight: bold;
    font-size: 13px;
}

.modal-sub-list {
    border-radius: 0px 0px 4px 4px !important;
    overflow: auto !important;
    height: 200px;
}

ul.modal-sub-list {
    border: 1px solid gray;
}

ul.modal-sub-list li {
    border: 1px solid gray;
    text-align: left;
    padding: 2px;
}

ul.modal-sub-list.sortable {
    border: 1px solid gray;    
    list-style: none;
    padding: 5px;
}

ul.modal-sub-list.sortable li {
    padding: 5px;
    margin: 3px 0;
    background: #f4f4f4;
    cursor: move;
}

.resp-close-modal {
    position: absolute;
    top: 1px;
    right: 13px;
    font-size: 20px;
    cursor: pointer;
    color: #333;
}

.resp-modal select {
    width: 100%;
    max-width: 100%;    
    box-sizing: border-box; 
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Table */
.responsive-table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 600px;
}

.responsive-table th,
.responsive-table td {
    border: 1px solid #ddd;
    padding: 4px;
    text-align: left;
}

.responsive-table th {
    text-align: center;
    vertical-align: middle;
}

.responsive-table td {
    text-align: left;
    vertical-align: middle;
}

.responsive-table input {    
    box-sizing: border-box;
}

.modal-table {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #9a9a9a;
    border-radius: 4px;
}

.modal-table-header {
    display: flex;
    background: #f4f4f4;
    font-weight: bold;
    border-bottom: 1px solid #9a9a9a;
    border-radius: 4px 4px 0px 0px;
    font-size: 14px;
}

.modal-table-body {
    max-height: 127px;
    overflow-y: auto;
    overflow-x: hidden;
}

#number-scores-table .modal-table-body {
    max-height: 112px !important;
    overflow-y: auto;
    overflow-x: hidden;
}

#answer-fields-table .modal-table-body {
    max-height: 112px !important;
    overflow-y: auto;
    overflow-x: hidden;
}

#answer-fields-section {
    flex-grow: 1;
}

.modal-table-row {
    display: flex;
    align-items: center;
}

.modal-table-cell {
    flex: 1;
    padding: 2px;
    text-align: left;
}

.question-form-body {     
    padding-right: 4px;
}

.no-margin-left {
    margin-left: 0px !important;
}

.resp-grid-rows {
    max-height: 300px;
    overflow-y: auto;
}

.resp-vertical-block {
    display: flex;
    flex-direction: column;
}

.resp-form-group:has(.flex-grow) {
    gap: 8px;
}

.flex-grow {
    flex-grow: 1;
}

.resp-horizontal-block {
    display: flex;
    flex-direction: row;
}

.resp-vertical-block label, .resp-horizontal-block label {
    width: unset !important;
    text-align: left !important;
    height: 20px !important;
}

.floatThead-wrapper .floatThead-container {
    z-index: 1000 !important;
}

#views-grid {
    width: 100%;
}

#views-grid .resp-grid-cell.actions {
    flex: 0 0 112px !important;    
}

#manageViewsModal .resp-modal-content h3 {
    margin: 0px;
}

#manageViewsModal .resp-grid-container {
    margin-top: 4px;
}

.columns-list {
    display: grid;
    grid-template-columns: 1fr 20px 1fr;
}

/* Card View for Small Screens */
@media (max-width: 540px) {
    .resp-form-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .resp-form-header button {
        margin-top: 10px;
    }

    .resp-form-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .resp-form-group label {
        width: auto;
        margin-right: 0;
        margin-bottom: 2px;
        margin-top: 4px;
        position: unset;
        top: unset;
        height: auto;
        margin-left: 0px;
    }

    .resp-form-group label:first-of-type {
        width: unset;        
    }

    .resp-form-group label:has(input[type="checkbox"]) {
        width: auto;
        margin-right: 0;
        margin-bottom: 2px;
        margin-top: 4px;
        position: unset;
        top: unset;
        height: auto;
    }

    .resp-form-section .resp-form-group label {
        width: auto;
    }

    .resp-form-group input,
    .resp-form-group textarea {
        width: 100%;
    }

    .checkbox {
        width: unset !important;
    }

    .resp-grid-header {
        display: none;
    }

    .resp-grid-row {
        flex-direction: column;
        border: 1px solid #ccc;
        border-radius: 5px;
        margin-bottom: 10px;
        background-color: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        height: unset !important;
    }

    .resp-grid-cell {
        padding: 8px !important;
        border-bottom: 1px solid #eee;
        display: block;
    }

    .resp-grid-cell:last-child {
        border-bottom: none;
    }

    .resp-grid-cell::before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
        margin-bottom: 5px;
    }

    .resp-grid-cell.actions {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
        align-items: center;
        justify-content: flex-start;
        flex: 1;
        padding-bottom: 10px;
    }

    .resp-grid-cell.actions::before {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }

    .resp-grid-action-btn {
        width: 100%;
        text-align: left;
        min-width: unset; /* Remove min-width in card view */
    }

    .resp-section-buttons .resp-grid-action-btn {
        margin-left: unset;
        top: unset;
    }

    .resp-section-buttons {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
        align-items: center;
        justify-content: flex-start;
        flex: 1;
        padding-top: 10px;        
    }

    .resp-section-buttons::before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
        margin-bottom: 5px;
        width: 100%;
    }     

    .responsive-table {
        min-width: unset;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table, 
    .responsive-table tbody, 
    .responsive-table tr, 
    .responsive-table td {
        display: block;        
    }

    .responsive-table tr {
        margin-bottom: 1.5rem;
        border: 1px solid #ccc;
        padding: 1rem;
        border-radius: 6px;       
    }

    .responsive-table td.stats-column {
        padding: 4px;
        text-align: left;
        position: relative;
        align-content: center;
        height: 24px;
    }

    .responsive-table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 100%;
        padding-right: 1rem;
    }

    .responsive-table td.stats-column::before {
        width: unset;
    }

    .responsive-table td input {
        float: right;
        width: calc(100% - 116px);
        margin-bottom: 5px;
    }    

    .modal-table-header {
        display: none;
    }

    .modal-table-body {
        max-height: 100px;
        padding-right: 6px;
    }

    .modal-table-row {
        display: flex;
        flex-direction: column;
        padding: 4px;
        background: unset;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .modal-table-cell {
        display: flex;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
    }

    .modal-table-cell::before {
        content: attr(data-label);
        font-weight: bold;
        font-size: 14px;
        width: 100px;
        display: inline-block;
        text-align: left;
    }   

    .radiogroup, .radiogroup label {
        display: flex;
    }

    .radiogroup label input[type="radio"] {
        top: -3px !important;
    }
    
    .flex-nowrap {
        flex-wrap: nowrap !important;
        flex: 1 !important;
    }
    
}