/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
}

/* Quiz Container */
.quiz-container {
    max-width: 640px;
    margin: 60px auto;
    padding: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.quiz-container h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 32px;
    text-align: center;
}

.quiz-container h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.quiz-container p {
    color: #6b7280;
    margin-bottom: 20px;
}
/* Form Groups */
.quiz-container .form-group {
    margin-bottom: 16px;
    text-align: left;
}

.quiz-container .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.quiz-container .form-group .id-input {
    margin-bottom: 0;
}
/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover:not(:disabled) {
    background: #e2e8f0;
}

.btn-restart {
    background: #1a1a2e;
    color: white;
    width: 100%;
    margin-top: 24px;
}

.btn-restart:hover {
    background: #2d2d44;
}

/* Form Inputs */
.id-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
}

.id-input:focus {
    outline: none;
    border-color: #2563eb;
}

.id-input::placeholder {
    color: #9ca3af;
}

/* Error Message */
.error-message {
    color: #dc2626;
    font-size: 14px;
    margin-top: 8px;
}

#error-screen {
    text-align: center;
    padding: 40px 20px;
}

#error-screen .error-message {
    font-size: 1rem;
}

/* Progress */
.progress {
    text-align: center;
    color: #6b7280;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
}

/* Question */
.question {
    font-size: 1.125rem;
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Options */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.option {
    padding: 16px 20px;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
    color: #374151;
}

.option:hover {
    border-color: #2563eb;
    background: #f0f7ff;
}

.option.selected {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 500;
}

.short-answer-input {
    width: 100%;
    padding: 16px 18px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #374151;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.short-answer-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Matching question */
.matching-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 24px;
}

.matching-prompt {
    padding: 14px 18px;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #374151;
    font-weight: 500;
}

.matching-select {
    width: 100%;
    padding: 14px 16px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s ease;
    appearance: auto;
}

.matching-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.matching-select:not(:invalid):not([value=""]) {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

@media (max-width: 560px) {
    .matching-grid {
        grid-template-columns: 1fr;
    }
}

/* Score Summary */
.score-summary {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 24px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 32px;
}

.score-item {
    text-align: center;
}

.score-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 4px;
}

.score-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.results-table th {
    text-align: left;
    padding: 12px 16px;
    background: #f8fafc;
    color: #6b7280;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
}

.results-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.result-correct {
    color: #059669;
    font-weight: 500;
}

.result-incorrect {
    color: #dc2626;
    font-weight: 500;
}

/* Hidden */
.hidden {
    display: none;
}
.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.profile-actions .btn {
    flex: 1;
}

/* Success Message */
.success-message {
    color: #059669;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
}

/* Readonly Input */
input[readonly] {
    background: #f1f5f9;
    color: #6b7280;
    cursor: not-allowed;
}


/* Profile Link */
.profile-link {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}

.profile-link a {
    color: #2563eb;
    text-decoration: none;
}

.profile-link a:hover {
    text-decoration: underline;
}

/* Auth Links */
.auth-links {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.auth-links p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.auth-links p:last-child {
    margin-bottom: 0;
}

.auth-links a {
    color: #2563eb;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}


/* Full Width Button */
.btn-full {
    width: 100%;
}

/* Success Card */
.success-card {
    text-align: center;
    padding: 32px 24px;
    background: #f0fdf4;
    border-radius: 12px;
    margin-bottom: 24px;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: #059669;
    color: white;
    font-size: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.success-card h2 {
    color: #059669;
    margin-bottom: 8px;
}

.success-card p {
    color: #374151;
    margin-bottom: 8px;
}

.user-id-display {
    margin-top: 16px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    font-size: 15px;
}

.user-id-display strong {
    color: #1a1a2e;
}

/* Success Actions */
.success-actions {
    display: flex;
    gap: 12px;
}

.success-actions .btn {
    flex: 1;
}

/* Responsive */
@media (max-width: 640px) {
    .quiz-container {
        margin: 20px;
        padding: 24px;
    }
    
    .quiz-container h1 {
        font-size: 1.5rem;
    }
    
    .score-summary {
        gap: 16px;
        padding: 16px;
    }
    
    .score-value {
        font-size: 1.5rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 10px 12px;
    }
}

.assigned-id-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assigned-id {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.4rem 0.75rem;
    background: #f3f4f6;
    border-radius: 6px;
    color: #111827;
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

.help-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.quiz-progress {
    margin-bottom: 1rem;
}
.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: #2563eb;
    transition: width 0.25s ease;
    width: 0;
}
.quiz-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.progress-text {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Quiz timer */
.quiz-timer {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 2px 10px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.quiz-timer--urgent {
    color: #dc2626;
    background: #fee2e2;
    border-color: #fca5a5;
    animation: timer-pulse 1s ease-in-out infinite;
}
@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* Attempt counter on quiz cards */
.quiz-card-attempts {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #6b7280;
}
.quiz-card-attempts--locked {
    color: #dc2626;
    font-weight: 500;
}

/* Locked / disabled quiz card button */
.quiz-card .btn-primary:disabled,
.course-card .btn-primary:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 1;
    border-color: transparent;
}

/* Question jumper dots */
.question-jumper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}
.jump-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}
.jump-dot:hover {
    border-color: #9ca3af;
}
.jump-dot.answered {
    background: #dcfce7;
    border-color: #16a34a;
    color: #166534;
}
.jump-dot.current {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.jump-dot.current.answered {
    background: #16a34a;
    border-color: #16a34a;
}

/* Quiz nav bar */
.quiz-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: #6b7280;
}
.btn-ghost:hover {
    color: #111827;
    border-color: #d1d5db;
}

/* Resume notice */
.resume-notice {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.95rem;
    color: #78350f;
}   

.section-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 1.25rem 0 0.5rem;
}

.quiz-picker-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.quiz-card:hover { border-color: #9ca3af; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.quiz-card.is-assigned { border-left: 4px solid #2563eb; }

.quiz-card-body { flex: 1; min-width: 0; }
.quiz-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}
.quiz-card-head h4 { margin: 0; font-size: 1.05rem; }
.quiz-card-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.quiz-card-desc { margin: 0 0 0.35rem; color: #4b5563; font-size: 0.9rem; }
.quiz-card-meta { margin: 0; color: #6b7280; font-size: 0.85rem; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}
.badge-assigned { background: #dbeafe; color: #1e40af; }
.badge-new      { background: #f3f4f6; color: #6b7280; }
.badge-progress { background: #fef3c7; color: #78350f; }
.badge-done     { background: #dcfce7; color: #166534; }
.badge-failed   { background: #fee2e2; color: #991b1b; }

.empty-state {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
}

.subtle { color: #6b7280; font-size: 0.9rem; margin-top: -0.25rem; }

/* Admin user modal checkboxes */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    cursor: pointer;
}
.checkbox-row input { margin: 0; }

.learning-container {
    max-width: 820px;
}

.learning-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.course-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.course-card {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.course-card:hover {
    border-color: #9ca3af;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.course-card h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    color: #111827;
}

.course-card p {
    margin: 0 0 0.45rem;
    color: #4b5563;
    font-size: 0.92rem;
}

.course-progress-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.course-description {
    color: #4b5563;
    margin-bottom: 1.25rem;
}

.lesson-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lesson-reader {
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.lesson-reader.is-complete {
    border-color: #86efac;
    background: #f0fdf4;
}

.lesson-reader-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.lesson-number {
    margin: 0 0 0.3rem;
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.lesson-reader h3 {
    margin: 0;
    color: #111827;
    font-size: 1.1rem;
}

.lesson-meta {
    margin: 0.25rem 0 0;
    color: #6b7280;
    font-size: 0.85rem;
}

.lesson-content {
    color: #374151;
    line-height: 1.65;
    white-space: normal;
}

.lesson-block-heading {
    margin: 1rem 0 0.4rem;
    color: #111827;
    font-size: 1rem;
    font-weight: 700;
}

.lesson-video {
    margin-top: 1rem;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #0f172a;
    aspect-ratio: 16 / 9;
}

.lesson-video iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.lesson-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.certification-action {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.certification-meta {
    margin-bottom: 0.75rem;
    color: #4b5563;
    font-size: 0.9rem;
}

.certification-meta.is-passed {
    color: #166534;
}

.certification-meta.is-failed {
    color: #991b1b;
}

.results-notice {
    margin: 0 0 1rem;
    padding: 10px 14px;
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #713f12;
}
.score-display {
    margin: 1rem 0 1.5rem;
    padding: 1rem;
    text-align: center;
    color: #111827;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.certificate-notice {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0 0 1.5rem;
    padding: 1rem;
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    text-align: center;
}

.certificate-notice span {
    color: #374151;
    font-size: 0.9rem;
}

.certificate-notice a {
    color: #166534;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.certificate-notice a:hover {
    text-decoration: underline;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.review-item {
    padding: 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.review-item p {
    margin-bottom: 0.45rem;
    color: #374151;
}

.review-item p:last-child {
    margin-bottom: 0;
}

.results-actions {
    margin-top: 1.5rem;
}

@media (max-width: 640px) {
    .learning-header-row,
    .course-card,
    .lesson-reader-header {
        flex-direction: column;
    }

    .course-card .btn,
    .learning-header-row .btn,
    .lesson-reader-header .btn {
        width: 100%;
    }

    .lesson-links .btn {
        width: 100%;
    }
}
/* ---------- Admin Report Table ---------- */
.responses-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.responses-table thead {
    background: #f3f4f6;
}

.responses-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.responses-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
    color: #1f2937;
    vertical-align: middle;
}

.responses-table tbody tr:hover {
    background: #f9fafb;
}

.responses-table tbody tr:last-child td {
    border-bottom: none;
}

.score-pass {
    color: #166534;
    font-weight: 600;
}

.score-fail {
    color: #b91c1c;
    font-weight: 600;
}

.empty-cell {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-style: italic;
}

/* Responsive: stack columns on narrow screens */
@media (max-width: 640px) {
    .responses-table thead { display: none; }
    .responses-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        padding: 0.5rem;
    }
    .responses-table td {
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #f3f4f6;
        padding: 0.5rem 0.25rem;
    }
    .responses-table td:last-child { border-bottom: none; }
    .responses-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
    }
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-completed   { background: #dcfce7; color: #166534; }
.status-in-progress { background: #fef3c7; color: #92400e; }

/* Progress bar cell */
.progress-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 160px;
}
.progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: #f59e0b;
    transition: width 0.2s ease;
}
.progress-text {
    font-size: 0.8rem;
    color: #4b5563;
    white-space: nowrap;
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 140px;
}
.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.filter-group input,
.filter-group select {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}
.filter-group input[type="number"] { width: 100px; }
.btn-clear { align-self: flex-end; }

.responses-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.responses-table th.sortable:hover {
    background: #e5e7eb;
}
