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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

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

.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 30px;
    text-align: center;
}

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

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

.info-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
}

.info-bar span {
    font-size: 1rem;
}

.info-bar strong {
    color: #fbbf24;
}

.progress-container {
    padding: 20px 30px;
    background: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), #34d399);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-container p {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 15px 30px;
    background: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
}

.tab {
    flex: 1;
    min-width: 120px;
    padding: 12px 15px;
    border: none;
    background: white;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.tab:hover {
    background: #e0e7ff;
    color: var(--primary-color);
}

.tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
}

#quiz-container {
    padding: 40px 30px;
    min-height: 400px;
}

.question-card {
    display: none;
    animation: fadeIn 0.3s ease;
}

.question-card.active {
    display: block;
}

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

.question-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.question-number {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.question-category {
    background: #e0e7ff;
    color: var(--primary-color);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.question-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 25px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.question-text strong {
    color: var(--primary-color);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 18px 20px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-label:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: translateX(5px);
}

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

.option-letter {
    background: var(--border-color);
    color: var(--text-secondary);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.option-label input[type="radio"]:checked + .option-text {
    color: var(--primary-color);
    font-weight: 600;
}

.option-label input[type="radio"]:checked ~ .option-letter {
    background: var(--primary-color);
    color: white;
}

.option-label:has(input:checked) {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.option-text {
    flex: 1;
    line-height: 1.6;
}

.essay-container {
    margin-top: 20px;
}

.essay-container textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

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

.essay-container textarea::placeholder {
    color: var(--text-secondary);
}

.word-count {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 8px;
}

.navigation {
    display: flex;
    justify-content: space-between;
    padding: 20px 30px;
    background: var(--bg-color);
    border-top: 2px solid var(--border-color);
    gap: 15px;
}

.nav-btn, .submit-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.nav-btn:hover:not(:disabled) {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.submit-btn {
    background: linear-gradient(135deg, var(--secondary-color), #059669);
    color: white;
    margin: 0 auto;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

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

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

.result-summary {
    margin-bottom: 30px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

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

.score-circle p {
    font-size: 1rem;
    opacity: 0.9;
}

.category-results {
    text-align: left;
    margin-bottom: 25px;
}

.category-results h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.category-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 8px;
}

.category-item span:first-child {
    font-weight: 500;
}

.category-item span:last-child {
    font-weight: bold;
    color: var(--primary-color);
}

.feedback {
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    margin-bottom: 25px;
    border-left: 4px solid var(--primary-color);
}

.feedback p {
    line-height: 1.6;
    color: var(--text-secondary);
}

.restart-btn, .close-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.restart-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(37, 99, 235, 0.4);
}

.close-btn {
    background: var(--border-color);
    color: var(--text-primary);
}

.close-btn:hover {
    background: var(--danger-color);
    color: white;
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.9rem;
}

footer a {
    color: #fbbf24;
    text-decoration: none;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .info-bar {
        flex-direction: column;
        gap: 10px;
    }

    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .tab {
        min-width: 100px;
        font-size: 0.85rem;
        padding: 10px;
    }

    #quiz-container {
        padding: 20px 15px;
    }

    .question-text {
        font-size: 1rem;
    }

    .navigation {
        flex-direction: column;
    }

    .nav-btn, .submit-btn {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        padding: 25px;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-circle span {
        font-size: 2.5rem;
    }
}

/* Answered indicator */
.question-card.answered .question-number {
    background: linear-gradient(135deg, var(--secondary-color), #059669);
}

.question-card.answered::after {
    content: '✓ Terjawab';
    display: block;
    text-align: right;
    color: var(--secondary-color);
    font-weight: 600;
    margin-top: 10px;
}
