/* ✅ Single scrollbar - html scrolls, body expands */
html {
  overflow-y: auto; /* Allow scrolling on html - single scrollbar */
  overflow-x: hidden; /* Prevent horizontal scroll */
  height: 100%; /* Full viewport height */
}

body {
  background-color: #f5f5f5;
  user-select: none; /* Disable text selection */
  -webkit-user-select: none; /* Safari */
  font-family: Arial, sans-serif;
  text-align: center;
  overflow: visible !important; /* Body doesn't scroll - html does */
  min-height: 100% !important; /* Minimum viewport height, but can grow */
  height: auto !important; /* Allow body to expand with content - override any inline styles */
  max-height: none !important; /* Remove any max-height constraints */
  margin: 0; /* Remove default margin */
  padding: 0; /* Remove default padding */
}

canvas {
  transform: translateZ(0);
  will-change: transform;
}

.scroll-indicator {
  position: fixed;
  right: 20px; /* Floating out of the right side of the canvas */
  top: 200px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px; /* Spacing between icons */
  color: #888; /* Light grey */
  font-size: 18px;
  pointer-events: none; /* Prevent interaction */
}

.scroll-indicator .scroll-text {
  font-size: 10px; /* Tiny text */
}

/* ✅ Fix Toolbar Floating on Left */
.toolbar {
  position: fixed;
  left: 10px; /* Stick to the far left */
  top: 50%; /* Move to the middle */
  transform: translateY(-50%); /* Center it vertically */
  display: flex;
  flex-direction: column; /* Stack buttons vertically */
  align-items: center;
  gap: 8px;
  background-color: #f8f9fa;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  width: auto; /* Allow width to expand for Clear Question button */
  min-width: 55px; /* Keep minimum width for other buttons */
}

.toolbar-btn {
  -webkit-touch-callout: none; /* Disable touch menu */
  -webkit-user-select: none; /* Prevent text selection */
  user-select: none; /* Standard way to prevent selection */
  -webkit-tap-highlight-color: transparent; /* Remove grey highlight */
  touch-action: manipulation; /* Prevent unintended gestures */
  font-size: 16px;
  background-color: white;
  border: 1px solid #ccc;
  padding: 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  width: 45px;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Keep hover highlight ONLY for mouse/trackpad (not touch/pen) */
@media (hover: hover) and (pointer: fine) {
.toolbar-btn:hover:not(.selected) {
  background-color: #e9ecef;
}
}

/* Prevent sticky focus/active styles on iPad/Pencil */
.toolbar-btn:focus,
.toolbar-btn:active {
outline: none;
background-color: white;
color: inherit;
}

/* Selected state wins over everything */
.toolbar-btn.selected {
background-color: black !important;
color: white !important;
}
.toolbar-btn.selected:hover,
.toolbar-btn.selected:active,
.toolbar-btn.selected:focus {
background-color: black !important;
color: white !important;
}


.row.mb-3.d-flex.align-items-center {
  margin-top: 10px; /* Move the dropdowns down */
}

#questionButtons {
  display: grid;
  grid-template-columns: repeat(40, auto); /* Up to 40 columns, then wrap */
  grid-gap: 3px; /* Space between buttons */
  justify-content: start; /* Align left (optional) */
}

.question-buttons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  /* Force each button to be a fixed width so that at most 40 fit in one line */
}

.question-btn {
  position: relative;
  width: calc(100% / 40 - 4px);  /* 4px is the gap—tweak as needed */
  /* The rest as above */
}

/* ✅ Ensure buttons stay relative */
.question-btn {
  position: relative; /* Required for absolute positioning of dots */
  width: 28px;
  height: 28px;
  font-size: 10px;
  text-align: center;
  padding: 0;
  line-height: 28px;
  border: 0px solid grey;
  transition: all 0.2s ease-in-out;
}

/* ✅ Small dot exactly above each button */
.evaluation-dot {
  position: absolute;
  top: -5px;  /* ✅ Align dot above button */
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: transparent; /* Default: No evaluation */
  z-index: 10;
  pointer-events: none;
}

/* ✅ Highlight the Active Question */
.question-btn.active {
  border: 3px solid blue !important;
  color: black !important;
}

/* ✅ Navigation buttons (Left-Right) */
.nav-button {
  width: 45px;
  height: 45px;
  font-size: 24px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-button:hover {
  background: lightgray;
}

/* ✅ Close button (Brown, White X) */
.close-button {
  width: 45px;
  height: 45px;
  font-size: 24px;
  background: brown;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-button:hover {
  background: darkred;
}

#versionPopup {
  position: absolute !important;
  overflow: hidden !important;
}

#versionPopup {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translate(-50%, 0);
  width: 800px;
  height: 600px;
  background: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.3);
  overflow-y: scroll; /* ✅ Force scrollbar */
  overflow-x: hidden;
  z-index: 3000;
  cursor: grab;
  -webkit-overflow-scrolling: touch; /* ✅ Enable smooth scrolling */
  display: flex;
  flex-direction: column;
}

/* ✅ Ensure scrolling works even on iOS */
#versionPopup::-webkit-scrollbar {
  width: 8px; /* ✅ Set scrollbar width */
}

#versionPopup::-webkit-scrollbar-thumb {
  background-color: darkgrey; /* ✅ Make scrollbar visible */
  border-radius: 4px;
}

#versionPopup::-webkit-scrollbar-track {
  background: lightgrey; /* ✅ Ensure the scrollbar track is visible */
}



/* Canvas container: allow vertical scrolling, no scrollbar */
#canvasContainer {
  touch-action: pan-y; /* Allow vertical scrolling */
  -webkit-user-select: none;
  user-select: none;
  overflow: visible !important; /* No scrollbar - use body scroll */
}

/* Actual canvas elements: prevent touch actions when drawing */
#fabricCanvas,
.canvas-container,
.canvas-container canvas.lower-canvas,
.canvas-container canvas.upper-canvas {
  touch-action: none; /* Prevent touch actions on canvas itself */
  -webkit-user-select: none;
  user-select: none;
}

.canvas-container,
.canvas-container canvas.lower-canvas,
.canvas-container canvas.upper-canvas {
  width: 930px !important;
  max-width: 930px !important;
  box-sizing: content-box; /* prevent internal padding issues */
}

/* ✅ Spinner Animation */
.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #ccc;
  border-top: 5px solid #007bff; /* Bootstrap blue */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Make evaluation buttons stand out */
#evaluationToolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 15px;
}

.eval-btn {
  background: white;
  border: 1px solid #ccc;
  padding: 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  width: 45px;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.eval-btn.selected {
  border: 2px solid dimgrey !important; /* Highlight selected evaluation */
}

/* ✅ Ensure each row takes full width */
.chapter-item {
  display: flex;
  justify-content: space-between; /* ✅ Name on left, Difficulty on right */
  align-items: center;
  width: 100%;
  padding: 15px;
  margin: 5px 0;
  cursor: pointer;
  background: white;
  border-radius: 5px;
  border: 1px solid #ddd;
}

/* ✅ Name column aligned left, with total questions count */
.chapter-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  flex-grow: 1;
  text-align: left;
  padding-left: 15px;
}

/* ✅ Total questions number inside Name column */
.total-questions {
  font-size: 14px;
  font-weight: normal;
  color: #777;
  margin-left: 10px;
}

/* ✅ Difficulty column aligned right */
.difficulty-box {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  min-width: 180px;
  text-align: right;
  padding-right: 15px;
}

/* ✅ Keep badge alignment consistent */
.difficulty-box span {
  display: inline-block;
  text-align: center;
  min-width: 35px;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: bold;
}

/* ✅ Color-coded badges */
.badge-soft-red { background-color: rgba(255, 99, 132, 0.2); color: #d9534f; }
.badge-soft-yellow { background-color: rgba(255, 206, 86, 0.2); color: #e6a700; }
.badge-soft-green { background-color: rgba(75, 192, 75, 0.2); color: #28a745; }

/* ✅ Hover effect */
.chapter-item:hover {
  background: #f1f1f1;
}

/* ✅ Ensure chapter container spans full width */
#chapterListContainer {
  width: 100%; /* ✅ Full width */
  max-width: 100%; /* ✅ Prevents unexpected shrinkage */
}

.difficulty-badge {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  color: white;
  margin-left: 5px;
}

.difficult { background: red; }
.needs-practice { background: #FFC300; color: black; }
.good { background: forestgreen; }

/* ✅ Match Dropdown Width & Align Left */
#chapterListContainer {
  max-width: 100%; /* Adjust to match dropdown width */
  margin-top: 10px;
}

/* ✅ Chapter List Style */
.chapter-list {
  width: 100%;
  border-collapse: collapse;
}

/* ✅ Chapter Row */
.chapter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 5px;
  background-color: #f8f9fa; /* Light grey for clean UI */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ✅ Soft Color Badges */
.badge-soft-red {
  background-color: rgba(255, 99, 132, 0.2); /* Softer Red */
  color: #d9534f;
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 600;
}

.badge-soft-yellow {
  background-color: rgba(255, 206, 86, 0.2); /* Softer Yellow */
  color: #e6a700;
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 600;
}

.badge-soft-green {
  background-color: rgba(75, 192, 75, 0.2); /* Softer Green */
  color: #28a745;
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 600;
}


/* === Canvas top-right controls (grouped) === */
.canvas-controls {
position: absolute;
top: -32px;        
left: 0;           /* instead of right: 0 */
z-index: 1000;
display: flex;
gap: 8px;
align-items: center;
flex-wrap: nowrap;
}

.canvas-controls button {
background: white;
border: 1px solid #ccc;
padding: 5px 10px;
border-radius: 10px;
box-shadow: 0 0 0 rgba(0,0,0,0.2);
font-size: 14px;
display: inline-flex;
align-items: center;
gap: 6px;
cursor: pointer;
touch-action: manipulation;   /* Apple Pencil friendly */
pointer-events: auto;
white-space: nowrap;          /* keep labels in one line */
}

.canvas-controls button i {
color: grey !important;
}

/* Active look for Split button when ON */
#toggleSplitBtn.active {
/* was grey; keep it visually the same as normal */
background-color: white;
color: inherit;
border-color: #ccc;
box-shadow: 0 0 0 rgba(0,0,0,0);
}
#toggleSplitBtn.active i {
color: grey !important;
}


/* Prevent accidental zoom on tap */
#toggleWritingBtn:active,
#toggleSplitBtn:active,
#toggleTimerBtn:active {
transform: scale(0.98);
}

/* Timer pill specifics (keeps a tidy width) */
#toggleTimerBtn {
max-width: 240px;
overflow: hidden;
}
#timerDisplay { color: grey; }

#hideWritingDisplay { color: grey; }

#splitScreenDisplay { color: grey; }

/* Ensure Apple Pencil can click */
#toggleWritingBtn:active {
  transform: scale(0.95);
}



.modal-body .nav-link.active {
font-weight: 600;
color: #0d6efd;
}

.modal-body ul.nav {
padding-top: 0.5rem;
}

/* Modal scroll stability */
.modal,
.modal * {
touch-action: pan-y;               /* allow vertical scroll in modals */
}

.modal-body {
overflow-y: auto;
-webkit-overflow-scrolling: touch; /* iOS momentum scroll */
overscroll-behavior: contain;      /* trap overscroll inside modal */
max-height: 75vh;
}

/* Wider membership upgrade popup */
#settingsModal .modal-dialog {
max-width: 900px;   /* adjust as needed */
width: 90%;         /* responsive scaling */
}

#settingsModal .modal-body {
max-height: 75vh;   /* keep vertical scroll control */
overflow-y: auto;
}






.ad-upgrade-box {
background: white;
padding: 24px;
border-radius: 16px;
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
text-align: center;
max-width: 640px;
width: 100%;
}

.ad-upgrade-icon {
font-size: 24px;
color: grey;
}

.ad-upgrade-heading {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}

.ad-upgrade-description {
font-size: 15px;
color: #444;
margin-bottom: 16px;
}

.ad-upgrade-btn {
background: black;
color: white;
font-weight: 600;
border: none;
padding: 10px 20px;
border-radius: 24px;
font-size: 14px;
cursor: pointer;
}

.ad-upgrade-btn:hover {
opacity: 0.9;
}

.dot {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
margin: 0 3px;
}

.dot-green { background: forestgreen; }
.dot-yellow { background: #FFC300; }
.dot-red { background: red; }

#loadingOverlay {
position: fixed;
top: 0; left: 0;
width: 100vw;
height: 100vh;
background: rgba(255, 255, 255, 0.85); /* dim screen */
display: none;             /* hidden by default */
z-index: 999999;           /* above most UI */
pointer-events: none;      /* don’t block when hidden */
align-items: center;
justify-content: center;
flex-direction: column;
backdrop-filter: blur(1px); /* optional for smoother look */
}

/* **********BIKRAM START********* */

.scroll-wrapper {
  overflow: visible !important; /* No scrollbar - content flows naturally */
  max-height: none !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Ensure main containers don't create scrollbars */
.container,
.container-fluid,
.row,
.col-md-12,
.col-md-4 {
  overflow: visible !important; /* No nested scrollbars */
}

/* Study Control and Session Plan - 2 column layout */
#studyControlSessionPlanRow {
  display: flex !important;
}

#studyControlSessionPlanRow > .col-lg-6,
#studyControlSessionPlanRow > .col-md-6 {
  display: flex !important;
  flex-direction: column !important;
}

/* Ensure cards fill their containers */
#studyControlSessionPlanRow .card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#studyControlSessionPlanRow .card-body {
  flex: 1;
}

/* Canvas container - consolidated definition */
#canvasContainer {
  width: 950px !important;
  max-width: 950px !important;
  padding: 10px;
  margin: 0 auto;
  background-color: white;
  overflow: visible !important; /* No scrollbar - use body scroll */
  box-sizing: border-box;
  display: block;
}



/* **********BIKRAM END********* */


/* **********BVanner ads start ********* */
.upgrade-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff; /* pure white */
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  padding: 20px;
  max-width: 1000px;
  margin: 20px auto;
  gap: 20px;
}
.upgrade-icon {
  width: 140px;
  height: auto;
}
.upgrade-text {
  flex: 1;
  font-size: 1.1rem;
}
.btn-upgrade {
  background: #000;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.3s ease;
}
.btn-upgrade:hover {
  background: #333;
}
@media (max-width: 700px) {
  .upgrade-banner {
      flex-direction: column;
      text-align: center;
  }
  .btn-upgrade {
      align-self: center;
  }
}
/* **********BVanner ads end ********* */


/* **********Animations start ********* */
.coin {
  position: absolute;
  width: 24px;
  height: 24px;
  background: url('https://cdn-icons-png.flaticon.com/512/138/138281.png') center/cover no-repeat;
  z-index: 2000;
}
/* **********Animations end ********* */


/* ********** Home dashbaord start ********* */
.dashboard-card {
  background: #fff;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  text-align: center;
  flex: 1;
  margin: 10px;
  }

  .dashboard-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin: 40px 0;
  }

  .dashboard-card h3 {
  font-size: 2rem;
  margin-bottom: 10px;
  color: #333;
  }

  .dashboard-card p {
  font-size: 1rem;
  color: #666;
  }

  .dashboard-chart-card {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  text-align: center;
  margin: 10px;
  width: 930px;    /* ✅ exact width */
  max-width: 930px;
  height: 250px;
  }

  .dashboard-meter-card {
  background: #fff; /* ✅ solid color, not array */
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  text-align: center;
  margin: 10px;
  flex: 1;
  max-width: 300px;
  height: 230px;
  font-size: 0.9rem;
  color: #999;
  }

  .dashboard-card:hover,
  .dashboard-chart-card:hover,
  .dashboard-meter-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  transition: all 0.3s ease;
  }


/* Global base style */
body {
font-family: "Segoe UI", sans-serif;
background: #f5f7fa;
color: #333;
}

/* Card styling consistent */
.card, .flex-fill.card {
border: 0;
border-radius: 10px;
}

/* Light avatar circles for date calendar */
.bg-light.rounded-circle {
font-size: 14px;
}

/* Quick action color circles (optional hover effect) */
.quick-action-box {
transition: transform 0.2s;
}
.quick-action-box:hover {
transform: translateY(-2px);
}

/* Calendar mini week numbers alignment */
.calendar-weeks div {
text-align: center;
font-size: 14px;
}

/* Fix spacing of avatar images inside small text rows */
.rounded-circle.me-2,
.rounded-circle.me-1 {
width: 30px;
height: 30px;
object-fit: cover;
}

/* Buttons */
.btn-outline-primary {
border-radius: 6px;
}

/* Chart container responsiveness */
#hoursChart {
width: 100% !important;
}

/* Responsive tweaks */
@media (max-width: 768px) {
.d-flex.mb-4 {
  flex-direction: column;
}
.d-flex.mb-4 > div {
  margin-bottom: 12px;
}
}



/* ********** Home dashbaord end ********* */



/* ********** FetchChapter ads start ********* */

.info-card {
background: #fff;
border-radius: 20px;
padding: 30px;
box-shadow: 0 5px 20px rgba(0,0,0,0.05);
width: 930px;
max-width: 930px;
height: 200px;
margin: 20px auto;
text-align: center;
}

.info-card h3 {
font-size: 1.8rem;
margin-bottom: 15px;
color: #333;
}

.info-card p {
font-size: 1rem;
color: #666;
margin-bottom: 20px;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}

.btn-download-spec {
background: #007bff;
color: white;
border: none;
padding: 12px 30px;
font-size: 1rem;
border-radius: 30px;
cursor: pointer;
transition: background 0.3s ease;
}
.btn-download-spec:hover {
background: #0056b3;
}

/* ********** FetchChapter ads end ********* */

/* ********** Main card start ********* */
.card-body {
scroll-behavior: smooth;
}

#mainDashboardCard {
scroll-behavior: smooth;
}

#farmtoolbar {
display: flex;
justify-content: start;
flex-wrap: wrap;
padding: 10px 0;
gap: 10px;
}

/* ********** Main card end ********* */



/* ********** AI tutor chat ********* */
/* === Feedback Metrics === */
.aitutor-metric-card {
color: white;
border-radius: 10px;
height: 100px;
width: 100px;
padding: 2px;
margin-bottom: 4px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-weight: bold;
text-align: center;
font-size: 13px;
}

.aitutor-metric-card span {
margin-top: 5px;
font-size: 15px;
width: 45px;
height: 45px;
line-height: 45px;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 50%;
display: inline-block;
}

/* === Feedback Card Slider === */
.aitutor-feedback-slider {
display: flex;
overflow-x: hidden;   /* no raw scrolling bars */
scroll-snap-type: x mandatory;
}

.aitutor-feedback-slide {
flex: 0 0 100%;
scroll-snap-align: start;
}


.feedback-card {
flex: 0 0 100%;
min-width: 100%;
max-width: 100%;
box-sizing: border-box;
scroll-snap-align: start;
padding: 32px;
border-radius: 20px;
background: white;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.05);
font-size: 18px;
color: #333;
text-align: left;
}

.feedback-card h2 {
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 0.75rem;
color: #111;
}

.feedback-card ul {
padding-left: 1rem;
line-height: 1.8;
font-size: 17px;
}

/* === Feedback Dots === */
.feedback-nav-dots {
text-align: center;
margin-top: -1rem;
margin-bottom: 1rem;
}

.feedback-dot {
display: inline-block;
width: 10px;
height: 10px;
margin: 0 6px;
border-radius: 50%;
background: #ccc;
transition: background 0.3s;
}

.feedback-dot.active {
background: #000;
}

/* === Optional legacy arrow buttons (if used) === */
.feedback-nav {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 6px;
}

.feedback-nav button {
font-size: 20px;
background: #e9ecef;
border: none;
border-radius: 50px;
padding: 10px 20px;
cursor: pointer;
transition: all 0.2s ease-in-out;
}

.feedback-nav button:hover {
background-color: #ced4da;
}

@keyframes fadeout {
0% { opacity: 1; transform: translateY(0); }
100% { opacity: 0; transform: translateY(-20px); }
}

@keyframes fadeUp {
0% { opacity: 1; transform: translateY(0); }
100% { opacity: 0; transform: translateY(-30px); }
}

#aitutor-box button:disabled {
opacity: 0.5 !important;
pointer-events: none;
cursor: not-allowed !important;
}

#aitutor-box button.active {
box-shadow: 0 0 0 3px #19875455;
border-color: #198754;
}
/* Ensure popup and buttons accept pen/finger taps */

#aitutor-box {
touch-action: auto;                /* allow pan/scroll with finger or pencil */
pointer-events: auto;
-webkit-overflow-scrolling: touch; /* smooth iOS scroll */
}

#aitutor-box button {
touch-action: manipulation;        /* immediate tap (no delay) */
pointer-events: auto;
user-select: none;                 /* prevent text highlight on tap */
}

/* If popup has scrollable inner content */
#aitutor-box .scrollable,
#aitutor-content {
max-height: 400px;
overflow-y: auto;
touch-action: pan-y;               /* Pencil/finger drag scrolls vertically */
}



.aitutor-loading {
display: flex;
align-items: center;
justify-content: center;  
gap: 8px;
height: 100%;
max-width: 300px;
margin: 0 auto;  
margin-top: -50px;   /* move image 50px higher */
}

.aitutor-loading img {
display: block;
object-fit: cover;             /* crop instead of resize */
object-position: center;       /* center after cropping */
clip-path: inset(20px 20px 20px 20px); /* top right bottom left */
width: 100%;   /* keep it filling container */
height: auto;  /* scale proportionally */
}

/* ******* end AI tutor chat ********* */   



/* ******* Coins HUD overlay ********* */   

#coins-hud {
position: fixed; inset: 0;
pointer-events: none;
z-index: 99999;
}

#coins-hud .coins-hud__badge {
position: fixed; top: 18px; right: 18px;
background: rgba(0,0,0,.75);
color: #fff;
padding: .35rem .6rem;
border-radius: 9999px;
display: flex; gap: .45rem; align-items: center;
transform: translateY(-20px); opacity: 0;
transition: all .25s ease-out;
font-weight: 600;
}
#coins-hud.show .coins-hud__badge { transform: translateY(0); opacity: 1; }

.coins-hud__count { font-weight: 800; }

/* Gold coin sprite (no external image required) */
.coin-sprite {
width:20px; height:20px;
background: radial-gradient(circle, gold 0%, orange 60%, #b87333 100%);
border-radius:50%;
box-shadow:0 0 12px rgba(255,215,0,.7);
position:fixed; z-index:9999;
}
#coins-hud.show .coins-hud__badge {
animation: pulse 0.5s ease;
}
@keyframes pulse {
0%{transform:scale(1);} 50%{transform:scale(1.15);} 100%{transform:scale(1);}
}

/* ******* End Coins HUD overlay ********* */   


/* Ensure settings dropdown is clickable normally */
.dropdown-menu {
z-index: 20000 !important;      /* keep your original behaviour */
pointer-events: auto !important;
}

/* BUT when a modal is open, push dropdowns under the modal so they don't block it */
.modal-open .dropdown-menu {
z-index: 1000 !important;       /* below Bootstrap modal (≈1055) */
}



/* ===== TopRecall Neuron Animations ===== */
@keyframes neuronGrow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7), 0 0 0 0 rgba(255, 193, 7, 0.4);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.4), 0 0 0 4px rgba(255, 193, 7, 0.2);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0), 0 0 0 0 rgba(255, 193, 7, 0);
  }
}

.toprecall-yellow-neuron {
  animation: neuronGrow 4s ease-in-out infinite;
  position: relative;
}

.toprecall-neuron-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: 1px;
}

.toprecall-connecting-line {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #888 30%, #888 50%, #888 70%, transparent 100%);
  background-size: 200% 100%;
  display: inline-block;
  vertical-align: middle;
  z-index: 0;
  animation: lineFlow 5s linear infinite;
  opacity: 0.4;
  flex-shrink: 0;
  width: 6px;
  margin: 0 1px;
  align-self: center;
}

@keyframes lineFlow {
  0% {
    opacity: 0.2;
    background-position: 100% 0;
  }
  50% {
    opacity: 0.6;
    background-position: 0% 0;
  }
  100% {
    opacity: 0.2;
    background-position: -100% 0;
  }
}

/* ===== SEO Bar and TopRecall Bar Styles ===== */

/* Quick Tools Toolbar (SEO Bar) */
.canvas-top-toolbar {
  position: relative;
  z-index: 50;
  touch-action: auto;
  pointer-events: auto;
  width: 100%;
}

.quick-tool-btn {
  touch-action: manipulation !important;
  pointer-events: auto !important;
  z-index: 10;
  position: relative;
  -webkit-touch-callout: none;
}

/* Floating Cards Container */
#floating-cards-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5000;
  overflow: visible;
}

#floating-cards-container .floating-card {
  pointer-events: auto;
}

/* TopRecall Bottom Bar - Highest z-index to cover Topic Tree Card */
#toprecallCardContainer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 930px;
  max-width: calc(100vw - 120px);
  z-index: 10000 !important; /* Highest level to cover Topic Tree Card (z-index: 100) */
  background: white;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  display: none;
  transition: transform 0.3s ease-in-out;
  pointer-events: auto;
}

#toprecallBar {
  padding: 12px 20px;
  border-top: 2px solid #0E9F6E;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#toprecallCardBody {
  display: none;
  max-height: none;
  overflow: visible;
  padding: 20px;
  border-top: 1px solid #e0e0e0;
  transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
}


/* ===== Floating Cards Styles (EXACT same as SEO page) ===== */
#floating-cards-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5000;
  overflow: visible;
}

#floating-cards-container .floating-card {
  pointer-events: auto;
}

.floating-card {
  position: fixed;
  z-index: 5000;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 0;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: none;
  border: 2px solid #0E9F6E;
  transition: opacity 0.2s ease;
}

.floating-card.dragged {
  opacity: 1;
}

.floating-card.active {
  display: flex;
  flex-direction: column;
  animation: slideInFromTop 0.4s ease-out;
}

.floating-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 2px solid #e0e0e0;
  cursor: move;
  background: #f8f9fa;
  flex-shrink: 0;
  gap: 12px;
}

.floating-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #000;
  margin: 0;
}

.floating-card-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.floating-card-close:hover {
  background: #e0e0e0;
  color: #000;
}

.floating-card-content {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.floating-card-content .card-title {
  margin-top: 0;
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* TopRecall Button Growing Color Outline Animation - Ripple effect (Yellow for AI marking) */
@keyframes toprecallButtonGrow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.8), 0 0 0 0 rgba(255, 193, 7, 0.4);
    border-color: #ffc107;
  }
  50% {
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.4), 0 0 0 8px rgba(255, 193, 7, 0);
    border-color: #ffc107;
  }
  100% {
    box-shadow: 0 0 0 8px rgba(255, 193, 7, 0), 0 0 0 12px rgba(255, 193, 7, 0);
    border-color: #ffc107;
  }
}

/* TopRecall Button Growing Color Outline Animation - Ripple effect (Green for Submit) */
@keyframes toprecallButtonGrowGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.8), 0 0 0 0 rgba(40, 167, 69, 0.4);
    border-color: #28a745;
  }
  50% {
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.4), 0 0 0 8px rgba(40, 167, 69, 0);
    border-color: #28a745;
  }
  100% {
    box-shadow: 0 0 0 8px rgba(40, 167, 69, 0), 0 0 0 12px rgba(40, 167, 69, 0);
    border-color: #28a745;
  }
}

.toprecall-button-grow {
  animation: toprecallButtonGrow 1.5s ease-out infinite;
  border-width: 2px !important;
  border-style: solid !important;
  border-color: #ffc107 !important;
  position: relative;
  outline: none !important;
}

.toprecall-button-grow-green {
  animation: toprecallButtonGrowGreen 2.5s ease-out infinite;
  border-width: 2px !important;
  border-style: solid !important;
  border-color: #28a745 !important;
  position: relative;
  outline: none !important;
}

/* Topic Selection Card - Green Checkboxes */
#topicSelectionCard input[type="checkbox"] {
  accent-color: #28a745 !important;
  cursor: pointer;
}

#topicSelectionCard input[type="checkbox"]:checked {
  background-color: #28a745 !important;
  border-color: #28a745 !important;
}

#topicSelectionCard input[type="checkbox"]:focus {
  border-color: #28a745 !important;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Fix iPad scrolling issue in topic selection card */
#topicSelectionCard .card-body {
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: auto !important;
  touch-action: pan-y pan-x !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative !important;
  scroll-behavior: auto !important;
  will-change: scroll-position !important;
}

/* Fix iPad scrolling issue in TopRecall card body */
#toprecallCardBody {
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: auto !important;
  touch-action: pan-y pan-x !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative !important;
  scroll-behavior: auto !important;
  will-change: scroll-position !important;
}

/* TopRecall Neuron Circle Animation */
@keyframes toprecallNeuronGrow {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.8;
  }
}

.toprecall-neuron-circle {
  animation: toprecallNeuronGrow 2s ease-in-out infinite;
}

/* TopRecall Precision Card - 30x30px Neurons */
.toprecall-precision-neuron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: #ffc107;
  border-radius: 50%;
  margin: 3px;
  animation: toprecallNeuronGrow 2s ease-in-out infinite;
  position: relative;
  font-size: 9px;
  font-weight: 600;
  color: #000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toprecall-precision-neuron.new-question {
  background: #6c757d;
  color: white;
}

.toprecall-precision-neuron:nth-child(1) { animation-delay: 0s; }
.toprecall-precision-neuron:nth-child(2) { animation-delay: 0.15s; }
.toprecall-precision-neuron:nth-child(3) { animation-delay: 0.3s; }
.toprecall-precision-neuron:nth-child(4) { animation-delay: 0.45s; }
.toprecall-precision-neuron:nth-child(5) { animation-delay: 0.6s; }
.toprecall-precision-neuron:nth-child(6) { animation-delay: 0.75s; }
.toprecall-precision-neuron:nth-child(7) { animation-delay: 0.9s; }
.toprecall-precision-neuron:nth-child(8) { animation-delay: 1.05s; }
.toprecall-precision-neuron:nth-child(9) { animation-delay: 1.2s; }
.toprecall-precision-neuron:nth-child(10) { animation-delay: 1.35s; }

/* TopRecall Precision Card - Tab Styling */
.precision-tab-btn {
  transition: all 0.2s ease;
  white-space: nowrap;
}

.precision-tab-btn:hover {
  color: #28a745 !important;
}

.precision-tab-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Topic Tree Content - Scrollable area with visible scrollbar */
#topicTreeContentSubjects,
#topicTreeContentChapters {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 #f7fafc;
}

#topicTreeContentSubjects::-webkit-scrollbar,
#topicTreeContentChapters::-webkit-scrollbar {
  width: 8px;
}

#topicTreeContentSubjects::-webkit-scrollbar-track,
#topicTreeContentChapters::-webkit-scrollbar-track {
  background: #f7fafc;
  border-radius: 4px;
}

#topicTreeContentSubjects::-webkit-scrollbar-thumb,
#topicTreeContentChapters::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

#topicTreeContentSubjects::-webkit-scrollbar-thumb:hover,
#topicTreeContentChapters::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Ensure button container stays at bottom */
#topicsGoButtonContainerSubjects,
#topicsGoButtonContainerChapters {
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* TopRecall Precision Slider - Enlarged Green Thumb */
#toprecallPrecisionSliderSubjects,
#toprecallPrecisionSliderChapters {
  -webkit-appearance: none;
  appearance: none;
}

#toprecallPrecisionSliderSubjects::-webkit-slider-thumb,
#toprecallPrecisionSliderChapters::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(to right, #ffc107 0%, #ffc107 50%, #6c757d 50%, #6c757d 100%); /* Default: half yellow, half grey */
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
  margin-top: -11px; /* Center the thumb vertically on the 10px high slider */
}

#toprecallPrecisionSliderSubjects::-webkit-slider-thumb:hover,
#toprecallPrecisionSliderChapters::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

#toprecallPrecisionSliderSubjects::-moz-range-thumb,
#toprecallPrecisionSliderChapters::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(to right, #ffc107 0%, #ffc107 50%, #6c757d 50%, #6c757d 100%); /* Default: half yellow, half grey */
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

#toprecallPrecisionSliderSubjects::-moz-range-thumb:hover,
#toprecallPrecisionSliderChapters::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* Fix Topic Tree scrolling - ensure touch events don't interfere */
#topicTreeContentChapters,
#topicTreeContentSubjects {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Precision Tab Styling - 50/50 width, rounded corners, always white text */
.precision-tab-btn {
  flex: 1;
  border-radius: 8px 8px 0 0 !important;
  border: 1px solid #e9ecef !important;
  border-bottom: none !important;
  transition: all 0.2s ease;
  position: relative;
}

.precision-tab-btn.active {
  background: #28a745 !important;
  color: white !important;
  border-color: #28a745 !important;
  z-index: 1;
}

.precision-tab-btn.active:hover {
  background: #218838 !important;
  color: white !important;
}

.precision-tab-btn:not(.active) {
  background: #f8f9fa !important;
  color: #666 !important;
  border-color: #e9ecef !important;
}

.precision-tab-btn:not(.active):hover {
  background: #e9ecef !important;
  color: #666 !important;
}

/* Ensure text is always visible - white for active, gray for inactive */
.precision-tab-btn.active,
.precision-tab-btn.active * {
  color: white !important;
}

.precision-tab-btn.active .badge {
  background-color: rgba(255, 255, 255, 0.3) !important;
  color: white !important;
}

.precision-tab-btn:not(.active),
.precision-tab-btn:not(.active) * {
  color: #666 !important;
}

/* NEW badge always red background, white text, even on hover */
.precision-tab-btn .badge.bg-danger,
.precision-tab-btn .badge.bg-danger:hover,
.precision-tab-btn .badge.bg-danger:focus,
.precision-tab-btn .badge.bg-danger:active {
  background-color: #dc3545 !important;
  color: white !important;
  border: none !important;
}