/* Component Specific Styles */

/* Question Components */
.question-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.question-number {
    background: white; /* Mặc định trắng - chưa làm */
    color: #333;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.question-number:hover {
    background: #f8f9fa;
    transform: scale(1.05);
}

/* Xanh dương - câu hiện tại */
.question-number.current {
    background: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
    box-shadow: 0 0 15px rgba(0, 123, 255, 0.4);
}

/* Xanh lá - câu đã làm đúng (chế độ instant scoring) */
.question-number.answered {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}

/* Đỏ - câu đã làm nhưng sai (chế độ instant scoring) */
.question-number.incorrect {
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

/* Màu cũ cho chế độ end scoring - đã làm nhưng chưa biết đúng/sai */
.exam-end-scoring .question-number.answered {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

.exam-end-scoring .question-number.incorrect {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

/* Trắng - câu chưa làm */
.question-number.unanswered {
    background: white;
    color: #333;
    border-color: #e9ecef;
}

.question-type {
    background: #ff6b6b;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
}

.question-type.critical {
    background: #ff4757;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.question-text {
    font-size: 1.2em;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #333;
}

.question-image {
    text-align: center;
    margin: 20px 0;
    min-height: 50px; /* Reserve space for images */
}

.question-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer; /* Allow clicking to zoom */
}

.question-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

/* Loading state for images */
.question-image img[style*="opacity:0"] {
    background: #f0f0f0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-image img[style*="opacity:0"]:before {
    content: "🔄 Đang tải ảnh...";
    color: #666;
    font-size: 14px;
}

/* Answer Options */
.answer-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.answer-option:hover {
    background: #e3f2fd;
    border-color: #2196f3;
}

.answer-option.selected {
    background: #e8f5e8;
    border-color: #4caf50;
}

.answer-option.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.answer-option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.answer-option.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-letter {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.answer-option.correct .option-letter {
    background: #28a745;
}

.answer-option.incorrect .option-letter {
    background: #dc3545;
}

.option-text {
    flex: 1;
    font-size: 1.05em;
    line-height: 1.4;
}

/* Navigation Controls */
.question-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.nav-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s ease;
    min-width: 120px;
}

.nav-btn:hover {
    background: #5a6fd8;
}

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.nav-btn.danger {
    background: #ff6b6b;
}

.nav-btn.danger:hover {
    background: #ff5252;
}

.nav-btn.success {
    background: #4caf50;
}

.nav-btn.success:hover {
    background: #45a049;
}

/* Progress Indicators */
.progress-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
    border-radius: 5px;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    color: #666;
}

.timer {
    background: #ff6b6b;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1em;
}

.timer.warning {
    animation: pulse 1s infinite;
    background: #ff4757;
}

/* Question Grid */
.question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.question-grid-item {
    aspect-ratio: 1;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    background: white; /* Trắng - câu chưa làm */
    color: #333;
}

.question-grid-item:hover {
    background: #f8f9fa;
    transform: scale(1.05);
}

.question-grid-item.current {
    background: #007bff !important; /* Xanh dương - câu hiện tại */
    color: white !important;
    border-color: #007bff !important;
    box-shadow: 0 0 15px rgba(0, 123, 255, 0.4);
}

.question-grid-item.answered {
    background: #28a745 !important; /* Xanh lá - câu đã làm đúng */
    color: white !important;
    border-color: #28a745 !important;
}

.question-grid-item.incorrect {
    background: #dc3545 !important; /* Đỏ - câu đã làm nhưng sai */
    color: white !important;
    border-color: #dc3545 !important;
}

.question-grid-item.critical {
    border: 3px solid #ff4757;
    background: #fff5f5;
}

.question-grid-item.critical.answered {
    background: #ff4757;
    color: white;
}

/* Results and Statistics */
.result-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.result-score {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.result-score.pass {
    color: #4caf50;
}

.result-score.fail {
    color: #ff6b6b;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.result-stat {
    text-align: center;
}

.result-stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.result-stat-label {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Lists and Categories */
.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.category-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.category-item h4 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #333;
}

.category-item p {
    color: #666;
    font-size: 0.95em;
    line-height: 1.4;
}

.category-count {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: bold;
    float: right;
}

/* Search and Filter */
.search-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.search-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #667eea;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Responsive adjustments for components */
@media (max-width: 768px) {
    .question-navigation {
        flex-direction: column;
        align-items: stretch;
    }
    
    .nav-btn {
        min-width: auto;
    }
    
    .question-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .result-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .category-list {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        justify-content: center;
    }
}
