@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #ec4899;
  --bg-gradient-1: #e0e7ff;
  --bg-gradient-2: #fbcfe8;
  --surface: rgba(255, 255, 255, 0.85);
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
}

body {
  background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  overflow-x: hidden;
  padding: 20px 0;
}

.container {
  width: 95%;
  max-width: 750px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: all 0.4s ease;
}

.container-admin {
    max-width: 1200px; /* Diperlebar lagi untuk memuat 40 baris map soal */
}

h1, h2, h3 { margin-bottom: 20px; text-align: center; color: var(--text-dark); }
.header { text-align: center; margin-bottom: 30px; }
.header h1 {
  font-size: 2.2rem;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text; color: transparent; margin-bottom: 5px;
}

.form-group { margin-bottom: 25px; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-dark); }
select, input {
  width: 100%; padding: 15px; border-radius: 12px; border: 2px solid #e2e8f0;
  font-size: 1rem; background: white; transition: all 0.3s ease; outline: none;
}
select:focus, input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2); }

.btn {
  width: 100%; padding: 15px; background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; border: none; border-radius: 12px; font-size: 1.1rem; font-weight: 600;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; text-transform: uppercase; letter-spacing: 1px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4); }
.btn:active { transform: translateY(0); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

/* Desktop Quiz Header */
.quiz-header {
  display: flex; flex-direction: row; align-items: center; justify-content: space-between;
  gap: 20px; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 2px solid rgba(0,0,0,0.05);
}
.student-info { flex: 1; min-width: 0; }
.student-name { margin-bottom: 5px; font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.q-counter { font-size: 0.95rem; color: var(--text-muted); display: block; }

.camera-box {
    width: 80px; height: 80px; border-radius: 50%; overflow: hidden;
    border: 4px solid var(--danger); background: #000; box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    animation: pulseCam 2s infinite; flex-shrink: 0;
}
.camera-box video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
@keyframes pulseCam { 0% { box-shadow: 0 0 5px rgba(239, 68, 68, 0.4); } 50% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.8); } 100% { box-shadow: 0 0 5px rgba(239, 68, 68, 0.4); } }

.timer {
  font-size: 1.5rem; font-weight: 700; color: var(--danger); background: rgba(239, 68, 68, 0.1);
  padding: 8px 16px; border-radius: 50px; animation: pulse 2s infinite; white-space: nowrap; flex-shrink: 0;
}
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* Mobile Quiz Layout */
@media (max-width: 650px) {
    .container { padding: 25px 20px; }
    .quiz-header { flex-direction: column; text-align: center; gap: 15px; }
    .camera-box { order: 1; width: 100px; height: 100px; }
    .student-info { order: 2; width: 100%; text-align: center; }
    .student-name { white-space: normal; text-align: center; font-size: 1.4rem; }
    .q-counter { margin-top: 5px; }
    .timer { order: 3; margin-top: 5px; }
}

.question-icon { font-size: 4rem; text-align: center; margin-bottom: 15px; display: block; animation: floatIcon 3s ease-in-out infinite; text-shadow: 0 10px 20px rgba(0,0,0,0.15); }
@keyframes floatIcon { 0% { transform: translateY(0px) scale(1); } 50% { transform: translateY(-10px) scale(1.1) rotate(5deg); } 100% { transform: translateY(0px) scale(1) rotate(0deg); } }
.question-text { font-size: 1.4rem; line-height: 1.6; margin-bottom: 10px; font-weight: 400; text-align: center; }
.question-translate { font-size: 1rem; color: var(--text-muted); text-align: center; margin-bottom: 30px; font-style: italic; padding: 10px; background: rgba(255, 255, 255, 0.5); border-radius: 8px; }

.options-container { display: flex; flex-direction: column; gap: 15px; }
.option-label { display: flex; align-items: center; padding: 15px 20px; background: white; border: 2px solid #e2e8f0; border-radius: 12px; cursor: pointer; transition: all 0.3s ease; font-size: 1.1rem; font-weight: 600; }
.option-label:hover { border-color: var(--primary); background: rgba(99, 102, 241, 0.05); transform: translateX(5px); }
.option-input { display: none; }
.option-input:checked + .option-label { background: var(--primary); color: white; border-color: var(--primary); transform: translateX(10px); box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); }

.nav-buttons { display: flex; gap: 15px; margin-top: 30px; }

.map-container { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; margin-top: 30px; border-top: 2px solid rgba(0,0,0,0.05); padding-top: 20px; }
@media (max-width: 600px) { .map-container { grid-template-columns: repeat(8, 1fr); } }
@media (max-width: 450px) { .map-container { grid-template-columns: repeat(5, 1fr); gap: 6px; } }
.map-btn { width: 100%; aspect-ratio: 1/1; border-radius: 8px; border: 2px solid #e2e8f0; background: white; font-weight: 600; font-size: 0.9rem; color: var(--text-muted); cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.map-btn:hover { border-color: var(--primary); }
.map-btn.answered { background: var(--success); color: white; border-color: var(--success); }
.map-btn.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3); transform: scale(1.1); z-index: 2; }

.fade-in { animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.slide-in-right { animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }

.result-circle { width: 150px; height: 150px; border-radius: 50%; background: conic-gradient(var(--success) var(--percentage), #e2e8f0 0deg); display: flex; align-items: center; justify-content: center; margin: 0 auto 30px; position: relative; }
.result-circle::before { content: ''; position: absolute; width: 120px; height: 120px; background: white; border-radius: 50%; }
.result-score { position: relative; font-size: 2.5rem; font-weight: 700; color: var(--text-dark); }

/* Admin Tbl */
.table-wrapper { overflow-x: auto; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; background: white; text-align: left; }
th, td { padding: 15px 20px; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
th { background: #f8fafc; font-weight: 600; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; color: var(--text-muted); }
tr:last-child td { border-bottom: none; }
tr.main-row:hover td { background: #fcfcfd; }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; margin-top: 5px; }
.badge.progress { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge.finished { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }

.action-btn { padding: 6px 12px; border-radius: 6px; border: none; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; margin-top: 10px; }
.btn-reset { background: rgba(239, 68, 68, 0.1); color: var(--danger); width: 100%; text-align: center; }
.btn-reset:hover { background: var(--danger); color: white; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3); }

/* Admin Badge Grid untuk Jawaban Realtime (Tampil Langsung) */
.admin-badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.q-badge {
    min-width: 28px;
    height: 28px;
    border-radius: 6px; /* Desain kotak melengkung bergaya badge elegan */
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #f1f5f9; 
    color: var(--text-muted);
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.q-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 10;
}
.q-badge.correct { background: linear-gradient(135deg, var(--success), #059669); color: white; border: none; }
.q-badge.wrong { background: linear-gradient(135deg, var(--danger), #b91c1c); color: white; border: none; }
