/**
 * Frontend CSS for CEJ Questions plugin
 */

.cej-questionnaire-header {
    margin-bottom: 30px;
}

.cej-questionnaire-title {
    font-size: 2em;
    margin-bottom: 15px;
    color: #333;
}

.cej-questionnaire-description {
    font-size: 1.1em;
    color: #666;
    line-height: 1.6;
}

.cej-questions {
    margin-bottom: 30px;
}

.cej-question {
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.cej-question.error {
    border-color: #e74c3c;
    background-color: #fdf2f2;
}

.cej-question-title {
    font-size: 1.3em;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.cej-question-title .required {
    color: #e74c3c;
    margin-left: 5px;
}

.cej-question-answers {
    display: grid;
    gap: 12px;
}

.cej-answer-option {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cej-answer-option:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.cej-answer-option.selected {
    border-color: #3498db;
    background: #e3f2fd;
}

/* Checked state styling */
.cej-answer-option:has(input:checked) {
    border-color: #3498db;
    background: #e3f2fd;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.cej-answer-option input[type="radio"] {
    margin-right: 12px;
    transform: scale(1.2);
    accent-color: #3498db;
    cursor: pointer;
    order: 1;
    flex-shrink: 0;
}

/* Enhanced radio button styling */
.cej-answer-option input[type="radio"]:checked {
    transform: scale(1.3);
}

.cej-answer-option input[type="radio"]:checked + .cej-answer-text {
    font-weight: 600;
    color: #2c5aa0;
}

/* Check icon for selected options */
.cej-answer-option {
    position: relative;
}

.cej-answer-option::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #A10822;
    border-radius: 50%;
    opacity: 1;
    transition: all 0.3s ease;
}

.cej-answer-option::before {
    content: '✓';
    position: absolute;
    left: 20px;
    top: 52%;
    transform: translateY(-50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1;
    border: 0!important;
}

/* Show check icon when selected */
.cej-answer-option.selected::after,
.cej-answer-option:has(input:checked)::after {
    opacity: 1;
}

.cej-answer-option.selected::before,
.cej-answer-option:has(input:checked)::before {
    opacity: 1;
}

/* Fallback for browsers that don't support :has() */
.cej-answer-option.selected {
    border-color: #3498db;
    background: #e3f2fd;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.cej-answer-text {
    font-size: 1em;
    color: #333;
    flex: 1;
    text-align: left;
    order: 0;
    margin-left: 30px;
}

.cej-questionnaire-actions {
    text-align: center;
    padding: 20px 0;
}

.cej-submit-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.cej-submit-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.cej-submit-btn:active {
    transform: translateY(0);
}

.cej-loading {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.cej-loading p {
    font-size: 1.1em;
    color: #666;
    margin: 0;
}

.cej-results {
    margin-top: 30px;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
}

.cej-result-message {
    padding: 30px;
    border-radius: 8px;
    margin: 20px 0;
}

.cej-result-message h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
}

.cej-result-message p {
    font-size: 1.1em;
    line-height: 1.6;
    margin: 0;
}

.cej-result-message.no_match {
    background: #ffebee;
    border: 2px solid #e57373;
    color: #c62828;
}

.cej-result-message.maybe_match {
    background: #fff3e0;
    border: 2px solid #ffb74d;
    color: #ef6c00;
}

.cej-result-message.match {
    background: #e8f5e8;
    border: 2px solid #81c784;
    color: #2e7d32;
}

.cej-error-message {
    background: #ffebee;
    border: 2px solid #e57373;
    color: #c62828;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.cej-error-message h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.cej-validation-error {
    background: #ffebee;
    color: #c62828;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 2px solid #e57373;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(229, 115, 115, 0.3);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Responsive design */
@media (max-width: 768px) {
    .cej-questionnaire {
        padding: 15px;
    }
    
    .cej-question {
        padding: 20px;
    }
    
    .cej-question-title {
        font-size: 1.2em;
    }
    
    .cej-answer-option {
        padding: 12px;
    }
    
    .cej-submit-btn {
        padding: 12px 30px;
        font-size: 1em;
    }
}

/* Animation for form submission */
.cej-questionnaire-form.submitting .cej-question {
    opacity: 0.6;
    pointer-events: none;
}

.cej-questionnaire-form.submitting .cej-submit-btn {
    opacity: 0.7;
    cursor: not-allowed;
}
