/* AI History Quiz Creator Styles - CORRECTED VERSION */

/* ===== ADMIN INTERFACE STYLES ===== */

/* Quiz Stage Management */
.quiz-stage {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    background: white;
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.quiz-stage.active {
    display: block;
    opacity: 1;
}

/* Header Navigation */
.header-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.header-nav .button {
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s ease;
}

/* Topic Selection Cards */
.quiz-topic-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.quiz-topic-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.quiz-topic-card:hover {
    border-color: #e74c3c;
    background: #fff5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.2);
}

.quiz-topic-card.selected {
    border-color: #e74c3c;
    background: linear-gradient(135deg, #fff5f5 0%, #ffeaea 100%);
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.3);
}

.quiz-topic-card.selected::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 15px;
    background: #e74c3c;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.quiz-topic-card h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.1em;
}

.quiz-topic-card p {
    margin: 0;
    color: #666;
    font-size: 0.95em;
    line-height: 1.4;
}

/* API Setup Styles */
.quiz-api-setup {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border-left: 4px solid #007bff;
    margin: 20px 0;
}

.quiz-api-setup h3 {
    margin-top: 0;
    color: #2c3e50;
}

.quiz-api-setup p {
    color: #666;
    line-height: 1.6;
}

.quiz-api-setup a {
    color: #007bff;
    text-decoration: none;
}

.quiz-api-setup a:hover {
    text-decoration: underline;
}

.quiz-api-status {
    margin-top: 15px;
    padding: 12px 20px;
    border-radius: 5px;
    font-weight: bold;
}

.quiz-api-status.ready {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.quiz-api-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading and Progress Styles */
.quiz-loading {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 20px 0;
}

.quiz-loading .progress-bar {
    width: 100%;
    height: 25px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.quiz-loading .progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

/* Quiz Preview Styles */
.quiz-preview {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.quiz-preview h3 {
    color: #e74c3c;
    margin-top: 0;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.quiz-question-preview {
    background: #f8f9fa;
    padding: 20px;
    margin: 15px 0;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.quiz-question-preview h6 {
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-size: 1.1em;
}

.quiz-question-preview ul {
    margin: 10px 0;
    padding-left: 0;
    list-style: none;
}

.quiz-question-preview li {
    padding: 8px 15px;
    margin: 5px 0;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #ecf0f1;
    transition: border-color 0.3s ease;
}

.quiz-question-preview li:hover {
    border-left-color: #e74c3c;
}

.quiz-question-preview p {
    margin: 15px 0 0 0;
    font-style: italic;
    color: #666;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 5px;
    border-left: 3px solid #2196f3;
}

/* ===== BULK ADMIN STYLES ===== */

.bulk-quiz-panel {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #e74c3c;
}

.bulk-quiz-panel h2 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.quiz-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.frequency-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.frequency-inputs input {
    flex: 0 0 80px;
    margin: 0;
}

.frequency-inputs select {
    flex: 1;
    margin: 0;
}

/* Queue Management Styles */
.quiz-queue-controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.quiz-queue-controls .button-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.quiz-queue-controls .button-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.quiz-queue-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #007bff;
}

.quiz-queue-stats strong {
    color: #2c3e50;
}

.quiz-queue-stats span {
    margin: 0 10px;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9em;
    background: white;
    border: 1px solid #dee2e6;
}

.quiz-queue-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

.quiz-queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-left: 4px solid #6c757d;
    transition: all 0.3s ease;
}

.quiz-queue-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.quiz-queue-item.pending {
    border-left-color: #ffc107;
}

.quiz-queue-item.processing {
    border-left-color: #007bff;
    background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
}

.quiz-queue-item.completed {
    border-left-color: #28a745;
}

.quiz-queue-item.error {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, #ffffff 0%, #ffebee 100%);
}

.quiz-queue-item h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.quiz-queue-item p {
    margin: 5px 0;
    color: #666;
    font-size: 0.9em;
}

.quiz-queue-item small {
    color: #999;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    margin-right: 10px;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-processing {
    background: #d1ecf1;
    color: #0c5460;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

/* ===== FORM ENHANCEMENT STYLES ===== */

.quiz-form-group {
    margin-bottom: 25px;
}

.quiz-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.quiz-form-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

.quiz-form-group input,
.quiz-form-group textarea,
.quiz-form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.quiz-form-group input:focus,
.quiz-form-group textarea:focus,
.quiz-form-group select:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Navigation Styles */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
}

.quiz-navigation .button {
    padding: 12px 25px;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.quiz-navigation .button-primary {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    color: white;
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.3);
}

.quiz-navigation .button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
}

/* Message Styles */
.quiz-success-message,
.quiz-error-message,
.quiz-info-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

.quiz-success-message {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.quiz-error-message {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.quiz-info-message {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

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

/* ===== FRONTEND QUIZ STYLES ===== */

/* Static Quiz List Styles */
.quiz-static-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 30px;
    margin: 30px 0;
    border-left: 5px solid #e74c3c;
}

.quiz-static-list h2 {
    color: #2c3e50;
    font-size: 1.8em;
    margin-bottom: 15px;
    text-align: center;
}

.quiz-static-list > p {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-bottom: 30px;
}

.static-quiz-question {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    border-left: 4px solid #3498db;
    transition: all 0.3s ease;
}

.static-quiz-question:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

.static-question-title {
    color: #e74c3c;
    font-size: 1.3em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
    font-weight: bold;
}

.static-question-image {
    text-align: center;
    margin: 20px 0;
}

.static-question-image img {
    border: 3px solid #ecf0f1;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 400px;
    height: auto;
    border-radius: 8px;
}

.static-question-text {
    color: #2c3e50;
    font-size: 1.2em;
    margin-bottom: 20px;
    line-height: 1.5;
    font-weight: 600;
}

.static-question-options {
    margin: 20px 0;
}

.static-option {
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    background: #f8f9fa;
    font-size: 1.05em;
    transition: all 0.3s ease;
}

.static-option:hover {
    border-color: #dee2e6;
    background: #e9ecef;
}

.static-option.correct-answer {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    position: relative;
    font-weight: 600;
}

.static-option.correct-answer::before {
    content: "";
    position: absolute;
    left: -2px;
    top: -2px;
    bottom: -2px;
    width: 4px;
    background: #28a745;
    border-radius: 8px 0 0 8px;
}

.correct-indicator {
    background: #28a745;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 10px;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(40, 167, 69, 0.3);
}

.static-question-explanation {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 10px;
    border-left: 4px solid #2196f3;
    box-shadow: 0 2px 10px rgba(33, 150, 243, 0.1);
}

.static-question-explanation h5 {
    color: #1976d2;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1.1em;
}

.static-question-explanation p {
    color: #0d47a1;
    line-height: 1.6;
    margin: 0;
    font-size: 1.05em;
}

.interactive-quiz-section {
    margin: 40px 0;
    padding: 30px 0;
    border-top: 3px solid #e74c3c;
    border-bottom: 3px solid #e74c3c;
}

.interactive-quiz-section h2 {
    color: #e74c3c;
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 15px;
}

.interactive-quiz-section > p {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
}

/* Interactive Quiz Styles */
.history-quiz-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #f9f9f9;
}

.quiz-header {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: bold;
    color: #333;
}

.quiz-question {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.question-image {
    text-align: center;
    margin-bottom: 20px;
}

.question-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.question-text {
    font-size: 1.3em;
    margin-bottom: 20px;
    color: #2c3e50;
    line-height: 1.4;
}

.question-options {
    margin: 20px 0;
}

.option-label {
    display: block;
    padding: 15px;
    margin: 10px 0;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-label:hover {
    background: #e9ecef;
    border-color: #e74c3c;
}

.option-label.selected {
    background: #fff3cd;
    border-color: #ffc107;
}

.option-label.correct {
    background: #d4edda;
    border-color: #28a745;
}

.option-label.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

.option-label input[type="radio"] {
    display: none;
}

.option-text {
    display: block;
    font-size: 1.1em;
}

.question-explanation {
    margin-top: 20px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.question-explanation h4 {
    margin-top: 0;
    color: #495057;
}

.quiz-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 0 10px;
    transition: background 0.3s ease;
}

.quiz-btn:hover {
    background: #c0392b;
}

.quiz-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.quiz-results {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 10px;
    margin: 20px 0;
}

.score-display {
    margin: 20px 0;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.score-percentage {
    font-size: 2em;
    font-weight: bold;
    color: white;
}

.score-text {
    font-size: 1.3em;
    margin-bottom: 20px;
}

.score-message {
    font-size: 1.1em;
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
}

.score-excellent {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.score-good {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.score-needs-improvement {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
    .quiz-topic-suggestions {
        grid-template-columns: 1fr;
    }
    
    .quiz-settings-grid {
        grid-template-columns: 1fr;
    }
    
    .header-nav {
        flex-direction: column;
        align-items: center;
    }
    
    .quiz-queue-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .quiz-queue-controls {
        flex-direction: column;
    }
    
    .quiz-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .frequency-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .frequency-inputs input,
    .frequency-inputs select {
        flex: none;
    }
    
    .quiz-static-list {
        padding: 20px;
        margin: 20px 0;
    }
    
    .static-quiz-question {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .static-question-title {
        font-size: 1.2em;
    }
    
    .static-question-text {
        font-size: 1.1em;
    }
    
    .static-option {
        padding: 12px;
        font-size: 1em;
    }
    
    .static-question-explanation {
        padding: 15px;
    }
    
    .correct-indicator {
        display: block;
        margin: 8px 0 0 0;
        text-align: center;
        width: fit-content;
    }
    
    .history-quiz-container {
        margin: 10px;
        padding: 15px;
    }
    
    .quiz-question {
        padding: 20px;
    }
    
    .question-text {
        font-size: 1.2em;
    }
    
    .option-label {
        padding: 12px;
    }
    
    .quiz-btn {
        padding: 10px 20px;
        margin: 5px;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .score-percentage {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .quiz-stage,
    .bulk-quiz-panel {
        padding: 15px;
        margin: 10px 0;
    }
    
    .quiz-topic-card {
        padding: 15px;
    }
    
    .quiz-api-setup {
        padding: 20px;
    }
}

/* Print Styles for Study Materials */
@media print {
    .quiz-static-list {
        background: white !important;
        box-shadow: none !important;
    }
    
    .static-quiz-question {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    .static-option.correct-answer {
        background: #f0f0f0 !important;
        font-weight: bold !important;
    }
    
    .interactive-quiz-section {
        display: none !important;
    }
}