/* Understanding Test Styles */

/* Enhanced Checkbox Styles */
#understanding-test-content .question-card input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    margin: 0 !important;
    margin-right: 0.75rem !important;
    border: 2px solid var(--clay-border) !important;
    border-radius: 8px !important;
    background: var(--clay-surface-dark) !important;
    cursor: pointer !important;
    position: relative !important;
    transition: all 0.3s ease !important;
    box-shadow: inset 2px 2px 4px rgba(163, 177, 198, 0.2), inset -2px -2px 4px rgba(255, 255, 255, 0.8) !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}

#understanding-test-content .question-card input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--clay-primary) 0%, var(--clay-secondary) 100%) !important;
    border-color: var(--clay-primary) !important;
    box-shadow: 0 4px 12px rgba(255, 154, 158, 0.4) !important;
}

#understanding-test-content .question-card input[type="checkbox"]:checked::after {
    content: '✓' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: white !important;
    font-size: 16px !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

#understanding-test-content .question-card input[type="checkbox"]:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(255, 154, 158, 0.3) !important;
}

/* Enhanced Radio Button Styles */
#understanding-test-content .question-card input[type="radio"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    margin: 0 !important;
    border: 2px solid var(--clay-border) !important;
    border-radius: 50% !important;
    background: var(--clay-surface-dark) !important;
    cursor: pointer !important;
    position: relative !important;
    transition: all 0.3s ease !important;
    box-shadow: inset 2px 2px 4px rgba(163, 177, 198, 0.2), inset -2px -2px 4px rgba(255, 255, 255, 0.8) !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}

#understanding-test-content .question-card input[type="radio"]:checked {
    background: linear-gradient(135deg, var(--clay-primary) 0%, var(--clay-secondary) 100%) !important;
    border-color: var(--clay-primary) !important;
    box-shadow: 0 4px 12px rgba(255, 154, 158, 0.4) !important;
}

#understanding-test-content .question-card input[type="radio"]:checked::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 10px !important;
    height: 10px !important;
    background: white !important;
    border-radius: 50% !important;
}

#understanding-test-content .question-card input[type="radio"]:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(255, 154, 158, 0.3) !important;
}

/* Enhanced Text Input Styles */
#understanding-test-content .option-input,
#understanding-test-content .question-card input[type="text"],
#understanding-test-content .question-card textarea,
#understanding-test-content .custom-category-form input[type="text"],
#understanding-test-content .custom-question-form input[type="text"],
#understanding-test-content .custom-question-form textarea {
    width: 100% !important;
    padding: 1rem 1.25rem !important;
    border: 2px solid transparent !important;
    border-radius: 15px !important;
    font-size: 1rem !important;
    font-family: inherit !important;
    transition: all 0.3s ease !important;
    background: var(--clay-surface-dark) !important;
    box-shadow: inset 4px 4px 8px rgba(163, 177, 198, 0.2), inset -4px -4px 8px rgba(255, 255, 255, 0.8) !important;
    color: var(--clay-text) !important;
    outline: none !important;
    box-sizing: border-box !important;
}

#understanding-test-content .option-input:focus,
#understanding-test-content .question-card input[type="text"]:focus,
#understanding-test-content .question-card textarea:focus,
#understanding-test-content .custom-category-form input[type="text"]:focus,
#understanding-test-content .custom-question-form input[type="text"]:focus,
#understanding-test-content .custom-question-form textarea:focus {
    border-color: var(--clay-primary) !important;
    box-shadow: inset 4px 4px 8px rgba(163, 177, 198, 0.2), inset -4px -4px 8px rgba(255, 255, 255, 0.8), 0 0 0 3px rgba(255, 154, 158, 0.2) !important;
    background: var(--clay-surface) !important;
}

#understanding-test-content .option-input::placeholder,
#understanding-test-content .question-card input[type="text"]::placeholder,
#understanding-test-content .question-card textarea::placeholder,
#understanding-test-content .custom-category-form input[type="text"]::placeholder,
#understanding-test-content .custom-question-form input[type="text"]::placeholder,
#understanding-test-content .custom-question-form textarea::placeholder {
    color: var(--clay-text-light) !important;
    opacity: 0.7 !important;
}

/* Test Category Styles */
.test-category {
    background: var(--clay-surface);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--clay-border);
    box-shadow: var(--clay-shadow-card);
    margin-bottom: 1.5rem;
}

.test-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--clay-border);
    flex-wrap: wrap;
}

.test-category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--clay-text);
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

.test-category-title span {
    word-wrap: break-word;
    white-space: normal;
}

/* Add Question button in category header */
.test-category-header .add-custom-btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    min-width: auto !important;
    margin: 0 !important;
}

/* Question Card Styles */
#understanding-test-content .question-card {
    background: var(--clay-surface-dark) !important;
    padding: 1.25rem !important;
    border-radius: 15px !important;
    border: 1px solid var(--clay-border) !important;
    margin-bottom: 1rem !important;
    transition: all 0.3s ease !important;
    box-shadow: var(--clay-shadow-soft) !important;
}

#understanding-test-content .question-card:hover {
    box-shadow: var(--clay-shadow-hover) !important;
    transform: translateY(-2px) !important;
}

#understanding-test-content .question-card.selected {
    border-color: var(--clay-primary) !important;
    background: var(--clay-surface) !important;
    box-shadow: 0 0 0 3px rgba(255, 154, 158, 0.1) !important;
}

#understanding-test-content .question-card-header {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

#understanding-test-content .question-card label {
    font-weight: 500 !important;
    cursor: pointer !important;
    flex: 1 !important;
    color: var(--clay-text) !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.question-options {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--clay-border);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Category/Question Form */
.custom-category-form,
.custom-question-form {
    background: var(--clay-surface);
    padding: 1.5rem;
    border-radius: 20px;
    border: 2px dashed var(--clay-border);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.custom-category-form:hover,
.custom-question-form:hover {
    border-color: var(--clay-primary);
    box-shadow: var(--clay-shadow-soft);
}

.custom-category-form.active,
.custom-question-form.active {
    border-style: solid;
    border-color: var(--clay-primary);
    background: var(--clay-surface-dark);
}

#understanding-test-content .add-custom-btn {
    background: linear-gradient(135deg, var(--clay-primary) 0%, var(--clay-secondary) 100%) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 15px !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: var(--clay-shadow-soft) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    margin: 1rem 0 !important;
    font-family: inherit !important;
}

#understanding-test-content .add-custom-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--clay-shadow-hover) !important;
}

.add-custom-btn .icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Form Actions */
#understanding-test-content .form-actions {
    display: flex !important;
    gap: 0.75rem !important;
    margin-top: 1rem !important;
}

#understanding-test-content .form-actions button {
    flex: 1 !important;
    padding: 0.75rem 1.5rem !important;
    border: none !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-family: inherit !important;
}

#understanding-test-content .btn-save {
    background: linear-gradient(135deg, var(--clay-primary) 0%, var(--clay-secondary) 100%) !important;
    color: white !important;
    box-shadow: var(--clay-shadow-soft) !important;
}

#understanding-test-content .btn-save:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--clay-shadow-hover) !important;
}

#understanding-test-content .btn-cancel {
    background: var(--clay-surface-dark) !important;
    color: var(--clay-text) !important;
    border: 1px solid var(--clay-border) !important;
}

#understanding-test-content .btn-cancel:hover {
    background: var(--clay-surface) !important;
    box-shadow: var(--clay-shadow-soft) !important;
}

/* Category Emoji Picker */
.emoji-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--clay-surface-dark);
    border-radius: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-option {
    font-size: 1.5rem;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    background: transparent;
    border: 2px solid transparent;
}

.emoji-option:hover {
    background: var(--clay-surface);
    transform: scale(1.2);
    border-color: var(--clay-primary);
}

.emoji-option.selected {
    background: var(--clay-primary);
    border-color: var(--clay-primary);
    transform: scale(1.1);
}

/* Dark Mode */
body.dark-mode .question-card input[type="checkbox"],
body.dark-mode .question-card input[type="radio"] {
    background: var(--clay-surface-dark);
    box-shadow: var(--clay-shadow-dark-inset);
}

body.dark-mode .question-card input[type="checkbox"]:checked,
body.dark-mode .question-card input[type="radio"]:checked {
    box-shadow: var(--clay-shadow-dark-soft);
}

body.dark-mode .option-input,
body.dark-mode .question-card input[type="text"],
body.dark-mode .question-card textarea {
    background: var(--clay-surface-dark);
    box-shadow: var(--clay-shadow-dark-inset);
    color: var(--clay-text);
}

body.dark-mode .option-input:focus,
body.dark-mode .question-card input[type="text"]:focus,
body.dark-mode .question-card textarea:focus {
    box-shadow: var(--clay-shadow-dark-inset), 0 0 0 3px rgba(255, 154, 158, 0.2);
}

/* Understanding Test Modal Responsive Fixes */
#understanding-test-modal .modal-content {
    position: relative;
    padding-top: 3.5rem !important; /* Space for close button */
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

#understanding-test-modal .modal-close {
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    z-index: 100 !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 1.25rem !important;
    background: var(--clay-surface-dark) !important;
    border: none !important;
    border-radius: 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: var(--clay-shadow-soft) !important;
}

#understanding-test-modal h3 {
    text-align: center !important;
    margin: 0 auto 1.5rem auto !important;
    padding: 0 2.5rem !important; /* Space for close button */
    font-size: 1.25rem !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    white-space: normal !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

#understanding-test-content h4 {
    font-size: 1.2rem !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    white-space: normal !important;
    margin-bottom: 0.75rem !important;
    color: var(--clay-text) !important;
}

/* Fix button sizes to be equal */
#understanding-test-content button.btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    min-height: 120px !important;
    text-align: center !important;
    font-size: 0.95rem !important;
}

#understanding-test-content button.btn .icon {
    width: 2.5rem !important;
    height: 2.5rem !important;
    margin-bottom: 0.5rem !important;
}

#understanding-test-content button.btn > div {
    font-size: 1rem !important;
    line-height: 1.4 !important;
    white-space: normal !important;
    word-wrap: break-word !important;
}

#understanding-test-content button.btn > div:last-child {
    font-size: 0.85rem !important;
    margin-top: 0.25rem !important;
    opacity: 0.9 !important;
}

/* Fix grid layout on mobile */
#understanding-test-content > div > div[style*="grid-template-columns"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
}

/* Tablet and smaller screens */
@media (max-width: 768px) {
    .test-category-header {
        gap: 0.75rem !important;
    }
    
    .test-category-title {
        font-size: 1rem !important;
        max-width: calc(100% - 120px) !important; /* Leave space for button */
    }
    
    .test-category-header .add-custom-btn {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }
}

/* Mobile specific fixes */
@media (max-width: 480px) {
    #understanding-test-modal .modal-content {
        max-width: 95% !important;
        padding: 1rem !important;
        padding-top: 3rem !important;
    }
    
    #understanding-test-modal h3 {
        font-size: 1.1rem !important;
        padding: 0 2rem !important;
        margin-bottom: 1rem !important;
    }
    
    #understanding-test-modal .modal-close {
        top: 0.75rem !important;
        right: 0.75rem !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 1.1rem !important;
    }
    
    #understanding-test-content button.btn {
        padding: 0.75rem !important;
        min-height: 100px !important;
        font-size: 0.9rem !important;
    }
    
    #understanding-test-content button.btn .icon {
        width: 2rem !important;
        height: 2rem !important;
    }
    
    #understanding-test-content button.btn > div {
        font-size: 0.9rem !important;
    }
    
    #understanding-test-content button.btn > div:last-child {
        font-size: 0.75rem !important;
    }
    
    #understanding-test-content > div > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Fix text compression */
    #understanding-test-content h4 {
        font-size: 1.1rem !important;
        line-height: 1.4 !important;
        word-wrap: break-word !important;
        white-space: normal !important;
        margin-bottom: 0.75rem !important;
    }
    
    #understanding-test-content p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        word-wrap: break-word !important;
    }
    
    /* Category header responsive fixes */
    .test-category-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .test-category-title {
        width: 100% !important;
        font-size: 0.95rem !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
        white-space: normal !important;
    }
    
    .test-category-header .add-custom-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Test category responsive */
    .test-category {
        padding: 1rem !important;
    }
    
    /* Question cards responsive */
    #understanding-test-content .question-card {
        padding: 1rem !important;
    }
    
    #understanding-test-content .question-card label {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
    }
    
    /* Custom question form responsive */
    .custom-question-form,
    .custom-category-form {
        padding: 1rem !important;
    }
    
    .custom-question-form h5,
    .custom-category-form h5 {
        font-size: 1rem !important;
        line-height: 1.4 !important;
        word-wrap: break-word !important;
        white-space: normal !important;
    }
    
    /* Form labels responsive */
    .custom-question-form label,
    .custom-category-form label {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }
    
    /* Option inputs responsive */
    #understanding-test-content .option-input {
        font-size: 0.9rem !important;
        padding: 0.75rem 1rem !important;
    }
    
    /* Correct answer radio buttons responsive */
    #understanding-test-content div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }
    
    /* Form actions responsive */
    #understanding-test-content .form-actions {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    #understanding-test-content .form-actions button {
        width: 100% !important;
        padding: 0.875rem 1rem !important;
        font-size: 0.95rem !important;
    }
}

