@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

/* General Styles */
body {
    font-family: 'Lato', sans-serif;
}

form {
    background: #ffffff;
    padding: 2.5em;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin: 2.5em auto;
}

h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 2em;
    font-weight: 600;
}

/* Question Styles */
.question {
    background: #fdfdfd;
    border: 1px solid #ecf0f1;
    padding: 2em;
    margin-bottom: 2em;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.question:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08);
}

form p {
    word-wrap: break-word;
    word-break: break-all;
    white-space: normal;
}

.question p {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 1.5em;
    word-wrap: break-word;
    word-break: break-all;
    white-space: normal;
}

.demographic-field label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #34495e;
    word-wrap: break-word;
    word-break: break-all;
    white-space: normal;
}

.question label {
    display: block;
    margin-bottom: 1em;
    color: #7f8c8d;
    cursor: pointer;
    position: relative;
    padding-left: 35px;
}

.question label input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: #ecf0f1;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.question label:hover input ~ .checkmark {
    background-color: #bdc3c7;
}

.question label input:checked ~ .checkmark {
    background-color: #3498db;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.question label input:checked ~ .checkmark:after {
    display: block;
}

.question label .checkmark:after {
    top: 9px;
    left: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* Submit Button */
input[type="submit"] {
    background-image: linear-gradient(to right, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 15px 30px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 18px;
    margin-top: 1.5em;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

input[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Result Styles */
.questionnaire-result {
    background: #ecf9ff;
    border: 1px solid #b3e0ff;
    padding: 2.5em;
    margin-top: 2.5em;
    border-radius: 12px;
    text-align: center;
}

.questionnaire-result h2 {
    color: #2980b9;
}

.questionnaire-result p {
    font-size: 1.3em;
    color: #2c3e50;
    word-wrap: break-word;
    word-break: break-all;
    white-space: normal;
}

.desktop-layout {
    display: none;
}

@media (min-width: 992px) {
    .mobile-layout {
        display: none;
    }

    .desktop-layout {
        display: block;
        overflow-x: auto; /* Add horizontal scroll on smaller viewports if needed */
    }

    .questionnaire-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 2em;
        table-layout: fixed;
    }

    .questionnaire-table th, .questionnaire-table td {
        padding: 8px 10px;
        text-align: left;
        border-bottom: 1px solid #ecf0f1;
    }

    .questionnaire-table thead th {
        background-color: #f9f9f9;
        font-weight: 600;
        color: #34495e;
        text-align: center;
        font-size: 13px;
        white-space: normal; /* Allow header text to wrap */
    }

    .questionnaire-table th:first-child {
        width: 40%;
    }

    .questionnaire-table .statement-cell {
        width: 40%; /* Make the first column 40% of the table width */
        max-width: 40%; /* Enforce the max width */
        word-wrap: break-word; /* Ensure long text wraps */
        word-break: break-all; /* Force word break */
        white-space: normal; /* Ensure whitespace is handled normally */
    }

    .questionnaire-table tbody tr:nth-child(even) {
        background-color: #f9f9f9;
    }

    .questionnaire-table td:not(:first-child) {
        text-align: center;
    }

    .questionnaire-table input[type="radio"] {
        cursor: pointer;
    }
}

.demographics-form {
    text-align: center;
}

.demographics-form input[type="submit"] {
    display: inline-block;
    width: auto;
}

/* About the Test Button and Modal */
.questionnaire-wrapper {
    position: relative;
}

.about-test-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #3498db;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 85%;
    max-width: 800px;
    border-radius: 8px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
    }
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
}

.modal-content p {
    word-wrap: break-word;
    word-break: break-all;
    white-space: normal;
}