/* Accessibility CSS for PYQ Master */

/* Skip to content link */
.visually-hidden-focusable {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.visually-hidden-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: 0.5rem !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* Focus indicators */
.btn:focus,
.form-control:focus,
.form-select:focus,
.nav-link:focus {
    outline: 2px solid #007bff !important;
    outline-offset: 2px !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        background-color: #000 !important;
        border-color: #000 !important;
        color: #fff !important;
    }
    
    .btn-secondary {
        background-color: #666 !important;
        border-color: #666 !important;
        color: #fff !important;
    }
    
    .text-muted {
        color: #333 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Screen reader only text */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ARIA live regions */
.aria-live {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Question state indicators for screen readers */
.question-btn[aria-label] {
    position: relative;
}

.question-btn[aria-label]::after {
    content: attr(aria-label);
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Form validation accessibility */
.is-invalid {
    border-color: #dc3545 !important;
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

/* Practice question accessibility */
.question-text {
    font-size: 1.1rem;
    line-height: 1.6;
}

.question-option {
    margin-bottom: 0.5rem;
}

.question-option input[type="radio"] {
    margin-right: 0.5rem;
}

/* Timer accessibility */
.timer-display {
    font-weight: bold;
    font-size: 1.2rem;
}

/* Navigation accessibility */
.nav-link {
    padding: 0.5rem 1rem;
}

.nav-link:hover,
.nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Button accessibility */
.btn {
    min-height: 48px;  /* Increased from 44px to iOS standard */
    min-width: 48px;
}

.btn-sm {
    min-height: 40px;  /* Increased from 36px */
    min-width: 40px;
}

/* Color contrast improvements */
.text-success {
    color: #198754 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #fd7e14 !important;
}

.text-info {
    color: #0dcaf0 !important;
}

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.answered {
    background-color: #28a745;
}

.status-dot.marked {
    background-color: #6f42c1;
}

.status-dot.visited {
    background-color: #17a2b8;
}

.status-dot.not-visited {
    background-color: transparent;
    border: 2px solid #dc3545;
}

/* Question grid accessibility */
.question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.question-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.question-btn:hover,
.question-btn:focus {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Instruction section accessibility */
.instruction-section {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-top: 1rem;
}

.instruction-section h6 {
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #495057;
}

/* Responsive design for accessibility */
@media (max-width: 768px) {
    .question-text {
        font-size: 1rem;
    }
    
    .btn {
        min-height: 48px;
        font-size: 1rem;
    }
    
    .question-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.25rem;
    }
    
    .question-btn {
        min-height: 40px;
        font-size: 0.9rem;
    }
}
