/* ========================================
   HIVEMIND - COMPONENTS STYLES
   ======================================== */

/* === BUTTON COMPONENTS === */

/* Complete All Due Button Styles */
.complete-due-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 102, 204, 0.3);
  background-color: #f0f6ff !important;
  border-color: #0052a3 !important;
}

.complete-due-btn:active {
  transform: translateY(0) scale(1.01);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.2);
}

.complete-due-btn-done {
  cursor: not-allowed !important;
  opacity: 0.8;
}

/* Mode Button Loading States */
.btn-mode.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-mode.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10;
}

.btn-mode.loading .mode-img {
  opacity: 0.3;
}

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

/* Loading message overlay for mode buttons */
.mode-loading-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(44, 62, 80, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 15;
  white-space: nowrap;
  pointer-events: none;
}

/* The 4 "Modes" Buttons */
.btn-mode {
  background: #fff;
  border: 2px solid var(--border-color);
  cursor: pointer;
  margin: 10px;
  outline: none;
  border-radius: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-mode:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px var(--box-shadow);
}

.mode-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
  border-width: 2px; 
  border-style: solid;
  border-color: transparent;
}

/* The ID-specific rules will override the border-color set by the .mode-img class rule above */
#prime-time-img {
  border-color: #27AE60; /* Green (var(--success-color)) */
}

#master-mind-img {
  border-color: #2C3E50; /* Black/Dark Blue (var(--primary-color)) */
}

#target-zone-img {
  border-color: #E74C3C; /* Red (var(--accent-color)) */
}

#test-zone-img {
  border-color: #3498DB; /* Blue (var(--info-color)) */
}

#notes-img {
  border-color: #F39C12; /* Yellow/Orange (var(--warning-color)) */
}

.mode-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.mode-label {
  color: var(--primary-color);
  font-weight: bold;
  text-align: center;
  font-size: 1.1rem;
}

/* Hover effect for "Show My Progress" button */
.hover-effect {
  background-color: #ffb93e;
  border: 2px solid #000000;
  border-radius: 10px;
  color: #000000;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.hover-effect:hover {
  background-color: #cc8c2a;
  border: 2px solid #000000;
  color: #ffffff;
  box-shadow: none;
  transform: none;
}

/* Flag Button Styles */
.flag-button-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
}

.btn-flag {
  background-color: #FFD700; /* Yellow background */
  color: #000000;            /* Black text */
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

.btn-flag.flagged {
  background-color: #FF0000; /* Red background */
  color: #FFFFFF;            /* White text */
}

/* === NAVIGATION COMPONENTS === */

/* Navigation Tabs Styling */
.nav-tabs {
  border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-link {
  color: #495057;
  background-color: #fff;
  border: 1px solid transparent;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
  margin-bottom: -1px;
  cursor: pointer;
}

.nav-tabs .nav-link.active {
  color: #fff;
  background-color: #28a745;
  border-color: #dee2e6 #dee2e6 #fff;
  cursor: default;
}

.nav-tabs .nav-link.disabled {
  color: #6c757d;
  pointer-events: none;
  background-color: transparent;
}

.nav-tabs .nav-item.show .nav-link,
.nav-tabs .nav-link:hover:not(.active) {
  background-color: #e9ecef;
}

/* Hide all tab contents by default */
.tab-content {
  display: none;
}

/* Display only the active tab content */
.tab-content.active {
  display: block;
}

/* Disabled Tabs Styling */
.nav-tabs .nav-link.tab.disabled {
  pointer-events: none;
  opacity: 0.6;
}

/* Active Tab Styling */
.nav-tabs .nav-link.tab.active {
  color: #fff;
  background-color: #28a745;
  border-color: #dee2e6 #dee2e6 #fff;
  cursor: default;
}

.nav-tabs .nav-link.tab:hover:not(.active) {
  background-color: #e9ecef;
}

.nav-tabs .nav-item:last-child .nav-link.tab {
  border-right: 1px solid #dee2e6;
}

/* Ensure borders are seamless */
.nav-tabs .nav-link.tab {
  border: 1px solid transparent;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
  margin-bottom: -1px;
  transition: background-color 0.3s ease;
}

/* === FEEDBACK COMPONENTS === */

/* Feedback / Boxes (Interim, Mastery, etc.) */
.feedback-box.interim-feedback {
  background-color: #ffffff;
  border: 2px solid var(--amber-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.feedback-box.interim-feedback i {
  color: var(--amber-color);
  font-size: 2rem;
}

.feedback-box.interim-feedback:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.mastery-feedback h4 {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.mastery-feedback h4 i {
  font-size: 2.5rem;
  margin-right: 10px;
  color: #3498DB;
}

#final-feedback-page .mastery-feedback p {
  margin-top: 20px;
  font-size: 1.1rem;
  color: var(--text-color);
}

#final-feedback-page .mastery-feedback i {
  margin-right: 8px;
}

#completion-feedback p {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--text-color);
}

/* Answer & Response Boxes */
.response-box {
  display: flex;
  align-items: center;
  background-color: #f0f8ff;
  border-left: 5px solid #1e90ff;
  border-radius: 5px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  margin-bottom: 15px;
}

.response-box i {
  font-size: 1.5rem;
  color: #1e90ff;
  margin-right: 10px;
}

.correct-answer-box {
  display: flex;
  align-items: center;
  background-color: #e6ffed;
  border-left: 5px solid #28a745;
  border-radius: 5px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  margin-bottom: 15px;
}

.correct-answer-box i {
  font-size: 1.5rem;
  color: #28a745;
  margin-right: 10px;
}

.testzone-feedback {
  display: flex;
  align-items: center;
  border-radius: 5px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  margin-bottom: 15px;
}

.testzone-feedback.correct {
  background-color: #e6ffe6;
  border-left: 5px solid #28a745;
}

.testzone-feedback.incorrect {
  background-color: #ffe6e6;
  border-left: 5px solid #dc3545;
}

.testzone-feedback i {
  font-size: 1.5rem;
  margin-right: 10px;
}

.testzone-feedback.correct i {
  color: #28a745;
}

.testzone-feedback.incorrect i {
  color: #dc3545;
}

.response-box:hover,
.correct-answer-box:hover,
.testzone-feedback:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 10px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

/* === CHART COMPONENTS === */

/* Consolidated Chart Sizing */
.chart-container {
  width: 100%;
  height: 400px;
  position: relative;
  padding: 20px;
  box-sizing: border-box;
  background-color: #f9f9f9;
}

/* Chart Canvas Styling */
#overallPie,
#streakChart,
#topicsBar,
#subtopicsBar,
#stagesBar,
#stagesSubtopicsBar,
#flashcardPie,
#testZoneBar,
#topicsTestZoneBar,
#testZoneSubtopicsBar {
  width: 100%;
  height: 100%;
  display: block;
  margin: 0 auto;
}

@media (max-width: 992px) {
  .chart-container {
    height: 300px;
  }

  #overallPie, #streakChart, #topicsBar, #subtopicsBar, #stagesBar, #stagesSubtopicsBar,
  #flashcardPie, #testZoneBar, #topicsTestZoneBar, #testZoneSubtopicsBar {
    max-width: 300px;
  }
}

@media (max-width: 576px) {
  .chart-container {
    height: 250px;
  }

  #overallPie, #streakChart, #topicsBar, #subtopicsBar, #stagesBar, #stagesSubtopicsBar,
  #flashcardPie, #testZoneBar, #topicsTestZoneBar, #testZoneSubtopicsBar {
    max-width: 250px;
  }
}

/* === MODAL COMPONENTS === */

/* Spinner Overlay */
#uploadSpinnerOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

#uploadSpinnerOverlay .spinner-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  color: #333;
}

#uploadSpinnerOverlay .spinner-content i {
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* Thank You Card Modal Styling */
#thank-you-modal .modal-content {
  border-radius: 15px;
  border: 2px solid var(--amber-color);
  background-color: #fdfaf3;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

#thank-you-modal .modal-body {
  padding: 2rem;
  text-align: center;
}

#thank-you-modal .thank-you-card-image {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

#thank-you-modal .thank-you-card-message {
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  color: #5c5c5c;
  line-height: 1.6;
}

#thank-you-modal .thank-you-card-signature {
  font-family: 'Brush Script MT', cursive;
  font-size: 2rem;
  color: var(--primary-color);
  margin-top: 1rem;
}

/* === FORM COMPONENTS === */

/* AO Type Dropdown Style Fix */
#aoSelection.form-select {
  -webkit-appearance: menulist;
  -moz-appearance: menulist;
  appearance: menulist;
  background-image: none !important;
  padding: 0.375rem 0.75rem !important;
  border: 1px solid #ced4da !important;
  background-color: #fff !important;
  color: #212529 !important;
}

/* === TOPIC COMPONENTS === */

/* Topics or Subtopics expansions */
.topic-header {
  transition: background-color 0.3s;
}

.topic-header:hover {
  background-color: #f8f9fa;
}

.topic-header i {
  transition: transform 0.3s;
}

.collapse.show + .topic-header i {
  transform: rotate(180deg);
}

.form-check-label {
  cursor: pointer;
  color: var(--text-color);
}

.border {
  border-radius: 8px;
}

.shadow-sm {
  box-shadow: 0 2px 5px var(--box-shadow);
}

#questions-available {
  font-size: 1.5em;
  color: blue;
}

.toggle-chevron.rotate {
  transform: rotate(180deg);
  transition: transform 0.3s;
}

/* Topic Box Styling */
.topic-box {
  cursor: pointer;
  width: 100%;
  padding: 15px;
  box-sizing: border-box;
  background-color: #f9f9f9;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Ensure the checkbox doesn't inherit the pointer cursor */
.topic-box input[type="checkbox"] {
  cursor: default;
}

/* Optional: Highlight the topic box on hover to indicate it's clickable */
.topic-box:hover {
  background-color: #f1f1f1;
  transition: background-color 0.3s ease;
}

/* Highlighting for selected MCQ option */
.selected-option {
  background-color: #18BC9C;
  color: white;
  border-color: #18BC9C;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Optional: Highlight selected confidence button */
.confidence-button.selected {
  border-color: #28a745;
  box-shadow: 0 0 5px #28a745;
}

/* === BADGE COMPONENTS === */

/* Badge Item Styles */
.badge-item {
  transition: transform 0.2s ease-in-out;
  cursor: default;
}

.badge-name {
  font-size: 0.9rem;
}

.badge-desc {
  font-size: 0.8rem;
  color: var(--light-text-color);
}

/* === BADGE CONGRATS POPUP === */

/* The main popup container */
.badge-congrats-popup {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  max-width: 500px;
  width: 90%;
  pointer-events: auto;
  opacity: 0;
  animation: fadeInUp 0.7s ease-out forwards;
}

/* The image on the left of the popup */
.badge-congrats-image {
  width: 100px;
  height: auto;
  flex-shrink: 0;
}

/* The text block on the right of the popup */
.badge-congrats-text {
  flex-grow: 1;
  text-align: left;
}

/* Styles for the text elements inside the popup */
.badge-congrats-text h4 {
  color: #2c3e50;
  margin-top: 0;
  margin-bottom: 10px;
  font-weight: bold;
}

.badge-congrats-text p {
  color: #34495e;
  margin-bottom: 5px;
  font-size: 1rem;
}

.badge-congrats-text .earned-badge-name {
  font-weight: bold;
  color: #18bc9c;
}

/* The small line of text that fades in slightly later */
.subtle-text-animation {
  opacity: 0;
  animation: fadeInText 0.5s ease-in-out 0.5s forwards;
  font-size: 0.9rem !important;
  color: #7f8c8d !important;
}

/* --- KEYFRAME DEFINITIONS FOR POPUP ANIMATIONS --- */

/* The fade-in animation for the main popup */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* The fade-out animation when the popup is dismissed */
@keyframes fadeOutEffect {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(0.9) translateY(10px); }
}

/* The fade-in animation for the subtle text line */
@keyframes fadeInText {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
