:root {
    --primary: #007bff;
    --primary-hover: #0056b3;
    --bg-color: #f0f2f5;
    --text-color: #333;
    --white: #fff;
    --border: #ddd;
    --success: #28a745;
    --danger: #dc3545;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
}

body {
    background: var(--bg-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* UTILS */
.hidden {
    display: none !important;
}

.container-center {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
}

/* HOME SCREEN */
.card {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.main-title {
    color: var(--primary);
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}

.exam-info {
    min-height: 50px;
    margin-bottom: 20px;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* QUIZ SCREEN */
header {
    background: var(--white);
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-back {
    border: 1px solid var(--border);
    background: transparent;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-back:hover {
    background: #eee;
}

.exam-title {
    font-weight: bold;
    font-size: 1.1rem;
}

.timer {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 5px;
}

.quiz-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 60px);
}

/* Main Content (Questions) */
.main-content {
    flex: 3;
    padding: 20px;
    overflow-y: auto;
    background: var(--white);
}

.question-box {
    margin-bottom: 30px;
}

.q-text {
    font-size: 1.15rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.options {
    list-style: none;
}

.option-item {
    border: 1px solid var(--border);
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
}

.option-item span {
    margin-right: 10px;
    font-weight: bold;
}

.option-item:hover {
    background: #f8f9fa;
}

.option-item.selected {
    background: #e7f1ff;
    border-color: var(--primary);
}

.option-item.correct {
    background: #d4edda;
    border-color: var(--success);
    color: #155724;
}

.option-item.wrong {
    background: #f8d7da;
    border-color: var(--danger);
    color: #721c24;
}

/* Sidebar (Palette) */
.sidebar {
    flex: 1;
    min-width: 250px;
    background: #f9f9f9;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    flex: 1;
    align-content: start;
    overflow-y: auto;
}

.q-btn {
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.q-btn.active {
    border: 2px solid var(--primary);
}

.q-btn.done {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.q-btn.res-correct {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.q-btn.res-wrong {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.sidebar-footer {
    margin-top: 15px;
    pt: 15px;
    border-top: 1px solid var(--border);
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}

/* Nav Buttons */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.btn-nav {
    padding: 10px 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-nav:hover {
    background: #eee;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    animation: slideIn 0.3s;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 6px solid var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    margin: 0 auto 20px;
}

.modal-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: #eee;
    border-radius: 6px;
    cursor: pointer;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .container-center {
        padding: 10px;
    }

    .card {
        padding: 20px;
    }

    .quiz-container {
        flex-direction: column;
    }

    .sidebar {
        order: 2;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border);
        flex: none;
        padding: 10px;
    }

    .palette-grid {
        display: flex;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .q-btn {
        flex: 0 0 40px;
    }

    .main-content {
        order: 1;
        flex: 1;
    }

    .header-left .exam-title {
        display: none;
    }

    /* Ẩn tên đề trên mobile cho đỡ chật */
}