/* Modern Question Interface Styles */
/* Provides styling for individual test questions and answer options */

/* Enhanced Lightbox Container */
.lightbox-container {
    padding: 2.5rem;
    max-width: 100%;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* Question Interface Base */
.question-interface {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
}

/* Enhanced Stage Header */
.stage-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.stage-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.05) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.stage-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 0.75rem 0;
    position: relative;
    z-index: 1;
}

.stage-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
    max-width: 800px;
    position: relative;
    z-index: 1;
    line-height: 1.7;
}

/* Enhanced Question Display */
.question-display {
    margin-bottom: 3.5rem;
}

.question-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: relative;
}

.question-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-hover));
    border-radius: 16px 16px 0 0;
}

/* Updated Question Info Layout */
.question-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.question-number {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-hover) 100%);
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    min-width: 70px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.question-number::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Updated Timer Display - Positioned to the right */
.question-timer {
    background: var(--primary-color-light);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.question-timer::before {
    content: '⏱️';
    font-size: 1.2rem;
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

.question-timer.warning {
    border-color: var(--warning-color);
    color: var(--warning-color);
    background: var(--warning-color);
    color: white;
    animation: pulse 1s infinite;
}

.question-timer.danger {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: var(--danger-color);
    color: white;
    animation: pulse 0.5s infinite;
}

/* Timer Progress Gauge */
.timer-gauge {
    margin: 1rem 0 1.5rem 0;
    padding: 0 0.5rem;
}

.timer-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.timer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-hover));
    border-radius: 4px;
    transition: width 1s linear;
    position: relative;
    overflow: hidden;
}

.timer-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

.timer-progress-fill.warning {
    background: linear-gradient(90deg, var(--warning-color), #ff9800);
}

.timer-progress-fill.danger {
    background: linear-gradient(90deg, var(--danger-color), #f44336);
    animation: pulse 0.5s infinite;
}

.timer-info {
    text-align: center;
    margin-top: 0.5rem;
}

.timer-info small {
    font-size: 0.75rem;
    color: var(--muted-color);
    font-style: italic;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

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

/* Advanced Timer Features */
.timer-pause-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    margin-left: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.timer-pause-btn:hover {
    background: var(--primary-color-hover);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.timer-pause-btn:active {
    transform: scale(0.95);
}

.timer-pause-btn.paused {
    background: var(--success-color);
}

.timer-pause-btn:disabled {
    background: var(--muted-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.timer-pause-btn:disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Timer Expired Message */
.timer-expired-message {
    background: var(--danger-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    animation: slideInDown 0.3s ease;
    box-shadow: var(--shadow-md);
}

.timer-expired-message i {
    margin-right: 0.5rem;
    animation: pulse 1s infinite;
}

/* Time Expired Banner */
.time-expired-banner {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid #fff;
    animation: slideInDown 0.5s ease;
}

.expired-banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    flex-wrap: wrap;
}

.expired-banner-content i {
    font-size: 1.25rem;
    color: #fff;
}

.expired-banner-content strong {
    font-size: 1.125rem;
    font-weight: 700;
}

.expired-banner-content span {
    opacity: 0.9;
    font-size: 0.875rem;
}

/* Disabled Answer Options */
.answer-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    background: #f8f9fa;
    border-color: #dee2e6;
}

.answer-option.disabled:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    transform: none;
    box-shadow: none;
}

.answer-option.disabled .answer-text {
    color: #6c757d;
}

.answer-option.disabled input[type="radio"] {
    cursor: not-allowed;
}

/* Disabled Submit Button */
.btn.disabled {
    background: #6c757d;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn.disabled:hover {
    background: #6c757d;
    transform: none;
    box-shadow: none;
}

/* Time Expired Submit Button */
.btn.time-expired {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
    position: relative;
    overflow: hidden;
}

.btn.time-expired:hover {
    background: #c82333;
    border-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn.time-expired::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn.time-expired:hover::before {
    left: 100%;
}

/* Enhanced Timer Visual States */
.question-timer.urgent {
    animation: urgentPulse 0.5s infinite;
    border-color: #d32f2f;
    background: linear-gradient(45deg, #f44336, #d32f2f);
    color: white;
}

.question-timer.final-warning {
    animation: finalWarning 0.3s infinite;
    border-color: #c62828;
    background: #c62828;
    color: white;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.6);
}

/* Timer Container Layout */
.question-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.timer-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timer-display {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

/* Timer State Indicators */
.timer-state-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--success-color);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.timer-state-indicator.paused {
    background: var(--warning-color);
}

.timer-state-indicator.expired {
    background: var(--danger-color);
    animation: pulse 0.5s infinite;
}

/* Timer Analytics Display */
.timer-analytics {
    position: absolute;
    bottom: -30px;
    left: 0;
    right: 0;
    font-size: 0.75rem;
    color: var(--muted-color);
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.question-timer:hover .timer-analytics {
    opacity: 1;
}

/* Time Warning */
.time-warning {
    background: var(--warning-color);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

/* Loading Container */
.loading-container {
    text-align: center;
    padding: 3rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .lightbox-container {
        padding: 1rem;
    }
    
    .stage-header {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .stage-title {
        font-size: 1.5rem;
    }
    
    .question-header {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .question-info {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .question-number {
        align-self: center;
        font-size: 1rem;
        padding: 0.375rem 0.75rem;
        min-width: 50px;
    }
    
    .question-timer {
        align-self: center;
        font-size: 1.25rem;
        padding: 0.5rem 1rem;
        min-width: 60px;
    }
    
    .question-title {
        font-size: 1.25rem;
    }
    
    .answer-option {
        padding: 1.25rem;
    }
    
    .option-text {
        font-size: 1rem;
    }
    
    .question-actions {
        flex-direction: column;
    }
    
    .question-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .timer-gauge {
        margin: 0.75rem 0 1rem 0;
    }
}

@media (max-width: 576px) {
    .stage-header {
        padding: 0.75rem;
    }
    
    .question-display {
        margin-bottom: 2rem;
    }
    
    .answer-interface {
        margin-bottom: 2rem;
    }
    
    .answer-option {
        padding: 1rem;
    }
    
    .option-text {
        font-size: 0.95rem;
    }
    
    .question-info {
        gap: 0.5rem;
    }
    
    .question-number {
        font-size: 0.9rem;
        padding: 0.25rem 0.5rem;
        min-width: 40px;
    }
    
    .question-timer {
        font-size: 1.1rem;
        padding: 0.375rem 0.75rem;
        min-width: 50px;
    }
    
    .timer-gauge {
        margin: 0.5rem 0 0.75rem 0;
    }
}

/* Dark Theme Support */
.dark-theme .question-interface {
    background: var(--bg-primary-dark);
    color: var(--text-primary-dark);
}

.dark-theme .stage-header {
    background: var(--bg-secondary-dark);
    border-bottom-color: var(--border-color-dark);
}

.dark-theme .stage-title {
    color: var(--primary-color-light);
}

.dark-theme .stage-description {
    color: var(--text-secondary-dark);
}

.dark-theme .question-title {
    color: var(--text-primary-dark);
}

.dark-theme .answer-option {
    background: var(--bg-secondary-dark);
    border-color: var(--border-color-dark);
}

.dark-theme .answer-option:hover {
    border-color: var(--primary-color-light);
}

.dark-theme .answer-option:has(input[type="radio"]:checked),
.dark-theme .answer-option.selected {
    background: var(--primary-color-dark);
    border-color: var(--primary-color-light);
}

.dark-theme .option-text {
    color: var(--text-primary-dark);
}

.dark-theme .question-actions {
    border-top-color: var(--border-color-dark);
}

/* Light Theme Support */
.light-theme .question-interface {
    background: var(--bg-primary-light);
    color: var(--text-primary-light);
}

.light-theme .stage-header {
    background: var(--bg-secondary-light);
    border-bottom-color: var(--border-color-light);
}

.light-theme .answer-option {
    background: var(--bg-secondary-light);
    border-color: var(--border-color-light);
}

.light-theme .question-actions {
    border-top-color: var(--border-color-light);
}

/* Accessibility Improvements */
.answer-option:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.answer-option input[type="radio"]:focus {
    outline: none;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .answer-option {
        border-width: 3px;
    }
    
    .answer-option:has(input[type="radio"]:checked),
    .answer-option.selected {
        border-width: 4px;
    }
    
    .question-number {
        border: 2px solid white;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .answer-option,
    .answer-option:hover,
    .progress-bar {
        transition: none;
    }
    
    .answer-option:hover {
        transform: none;
    }
}

.question-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    padding-top: 0.5rem;
}

/* Enhanced Answer Interface */
.answer-interface {
    margin-top: 2rem;
}

.answer-form {
    margin-top: 1.5rem;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Enhanced Answer Option */
.answer-option {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.answer-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.02) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.answer-option:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.answer-option:hover::before {
    opacity: 1;
}

.answer-option input[type="radio"] {
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-primary);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.answer-option input[type="radio"]:checked {
    border-color: var(--primary-color);
    background: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-color-light);
}

.answer-option input[type="radio"]:checked + .option-text {
    color: var(--primary-color);
    font-weight: 600;
}

.answer-option:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: var(--primary-color-light);
    box-shadow: var(--shadow-md);
}

.answer-option:has(input[type="radio"]:checked)::before {
    opacity: 1;
}

.answer-option.selected {
    border-color: var(--primary-color);
    background: var(--primary-color-light);
    box-shadow: var(--shadow-md);
}

.answer-option.selected::before {
    opacity: 1;
}

.option-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.6;
    flex: 1;
    transition: all 0.3s ease;
}

/* Enhanced Question Actions */
.question-actions {
    margin-top: 3rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    align-items: center;
}

.question-actions .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.question-actions .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.question-actions .btn:hover::before {
    left: 100%;
}

/* Timer Animations */
@keyframes urgentPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
}

@keyframes finalWarning {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 20px rgba(244, 67, 54, 0.6);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 0 30px rgba(244, 67, 54, 0.8);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Timer Accessibility */
.question-timer:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.timer-pause-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .question-timer {
        border-width: 3px;
    }
    
    .timer-pause-btn {
        border: 2px solid white;
    }
    
    .timer-expired-message {
        border: 2px solid white;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .question-timer,
    .timer-progress-fill,
    .timer-pause-btn {
        animation: none;
        transition: none;
    }
    
    .timer-expired-message {
        animation: none;
    }
}

/* Stage Overview Styles */
.stage-overview-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.stage-overview-container h2 {
    color: #333;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
}

.stage-overview-container .text-muted {
    font-size: 16px;
}

.stage-overview-container .card {
    border: 2px solid;
    transition: all 0.3s ease;
    height: 100%;
}

.stage-overview-container .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.stage-overview-container .card.border-primary {
    border-color: #007bff !important;
}

.stage-overview-container .card.bg-primary {
    background-color: #007bff !important;
}

.stage-overview-container .card.border-light {
    border-color: #dee2e6 !important;
}

.stage-overview-container .card-body {
    padding: 1.5rem;
}

.stage-overview-container .card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.stage-overview-container .card-text {
    font-size: 0.875rem;
    color: inherit;
    opacity: 0.9;
}

.stage-overview-container .stage-info {
    margin-top: 1rem;
}

.stage-overview-container .badge {
    margin: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.stage-overview-container .badge-light {
    background-color: rgba(255,255,255,0.2);
    color: inherit;
}

.stage-overview-container .badge-info {
    background-color: rgba(255,255,255,0.2);
    color: inherit;
}

.current-stage-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    margin-top: 1.5rem;
}

.current-stage-details h4 {
    color: #007bff;
    margin-bottom: 15px;
    font-size: 18px;
}

.current-stage-details h5 {
    color: #333;
    font-size: 18px;
    margin-bottom: 10px;
}

.current-stage-details p {
    color: #666;
    line-height: 1.6;
}

.stage-meta p {
    margin-bottom: 0.5rem;
}

.stage-meta strong {
    color: #333;
}

/* Stage Description Section Styling */
.stage-description-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    margin-top: 1.5rem;
}

.stage-description-section p {
    color: #666;
    line-height: 1.6;
    font-size: 16px;
    margin: 0;
    text-align: left;
}

/* Loading spinner for stages */
.spinner-border.text-primary {
    color: #007bff !important;
}

/* Continue button styling */
#continue-to-questions {
    font-size: 18px;
    padding: 15px 30px;
    min-width: 200px;
    transition: all 0.3s ease;
}

#continue-to-questions:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.3);
}

#continue-to-questions:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
