/**
 * MCQ System Styles
 * 
 * Styles for admin question management interface.
 * 
 * @package Stempathy_Core
 */

/* ==========================================================================
   ADMIN STYLES - Question Management Meta Box
   ========================================================================== */

.stempathy-mcq-admin {
    padding: 15px 0;
}

/* Header row */
.stempathy-mcq-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

/* Question count */
.stempathy-question-count {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stempathy-question-count .count-number {
    font-size: 32px;
    font-weight: 700;
    color: #4C9F38;
    line-height: 1;
}

.stempathy-question-count .count-label {
    font-size: 14px;
    color: #666;
}

/* Action buttons */
.stempathy-mcq-admin-actions {
    display: flex;
    gap: 10px;
}

/* ==========================================================================
   SLIDE-DOWN PANELS
   ========================================================================== */

.stempathy-mcq-panel {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.stempathy-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}

.stempathy-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.stempathy-panel-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 3px;
}

.stempathy-panel-close:hover {
    background: #ddd;
    color: #333;
}

.stempathy-panel-body {
    padding: 20px;
}

/* ==========================================================================
   CSV IMPORT
   ========================================================================== */

.stempathy-csv-dropzone {
    border: 2px dashed #ccc;
    border-radius: 4px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    margin: 15px 0;
    position: relative;
}

.stempathy-csv-dropzone:hover {
    border-color: #4C9F38;
    background: rgba(76, 159, 56, 0.05);
}

.stempathy-csv-dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.stempathy-csv-dropzone .dropzone-content p {
    margin: 0;
    color: #666;
}

.stempathy-csv-preview {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.stempathy-csv-preview h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
}

.stempathy-csv-preview-table {
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
}

.stempathy-csv-preview-table table {
    width: 100%;
    border-collapse: collapse;
}

.stempathy-csv-preview-table th,
.stempathy-csv-preview-table td {
    padding: 6px 8px;
    border: 1px solid #ddd;
    text-align: left;
}

.stempathy-csv-preview-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.stempathy-csv-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* ==========================================================================
   QUESTION FORM
   ========================================================================== */

.stempathy-form-field {
    margin-bottom: 20px;
}

.stempathy-form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.stempathy-form-field .required {
    color: #dc3545;
}

.stempathy-form-field .description {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.stempathy-form-field textarea,
.stempathy-form-field input[type="text"],
.stempathy-form-field select {
    width: 100%;
}

.stempathy-form-field select {
    max-width: 200px;
}

/* Options grid */
.stempathy-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stempathy-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stempathy-option-row .option-label {
    width: 28px;
    height: 28px;
    background: #4C9F38;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.stempathy-option-row input[type="text"] {
    flex: 1;
}

/* Image upload */
.stempathy-image-upload {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.stempathy-image-preview img {
    max-width: 120px;
    height: auto;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Form actions */
.stempathy-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* ==========================================================================
   QUESTIONS TABLE
   ========================================================================== */

.stempathy-questions-list-wrapper {
    margin-top: 20px;
}

.stempathy-questions-table td,
.stempathy-questions-table th {
    padding: 10px 12px;
    vertical-align: middle;
}

.stempathy-questions-table tbody tr:hover {
    background: #f9f9f9;
}

/* Drag handle */
.stempathy-drag-handle {
    cursor: grab;
    color: #999;
}

/* Answer badge */
.answer-badge {
    display: inline-block;
    width: 26px;
    height: 26px;
    background: #4C9F38;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 26px;
    font-weight: 600;
}

.column-actions {
    white-space: nowrap;
}

.button-link-delete {
    color: #a00 !important;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.stempathy-no-questions {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 4px;
    color: #666;
}

/* ==========================================================================
   FRONTEND STYLES - Quiz Interface
   
   Brand Colors:
   - Eerie Black: #212520 (text, headings)
   - Pigment Green: #4C9F38 (primary green, correct answers)
   - Olivine: #97BD8A (light green accent)
   - Isabelline: #EEEDEA (backgrounds)
   - Sunset: #EEC782 (light gold accent)
   - Xanthous: #F9B428 (primary buttons)
   ========================================================================== */

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.stempathy-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stempathy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stempathy-btn-primary {
    background: #F9B428;
    color: #212520;
    border-color: #F9B428;
}

.stempathy-btn-primary:hover:not(:disabled) {
    background: #e5a520;
    border-color: #e5a520;
}

.stempathy-btn-secondary {
    background: #4C9F38;
    color: #fff;
    border-color: #4C9F38;
}

.stempathy-btn-secondary:hover:not(:disabled) {
    background: #3d8a2c;
    border-color: #3d8a2c;
}

.stempathy-btn-neutral {
    background: #EEEDEA;
    color: #212520;
    border-color: #EEEDEA;
}

.stempathy-btn-neutral:hover:not(:disabled) {
    background: #ddd;
    border-color: #ddd;
}

.stempathy-btn-outline {
    background: transparent;
    color: #212520;
    border-color: #212520;
}

.stempathy-btn-outline:hover:not(:disabled) {
    background: #212520;
    color: #fff;
}

/* ==========================================================================
   LOADING STATE
   ========================================================================== */

.stempathy-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid #EEEDEA;
    border-top-color: #4C9F38;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.stempathy-loading p {
    color: #666;
    margin: 0;
}

/* ==========================================================================
   ERROR STATE
   ========================================================================== */

.stempathy-error {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    margin: 40px auto;
}

.stempathy-error p {
    color: #dc3545;
    font-size: 18px;
    margin-bottom: 20px;
}

/* ==========================================================================
   QUIZ START SCREEN
   ========================================================================== */

.stempathy-quiz-start {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
    padding: 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.quiz-start-header h2 {
    font-size: 28px;
    color: #212520;
    margin: 0 0 15px 0;
}

.quiz-description {
    color: #666;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.quiz-start-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    padding: 25px;
    background: #EEEDEA;
    border-radius: 8px;
}

.info-item {
    text-align: center;
}

.info-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #4C9F38;
    line-height: 1.2;
}

.info-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.quiz-start-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin: 0 auto;
}

.quiz-start-actions .stempathy-btn {
    width: auto;
}

/* ==========================================================================
   QUIZ CONTAINER (In Progress)
   ========================================================================== */

.stempathy-quiz-container {
    max-width: 800px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Quiz Header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: #fff;
    border-bottom: none;
}

.quiz-header h3 {
    margin: 0;
    font-size: 16px;
    color: #212520;
    font-weight: 600;
}

.quiz-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.quiz-progress-text {
    font-size: 14px;
    color: #666;
}

.quiz-exit-btn {
    background: #fff;
    border: 2px solid #d7d7d7;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #212520;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.quiz-exit-btn:hover {
    background: #EEEDEA;
    border-color: #cfcfcf;
}

/* Progress Bar */
.quiz-progress-bar {
    height: 6px;
    background: #EEEDEA;
    border-radius: 3px;
    overflow: hidden;

    /* inset spacing so it doesn't touch edges */
    margin: 0 25px;
}

.quiz-progress-fill {
    height: 100%;
    background: #4C9F38;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Question Area */
.quiz-question {
    padding: 30px 25px;
}

.quiz-question-number {
    font-size: 14px;
    color: #4C9F38;
    font-weight: 600;
    margin-bottom: 10px;
}

.quiz-question-text {
    font-size: 20px;
    color: #212520;
    line-height: 1.5;
}

.quiz-question-image {
    margin-top: 20px;
}

.quiz-question-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* Options */
.quiz-options {
    padding: 0 25px 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 16px 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    transition: all 0.15s ease;
}

.quiz-option:hover {
    border-color: #4C9F38;
    background: rgba(76, 159, 56, 0.05);
}

.quiz-option.selected {
    border-color: #4C9F38;
    background: rgba(76, 159, 56, 0.1);
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #EEEDEA;
    color: #212520;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
}

.quiz-option.selected .option-letter {
    background: #4C9F38;
    color: #fff;
}

.option-text {
    flex: 1;
    color: #212520;
}

/* Instant marking (in-quiz) */
.quiz-option.is-correct {
    border: 2px solid #4C9F38;
}

.quiz-option.is-incorrect {
    border: 2px solid #d63638;
}

.quiz-option:disabled {
    cursor: not-allowed;
    opacity: 0.95;
}

.quiz-feedback {
    margin: 16px 25px 0 25px;
    padding: 14px 18px;
    background: #EEEDEA;
    border-radius: 8px;
    color: #212520;
    font-size: 15px;
}

.quiz-feedback-text {
    font-weight: 600;
    margin-bottom: 6px;
}

.quiz-feedback-explanation {
    font-weight: 400;
    color: #444;
}


/* Navigation */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    padding: 20px 25px;
    background: #fff;
}

/* ==========================================================================
   RESULTS SCREEN
   ========================================================================== */

.stempathy-quiz-results {
    max-width: 500px;
    margin: 40px auto;
    text-align: center;
    padding: 50px 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.results-header h2 {
    font-size: 28px;
    color: #212520;
    margin: 0 0 30px 0;
}

/* Score Circle */
.results-score {
    margin-bottom: 30px;
}

.score-circle {
    width: 150px;
    height: 150px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 8px solid #ddd;
}

.score-percentage {
    font-size: 42px;
    font-weight: 700;
}

.score-details {
    font-size: 16px;
    color: #666;
}

/* Score Colors */
.results-score.score-excellent .score-circle {
    border-color: #4C9F38;
}
.results-score.score-excellent .score-percentage {
    color: #4C9F38;
}

.results-score.score-good .score-circle {
    border-color: #4C9F38;
}
.results-score.score-good .score-percentage {
    color: #4C9F38;
}

.results-score.score-average .score-circle {
    border-color: #F9B428;
}
.results-score.score-average .score-percentage {
    color: #F9B428;
}

.results-score.score-needs-work .score-circle {
    border-color: #dc3545;
}
.results-score.score-needs-work .score-percentage {
    color: #dc3545;
}

/* Results Message (match Flashcards) */
.results-message {
    font-size: 15px;
    color: #666;
    margin: 0 0 24px 0;
    padding: 14px 20px;
    background: #EEEDEA;
    border-radius: 8px;
    display: inline-block;
    text-align: center;
}

.results-message p {
    margin: 0;
    font-size: 15px;
    color: inherit;
}

/* Results Actions */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

/* Back to Dashboard Link (text style, not button) */
.stempathy-back-link {
    display: inline-block;
    margin-top: 10px;
    color: #666;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.stempathy-back-link:hover {
    color: #212520;
    text-decoration: underline;
}
/* ==========================================================================
   REVIEW MODE
   ========================================================================== */

/* Make the question header layout match review mode in BOTH modes */
.quiz-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}


.question-result {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.question-result.correct {
    background: rgba(76, 159, 56, 0.1);
    color: #4C9F38;
}

.question-result.incorrect {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Review Options (not clickable) */
.review-options .quiz-option {
    cursor: default;
    position: relative;
}

.review-options .quiz-option:hover {
    border-color: #ddd;
    background: #fff;
}

.review-options .quiz-option.correct {
    border-color: #4C9F38;
    background: rgba(76, 159, 56, 0.08);
}

.review-options .quiz-option.correct .option-letter {
    background: #4C9F38;
    color: #fff;
}

.review-options .quiz-option.user-incorrect {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
}

.review-options .quiz-option.user-incorrect .option-letter {
    background: #dc3545;
    color: #fff;
}

/* Option Indicator (checkmark or X) */
.option-indicator {
    margin-left: auto;
    font-weight: 700;
    font-size: 18px;
}

.option-indicator.correct {
    color: #4C9F38;
}

.option-indicator.incorrect {
    color: #dc3545;
}

/* Explanation Box */
.quiz-explanation {
    margin: 0 25px 25px;
    padding: 20px;
    background: #EEEDEA;
    border-left: 4px solid #97BD8A;
    border-radius: 0 8px 8px 0;
}

.quiz-explanation h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #4C9F38;
    font-weight: 600;
}

.quiz-explanation p {
    margin: 0;
    font-size: 15px;
    color: #212520;
    line-height: 1.6;
}

/* ==========================================================================
   INSTANT MARKING (match review options styling)
   Applies to the normal quiz question view too
   ========================================================================== */

/* Use the same green correct styling in normal quiz options */
.quiz-options .quiz-option.correct {
    border-color: #4C9F38;
    background: rgba(76, 159, 56, 0.08);
}

.quiz-options .quiz-option.correct .option-letter {
    background: #4C9F38;
    color: #fff;
}

/* Use the same red incorrect styling for the user's wrong choice */
.quiz-options .quiz-option.user-incorrect {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
}

.quiz-options .quiz-option.user-incorrect .option-letter {
    background: #dc3545;
    color: #fff;
}

/* (Optional but usually needed) If you want the user's correct choice to also look green */
.quiz-options .quiz-option.user-correct {
    border-color: #4C9F38;
    background: rgba(76, 159, 56, 0.08);
}

.quiz-options .quiz-option.user-correct .option-letter {
    background: #4C9F38;
    color: #fff;
}


/* ==========================================================================
   CUSTOM CONFIRMATION MODAL
   ========================================================================== */

.stempathy-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.stempathy-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.stempathy-modal {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.stempathy-modal-overlay.active .stempathy-modal {
    transform: scale(1);
}

.stempathy-modal-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.stempathy-modal h4 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #212520;
}

.stempathy-modal p {
    margin: 0 0 25px 0;
    color: #666;
    font-size: 15px;
    line-height: 1.5;
}

.stempathy-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.stempathy-modal-actions .stempathy-btn {
    min-width: 100px;
}
/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 600px) {
    .stempathy-quiz-start,
    .stempathy-quiz-results {
        margin: 20px;
        padding: 30px 20px;
    }
    
    /* Mobile: match Flashcards stats bar layout (single row) */
.quiz-start-info {
    flex-direction: row;
    gap: 0;
    padding: 16px;
    border-radius: 12px;
}

.quiz-start-info .info-item {
    flex: 1;
    border-right: 1px solid #ddd;
}

.quiz-start-info .info-item:last-child {
    border-right: none;
}

    
    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .quiz-header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .quiz-question-text {
        font-size: 18px;
    }
    
    .quiz-option {
        padding: 14px 16px;
    }
    
    .quiz-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .quiz-navigation .stempathy-btn {
        width: 100%;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
    }
    
    .score-percentage {
        font-size: 32px;
    }
}

/* Saved progress note */
.quiz-progress-note {
    text-align: center;
    margin-top: 12px;
    margin-bottom: 0;
    color: #6b7280; /* Muted gray */
    font-size: 13px;
}

.quiz-progress-note small {
    font-style: italic;
}