/* Quiz Maker - Frontend Styles */

/* Force unchecked state - overrides all :has() selectors but allows hover */
.quiz-answer-item.quiz-force-unchecked:not(:hover) {
    background-color: #f9f9f9 !important;
    border-color: #e0e0e0 !important;
}

.quiz-maker-container {
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quiz-maker-form {
    display: block;
}

.quiz-question-item {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.quiz-question-item:last-child {
    border-bottom: none;
}

.quiz-question-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    line-height: 1.4;
}

.quiz-answers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-answer-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-answer-item:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.quiz-answer-item input[type="radio"] {
    margin: 0 12px 0 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.quiz-answer-text {
    flex: 1;
    font-size: 16px;
    color: #555;
    line-height: 1.5;
}

.quiz-answer-item input[type="radio"]:checked + .quiz-answer-text {
    /* Font weight controlled by Elementor widget */
    color: #333;
}

.quiz-answer-item:has(input[type="radio"]:checked) {
    background: #e3f2fd;
    border-color: #2196f3;
}

/* ABCD Label Styles */
.quiz-answer-item.has-abcd-label {
    gap: 12px;
}

.quiz-answer-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    color: #667eea;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.quiz-answer-item:has(input[type="radio"]:checked) .quiz-answer-label {
    background: #667eea;
    color: #ffffff;
}

.quiz-answer-item.has-abcd-label input[type="radio"] {
    display: none;
}

.quiz-answer-item.has-abcd-label .quiz-answer-text {
    margin-left: 0;
}

.quiz-submit-container {
    margin-top: 30px;
    text-align: center;
}

.quiz-submit-btn {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    background: #0073aa;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 115, 170, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.quiz-submit-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.4);
}

.quiz-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.elementor-button-content-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.elementor-button-icon {
    display: inline-flex;
    align-items: center;
}

.elementor-button-text {
    display: inline-block;
}

/* Loading State */
.quiz-loading {
    text-align: center;
    padding: 40px;
}

.quiz-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results */
.quiz-results {
    text-align: center;
    padding: 30px;
}

.quiz-results-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
}

.quiz-results-title.passed {
    color: #4caf50;
}

.quiz-results-title.failed {
    color: #f44336;
}

.quiz-results-stats {
    font-size: 18px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 6px;
}

.quiz-results-stats p {
    margin: 8px 0;
}

.quiz-results-details {
    text-align: left;
    margin-top: 30px;
}

.quiz-result-item {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #ddd;
}

.quiz-result-item.correct {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.quiz-result-item.partial {
    background: #fff3e0;
    border-left-color: #ff9800;
}

.quiz-result-item.incorrect {
    background: #ffebee;
    border-left-color: #f44336;
}

.quiz-result-question {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.quiz-result-answer {
    color: #666;
    font-size: 14px;
}

/* Step-by-Step Quiz Styles */
.quiz-maker-step {
    position: relative;
}

.quiz-progress-bar {
    background: #e0e0e0;
    height: 8px;
    border-radius: 4px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.quiz-progress-bar.quiz-progress-absolute {
    position: absolute;
    z-index: 10;
}

.quiz-progress-fill {
    background: linear-gradient(90deg, #0073aa, #0099cc);
    height: 100%;
    transition: width 0.4s ease;
    border-radius: 4px;
}

.quiz-progress-text {
    position: absolute;
    top: -25px;
    right: 0;
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

/* Step Indicators Style */
.quiz-progress-style-steps {
    background: transparent;
    height: auto;
    overflow: visible;
}

.quiz-progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.quiz-progress-step {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-progress-step.active {
    background-color: #0073aa;
    transform: scale(1.2);
}

.quiz-progress-step.completed {
    background-color: #4caf50;
}

.quiz-step-number {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    line-height: 1;
}

.quiz-progress-style-steps .quiz-progress-text {
    position: static;
    margin-top: 10px;
    text-align: center;
    width: 100%;
}

.quiz-question-step {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.quiz-step-navigation {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.quiz-prev-btn,
.quiz-next-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #0073aa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #0073aa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.quiz-prev-btn:hover,
.quiz-next-btn:hover:not(:disabled) {
    background: #0073aa;
    color: #ffffff;
    transform: translateY(-2px);
}

.quiz-next-btn:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.quiz-maker-step .quiz-question-title {
    font-size: 22px;
    text-align: center;
    margin-bottom: 30px;
}

.quiz-maker-step .quiz-submit-btn {
    padding: 12px 30px;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .quiz-maker-container {
        padding: 20px;
    }
    
    .quiz-question-title {
        font-size: 16px;
    }
    
    .quiz-answer-text {
        font-size: 14px;
    }
    
    .quiz-submit-btn {
        padding: 12px 30px;
        font-size: 16px;
    }
    
    .quiz-step-navigation {
        flex-direction: column;
    }
    
    .quiz-prev-btn,
    .quiz-next-btn {
        width: 100%;
    }
    
    .quiz-progress-text {
        top: 15px;
        right: 0;
        background: white;
        padding: 5px 10px;
        border-radius: 4px;
    }
}

/* Quiz Progress Widget & Shortcode Styles */
.quiz-progress-bar-widget {
    /* No default margin/padding - use widget controls */
}

.quiz-progress-bar-shortcode {
    margin: 20px 0;
}

.quiz-progress-bar-widget.quiz-progress-fixed,
.quiz-progress-bar-shortcode.quiz-progress-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: white;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quiz-progress-bar-widget .quiz-progress-bar-bg,
.quiz-progress-bar-shortcode .quiz-progress-bar-bg {
    position: relative;
    overflow: hidden;
}

.quiz-progress-bar-widget .quiz-progress-fill,
.quiz-progress-bar-shortcode .quiz-progress-fill {
    transition: width 0.3s ease;
}

.quiz-progress-bar-widget .quiz-progress-steps,
.quiz-progress-bar-shortcode .quiz-progress-steps {
    display: flex;
    align-items: center;
}

.quiz-progress-bar-widget .quiz-progress-step,
.quiz-progress-bar-shortcode .quiz-progress-step {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
