/* --- CƠ BẢN --- */
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f6f9; display: flex; justify-content: center; padding: 20px; min-height: 100vh; }
.hidden { display: none !important; }
#login-container, #quiz-container, #result-container { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); width: 100%; max-width: 800px; }

/* --- INPUT & BUTTON --- */
input, select, button { width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px; box-sizing: border-box; }
button { background-color: #007bff; color: white; border: none; font-weight: bold; cursor: pointer; transition: 0.3s; }
button:hover { background-color: #0056b3; }
button:disabled { background-color: #ccc; cursor: not-allowed; }

/* --- CÂU HỎI --- */
.question-block { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #eee; }
.question-text { font-weight: 600; font-size: 1.1em; color: #333; margin-bottom: 15px; }
.question-media { text-align: center; margin-bottom: 15px; }
.q-img { max-width: 100%; max-height: 200px; border-radius: 8px; }

/* --- DẠNG TRẮC NGHIỆM (TEXT) --- */
.options label { display: block; padding: 10px; background: #f9f9f9; margin-bottom: 5px; border-radius: 5px; cursor: pointer; }
.options label:hover { background: #eef; }
.options input { width: auto; margin-right: 10px; }

/* --- DẠNG TRẮC NGHIỆM (ẢNH) --- */
.options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
@media(min-width:600px) { .options-grid { grid-template-columns: repeat(4, 1fr); } }
.option-image-box { border: 2px solid #eee; padding: 5px; border-radius: 8px; cursor: pointer; transition: 0.2s; text-align: center; }
.option-image-box img { width: 100%; height: 100px; object-fit: contain; }
.option-image-box:has(input:checked) { border-color: #007bff; background: #e7f3ff; }
/* Fallback cho trình duyệt cũ */
.option-image-box input:checked + img { border: 3px solid #007bff; }

/* --- DẠNG ĐIỀN TỪ --- */
.fill-input { border: 2px solid #007bff; background: #fffdf0; font-weight: bold; }

/* --- DẠNG SẮP XẾP ẢNH --- */
.arrange-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.arrange-item { position: relative; border: 1px solid #ddd; padding: 10px; border-radius: 8px; text-align: center; }
.arrange-label { position: absolute; top: 5px; left: 5px; background: #007bff; color: white; width: 25px; height: 25px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.arrange-item img { width: 100%; height: 80px; object-fit: cover; }
.arrange-input { width: 60px; text-align: center; font-weight: bold; margin-top: 5px; }

/* --- DẠNG SẮP XẾP TỪ --- */
.answer-zone { min-height: 50px; border-bottom: 2px dashed #aaa; padding: 10px; margin-bottom: 15px; display: flex; flex-wrap: wrap; gap: 10px; background: #fff; }
.word-bank { display: flex; flex-wrap: wrap; gap: 10px; }
.word-btn { width: auto; background: white; border: 1px solid #ccc; border-radius: 20px; padding: 5px 15px; box-shadow: 0 2px 0 #ddd; color: #333; }
.word-btn.selected { background: #e7f3ff; border-color: #007bff; color: #007bff; }

/* --- THÔNG BÁO --- */
.message { text-align: center; margin-top: 10px; font-weight: bold; }
.message.error { color: red; }
.message.success { color: green; }



/* Thêm vào style.css */

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 15px;
    border-bottom: 2px solid #007bff;
    
    /* Làm đồng hồ dính chặt lên trên cùng khi cuộn */
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#timer {
    font-size: 1.2em;
    font-weight: bold;
    color: #d9534f; /* Màu đỏ cho khẩn cấp */
    background: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    border: 2px solid #d9534f;
}

/* Thêm style cho tiêu đề từng vòng phân cách */
.round-divider {
    background-color: #8ec1f3;
    color: #495057;
    padding: 10px;
    margin: 20px 0 10px 0;
    font-weight: bold;
    text-transform: uppercase;
    border-left: 5px solid #ec8927;
    border-radius: 4px;
}

/* --- STYLE CHO LOGO TRUNG TÂM --- */
.logo-header {
    display: flex;
    justify-content: center; /* Căn giữa 2 logo */
    align-items: center;
    gap: 20px; /* Khoảng cách giữa 2 logo */
    margin-bottom: 20px; /* Khoảng cách từ logo xuống tiêu đề */
}

.academy-logo {
    max-height: 200px; /* Chiều cao tối đa, tránh logo quá to */
    max-width: 45%;   /* Đảm bảo 2 logo không bị tràn ra ngoài trên điện thoại */
    object-fit: contain; /* Giữ nguyên tỷ lệ ảnh không bị méo */
    display: block;
}



/* --- NÚT NGHE AUDIO MỚI --- */
.audio-btn {
    background-color: #28a745; /* Màu xanh lá */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto; /* Không chiếm hết dòng */
}

.audio-btn:hover {
    background-color: #218838;
}

.audio-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.playing {
    background-color: #dc3545 !important; /* Màu đỏ khi đang phát */
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* --- THANH ĐIỀU HƯỚNG --- */
.control-bar {
    display: flex;
    justify-content: space-between; /* Đẩy 2 nút ra 2 góc */
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.primary-btn {
    background-color: #007bff;
    color: white;
    padding: 12px 30px;
    font-size: 1.1em;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}
.primary-btn:hover { background-color: #0056b3; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

.secondary-btn {
    background-color: #6c757d; /* Màu xám */
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}
.secondary-btn:hover { background-color: #5a6268; }