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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Navbar */
.navbar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-box, .register-box {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.3s ease;
}

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

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-box h2, .register-box h2 {
    text-align: center;
    color: #333;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-row {
    align-items: center;
    color: #555;
    display: inline-flex;
    font-weight: 500;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.checkbox-row input[type="checkbox"] {
    height: 18px;
    width: 18px;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}

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

.quiz-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.quiz-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.quiz-card.archived-card {
    background: #f4f6f9;
    border: 1px solid #d1d9e6;
}

.quiz-card.archived-card h3 {
    color: #555;
}

.dashboard-section {
    margin-bottom: 3rem;
}

.dashboard-section h2 {
    color: #1f2937;
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.archived-section {
    padding-top: 1rem;
    border-top: 1px solid rgba(102, 126, 234, 0.18);
}

.empty-message {
    grid-column: 1 / -1;
    color: #6b7280;
    font-size: 1rem;
    padding: 1rem 0;
}

.quiz-card h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.quiz-card p {
    color: #666;
    margin-bottom: 1rem;
}

.quiz-date {
    font-size: 0.9rem;
    color: #999;
}

/* Question Card */
.question-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.report-card {
    background: #fafafa;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.report-card h3 {
    margin-bottom: 0.75rem;
    color: #333;
}

.report-question {
    margin-bottom: 0.75rem;
    color: #555;
}

.report-status {
    font-weight: 600;
}

.report-debug {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 10px;
    color: #856404;
    font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
    white-space: pre-wrap;
}

.debug-badge {
    margin: 1rem 2rem;
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: #ffe8e8;
    color: #b02a37;
    font-weight: 700;
    border: 1px solid #f5c2c7;
}

.correct-answer {
    color: #1f7a1f;
}

.incorrect-answer {
    color: #c82333;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.question-number {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1rem;
}

.question-type {
    background: #e3f2fd;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #1976d2;
}

.question-points {
    background: #fff3e0;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #f57c00;
}

.question-card h3 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

/* Options Container */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.option-label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option-label input[type="radio"] {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option-label span {
    flex: 1;
    font-size: 1rem;
}

/* Results Table */
.results-table {
    width: 100%;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.results-table thead {
    background: #667eea;
    color: white;
}

.results-table th,
.results-table td {
    padding: 1rem;
    text-align: left;
}

.results-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.results-table tbody tr:hover {
    background: #e3f2fd;
}

.progress-table td {
    vertical-align: top;
}

.attempt-history {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attempt-pill {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    color: #3730a3;
    display: inline-block;
    font-size: 0.85rem;
    padding: 0.35rem 0.65rem;
}

.progress-up {
    color: #15803d;
    font-weight: 700;
}

.progress-down {
    color: #b91c1c;
    font-weight: 700;
}

/* Results Box */
.results-box {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.results-box h2 {
    color: #667eea;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.results-box #finalScore {
    color: #28a745;
    font-size: 2.5rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0.5rem 0;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Register Link */
.register-link {
    text-align: center;
    margin-top: 1.5rem;
}

.register-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

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

/* Admin Dashboard */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header h1 {
    color: white;
}

/* Create Quiz Form */
.quiz-builder {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.question-builder {
    border: 2px solid #e0e0e0;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    position: relative;
}

.question-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.question-id {
    color: #888;
    font-size: 0.9rem;
    font-weight: 500;
}

.remove-question {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .quiz-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .question-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 3rem;
    color: white;
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Success/Error Messages */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

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

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

h1, h2 {
    color: white;
    margin-bottom: 1rem;
}
