:root {
    --bg: #f0f2f5;
    --card: #ffffff;
    --primary: #3b5998;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --text: #333;
    --text-light: #666;
    --border: #ddd;
    --radius: 12px;
    --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

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

body {
    font-family: Tahoma, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.container {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    width: 100%;
    max-width: 540px;
    text-align: center;
}

h1 { color: var(--primary); margin-bottom: 4px; font-size: 22px; font-weight: 800; }
h2 { color: var(--primary); margin-bottom: 12px; font-size: 19px; font-weight: 700; }

.subtitle { color: var(--text-light); margin-bottom: 20px; font-size: 13px; }

.btn {
    display: inline-block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.25s;
    color: white;
    font-family: inherit;
    text-decoration: none;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: var(--primary); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); color: #333; }
.btn-danger { background: var(--danger); }
.btn-info { background: var(--info); }
.btn-gray { background: #6c757d; }
.btn-sm { width: auto; padding: 6px 14px; font-size: 12px; margin: 3px; }
.btn-xs { width: auto; padding: 4px 8px; font-size: 10px; border-radius: 4px; }

.input-group { margin-bottom: 12px; text-align: right; }
.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 4px;
    font-weight: 600;
}
.input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fafafa;
    transition: border 0.2s;
}
.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,89,152,0.1);
}

.error-msg { color: var(--danger); font-size: 12px; display: none; margin-top: 4px; }

.card {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 14px;
    margin: 8px 0;
    text-align: right;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.card-title { font-weight: 700; font-size: 14px; }

.badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }

.flex-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; }
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-bold { font-weight: 700; }

.divider { border: none; border-top: 1px solid #eee; margin: 16px 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #e9ecef; padding: 10px 8px; text-align: center; font-size: 12px; }
td { padding: 8px; text-align: center; border-bottom: 1px solid #eee; }
tr:hover td { background: #f8f9fa; }

.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
    background: white; padding: 24px; border-radius: 12px;
    max-width: 500px; width: 100%; max-height: 80vh; overflow-y: auto;
    text-align: right;
}

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #333; color: white; padding: 10px 24px; border-radius: 20px;
    font-size: 13px; z-index: 9999;
    animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.timer-bar {
    background: #f0f4ff; padding: 12px; border-radius: 8px; margin-bottom: 16px;
}
.timer-warning { color: red !important; font-weight: 800; }

.exam-img { max-width: 100%; border-radius: 8px; margin: 8px 0; }

.option-label {
    cursor: pointer; padding: 8px 16px; border: 2px solid var(--border);
    border-radius: 8px; transition: all 0.2s; min-width: 50px; text-align: center;
    display: inline-block;
}
.option-label:hover { border-color: var(--primary); }
.option-label.selected {
    border-color: var(--primary); background: #e8eeff;
}
.option-label input { display: none; }

.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 12px; }
.pagination button { min-width: 36px; }

@media (max-width: 480px) {
    .container { padding: 20px 16px; margin: 8px; }
    .btn { font-size: 14px; padding: 10px; }
    h1 { font-size: 19px; }
}
