/* Exam Folder Plugin Styles */

/* Custom styles to complement Tailwind CSS */
.exam-folder-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Question transitions */
.question-container {
    transition: opacity 0.3s ease-in-out;
}

.question-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.question-container.active {
    opacity: 1;
    pointer-events: all;
}

/* Custom radio and checkbox styles */
.exam-folder-container input[type="radio"],
.exam-folder-container input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.exam-folder-container input[type="radio"] {
    border-radius: 50%;
}

.exam-folder-container input[type="radio"]:checked,
.exam-folder-container input[type="checkbox"]:checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

.exam-folder-container input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem;
    height: 0.5rem;
    background-color: #ffffff;
    border-radius: 50%;
}

.exam-folder-container input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: bold;
}

.exam-folder-container input[type="radio"]:focus,
.exam-folder-container input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Progress bar animation */
#progress-bar {
    transition: width 0.3s ease-in-out;
}

/* Timer warning styles */
.timer-warning {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Modal animations */
#results-modal {
    transition: opacity 0.3s ease-in-out;
}

#results-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Button hover effects */
.exam-folder-container button {
    transition: all 0.2s ease-in-out;
}

.exam-folder-container button:hover {
    transform: translateY(-1px);
}

.exam-folder-container button:active {
    transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .exam-folder-container .question-container {
        padding: 1rem;
    }

    .exam-folder-container .flex {
        flex-direction: column;
    }

    .exam-folder-container .space-y-3 > div {
        margin-bottom: 0.75rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success/Error states */
.success-message {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.error-message {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Accessibility improvements */
.exam-folder-container .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators for keyboard navigation */
.exam-folder-container button:focus,
.exam-folder-container input:focus,
.exam-folder-container select:focus,
.exam-folder-container textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .exam-folder-container {
        border: 2px solid #000000;
    }

    .exam-folder-container button {
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .exam-folder-container * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Code block styling */
.exam-code-block {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    position: relative;
}

.exam-code-block::before {
    content: attr(data-language);
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background-color: #6c757d;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.exam-code-block code {
    background: none;
    padding: 0;
    border: none;
    font-size: inherit;
    color: inherit;
}

/* Inline code styling */
.exam-inline-code {
    background-color: #f1f3f4;
    border: 1px solid #e0e0e0;
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    font-size: 0.875em;
    color: #d63384;
    white-space: nowrap;
}

/* Code block in questions */
.exam-folder-container .exam-code-block {
    margin: 0.75rem 0;
    max-width: 100%;
}

.exam-folder-container .exam-code-block pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    overflow: visible;
}

/* Dark theme support for code blocks */
@media (prefers-color-scheme: dark) {
    .exam-code-block {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .exam-inline-code {
        background-color: #4a5568;
        border-color: #718096;
        color: #fbb6ce;
    }
}

/* Code block copy button (optional enhancement) */
.exam-code-block {
    position: relative;
}

.exam-code-block .copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.exam-code-block .copy-button:hover {
    opacity: 1;
}

/* Responsive code blocks */
@media (max-width: 768px) {
    .exam-code-block {
        font-size: 0.75rem;
        padding: 0.75rem;
        margin: 0.5rem 0;
    }

    .exam-inline-code {
        font-size: 0.8em;
        padding: 0.1rem 0.25rem;
    }
}

/* Unanswered question highlighting */
.unanswered-question {
    border: 2px solid #f59e0b !important;
    border-radius: 8px;
    background-color: #fef3c7 !important;
    animation: pulse-warning 1s ease-in-out;
}

@keyframes pulse-warning {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* Dark mode for unanswered questions */
@media (prefers-color-scheme: dark) {
    .unanswered-question {
        border-color: #f59e0b !important;
        background-color: #451a03 !important;
    }
}
