/* =================================================================
   MCQBD QUIZ ENGINE SPECIFIC STYLES (UNIVERSAL FINAL)
   (With Native Print & CSS Front Watermark)
================================================================= */

/* -----------------------------------------
   1. Font Enforcement & Global Fixes
----------------------------------------- */
body.active-quiz-mode, 
body.active-quiz-mode button, 
body.active-quiz-mode input, 
.math-content {
  font-family: 'Hind Siliguri', 'Baloo Da 2', sans-serif !important;
}

#navbar {
  position: relative !important;
  z-index: 10;
}

body.active-quiz-mode {
  background: var(--bg-alt);
  height: 100vh;
  overflow: hidden; 
  display: flex;
  flex-direction: column;
  padding-top: 0 !important; 
}

/* -----------------------------------------
   2. Main Layout & Quiz Card
----------------------------------------- */
.quiz-main-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
}

.single-quiz-card {
  background: var(--surface-solid);
  max-width: 750px; 
  width: 100%;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 95vh; 
}

.card-header {
  background: var(--surface-bg);
  padding: 12px 20px;
  border-bottom: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.card-body {
  padding: 20px 25px;
  overflow-y: auto; 
  flex: 1;
}

.card-footer {
  padding: 15px 25px;
  background: var(--surface-bg);
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

#ui-question-text {
  font-size: 1.3rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* -----------------------------------------
   3. Option Buttons & Interactions
----------------------------------------- */
.option-btn {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 14px 20px;
  background: transparent; 
  border: 2px solid var(--border, #e2e8f0);
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text, #1e293b);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-align: left;
  font-family: inherit;
  outline: none;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary-light, #1A6B54);
  background: rgba(26, 107, 84, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(11, 61, 46, 0.05);
}

.option-prefix {
  font-weight: 700;
  color: var(--primary);
  background: rgba(11, 61, 46, 0.1);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Correct & Wrong States */
.option-btn.correct {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: #10b981 !important;
  color: #047857 !important;
  animation: pop 0.4s ease;
  transform: none;
  box-shadow: none;
}
.option-btn.correct .option-prefix {
  background: #10b981;
  color: white;
}

.option-btn.wrong {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  animation: shake 0.4s ease;
  transform: none;
  box-shadow: none;
}
.option-btn.wrong .option-prefix {
  background: #ef4444;
  color: white;
}

.option-btn:disabled {
  cursor: not-allowed;
  opacity: 0.9;
}

/* -----------------------------------------
   4. Animations
----------------------------------------- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* -----------------------------------------
   5. Utility & Scrollbars
----------------------------------------- */
.math-content {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 5px; 
  scrollbar-width: thin;
}

.card-body::-webkit-scrollbar, 
#review-content::-webkit-scrollbar,
#result-interface::-webkit-scrollbar {
  width: 6px;
}
.card-body::-webkit-scrollbar-thumb, 
#review-content::-webkit-scrollbar-thumb,
#result-interface::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

/* -----------------------------------------
   6. Custom Buttons Design
----------------------------------------- */
#btn-submit-early {
  background: var(--surface-bg) !important;
  border: 2px solid #cbd5e1 !important;
  color: #475569 !important;
  font-weight: 700 !important;
  padding: 10px 20px !important;
  border-radius: 8px !important;
  transition: all 0.3s ease;
  box-shadow: none !important;
  cursor: pointer;
}
#btn-submit-early:hover {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.05) !important;
}

.btn-loading {
  opacity: 0.7 !important;
  cursor: wait !important;
  pointer-events: none !important;
}

/* -----------------------------------------
   7. Review Answers Interface
----------------------------------------- */
.review-card {
  background: transparent !important; /* পিডিএফের ফিক্সড সাদা কালার সরাতে !important যুক্ত করা হলো */
  border: 1px solid var(--border) !important;
  border-radius: 16px;
  padding: 20px;
  text-align: left;
  margin-bottom: 15px;
}

.review-q-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 15px;
  line-height: 1.5;
}

.review-opt {
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border) !important;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  color: var(--text-muted);
  background: transparent !important; /* পিডিএফের ফিক্সড সাদা কালার সরাতে !important যুক্ত করা হলো */
}

.review-opt.correct {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: #10b981 !important;
  color: #047857 !important;
  font-weight: 600;
}

.review-opt.wrong {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}

.review-user-badge {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.review-explanation {
  margin-top: 15px;
  padding: 15px;
  background: rgba(16, 185, 129, 0.05);
  border-left: 3px solid #10b981;
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text-muted);
}
/* -----------------------------------------
   8. PDF Export Base Styles
----------------------------------------- */
#pdf-export-container { 
  display: none; 
}

#pdf-inner-content {
  padding: 30px; 
  font-family: 'Hind Siliguri', 'Baloo Da 2', sans-serif; 
  color: #333;
  background: transparent;
}

.pdf-q-box {
  page-break-inside: avoid;
  margin-bottom: 25px;
  padding: 15px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fafafa;
}

.pdf-opt {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

.pdf-opt.correct {
  background: #e6f6f0;
  border-color: #10b981;
  color: #047857;
  font-weight: bold;
}

.pdf-opt.wrong {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
  text-decoration: line-through; 
}

/* -----------------------------------------
   9. Custom Confirm Modal
----------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(11, 61, 46, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.custom-modal-card {
  background: var(--surface-solid, #ffffff);
  border-radius: 20px;
  padding: 30px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalPop 0.3s ease-out;
}
.custom-modal-card .modal-icon { font-size: 3.5rem; margin-bottom: 15px; }
.custom-modal-card h3 { font-size: 1.6rem; color: var(--text); margin-bottom: 10px; }
.custom-modal-card p { color: var(--text-muted); margin-bottom: 25px; font-size: 1.1rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 15px; justify-content: center; }
.modal-actions button { flex: 1; padding: 12px; font-size: 1.1rem; }

@keyframes modalPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* -----------------------------------------
   10. Dark Mode & MathJax Fixes
----------------------------------------- */
.math-content, mjx-container {
  color: inherit !important;
}

#ui-question-text {
  color: var(--text);
}

/* -----------------------------------------
   11. Mobile Specific Fixes
----------------------------------------- */
@media (max-width: 768px) {
  .navbar__inner { min-height: 60px; }
  #navbar { padding: 0; }
  
  .card-header { padding: 10px 15px; }
  .card-body { padding: 12px 15px; }
  #ui-options-grid { gap: 8px !important; }
  
  .card-footer { 
    padding: 12px 15px; 
    flex-direction: column-reverse; 
    gap: 12px;
  }
  
  #btn-submit-early, #btn-next-question {
    width: 100% !important;
    padding: 12px !important;
    text-align: center;
  }

  #ui-question-text { font-size: 1.1rem; margin-bottom: 12px; }
  .single-quiz-card { border-radius: 16px; max-height: 98vh; }
}

/* -----------------------------------------
   12. NATIVE PRINT MODE WITH FRONT WATERMARK
----------------------------------------- */
body.printing-mode {
  height: auto !important;
  overflow: visible !important;
  background: #ffffff !important;
}

body.printing-mode #navbar,
body.printing-mode .quiz-main-container,
body.printing-mode #custom-confirm-modal {
  display: none !important;
}

body.printing-mode #pdf-export-container {
  display: block !important;
  position: static !important;
  width: 100% !important;
  background-color: #ffffff !important;
}

/* 
  FRONT WATERMARK OVERLAY (Custom 3D Logo)
*/
body.printing-mode #pdf-watermark-front {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh; /* প্রতিটি প্রিন্ট পেজের সমান উচ্চতা */
  z-index: 9999; 
  pointer-events: none; 
  
  /* আপনার অরিজিনাল 3D লোগোর লিংক */
  background-image: url("../images/mcqbd-logo.png") !important;
  
  /* পুরো পেজ জুড়ে যেন না ছড়ায়, তাই no-repeat করা হলো */
  background-repeat: no-repeat !important; 
  
  /* পেজের একদম ঠিক মাঝখানে (Center) বসানো হলো */
  background-position: center center !important; 
  
  /* লোগোর সাইজ ৪০০ পিক্সেল রাখা হলো (প্রয়োজনে কমাতে/বাড়াতে পারেন) */
  background-size: 400px auto !important; 
  
  /* লোগোটি আগের চেয়ে বেশি উজ্জ্বল (Bright) করা হলো */
  opacity: 0.15 !important; 
}

/* ডার্ক মোডে পিডিএফের সাদা টেক্সট ফিক্স */
body.printing-mode #pdf-export-container .review-q-title,
body.printing-mode #pdf-export-container .math-content,
body.printing-mode #pdf-export-container .review-opt,
body.printing-mode #pdf-export-container .review-explanation {
  color: #1e293b !important; /* জোর করে ডার্ক টেক্সট দেওয়া হলো */
}

@media print {
  @page { margin: 0.5in; }
  
  body {
    background: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  /* প্রিন্টের সময় সব টেক্সট কালো/ডার্ক করতে হবে */
  #pdf-export-container .review-q-title,
  #pdf-export-container .math-content,
  #pdf-export-container .review-opt,
  #pdf-export-container .review-explanation {
    color: #1e293b !important;
  }
  
  /* তবে সঠিক ও ভুল উত্তরের কালার যেন নষ্ট না হয় */
  #pdf-export-container .review-opt.correct { color: #047857 !important; }
  #pdf-export-container .review-opt.wrong { color: #b91c1c !important; }
  
  .pdf-q-box, .review-card {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 20px;
  }

  .pdf-opt {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  
  #navbar, .quiz-main-container, #custom-confirm-modal {
    display: none !important;
  }
  
  #pdf-export-container {
    display: block !important;
  }
  
  #pdf-watermark-front {
    display: block !important;
  }
}