/**
 * Map Quiz Results Styles
 *
 * Custom styling for map quiz results page and LearnDash result suppression
 */

/* Hide LearnDash default quiz results for map quizzes */
body.sfwd-quiz .learndash_quiz_message[data-map-quiz="true"],
body[class*="postid-5657"] .learndash_quiz_message,
body.map-quiz-active .learndash_quiz_message,
.tfl-map-quiz-wrapper ~ .learndash_quiz_message {
    display: none !important;
}

/* Hide LearnDash quiz statistics for map quizzes */
body[class*="postid-5657"] .wpProQuiz_quiz_msg,
body[class*="postid-5657"] #quiz_continue_link,
body.map-quiz-active .wpProQuiz_quiz_msg,
body.map-quiz-active #quiz_continue_link {
    display: none !important;
}

/* Custom Results Page Styles */
.tfl-map-quiz-results {
    max-width: 800px;
    margin: 2em auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tfl-map-quiz-results-header {
    background: #2e7d32;
    color: #fff;
    padding: 1.5em;
    text-align: center;
}

.tfl-map-quiz-results-header h2 {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
}

.tfl-map-quiz-results-body {
    padding: 2em;
}

/* Result Badge */
.tfl-result-badge {
    text-align: center;
    padding: 2em 0;
    margin-bottom: 2em;
}

.tfl-result-badge .badge-icon {
    display: block;
    font-size: 4em;
    line-height: 1;
    margin-bottom: 0.25em;
}

.tfl-result-badge.badge-pass .badge-icon {
    color: #2e7d32;
}

.tfl-result-badge.badge-fail .badge-icon {
    color: #c62828;
}

.tfl-result-badge .badge-text {
    display: block;
    font-size: 2em;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.tfl-result-badge.badge-pass .badge-text {
    color: #2e7d32;
}

.tfl-result-badge.badge-fail .badge-text {
    color: #c62828;
}

/* Score Summary */
.tfl-result-score-summary {
    background: #f5f5f5;
    border-radius: 6px;
    padding: 1.5em;
    margin-bottom: 1.5em;
}

.tfl-result-score-summary .score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75em 0;
    border-bottom: 1px solid #ddd;
}

.tfl-result-score-summary .score-item:last-child {
    border-bottom: none;
}

.tfl-result-score-summary .score-label {
    font-weight: 600;
    font-size: 1.1em;
    color: #333;
}

.tfl-result-score-summary .score-value {
    font-weight: 800;
    font-size: 1.3em;
    color: #2e7d32;
}

/* Progress Bar */
.tfl-result-progress-bar {
    background: #e0e0e0;
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 2em;
}

.tfl-result-progress-bar .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #2e7d32);
    transition: width 0.8s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: #fff;
    font-weight: 700;
}

.tfl-map-quiz-results.failed .progress-bar-fill {
    background: linear-gradient(90deg, #e57373, #c62828);
}

/* Questions Breakdown */
.tfl-result-questions-breakdown {
    margin-bottom: 2em;
}

.tfl-result-questions-breakdown h3 {
    margin: 0 0 1em;
    font-size: 1.4em;
    color: #333;
    border-bottom: 2px solid #2e7d32;
    padding-bottom: 0.5em;
}

.tfl-questions-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.tfl-questions-table thead {
    background: #f5f5f5;
}

.tfl-questions-table th {
    padding: 1em;
    text-align: left;
    font-weight: 700;
    color: #333;
    border-bottom: 2px solid #ddd;
}

.tfl-questions-table td {
    padding: 0.75em 1em;
    border-bottom: 1px solid #eee;
}

.tfl-questions-table .score-cell {
    font-weight: 700;
    color: #2e7d32;
}

.tfl-questions-table tbody tr:hover {
    background: #fafafa;
}

/* Action Buttons */
.tfl-result-actions {
    display: flex;
    gap: 1em;
    justify-content: center;
    padding-top: 1em;
    border-top: 2px solid #eee;
}

.tfl-btn {
    display: inline-block;
    padding: 0.75em 2em;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1em;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.tfl-btn-retry {
    background: #2e7d32;
    color: #fff;
    border-color: #2e7d32;
}

.tfl-btn-retry:hover {
    background: #1b5e20;
    border-color: #1b5e20;
    color: #fff;
}

.tfl-btn-home {
    background: transparent;
    color: #333;
    border-color: #333;
}

.tfl-btn-home:hover {
    background: #333;
    color: #fff;
}

/* Error State */
.tfl-map-quiz-results.error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 1.5em;
    border-radius: 6px;
    text-align: center;
}

.tfl-map-quiz-results.error p {
    margin: 0;
    color: #856404;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tfl-map-quiz-results {
        margin: 1em;
    }

    .tfl-map-quiz-results-body {
        padding: 1em;
    }

    .tfl-result-badge .badge-icon {
        font-size: 3em;
    }

    .tfl-result-badge .badge-text {
        font-size: 1.5em;
    }

    .tfl-result-actions {
        flex-direction: column;
    }

    .tfl-btn {
        width: 100%;
    }

    .tfl-questions-table {
        font-size: 0.9em;
    }

    .tfl-questions-table th,
    .tfl-questions-table td {
        padding: 0.5em;
    }
}

/* Results placeholder (shown while LearnDash results are suppressed) */
.tfl-map-quiz-results-placeholder {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-style: italic;
}
