/**
 * Single MCQ Styling - Enhanced UI
 * Fixes color combinations, text visibility, and interaction states
 */

/* ============================================
   SINGLE MCQ CONTAINER
   ============================================ */

.mcq-single {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin: 2rem auto;
    max-width: 900px;
    overflow: hidden;
}

/* ============================================
   MCQ HEADER
   ============================================ */

.mcq-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.mcq-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.mcq-tags span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mcq-difficulty {
    color: white;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.mcq-difficulty.easy {
    background: #28a745;
}

.mcq-difficulty.medium {
    background: #ffc107;
    color: #212529 !important;
}

.mcq-difficulty.hard {
    background: #dc3545;
}

.premium-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.mcq-subject {
    background: #007bff;
    color: white;
}

.mcq-subject a {
    color: inherit;
    text-decoration: none;
}

.mcq-subject:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.mcq-topic {
    background: #17a2b8;
    color: white;
}

.mcq-topic a {
    color: inherit;
    text-decoration: none;
}

.mcq-topic:hover {
    background: #138496;
    transform: translateY(-1px);
}

.mcq-board {
    background: #6f42c1;
    color: white;
}

.mcq-board a {
    color: inherit;
    text-decoration: none;
}

.mcq-board:hover {
    background: #5a2d91;
    transform: translateY(-1px);
}

.mcq-actions-header {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    border-color: #007bff;
    color: #007bff;
    background: #f8f9fa;
    transform: translateY(-1px);
}

/* ============================================
   MCQ CONTENT
   ============================================ */

.mcq-content {
    padding: 2rem;
}

.mcq-question-container {
    margin-bottom: 2rem;
}

.question-number {
    background: #e9ecef;
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 1rem;
}

.mcq-question h1 {
    font-size: 1.4rem;
    line-height: 1.5;
    color: #212529;
    margin: 0;
    font-weight: 600;
}

/* ============================================
   MCQ OPTIONS - ENHANCED STYLING
   ============================================ */

.mcq-options-container {
    margin-bottom: 2rem;
}

.mcq-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.mcq-option {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    position: relative;
    min-height: 60px;
}

.mcq-option:hover {
    border-color: #007bff;
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.mcq-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.mcq-option input[type="radio"]:checked + .option-indicator {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.mcq-option input[type="radio"]:checked ~ .option-text {
    color: #007bff;
    font-weight: 600;
}

.option-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    background: white;
    font-weight: bold;
    font-size: 1rem;
    margin-right: 1rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: #495057;
}

.option-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    transition: all 0.2s ease;
    padding-right: 1rem;
}

.option-feedback {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ============================================
   OPTION STATES - FIXED VISIBILITY
   ============================================ */

/* Selected state */
.mcq-option input[type="radio"]:checked {
    border-color: #007bff !important;
    background: #e3f2fd !important;
}

/* Correct answer state */
.mcq-option.correct {
    border-color: #28a745 !important;
    background: #d4edda !important;
}

.mcq-option.correct .option-indicator {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.mcq-option.correct .option-text {
    color: #155724 !important;
    font-weight: 600 !important;
}

.mcq-option.correct .option-feedback {
    color: #28a745 !important;
}

/* Incorrect answer state */
.mcq-option.incorrect {
    border-color: #dc3545 !important;
    background: #f8d7da !important;
}

.mcq-option.incorrect .option-indicator {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.mcq-option.incorrect .option-text {
    color: #721c24 !important;
    font-weight: 600 !important;
}

.mcq-option.incorrect .option-feedback {
    color: #dc3545 !important;
}

/* Neutral state (other options when answered) */
.mcq-option.neutral {
    opacity: 0.6;
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
}

.mcq-option.neutral .option-text {
    color: #6c757d !important;
}

.mcq-option.neutral .option-indicator {
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #6c757d !important;
}

/* Disabled state */
.mcq-option input[type="radio"]:disabled {
    cursor: not-allowed;
}

.mcq-option:has(input[type="radio"]:disabled) {
    cursor: not-allowed;
}

/* ============================================
   FORM ACTIONS
   ============================================ */

.mcq-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    min-height: 48px;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.25);
}

.btn-outline {
    background: transparent;
    color: #6c757d;
    border: 2px solid #6c757d;
}

.btn-outline:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   RESULT DISPLAY
   ============================================ */

.mcq-result {
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #dee2e6;
}

.mcq-result.correct {
    background: #d4edda;
    border-left-color: #28a745;
}

.mcq-result.incorrect {
    background: #f8d7da;
    border-left-color: #dc3545;
}

.result-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.result-icon {
    font-size: 1.5rem;
}

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

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

.result-text {
    flex: 1;
    font-size: 1.1rem;
    line-height: 1.4;
}

.mcq-result.correct .result-text {
    color: #155724;
}

.mcq-result.incorrect .result-text {
    color: #721c24;
}

/* ============================================
   EXPLANATION SECTION
   ============================================ */

.mcq-explanation {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.mcq-explanation h4 {
    color: #495057;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.explanation-content {
    color: #333;
    line-height: 1.6;
}

.explanation-content p {
    margin-bottom: 1rem;
}

.explanation-content p:last-child {
    margin-bottom: 0;
}

.toggle-explanation {
    margin-top: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* ============================================
   PREMIUM CONTENT BLOCK
   ============================================ */

.premium-content-blocked {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.1) 0%, rgba(245, 87, 108, 0.1) 100%);
    border-radius: 12px;
    border: 2px dashed #f093fb;
}

.premium-block-icon {
    font-size: 4rem;
    color: #f093fb;
    margin-bottom: 1.5rem;
}

.premium-content-blocked h3 {
    color: #721c24;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.premium-content-blocked p {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.premium-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ============================================
   NAVIGATION
   ============================================ */

.mcq-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    gap: 1rem;
}

.mcq-nav-previous,
.mcq-nav-next {
    flex: 1;
}

.mcq-nav-next {
    text-align: right;
}

.mcq-nav-center {
    flex: 0 0 auto;
}

/* ============================================
   RELATED MCQs
   ============================================ */

.related-mcqs {
    padding: 2rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.related-mcqs h3 {
    color: #495057;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-mcqs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.related-mcq-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.related-mcq-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.related-mcq-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.related-mcq-meta .difficulty {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.related-mcq-meta .difficulty.easy {
    background: #d4edda;
    color: #155724;
}

.related-mcq-meta .difficulty.medium {
    background: #fff3cd;
    color: #856404;
}

.related-mcq-meta .difficulty.hard {
    background: #f8d7da;
    color: #721c24;
}

.related-mcq-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.related-mcq-card h4 a {
    color: #333;
    text-decoration: none;
}

.related-mcq-card h4 a:hover {
    color: #007bff;
}

.related-mcq-card p {
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* ============================================
   NO OPTIONS STATE
   ============================================ */

.mcq-no-options {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

.mcq-no-options p {
    color: #721c24;
    font-size: 1.1rem;
    margin: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .mcq-single {
        margin: 1rem;
        border-radius: 8px;
    }
    
    .mcq-header {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .mcq-tags {
        justify-content: center;
        gap: 0.5rem;
    }
    
    .mcq-tags span {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .mcq-actions-header {
        justify-content: center;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
    }
    
    .mcq-content {
        padding: 1.5rem;
    }
    
    .mcq-question h1 {
        font-size: 1.2rem;
    }
    
    .mcq-option {
        padding: 0.8rem 1rem;
        gap: 0.75rem;
    }
    
    .option-indicator {
        width: 32px;
        height: 32px;
        margin-right: 0.75rem;
    }
    
    .option-text {
        font-size: 0.95rem;
    }
    
    .mcq-form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        justify-content: center;
        padding: 0.75rem 1.25rem;
    }
    
    .mcq-navigation {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .mcq-nav-previous,
    .mcq-nav-next,
    .mcq-nav-center {
        text-align: center;
        flex: none;
    }
    
    .premium-actions {
        flex-direction: column;
    }
    
    .related-mcqs-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .related-mcqs {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .mcq-single {
        margin: 0.5rem;
        border-radius: 6px;
    }
    
    .mcq-header {
        padding: 0.75rem;
    }
    
    .mcq-content {
        padding: 1rem;
    }
    
    .mcq-question h1 {
        font-size: 1.1rem;
        line-height: 1.4;
    }
    
    .mcq-option {
        padding: 0.8rem;
        min-height: 56px; /* Better touch target */
        border-radius: 8px;
        margin-bottom: 0.5rem;
    }
    
    .option-indicator {
        width: 32px;
        height: 32px;
        margin-right: 0.7rem;
        font-size: 0.9rem;
        /* Better touch target */
        min-width: 32px;
        min-height: 32px;
    }
    
    .option-text {
        font-size: 0.9rem;
        line-height: 1.4;
        /* Ensure text wraps nicely on small screens */
        word-wrap: break-word;
        hyphens: auto;
    }
    
    .mcq-form-actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }
    
    .btn {
        min-height: 48px; /* Better touch target */
        font-size: 0.95rem;
        padding: 0.8rem 1.2rem;
    }
    
    .mcq-result {
        padding: 1rem;
    }
    
    .result-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .mcq-explanation {
        padding: 1rem;
    }
    
    .premium-content-blocked {
        padding: 2rem 1rem;
    }
    
    .premium-block-icon {
        font-size: 3rem;
    }
    
    .related-mcq-card {
        padding: 1rem;
    }
    
    .mcq-navigation {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .mcq-nav-previous,
    .mcq-nav-next,
    .mcq-nav-center {
        width: 100%;
        text-align: center;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

.mcq-option:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mcq-option {
        border-width: 3px;
    }
    
    .mcq-option.correct {
        border-width: 3px;
    }
    
    .mcq-option.incorrect {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Print styles */
@media print {
    .mcq-actions-header,
    .mcq-form-actions,
    .mcq-navigation,
    .btn {
        display: none !important;
    }
    
    .mcq-single {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .mcq-option {
        break-inside: avoid;
    }
}