/* Reset default styles for consistency */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body and general styling */
body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    padding: 20px;
    background: #f9f9f9;
    color: #333;
}

/* Header with icon */
h1 {
    display: flex;
    align-items: center;
    font-size: 2em;
    margin-bottom: 20px;
}

h1 img {
    margin-right: 10px;
}

/* Explanation section */
.explaination {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.explaination ul {
    list-style: none;
    margin-bottom: 10px;
}

.explaination li {
    margin: 5px 0;
}

/* Category headers */
.category {
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    margin: 10px 0;
    padding: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    transition: background 0.3s;
}

.category:hover {
    background: #d0d0d0;
}

/* Category content (collapsible) */
.category-content {
    display: none;
    padding-left: 20px;
    margin-bottom: 20px;
}

.category-content.active {
    display: block;
}

/* Activity (slider) styling */
.activity {
    margin: 10px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.activity label {
    flex: 1;
    min-width: 150px;
    font-weight: normal;
}

.activity output {
    flex: 0 0 auto;
    min-width: 60px;
    text-align: right;
    font-weight: bold;
    padding-right: 10px;
}

/* Slider styling */
input[type=range] {
    flex: 1;
    width: clamp(120px, 40vw, 180px);
    margin: 0;
    -webkit-appearance: none;
    background: #ddd;
    height: 8px;
    border-radius: 4px;
    outline: none;
    transition: background 0.3s;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #4caf50;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

input[type=range]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4caf50;
    border-radius: 50%;
    cursor: pointer;
}

input[type=range]:focus {
    background: #ccc;
}

input[type=range]:focus::-webkit-slider-thumb {
    background: #388e3c;
}

input[type=range]:focus::-moz-range-thumb {
    background: #388e3c;
}

/* Rating colors */
.red { color: red; }
.curious { color: orange; }
.ylike { color: green; }
.moderate { color: blue; }
.ohyes { color: purple; }

/* Quick quiz styling */
#quick-quiz {
    display: none;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 20px;
    background: #fff;
}

#quick-quiz h2 {
    font-size: 1.5em;
    margin-bottom: 15px;
}

#quick-quiz button {
    padding: 10px 20px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

#quick-quiz button:hover {
    background: #388e3c;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 10px;
    background: #ddd;
    margin: 10px 0;
    border-radius: 5px;
}

.progress-fill {
    height: 100%;
    background: #4caf50;
    width: 0;
    border-radius: 5px;
    transition: width 0.3s ease-in-out;
}

/* QR code and export buttons */
#export_button, #qr_button, #code {
    display: inline-block;
    margin: 10px 5px;
    padding: 8px 15px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    cursor: pointer;
}

#export_button:hover, #qr_button:hover, #code:hover {
    background: #0056b3;
}

#qrcode {
    margin-top: 10px;
}

/* Form container */
form {
    margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        padding: 10px;
        font-size: clamp(14px, 4vw, 16px);
    }

    h1 {
        font-size: clamp(1.2em, 5vw, 1.5em);
        flex-direction: column;
        align-items: flex-start;
    }

    h1 img {
        width: 30px;
        margin-bottom: 10px;
    }

    .explaination {
        padding: 10px;
        font-size: 0.9em;
    }

    .category {
        font-size: 1em;
        padding: 8px;
    }

    .category-content {
        padding-left: 10px;
    }

    .activity {
        flex-direction: column;
        align-items: center;
        gap: 1px;
    }

    .activity label {
        width: auto;
        min-width: 0;
        text-align: left;
    }

    .activity output {
        width: auto;
        min-width: 0;
        text-align: left;
        padding-right: 0;
    }

    input[type=range] {
        width: 100%;
        max-width: 300px;
        margin: 0;
    }

    input[type=range]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }

    input[type=range]::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }

    button, #export_button, #qr_button, #code {
        padding: 12px 20px;
        min-width: 48px;
        min-height: 48px;
        font-size: 1em;
    }

    .category:hover, #export_button:hover, #qr_button:hover, #code:hover {
        background: initial;
    }

    .category:active, #export_button:active, #qr_button:active, #code:active {
        background: #d0d0d0;
    }

    .progress-bar, #qrcode {
        max-width: 100%;
        overflow: hidden;
    }

    #quick-quiz {
        padding: 10px;
        font-size: 0.9em;
    }

    #quick-quiz h2 {
        font-size: 1.2em;
    }
}

/* Accessibility improvements */
input[type=range]:focus {
    outline: 2px solid #007bff;
}

button:focus, a:focus {
    outline: 2px solid #007bff;
}

button {
    padding: 5px 10px;
    margin: 5px;
    cursor: pointer;
}
