/* Quiz and Polling Frontend Styles */

.qap-quiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.qap-quiz-header {
    margin-bottom: 30px;
    text-align: center;
}

.qap-quiz-title {
    font-size: 28px;
    margin-bottom: 10px;
    color: #333;
}

.qap-quiz-description {
    color: #666;
    font-size: 16px;
    line-height: 1.6;
}

/* Participant Info */
.qap-participant-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.qap-participant-info h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #333;
}

.qap-field {
    margin-bottom: 15px;
}

.qap-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.qap-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.qap-field input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.qap-field .required {
    color: #dc3232;
}

.qap-field input.qap-invalid {
    border-color: #dc3545;
    background: #fff5f5;
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.25);
}

/* Questions */
.qap-questions {
    margin-bottom: 30px;
}

.qap-question {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
}

.qap-question:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.qap-question-number {
    display: none;
}

.qap-question-text {
    font-size: 18px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.4;
}

/* Hint */
.qap-hint-container {
    margin-bottom: 15px;
}

.qap-hint-toggle {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.qap-hint-toggle:hover {
    background: #ffc107;
    color: #000;
}

.qap-hint-text {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 12px 15px;
    margin-top: 10px;
    font-size: 14px;
    color: #856404;
    line-height: 1.5;
}

/* Answers */
.qap-answers {
    margin-top: 15px;
}

.qap-answer {
    margin-bottom: 10px;
}

.qap-answer label {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.qap-answer label:hover {
    background: #e9ecef;
}

.qap-answer input[type="radio"],
.qap-answer input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex-shrink: 0;
    appearance: auto;
    -webkit-appearance: auto;
}

.qap-answer input:checked + span {
    font-weight: 500;
}

.qap-answer label:has(input:checked) {
    background: #e7f3ff;
    border-color: #0073aa;
}

.qap-answer span {
    font-size: 15px;
    color: #333;
}

.qap-answer-text textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
}

.qap-answer-text textarea:focus {
    outline: none;
    border-color: #0073aa;
}

/* Submit Button */
.qap-submit {
    text-align: center;
    padding-top: 20px;
}

.qap-submit-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.qap-submit-btn:hover {
    background: #005a87;
}

.qap-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Retake Button */
.qap-retake-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 15px;
}

.qap-retake-btn:hover {
    background: #005a87;
}

/* Loading State */
.qap-loading {
    text-align: center;
    padding: 40px;
}

.qap-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: qap-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes qap-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results */
.qap-results {
    text-align: center;
    padding: 40px 20px;
}

.qap-results-score {
    font-size: 48px;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 10px;
}

.qap-results-message {
    font-size: 20px;
    color: #333;
    margin-bottom: 30px;
}

.qap-results-details {
    text-align: left;
    margin-top: 30px;
}

.qap-result-item {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.qap-result-item.correct {
    background: #d4edda;
    border-color: #c3e6cb;
}

.qap-result-item.incorrect {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.qap-result-question {
    font-weight: 500;
    margin-bottom: 8px;
}

.qap-result-description {
    margin: 8px 0 12px 0;
    padding: 10px 12px;
    background: #f0f7ff;
    border-radius: 4px;
    font-size: 14px;
    color: #444;
    line-height: 1.5;
}

.qap-result-answer {
    font-size: 14px;
    color: #666;
}

.qap-result-correct-answer {
    font-size: 13px;
    color: #155724;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(21, 87, 36, 0.1);
    border-radius: 4px;
}

.qap-result-explanation {
    font-size: 13px;
    color: #004085;
    margin-top: 8px;
    padding: 8px 12px;
    background: #cce5ff;
    border-radius: 4px;
    line-height: 1.5;
}

.qap-icon-correct {
    color: #155724;
    font-weight: bold;
    margin-right: 5px;
}

.qap-icon-incorrect {
    color: #721c24;
    font-weight: bold;
    margin-right: 5px;
}

/* Dashicons for result icons */
.qap-result-answer .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 5px;
}

.qap-result-answer .dashicons.qap-icon-correct {
    color: #28a745;
}

.qap-result-answer .dashicons.qap-icon-incorrect {
    color: #dc3545;
}

.qap-question-number {
    font-weight: 600;
    color: #0073aa;
}

.qap-points {
    color: #666;
    font-size: 12px;
}

/* Result status (correct/incorrect) */
.qap-result-status {
    font-size: 14px;
    color: #666;
    margin-top: 15px;
    margin-bottom: 12px;
}

.qap-result-status .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 5px;
}

.qap-result-status .dashicons.qap-icon-correct {
    color: #28a745;
}

.qap-result-status .dashicons.qap-icon-incorrect {
    color: #dc3545;
}

/* All Answers List */
.qap-all-answers {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.qap-all-answers-header {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

.qap-answers-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.qap-answer-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
}

.qap-answer-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* User's answer - correct */
.qap-answer-item.qap-user-correct {
    background: #d4edda;
    border-color: #28a745;
}

.qap-answer-item.qap-user-correct .qap-answer-text {
    color: #155724;
    font-weight: 600;
}

/* User's answer - incorrect */
.qap-answer-item.qap-user-incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

.qap-answer-item.qap-user-incorrect .qap-answer-text {
    color: #721c24;
    font-weight: 600;
}

.qap-answer-item.qap-user-selected {
    background: #e3f2fd;
    border-color: #90caf9;
}

.qap-answer-item .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.qap-answer-correct-icon {
    color: #28a745;
}

.qap-answer-incorrect-icon {
    color: #dc3545;
}

.qap-answer-bullet {
    display: inline-block;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    background: #ccc;
    border-radius: 50%;
    flex-shrink: 0;
}

.qap-answer-bullet.qap-bullet-correct {
    background: #28a745;
}

.qap-answer-bullet.qap-bullet-selected {
    background: #28a745;
}

.qap-answer-item .qap-answer-text {
    flex: 1;
    min-width: 150px;
    color: #333;
}

.qap-answer-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    background: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #ddd;
}

.qap-answer-count .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #0073aa;
}

/* Answer Progress Bar */
.qap-answer-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-left: 26px;
}

.qap-answer-progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.qap-answer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6c757d 0%, #868e96 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.qap-answer-progress-fill.qap-progress-correct {
    background: linear-gradient(90deg, #28a745 0%, #34ce57 100%);
}

.qap-answer-percentage {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    min-width: 36px;
    text-align: right;
}

.qap-answer-stats {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    background: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.qap-answer-stats .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #0073aa;
}

.qap-user-correct .qap-answer-progress-fill {
    background: linear-gradient(90deg, #28a745 0%, #34ce57 100%);
}

.qap-user-incorrect .qap-answer-progress-fill {
    background: linear-gradient(90deg, #dc3545 0%, #e4606d 100%);
}

.qap-your-answer {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Your answer label - correct */
.qap-user-correct .qap-your-answer {
    color: #155724;
    background: #c3e6cb;
}

/* Your answer label - incorrect */
.qap-user-incorrect .qap-your-answer {
    color: #721c24;
    background: #f5c6cb;
}

/* Correct answer highlight (when user answered incorrectly) */
.qap-answer-item.qap-correct-answer-highlight {
    background: #d4edda;
    border-color: #c3e6cb;
}

.qap-answer-item.qap-correct-answer-highlight .qap-answer-text {
    color: #155724;
    font-weight: 600;
}

.qap-correct-label {
    font-size: 11px;
    color: #155724;
    font-weight: 600;
    background: #c3e6cb;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Question Statistics */
.qap-question-stats {
    display: none;
    margin: 12px 0;
    padding: 12px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.qap-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.qap-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
}

.qap-stat-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.qap-stat-correct {
    color: #28a745;
    border-color: #28a745;
}

.qap-stat-correct .dashicons {
    color: #28a745;
}

.qap-stat-incorrect {
    color: #dc3545;
    border-color: #dc3545;
}

.qap-stat-incorrect .dashicons {
    color: #dc3545;
}

.qap-stat-total {
    color: #0073aa;
    border-color: #0073aa;
}

.qap-stat-total .dashicons {
    color: #0073aa;
}

.qap-stat-percentage {
    color: #6f42c1;
    border-color: #6f42c1;
    background: linear-gradient(135deg, #fff 0%, #f3e8ff 100%);
}

.qap-stat-percentage .dashicons {
    color: #6f42c1;
}

@media screen and (max-width: 600px) {
    .qap-stats-row {
        gap: 8px;
    }

    .qap-stat-item {
        font-size: 11px;
        padding: 4px 8px;
    }

    .qap-stat-item .dashicons {
        font-size: 14px;
        width: 14px;
        height: 14px;
    }

    .qap-answer-progress-wrapper {
        margin-left: 0;
    }

    .qap-answer-progress-bar {
        height: 6px;
    }

    .qap-answer-percentage {
        font-size: 11px;
        min-width: 30px;
    }

    .qap-answer-stats {
        font-size: 11px;
        padding: 3px 8px;
    }
}

/* Poll Results */
.qap-poll-results {
    margin-top: 30px;
    text-align: left;
}

.qap-poll-question {
    margin-bottom: 25px;
}

.qap-poll-question-text {
    font-weight: 500;
    margin-bottom: 15px;
}

.qap-poll-answer {
    margin-bottom: 10px;
}

.qap-poll-answer-text {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
}

.qap-poll-bar {
    height: 24px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.qap-poll-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    transition: width 0.5s ease;
    border-radius: 4px;
}

.qap-poll-votes {
    font-size: 12px;
    color: #666;
}

/* Unanswered Question Highlight */
.qap-question.qap-unanswered {
    border-color: #dc3545;
    background: #fff5f5;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
    animation: qap-shake 0.5s ease-in-out;
}

.qap-question.qap-unanswered .qap-question-number {
    color: #dc3545;
}

@keyframes qap-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Pagination */
.qap-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 25px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.qap-pagination-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.qap-pagination-btn:hover {
    background: #005a87;
}

.qap-pagination-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.qap-pagination-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.qap-pagination-info {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.qap-page {
    display: none;
}

.qap-page.active {
    display: block;
}

/* Show Unanswered Toggle Button */
.qap-show-unanswered-btn {
    background: #6c757d;
    color: #fff;
    border: none;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qap-show-unanswered-btn:hover {
    background: #5a6268;
    transform: scale(1.02);
}

.qap-show-unanswered-btn.active {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: #fff;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

.qap-show-unanswered-btn.active:hover {
    background: linear-gradient(135deg, #218838, #1db887);
}

.qap-show-unanswered-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.qap-show-unanswered-btn.active .dashicons {
    transform: rotate(180deg);
}

/* Filter Mode Active Indicator */
.qap-quiz-container.qap-filter-mode-active .qap-pagination {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border: 2px solid #28a745;
}

.qap-quiz-container.qap-filter-mode-active .qap-pagination-info {
    color: #155724;
    font-weight: 600;
}

/* Question Transition when answered in filter mode */
.qap-question.qap-answered-transition {
    opacity: 0.5;
    transform: translateX(20px);
    transition: all 0.4s ease;
}

/* Filtered hidden questions */
.qap-question.qap-filtered-hidden {
    display: none !important;
}

/* Error message */
.qap-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
    .qap-quiz-container {
        padding: 15px;
    }

    .qap-quiz-title {
        font-size: 22px;
    }

    .qap-question-text {
        font-size: 16px;
    }

    .qap-submit-btn {
        width: 100%;
        padding: 12px 20px;
    }

    .qap-results-score {
        font-size: 36px;
    }

    .qap-pagination {
        flex-direction: column;
        gap: 10px;
    }

    .qap-pagination-btn {
        width: 100%;
        justify-content: center;
    }

    .qap-show-unanswered-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Previous Result Display */
.qap-previous-result {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
}

.qap-previous-result .qap-results {
    display: block;
}

.qap-results.qap-results-visible {
    display: block;
}

.qap-result-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.qap-result-header h3 {
    font-size: 24px;
    color: #333;
    margin: 0 0 10px 0;
}

.qap-previous-notice {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid #ffc107;
}

.qap-score-display {
    text-align: center;
    margin-bottom: 30px;
}

.qap-score-number {
    font-size: 48px;
    font-weight: 700;
    color: #0073aa;
}

.qap-score-percentage {
    font-size: 24px;
    color: #666;
    margin-top: 5px;
}

/* Questions Results for Previous Submission */
.qap-questions-results {
    text-align: left;
}

.qap-question-result {
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
}

.qap-question-result.qap-correct {
    border-left: 4px solid #28a745;
}

.qap-question-result.qap-incorrect {
    border-left: 4px solid #dc3545;
}

.qap-question-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.qap-result-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.qap-question-result.qap-correct .qap-result-icon .dashicons {
    color: #28a745;
}

.qap-question-result.qap-incorrect .qap-result-icon .dashicons {
    color: #dc3545;
}

.qap-question-result .qap-question-text {
    margin-bottom: 15px;
    font-size: 16px;
}

.qap-answers-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qap-answer-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.qap-answer-result.qap-selected {
    background: #e3f2fd;
    border-color: #90caf9;
}

.qap-answer-result.qap-correct-answer {
    background: #d4edda;
    border-color: #c3e6cb;
}

.qap-answer-result.qap-selected.qap-correct-answer {
    background: #d4edda;
    border-color: #28a745;
}

.qap-answer-result .qap-answer-text {
    flex: 1;
}

.qap-answer-result .qap-your-answer {
    font-size: 11px;
    font-weight: 600;
    color: #0073aa;
    background: #e3f2fd;
    padding: 3px 10px;
    border-radius: 12px;
}

.qap-answer-result .qap-correct-label {
    font-size: 11px;
    font-weight: 600;
    color: #155724;
    background: #c3e6cb;
    padding: 3px 10px;
    border-radius: 12px;
}

.qap-correct-answer-info {
    margin-top: 15px;
    padding: 12px 15px;
    background: #cce5ff;
    border-radius: 6px;
    font-size: 14px;
    color: #004085;
    line-height: 1.5;
}

/* Result Pagination */
.qap-result-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 25px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.qap-result-pagination .qap-pagination-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s ease;
}

.qap-result-pagination .qap-pagination-btn:hover {
    background: #005a87;
}

.qap-result-pagination .qap-pagination-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.qap-result-pagination .qap-pagination-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.qap-result-pagination .qap-pagination-info {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Responsive Result Pagination */
@media (max-width: 480px) {
    .qap-result-pagination {
        flex-direction: column;
        gap: 10px;
    }

    .qap-result-pagination .qap-pagination-btn {
        width: 100%;
        justify-content: center;
    }
}
