/* ========================================
   ENHANCED TEST FEATURES - ADVANCED CSS
   Styles for JavaScript-enhanced features
   ======================================== */

/* Auto-Save Indicator */
.auto-save-indicator {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.auto-save-indicator.active {
    opacity: 1;
    transform: translateY(0);
}

.auto-save-indicator .save-status {
    font-size: 18px;
}

.auto-save-indicator .save-text {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
}

.auto-save-indicator.saving {
    background: linear-gradient(135deg, #fff3cd 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
}

.auto-save-indicator.saving .save-status {
    animation: spin 1s linear infinite;
}

.auto-save-indicator.saved {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
}

.auto-save-indicator.saved .save-text {
    color: #065f46;
}

.auto-save-indicator.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #ef4444;
}

.auto-save-indicator.error .save-text {
    color: #991b1b;
}

/* Enhanced Timer Ring */
.timer-ring {
    width: 40px;
    height: 40px;
    transform: rotate(-90deg);
}

.timer-ring-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 3;
}

.timer-ring-progress {
    fill: none;
    stroke: #667eea;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease;
}

.timer.warning .timer-ring-progress {
    stroke: #f59e0b;
}

.timer.danger .timer-ring-progress {
    stroke: #ef4444;
}

/* Question Navigation */
.question-navigation {
    position: sticky;
    top: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 30px;
    z-index: 100;
    border: 2px solid #e2e8f0;
}

.question-navigation .nav-header {
    font-size: 16px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

.question-navigation .nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
}

.question-navigation .nav-item {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background: white;
    color: #718096;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-navigation .nav-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: scale(1.1);
}

.question-navigation .nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.question-navigation .nav-item.answered {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    color: #065f46;
}

.question-navigation .nav-item.answered.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* Keyboard Shortcuts Help Button */
.keyboard-help-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.keyboard-help-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
}

/* Shortcuts Modal */
.shortcuts-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.shortcuts-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease;
}

.shortcuts-content h3 {
    margin: 0 0 24px;
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.shortcuts-table tr {
    border-bottom: 1px solid #e2e8f0;
}

.shortcuts-table tr:last-child {
    border-bottom: none;
}

.shortcuts-table td {
    padding: 16px 0;
}

.shortcuts-table td:first-child {
    width: 140px;
}

.shortcuts-table kbd {
    display: inline-block;
    padding: 6px 12px;
    background: #f1f5f9;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.shortcuts-table td:last-child {
    font-size: 14px;
    color: #4a5568;
}

.close-shortcuts {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.close-shortcuts:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Form Validation Styles */
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
    border-color: #ef4444;
    background: #fef2f2;
}

.form-group.has-error label {
    color: #ef4444;
}

.error-message {
    display: block;
    color: #ef4444;
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

/* Progress Bar */
.test-progress-bar {
    position: relative;
    background: #e2e8f0;
    height: 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 700;
    color: #1a202c;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .auto-save-indicator {
        bottom: 20px;
        right: 20px;
        padding: 10px 16px;
    }

    .keyboard-help-btn {
        bottom: 20px;
        left: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .question-navigation {
        position: relative;
        top: 0;
    }

    .question-navigation .nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 6px;
    }

    .question-navigation .nav-item {
        width: 35px;
        height: 35px;
        font-size: 13px;
    }

    .shortcuts-content {
        padding: 24px;
        max-width: 90%;
    }

    .shortcuts-content h3 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .shortcuts-table kbd {
        padding: 4px 8px;
        font-size: 11px;
    }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State for Buttons */
.button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Focus Indicators for Accessibility */
button:focus-visible,
.nav-item:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

/* Print Styles */
@media print {
    .auto-save-indicator,
    .keyboard-help-btn,
    .question-navigation,
    .test-progress-bar {
        display: none;
    }
}
