/* ============================================
   DIAGNOSTIC WIDGETS - MCQ & FLASHCARDS
   Center-screen, smooth animations, modern UI
   ============================================ */

/* Base Diagnostic Widget - Top Left Positioning */
.diagnostic-widget {
    position: fixed;
    top: 20px;
    left: 50px;
    width: 90%;
    max-width: 600px;
    max-height: calc(100vh - 40px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(40px) saturate(180%);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.10),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

/* Collapsed state - header bar only (like blackboard) */
.diagnostic-widget.collapsed-state {
    max-height: 64px;
    transform: translateY(0);
    overflow: hidden;
    border-radius: 16px;
    padding: 0;
}

.diagnostic-widget.collapsed-state .diagnostic-widget-content,
.diagnostic-widget.collapsed-state .mcq-button-container {
    display: none;
}

/* Widget Header (shown in collapsed state) */
.diagnostic-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.diagnostic-widget-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.diagnostic-icon {
    font-size: 24px;
}

/* Loader Spinner (like blackboard controls position) */
.diagnostic-widget-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hide header when expanded */
.diagnostic-widget:not(.collapsed-state) .diagnostic-widget-header {
    display: none;
}

.diagnostic-widget.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* When expanding from collapsed */
.diagnostic-widget.visible:not(.collapsed-state) {
    max-height: calc(100vh - 200px);
}

.diagnostic-widget-content {
    padding: 32px 32px 0 32px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Header */
.diagnostic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.diagnostic-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

.progress-indicator {
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 8px 16px;
    border-radius: 12px;
}

/* Skeleton Loading */
.skeleton-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
    margin-bottom: 24px;
}

.skeleton-question {
    height: 60px;
    width: 100%;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 12px;
    margin-bottom: 16px;
}

.skeleton-option {
    height: 56px;
    width: 100%;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 12px;
    margin-bottom: 12px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* MCQ Question */
.mcq-question {
    animation: fadeIn 0.4s ease-out;
}

.question-text {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.mcq-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mcq-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    font-size: 16px;
    color: #374151;
    font-weight: 500;
}

.mcq-option:hover:not(:disabled) {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.mcq-option:disabled {
    cursor: not-allowed;
    opacity: 0.9;
}

.mcq-option.correct {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    font-weight: 600;
}

.mcq-option.correct::before {
    content: '✓ ';
    font-weight: bold;
    margin-right: 8px;
}

.mcq-option.incorrect {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    font-weight: 600;
}

.mcq-option.incorrect::before {
    content: '✗ ';
    font-weight: bold;
    margin-right: 8px;
}

.option-label {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.option-text {
    flex: 1;
    font-weight: 500;
}

/* MCQ Completion */
.mcq-completion {
    text-align: center;
    padding: 40px 20px;
}

.completion-icon {
    font-size: 64px;
    margin-bottom: 24px;
    animation: bounce 0.6s ease-out;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.mcq-completion h3 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.mcq-completion p {
    font-size: 18px;
    color: #6b7280;
    margin: 0 0 32px 0;
}

/* CTA Buttons */
.cta-button {
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    font-family: inherit;
}

.cta-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.cta-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.cta-button.primary:active {
    transform: translateY(0);
}

.flashcard-cta {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.flashcard-cta:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.5);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
.diagnostic-widget-content::-webkit-scrollbar {
    width: 8px;
}

.diagnostic-widget-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.diagnostic-widget-content::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

.diagnostic-widget-content::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* MCQ Explanation Area (from tutor-waiting-content.css) */
.mcq-explanation {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 10px;
    margin-top: 16px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-out;
}

.mcq-explanation.hidden {
    display: none;
}

.mcq-explanation.correct-explanation {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.mcq-explanation.incorrect-explanation {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.explanation-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.explanation-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
}

.explanation-text strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 600;
}

.explanation-text p {
    margin: 0;
    color: #555;
}

/* MCQ Button Container - Fixed at bottom */
.mcq-button-container {
    padding: 20px 32px 32px 32px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.98) 20%, 
        rgba(255, 255, 255, 0.98) 100%
    );
    flex-shrink: 0;
}

/* MCQ Next Button */
.mcq-next-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.mcq-next-btn.hidden {
    display: none;
}

.mcq-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.mcq-next-btn:active {
    transform: translateY(0);
}

/* MCQ Results Card (from tutor-waiting-content.css) */
.mcq-results-card {
    text-align: center;
    padding: 32px 24px;
    animation: fadeIn 0.4s ease-out;
}

.results-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.results-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.results-score {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.results-message {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

/* ============================================
   FLASHCARD WIDGET
   ============================================ */

.flashcard-container {
    padding: 20px 0;
}

.flashcard-card {
    width: 100%;
    height: 280px;
    cursor: pointer;
    perspective: 1000px;
    margin-bottom: 24px;
    transition: transform 0.2s ease;
}

.flashcard-card:hover {
    transform: scale(1.02);
}

.flashcard-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard-card.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    border: 2px solid #667eea;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.flashcard-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: #764ba2;
}

.flashcard-label {
    font-size: 13px;
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.flashcard-back .flashcard-label {
    color: #764ba2;
}

.flashcard-content {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    line-height: 1.6;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    word-wrap: break-word;
}

.flashcard-hint {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 16px;
    font-style: italic;
}

.flashcard-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.flashcard-nav-btn {
    padding: 12px 24px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.flashcard-nav-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.flashcard-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.flashcard-nav-btn:active:not(:disabled) {
    transform: translateY(0);
}

.flashcard-nav-btn.next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.flashcard-nav-btn.next-btn:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .diagnostic-widget {
        width: 95%;
        max-width: none;
    }

    .diagnostic-widget-content {
        padding: 24px 24px 0 24px;
    }

    .mcq-button-container {
        padding: 16px 24px 24px 24px;
    }

    .diagnostic-header h3 {
        font-size: 20px;
    }

    .question-text {
        font-size: 18px;
    }

    .mcq-option {
        padding: 12px 16px;
        font-size: 15px;
    }

    .flashcard-card {
        height: 240px;
    }

    .flashcard-content {
        font-size: 18px;
    }
}