/* Reset and Base Styles */
:root {
    --dark-moss-green: #606c38;
    --pakistan-green: #283618;
    --cornsilk: #fefae0;
    --earth-yellow: #dda15e;
    --tigers-eye: #bc6c25;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--cornsilk);
    min-height: 100vh;
    color: var(--pakistan-green);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: var(--pakistan-green);
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}



/* Screen Management */
.screen {
    display: none;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.screen.active {
    display: block;
    animation: slideUpFadeIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 10px;
}

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

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    background: var(--pakistan-green);
}

.btn-secondary {
    background: transparent;
    color: var(--dark-moss-green);
    border: 2px solid var(--dark-moss-green);
}

.btn-secondary:hover {
    background: var(--dark-moss-green);
    color: white;
    transform: translateY(-3px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Main Menu */
.menu-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.menu-options .btn {
    width: 300px;
    font-size: 1.3rem;
    padding: 20px;
}

/* Form Styles */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}

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

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

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--dark-moss-green);
    box-shadow: 0 0 0 3px rgba(96, 108, 56, 0.1);
}

.upload-options {
    display: flex;
    gap: 15px;
}

.file-input-styled {
    display: none;
}

.upload-options .btn {
    flex-grow: 1;
}


.file-preview {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: popIn 0.3s ease;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

/* Processing Screen */
.processing-container {
    text-align: center;
}

.progress-steps {
    margin: 40px 0;
}

.step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #dee2e6;
    transition: all 0.4s ease;
}

.step.active {
    border-left-color: var(--earth-yellow);
    background: #fffaf0;
}

.step.completed {
    border-left-color: var(--dark-moss-green);
    background: #f9fbf5;
}

.step-icon {
    font-size: 1.5rem;
    margin-right: 15px;
}

.step-text {
    flex: 1;
    text-align: left;
    font-weight: 500;
}

.step-status {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.step.completed .step-status {
    transform: scale(1.2);
}

.progress-log {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
    font-family: monospace;
    font-size: 0.9rem;
}

/* Question Count Selection */
.question-count-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.count-btn {
    padding: 20px;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    background: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.count-btn:hover {
    border-color: var(--earth-yellow);
    background: #fffaf0;
    transform: translateY(-2px);
}

/* Quiz Interface */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.quiz-progress {
    background: var(--cornsilk);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--dark-moss-green);
}

.question-container h3 {
    font-size: 1.4rem;
    margin-bottom: 30px;
    line-height: 1.6;
    color: var(--pakistan-green);
}

.options-container {
    display: grid;
    gap: 15px;
}

.option {
    padding: 20px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-align: left;
}

.option:hover {
    border-color: var(--earth-yellow);
    background: #fffaf0;
}

.option-explanation {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #6c757d;
}

.option.correct-answer .option-explanation,
.option.incorrect-answer .option-explanation {
    color: white;
}

.option.selected {
    border-color: var(--dark-moss-green);
    background: var(--dark-moss-green);
    color: white;
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.option.correct-answer {
    background-color: #28a745; /* A clear, friendly green */
    border-color: #28a745;
    color: white;
}

.option.incorrect-answer {
    background-color: #dc3545; /* A clear, but not jarring, red */
    border-color: #dc3545;
    color: white;
}

.explanation-container {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid var(--dark-moss-green);
}

.explanation-content {
    font-size: 1rem;
    line-height: 1.6;
}

/* Results Screen */
.results-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

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

.score-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--earth-yellow) 0%, var(--tigers-eye) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 20px 40px rgba(221, 161, 94, 0.3);
    animation: scaleIn 0.5s ease-out;
}

.score-circle span {
    font-size: 3rem;
    font-weight: bold;
    color: white;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

/* Quiz List */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.quiz-card {
    background: #fff;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #eee;
    transition: all 0.3s ease;
    cursor: pointer;
}

.quiz-card:hover {
    border-color: var(--earth-yellow);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.quiz-card h3 {
    margin-bottom: 15px;
    color: var(--pakistan-green);
}

.quiz-card p {
    color: #666;
    margin-bottom: 15px;
}

.quiz-card-actions {
    display: flex;
    gap: 10px;
}

.quiz-card-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    margin: 0;
}

/* Answer Review */
.review-question {
    background: #fff;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    border-left: 4px solid #dee2e6;
}

.review-question.correct {
    border-left-color: var(--dark-moss-green);
    background: #f9fbf5;
}

.review-question.incorrect {
    border-left-color: var(--tigers-eye);
    background: #fff8f0;
}

.review-option {
    padding: 10px 15px;
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.review-option.user-answer {
    background: var(--earth-yellow);
    color: white;
    border-color: var(--earth-yellow);
}

.review-option.correct-answer {
    background: var(--dark-moss-green);
    color: white;
    border-color: var(--dark-moss-green);
}

.review-option.incorrect-answer {
    background: var(--tigers-eye);
    color: white;
    border-color: var(--tigers-eye);
}

.explanation {
    background: #f9fbf5;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    border-left: 4px solid var(--dark-moss-green);
    color: var(--pakistan-green);
}

.explanation strong {
    color: var(--pakistan-green);
}

/* Camera Modal */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.camera-modal.active {
    display: flex;
}

.camera-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    background: black;
    border-radius: 15px;
    overflow: hidden;
}

#camera-feed {
    width: 100%;
    display: block;
}

.camera-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
}

#capture-btn {
    background: white;
    color: black;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    padding: 0;
    font-size: 1.5rem;
    border: 4px solid black;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

#capture-btn:hover {
    background: #eee;
}

.camera-container .loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8); /* Dark overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 10; /* Above video, below camera actions */
    color: white;
    font-size: 1.2rem;
}

.camera-container .loading-indicator .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--earth-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* Loading Overlay */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--earth-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-overlay p {
    color: white;
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container { padding: 15px; }
    header h1 { font-size: 2rem; }
    .screen { padding: 20px; }
    .menu-options .btn { width: 100%; font-size: 1.1rem; }
    .quiz-header { flex-direction: column; gap: 15px; text-align: center; }
    .quiz-actions { flex-direction: column; gap: 15px; }
    .results-actions { flex-direction: column; align-items: center; }
    .score-circle { width: 150px; height: 150px; }
    .score-circle span { font-size: 2rem; }
    .question-count-options { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .question-count-options { grid-template-columns: 1fr; }
    .quiz-grid { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column; }
}

/* Animations */
@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  70% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
/* Success/Error Messages */
.message { padding: 15px 20px; border-radius: 10px; margin: 20px 0; font-weight: 500; }
.message.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.message.info { background: #cce7ff; color: #004085; border: 1px solid #b3d7ff; }