/* Production ML Engineering Quiz - Styles */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --error-color: #dc2626;
    --warning-color: #d97706;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 8px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.quiz-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.quiz-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.quiz-header h1 i {
    margin-right: 10px;
    color: #fbbf24;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* Progress Bar */
.progress-container {
    max-width: 400px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #fbbf24;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 10%;
}

.progress-text {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Screen Management */
.screen {
    display: none;
    flex: 1;
}

.screen.active {
    display: block;
}

/* Welcome Screen */
.welcome-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.welcome-card h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.quiz-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    text-align: left;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--background);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.info-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
    min-width: 20px;
}

/* Question Card */
.question-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.question-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.question-type {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.question-content h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    line-height: 1.5;
    color: var(--text-primary);
}

/* Code Block */
.code-block {
    margin: 20px 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.code-block pre {
    margin: 0;
    background: #1e293b !important;
    padding: 20px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

.hidden {
    display: none;
}

/* Answer Options */
.answer-options {
    margin: 25px 0;
}

.answer-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    margin-bottom: 12px;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.answer-option:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
}

.answer-option input[type="radio"] {
    margin: 0;
    accent-color: var(--primary-color);
}

.answer-option label {
    cursor: pointer;
    flex: 1;
    font-weight: 500;
}

/* Feedback States for Answer Options */
.answer-option.feedback-correct {
    background: #dcfce7;
    border-color: var(--success-color);
    color: #166534;
}

.answer-option.feedback-incorrect {
    background: #fef2f2;
    border-color: var(--error-color);
    color: #991b1b;
}

.answer-option.feedback-neutral {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #64748b;
    opacity: 0.7;
}

.answer-option.feedback-correct:hover,
.answer-option.feedback-incorrect:hover,
.answer-option.feedback-neutral:hover {
    background: inherit;
    border-color: inherit;
}

.answer-input textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease;
}

.answer-input textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Feedback Container */
.feedback-container {
    margin: 25px 0;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid;
    animation: fadeIn 0.3s ease;
}

.feedback-container.feedback-correct-bg {
    background: #dcfce7;
    border-color: var(--success-color);
    color: #166534;
}

.feedback-container.feedback-incorrect-bg {
    background: #fef2f2;
    border-color: var(--error-color);
    color: #991b1b;
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    font-weight: 600;
}

.feedback-icon {
    font-size: 1.2rem;
}

.feedback-title {
    flex: 1;
    font-size: 1.1rem;
}

.current-score {
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.feedback-answer {
    margin: 15px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
    line-height: 1.6;
}

.feedback-explanation {
    margin-top: 15px;
}

.feedback-explanation p {
    margin-top: 8px;
    line-height: 1.6;
    color: inherit;
}

/* Question Actions */
.question-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.question-jump {
    flex: 1;
    max-width: 200px;
    margin: 0 auto;
}

.question-select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-family: var(--font-family);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.question-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.question-select option {
    padding: 5px;
}

.question-select option.answered {
    background: #dcfce7;
    color: #166534;
}

.question-select option.current {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Results Screen */
.results-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.score-display {
    margin-bottom: 40px;
}

.score-circle {
    display: inline-block;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.score-number {
    font-size: 2.5rem;
    font-weight: 700;
}

.score-total {
    font-size: 1.2rem;
    opacity: 0.9;
}

.score-display h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.score-display p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Results Breakdown */
.results-breakdown {
    margin-bottom: 40px;
    text-align: left;
}

.results-breakdown h3 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.breakdown-grid {
    display: grid;
    gap: 15px;
}

.breakdown-item {
    padding: 15px;
    background: var(--background);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.category-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.category-score {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.category-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.category-fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

/* Review Screen */
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.review-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.review-content {
    display: grid;
    gap: 25px;
}

.review-item {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border-color);
}

.review-item.correct {
    border-left-color: var(--success-color);
}

.review-item.incorrect {
    border-left-color: var(--error-color);
}

.review-header-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.result-icon {
    font-size: 1.2rem;
}

.result-icon .fa-check-circle {
    color: var(--success-color);
}

.result-icon .fa-times-circle {
    color: var(--error-color);
}

.review-question h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    line-height: 1.5;
    color: var(--text-primary);
}

.review-answers {
    margin: 20px 0;
}

.user-answer, .correct-answer {
    padding: 10px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.user-answer.correct {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.user-answer.incorrect {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.correct-answer {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.review-explanation {
    padding: 15px;
    background: var(--background);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.review-explanation p {
    margin-top: 8px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Certificate Screens */
.certificate-form-card, .certificate-display-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    max-width: 800px;
    margin: 0 auto;
}

.certificate-header, .certificate-display-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.certificate-header h2, .certificate-display-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--success-color), #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.certificate-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.certificate-form {
    max-width: 500px;
    margin: 0 auto;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.github-input {
    display: flex;
    align-items: center;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color 0.2s ease;
    overflow: hidden;
}

.github-input:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.github-prefix {
    background: var(--background);
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    border-right: 1px solid var(--border-color);
}

.github-input input {
    border: none;
    box-shadow: none;
    flex: 1;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.certificate-preview {
    background: var(--background);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin: 25px 0;
}

.certificate-preview h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.certificate-preview ul {
    list-style: none;
    padding: 0;
}

.certificate-preview li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.certificate-preview li i {
    color: var(--success-color);
    font-size: 0.9rem;
}

.certificate-actions, .certificate-footer-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Certificate Display */
.certificate-display {
    text-align: center;
    margin: 30px 0;
}

.certificate-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.certificate-display canvas {
    max-width: 100%;
    height: auto;
    margin-bottom: 25px;
}

/* Footer */
.quiz-footer {
    text-align: center;
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.quiz-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .quiz-header {
        padding: 20px 15px;
    }
    
    .quiz-header h1 {
        font-size: 2rem;
    }
    
    .question-card, .welcome-card, .results-card {
        padding: 20px;
    }
    
    .question-actions {
        flex-direction: column;
    }
    
    .question-jump {
        max-width: 100%;
        width: 100%;
    }
    
    .results-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        justify-content: center;
    }
    
    .review-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .quiz-info {
        grid-template-columns: 1fr;
    }
    
    .certificate-form-card, .certificate-display-card {
        padding: 25px;
    }
    
    .certificate-header h2, .certificate-display-header h2 {
        font-size: 1.5rem;
    }
    
    .certificate-actions, .certificate-footer-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .github-input {
        flex-direction: column;
    }
    
    .github-prefix {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .quiz-header h1 {
        font-size: 1.5rem;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .score-number {
        font-size: 2rem;
    }
    
    .question-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen.active {
    animation: fadeIn 0.3s ease;
}

/* Print Styles */
@media print {
    .quiz-header, .question-actions, .results-actions, .quiz-footer {
        display: none;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .review-item {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}