/* ==========================================================================
   Driving Quiz Pro - Stylesheet
   Chứa các định nghĩa giao diện cho bài thi Frontend (UI).
   Hỗ trợ thiết kế dạng Grid linh hoạt và Responsive cho thiết bị di động.
   ========================================================================== */

:root {
  /* Biến màu sắc toàn cục (Color Palette) */
  --dq-primary: #0ea5e9;
  --dq-primary-hover: #0284c7;
  --dq-bg: #f8fafc;
  --dq-card-bg: #ffffff;
  --dq-text-main: #0f172a;
  --dq-text-muted: #64748b;

  --dq-correct: #22c55e;
  --dq-wrong: #ef4444;
  --dq-border: #e2e8f0;

  /* Typograpy */
  --dq-font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.dq-btn-blue {
  background: #0ea5e9;
  color: #fff;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
}

.dq-btn-blue:hover {
  background: #0284c7;
}

/* ===== Layout tổng (App Container) ===== */
.dq-exam-container {
  max-width: 1000px;
  margin: 0 auto;
  font-family: var(--dq-font);
}

/* Modal Overlay */
.dq-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.dq-modal-box {
  background: #fff;
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.dq-modal-header {
  background: #f8fafc;
  padding: 15px 20px;
  border-bottom: 1px solid var(--dq-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dq-modal-header h3 {
  margin: 0;
  color: #0284c7;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}

.dq-close-btn {
  font-size: 24px;
  cursor: pointer;
  color: #64748b;
}

.dq-modal-body {
  padding: 20px;
}

.dq-form-group {
  margin-bottom: 15px;
}

.dq-form-group label {
  display: block;
  margin-bottom: 6px;
  color: #333;
  font-size: 15px;
}

.dq-select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 15px;
}

.dq-modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--dq-border);
  text-align: right;
}

/* Loader */
.dq-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-size: 18px;
  font-weight: bold;
  color: var(--dq-primary);
}

.dq-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--dq-border);
  border-top: 4px solid var(--dq-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}


/* Exam UI */
.dq-exam-ui {
  background: #f1f5f9;
  border: 1px solid var(--dq-border);
  border-radius: 6px;
}

.dq-topbar {
  background: #0ea5e9;
  color: #fff;
  padding: 12px 20px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  border-radius: 6px 6px 0 0;
}

.dq-exam-body {
  display: flex;
  gap: 20px;
  padding: 20px;
}

/* Left Grid */
.dq-exam-left {
  width: 250px;
  background: #fff;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid var(--dq-border);
}

.dq-left-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Tùy chỉnh thanh cuộn cho danh sách câu hỏi */
.dq-left-grid::-webkit-scrollbar {
  width: 6px;
}
.dq-left-grid::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.dq-left-grid::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.dq-left-grid::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dq-grid-item {
  width: 35px;
  height: 35px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid var(--dq-primary);
  color: var(--dq-primary);
  background: #fff;
  user-select: none;
}

.dq-grid-item:hover {
  background: #e0f2fe;
}

.dq-grid-item.active {
  background: var(--dq-primary) !important;
  color: #fff !important;
}

.dq-grid-item.answered {
  background: #e2e8f0;
  color: #333;
  border-color: #cbd5e1;
}

.dq-grid-item.correct {
  background: #22c55e !important;
  color: #fff !important;
  border-color: #16a34a !important;
}

.dq-grid-item.wrong {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
}

.dq-btn-block {
  display: block;
  width: 100%;
  margin-top: 15px;
  padding: 12px;
}

/* Right Panel */
.dq-exam-right {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--dq-border);
  padding: 20px;
}

.dq-question-nav {
  display: flex;
  justify-content: space-between;
}

.dq-btn-nav {
  background: #0ea5e9;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

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

.dq-card-exam {
  padding: 20px 0;
}

.dq-question-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 20px;
  line-height: 1.5;
  color: #0f172a;
}

.dq-image-wrap {
  margin: 10px 0;
  text-align: center;
}

.dq-image-wrap img {
  max-width: 100%;
  height: auto;
  max-height: 250px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.dq-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dq-answer {
  padding: 12px 15px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
}

.dq-answer:hover {
  background: #f1f5f9;
}

.dq-answer.picked {
  background: #dbeafe;
  border-color: #93c5fd;
}

.dq-answer.correct {
  background: #22c55e;
  border-color: #16a34a;
  color: #fff;
}

.dq-answer.wrong {
  background: #ef4444;
  border-color: #dc2626;
  color: #fff;
}

.dq-explain {
  margin-top: 20px;
  padding: 15px;
  background: #e0f2fe;
  border-left: 4px solid var(--dq-primary);
}

.dq-explain-title {
  font-weight: bold;
  margin-bottom: 5px;
  color: var(--dq-primary);
}

/* Result Screen */
.dq-result-screen {
  background: #fff;
  border: 1px solid var(--dq-border);
  border-radius: 6px;
  overflow: hidden;
}

.dq-result-header {
  background: #ef4444;
  color: #fff;
  text-align: center;
  padding: 15px;
}

.dq-result-header h2 {
  margin: 0;
  font-weight: bold;
  font-size: 20px;
  color: #fff;
}

.dq-result-table {
  width: 100%;
  border-collapse: collapse;
}

.dq-result-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--dq-border);
  font-size: 16px;
}

.dq-result-table td:first-child {
  font-weight: bold;
  width: 150px;
  background: #f8fafc;
}

.dq-result-actions {
  padding: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dq-btn-action {
  background: #0ea5e9;
  color: #fff;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.dq-btn-action:hover {
  background: #0284c7;
}

/* Mobile Nav */
.dq-nav-mobile {
  display: none;
}

/* Responsive */
@media (max-width: 980px) {
  .dq-exam-body {
    flex-direction: column;
  }

  .dq-exam-left {
    width: 100%;
  }

  .dq-left-grid {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 15px;
  }

  .dq-grid-item {
    flex: 0 0 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
  }

  .dq-question-title {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    padding: 10px 0;
    border-bottom: 1px solid var(--dq-border);
  }

  .dq-nav-mobile {
    display: flex;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(120, 120, 120, 0.9);
    color: #fff;
    border: none;
    font-size: 20px;
    font-weight: bold;
    z-index: 1000;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  }

  .dq-nav-left {
    left: 8px;
  }

  .dq-nav-right {
    right: 8px;
  }

  .top-nav,
  .bottom-nav {
    display: none !important;
  }
}