/* ----------------------------------------------------------------
   SECTION: Problem Solution Feedback Base
   ---------------------------------------------------------------- */

/* Popup Styles */
.popup {
  display: none; /* Hidden by default */
  position: fixed;
  bottom: 0;
  right: 0;
  width: 500px;
  min-width: 400px;
  height: 100vh; /* Full height of viewport */
  max-height: 100vh; /* Prevent exceeding viewport */
  overflow: hidden; /* No scrolling */
  transition: all 0.25s ease-out;
  background: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  z-index: 10020 !important;
}

.popup:not(.loading) {
  opacity: 1 !important;
  visibility: visible;
}

.popup.loading {
  height: auto;
  color: #0d847e;
  font-style: italic;
  line-height: 1.2;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
  z-index: 10025 !important;
}

@keyframes rotateLoader {
  100% {
    transform: rotate(1turn);
  }
}

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

.popup.slide-in {
  animation: popupSlideIn 0.25s ease-out forwards; /* Apply slide-in animation */
}

.popup.slide-out {
  animation: popupSlideOut 0.25s ease-out forwards; /* Apply slide-out animation */
}

.popup.collapsed {
  pointer-events: none;
}

.popup.expanded {
  animation: popupExpand 0.25s ease-out forwards;
}

.popup-drag-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 5px;
  cursor: ew-resize;
}

/* Popup Content Styles */
.popup-content {
  height: 100%;
  overflow-y: auto;
  width: 100% !important;
  width: auto; /* Adjusted width to fit at bottom-right */
  position: relative;
}
.popup-content.hide-overflow {
  overflow: hidden;
}

.close-and-collapse-icon {
  display: flex;
  gap: 8px;
  align-items: center;
  position: sticky;
  z-index: 10000;
  width: 100%;
  top: 0;
  background-color: white;
  padding: 8px 16px;
  margin-bottom: 1rem;
}

.close-btn {
  cursor: pointer;
  width: 16px;
  height: 16px;
  transition: fill 0.2s ease-in-out;
}

.collapse-btn {
  display: none !important;
}

.close-btn:hover g path,
.collapse-btn:hover g path {
  fill: #6b6b6b;
}

#popup-body {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#popup-body.loading {
  height: 100%;
}

.loader {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.loader .loading-spinner {
  position: relative;
  z-index: 1;
}

.loader p {
  background: white;
  max-width: 350px;
  padding: 10px 15px;
  margin-right: 120px;
  box-shadow: 0 0 9px 3px #0003;
}
.loader p.fade-away {
  opacity: 0;
  transition: opacity 0.5s ease-in-out; /* Only transitions when fade-away is added */
}
.loader.submission {
  height: 100%;
  width: 100%;
  justify-content: center;
  padding-right: 0;
  gap: 0;
  overflow: hidden;
}

.loading-spinner {
  width: 35px; /* Increased size to fit timer */
  height: 35px; /* Match width */
  border: 3px solid rgba(0, 0, 0, 0.2); /* Subtle inactive border */
  border-radius: 50%; /* Circular shape */
  border-top: 3px solid var(--primary-color); /* Keep the primary color for the spinner */
  animation: popupSpin 0.6s linear infinite; /* Smooth and slightly faster spin */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner.big {
  width: 50px; /* Increased size */
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.error h6 {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 0;
  color: #d4380d;
}

#error p {
  font-size: var(--text-small);
  text-align: center;
  color: #595959;
  white-space: unset;
}

/* Submission popup css */
.problem-details {
  display: flex;
  gap: 0.8rem;
  flex-direction: column;
  margin: 0px 16px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f1f1f1;
  margin-bottom: 25px;
}

.problem-id,
.problem-statement,
.problem-xp {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.problem-statement {
  align-items: flex-start;
}

.problem-id h3 {
  font-size: var(--text-large);
}

.problem-statement-text,
.problem-xp p {
  font-size: var(--text-base);
}

.problem-statement-text {
  position: relative;
  max-height: 4.5em;
  overflow: hidden;
  line-height: 1.5em;
  transition: max-height 0.3s ease-in-out;
}

.problem-statement-text.has-fade {
  cursor: pointer;
}

/* Apply fade only when class 'has-fade' is present */
.problem-statement-text.has-fade::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1.5em; /* Match line height */
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, white 100%);
  pointer-events: none; /* Ensure clicks go through */
}

.problem-statement-text.expanded {
  max-height: none;
}

.problem-statement-text.expanded::after {
  display: none; /* Remove fade effect when expanded */
}

.problem-xp.statement {
  color: var(--purple);
}

.problem-id img,
.problem-statement img,
.problem-xp img {
  width: 24px;
}

.overall-grade-block {
  display: flex;
  justify-content: start;
  font-weight: 700;
}

.response-block {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-base) !important;
  font-family: Cmu, Arial, sans-serif !important;
}

.response-block.long {
  flex-direction: column;
  gap: 3px;
  align-items: start !important;
}

.response-block.overall-grade {
  width: fit-content;
  margin-top: 5px;
}

.response-block h1 {
  font-size: var(--text-base);
}

.response-title {
  font-size: var(--text-base);
  white-space: nowrap;
}

.response-value {
  padding-right: 5px;
}

.submission {
  margin-top: 10px;
}

.hr-divider {
  margin-top: 15px;
}

.response-block p,
.response-block ul {
  font-size: var(--text-base);
}

/* Problems popup */
.response-field {
  font-size: 1.1rem;
  font-family: Cmu, Arial, sans-serif;
}

#expand-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 30px;
  width: 50px;
  cursor: pointer;
  padding: 7px;
  background-color: white;
  box-shadow: 0 0 9px 3px #0003;
  border-radius: 100%;
  transition: all 0.25s ease-out;
  z-index: 1111;
}

#expand-btn:hover {
  transform: scale(1.1);
  background-color: var(--bluish-gray);
}

@media only screen and (max-width: 600px) {
  .popup {
    min-width: 350px;
  }
}

.submission-loader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.loader-label {
  font-size: 13px;
  color: #444;
  font-weight: 500;
}

#popup-timer,
.timer {
  font-size: 13px;
  color: #666;
}

/* ----------------------------------------------------------------
   SECTION: Keyframes
---------------------------------------------------------------- */
@keyframes popupSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes popupSlideIn {
  from {
    transform: translateX(100%); /* Start off-screen to the right */
  }
  to {
    transform: translateX(0); /* Move to its final position */
  }
}

@keyframes popupSlideOut {
  from {
    transform: translateX(0); /* Start at its current position */
  }
  to {
    transform: translateX(100%); /* Move off-screen to the right */
  }
}

/* macOS-like Minimize Animation */
@keyframes popupCollapse {
  0% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
    transform-origin: 50% 100%;
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.2) translate(150px, 300px);
    transform-origin: 50% 100%;
    filter: blur(2px);
  }
}

/* macOS-like Restore Animation */
@keyframes popupExpand {
  from {
    transform: scale(0.1) translate(100%, 100%);
    opacity: 0;
    visibility: hidden;
  }
  to {
    transform: scale(1) translate(0, 0);
    opacity: 1;
  }
}

.markdown-content {
  max-width: calc(
    100% - 10px
  ); /* Ensures it is slightly smaller than .popup-content */
  width: 100%;
  box-sizing: border-box; /* Ensures padding doesn't increase width */
  word-wrap: break-word; /* Ensures long words wrap properly */
}

#right-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tab-content {
  padding: 0 16px;
}

.markdown-content {
  line-height: 1.3; /* Reduce line spacing */
}

.markdown-content p {
  margin-top: 5px;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0; /* Reduce space for lists */
  padding-left: 20px; /* Keep indentation */
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.markdown-content h3,
.markdown-content h4 {
  margin-bottom: 8px; /* Reduce space below headers */
}

.markdown-content blockquote {
  margin: 5px 0; /* Reduce space above and below blockquotes */
  padding: 5px 10px;
}

.markdown-content code {
  font-size: 0.95em; /* Reduce font size slightly */
  padding: 2px 4px;
}

.markdown-content pre {
  margin: 5px 0;
  padding: 5px;
}

.mjx-chtml {
  margin: 0.5rem 0;
}

.submission-time {
  font-style: italic;
  color: var(--gray);
  font-size: 14px;
}

/* Feedback buttons */
#feedback-buttons {
  margin: 0px 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
}

.feedback-container {
  background: #f3f3f2;
  padding: 12px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 24px;
}

#thumb-up-btn.selected,
#thumb-down-btn.selected {
  cursor: not-allowed !important;
}

/* Thumbs-up/down styling */
#thumb-up-btn,
#thumb-down-btn {
  width: 18px;
  height: 18px;
  background: none !important;
  transform: scale(0.8);
}

#thumb-up-btn:not(.clicked):hover svg path,
#thumb-down-btn:not(.clicked):hover svg path {
  fill: var(--primary-color);
}

#thumb-up-btn svg,
#thumb-down-btn svg {
  width: 18px;
  height: 18px;
}

#thnk_feedback {
  white-space: normal;
  display: none;
  color: #909090;
  line-height: 100%;
  font-size: 14px;
  font-style: italic;
  margin-left: 10px;
  transform: translateY(2px);
}

.user-submission-block {
  background: var(--very-light-blue);
  padding: 16px;
  font-family: Cmu, Arial, sans-serif;
}

.user-submission-block * {
  font-size: var(--text-base);
  text-wrap: auto;
}

#right-content {
  margin-bottom: 20px;
}

.tooltip {
  position: absolute;
  background: black;
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10000000;
}

#popup-body.loading {
  padding: 16px;
}

.hidden {
  display: none !important;
}
.active {
  display: flex !important;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  gap: 8px;
}

.nav-menu > .submission-time {
  margin: 0;
  font-style: italic;
  color: var(--gray);
  font-size: 14px;
}

.nav-menu:has(.tab-toggle-button) {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.nav-menu .tab-toggle-button ~ * {
  margin-left: auto;
}

.nav-menu .tab-toggle-button {
  margin-right: auto;
}

.submission-metadata {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--dark-gray);
  white-space: nowrap;
  transition: all 0.5s ease;
  padding: 4px 8px;
  border-radius: 6px;
}

.submission-metadata:hover {
  transform: scale(1.1);
  background-color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* Optional: subtle shadow for depth */
}

.metadata-item {
  font-weight: 500;
  font-style: italic;
}

.metadata-separator {
  color: #999;
  font-weight: normal;
}

@media (max-width: 768px) {
  /* Container that holds both overall grade and metadata */
  .nav-menu > div[style*="display: flex"][style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  
  /* Move metadata to top and align left */
  .submission-metadata {
    order: -1 !important; /* Move to beginning */
    align-self: flex-start !important;
    margin-bottom: 8px !important;
    margin-left: 0 !important;
    justify-self: flex-start !important;
    padding: 4px 0 !important;
  }
  
  /* Keep overall grade below metadata and align left */
  .overall-grade-inline {
    order: 1 !important; /* Move to end */
    align-self: flex-start !important;
    margin-top: 0 !important;
    justify-self: flex-start !important;
  }
}

/* .tab-toggle-button {
  width: 45px;
  height: 35px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  background-color: transparent !important;
  border-radius: 8px;
  transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out;
  transform: scale(0.7);
  padding: 2px;
  box-sizing: border-box;
}

.tab-toggle-button img {
  width: 70% !important;
  max-width: 70% !important;
}

.tab-toggle-button:not(.active) {
  background-color: #c6c7d1 !important;
}

.tab-toggle-button.active svg path {
  fill: #727c93;
  transition: fill 0.2s ease-in-out;
}

.tab-toggle-button.active:hover svg path {
  fill: #374a68;
}

.tab-toggle-button:hover {
  transform: scale(0.85);
}

.tab-toggle-button.active:hover {
  background-color: #c6c7d1 !important;
}

.tab-toggle-button svg {
  width: 28px;
} */

/* @media (hover: none) and (pointer: coarse) { */
  /* Prevent :hover from interfering visually */
  /* .tab-toggle-button:hover {
    background-color: transparent !important;
    transform: none !important;
  }

  .tab-toggle-button:hover svg path {
    fill: #727c93 !important;
  } */

  /* Tab container and buttons styling */
.tab-container {
  width: 100%;
  margin-bottom: 16px;
}

.tab-buttons {
  display: flex;
  background-color: var(--light-gray);
  border-radius: 30px;
  padding: 6px;
  width: fit-content;
  gap: 20px;
  margin-left: 12px;
}

.tab-button {
  padding: 4px 6px;
  border: none;
  background: transparent;
  border-radius: 30px;
  font-size: 10px;
  font-weight: 500;
  color: var(--dark-gray);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-button:hover {
  background-color: rgba(255, 255, 255, 0.5);
  color: #333;
}

.tab-button.active {
  background-color: white;
  color: #333;
  box-shadow: 0px 0px 5px -2px black;
}

.tab-button:focus {
  outline: none;
  box-shadow: 0px 0px 5px -2px black;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .tab-buttons {
    width: fit-content !important;
    justify-content: flex-start;
    margin-left: 12px;
  }
  
  .tab-button {
    flex: none; 
    text-align: center;
    font-size: 12px;
    padding: 4px 8px;
    min-width: auto;
    width: auto;
  }
}

@media (max-width: 480px) {
  .tab-buttons {
    padding: 6px;
    gap: 12px;
  }
  
  .tab-button {
    font-size: 10px;
    padding: 3px 6px;
  }
}

  /* Not active (default look on mobile) */
  /* .tab-toggle-button:not(.active) {
    background-color: #c6c7d1 !important;
  }

  .tab-toggle-button:not(.active) svg path {
    fill: #727c93 !important;
  } */

  /* Active still = transparent bg + greyish svg */
  /* .tab-toggle-button.active {
    background-color: transparent !important;
  }

  .tab-toggle-button.active svg path {
    fill: #727c93 !important;
  } */

  /* Manually applied hover effect (via JS) */
  /* .tab-toggle-button.force-hover svg path {
    fill: #374a68 !important;
  }
} */

.submission-block-title {
  font-size: 10px;
  color: black;
  margin: 0;
}

mjx-container {
  overflow: auto !important;
}

.MathJax {
  /* display: inline !important; */
}

/* Hide the separate timer element since we're using ::before */
.timer {
  display: none;
}

.markdown-content {
  font-family: Cmu, Arial, sans-serif !important;
}

.submission-image-container img {
  width: 100%;
  max-width: 100%;
  height: 180px;
  object-fit: contain;
  margin-top: 10px;
}

/* handles feedback popup in mobile */
@media (max-width: 780px) {
  .popup {
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
    margin: 0 auto !important;
    padding-top: env(safe-area-inset-top, 20px);
  }

  .close-and-collapse-icon {
    display: none !important;
    /* position: sticky;
    top: env(safe-area-inset-top, 10px); */
    /* height: 95px; */
    /* z-index: 10000;
    background-color: white;
    padding: 8px 16px;
    align-items: end; */
  }

  .popup-content {
    max-width: 100vw;
    box-sizing: border-box;
    height: auto !important;
    max-height: 100vh !important;
    padding-top: calc(env(safe-area-inset-top, 10px) + 65px);
  }

  .popup-content * {

    /* max-width: 100%; */
    word-break: break-word;
  }

  .image-gallery img,
  .submission-image-container img {
    max-width: 100%;
    height: auto;
  }

  /* handles the thank you for submission and time spinner in mobile */
  .popup.loading {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .popup.loading p {
    font-size: 13px;
    max-width: 65vw;
    text-align: center;
    margin-right: 80px;
    background: white;
    padding: 10px 14px;
    box-shadow: 0 0 9px 3px #0003;
    line-height: 1.4;
  }

  body.no-scroll-mobile {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
  }

  .popup-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; /* Prevent scroll chaining to background */
    /* height: 100vh; Ensure it gets full scrollable height */
    /* padding-top: calc(env(safe-area-inset-top, 20px) + 25px); ensure content clears the top bar */
    box-sizing: border-box;
    /* margin-top: 80px !important; */
  }

  #popup-body {
    /* padding-top: calc(env(safe-area-inset-top, 20px) + 65px); */
  }
}

.popup-error-centered {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.popup-error-message {
  font-size: 16px;
  color: #000;
  line-height: 1.5;
  max-width: 90%;
}

.submission-details-popup #submission-details-body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.submission-details-popup .loader.submission {
  height: calc(100vh - 80px); /* Account for header space */
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  overflow: hidden;
}

.submission-details-popup .loading-spinner.big {
  margin-bottom: 16px;
}

.submission-details-popup .loader.submission p {
  text-align: center;
  margin: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  max-width: none;
}

mjx-container[jax="CHTML"][display="false"] mjx-c.TEX-I::before {
  /* fixes for n alignment */
  padding: 0.694em 0.521em 0.011em 0 !important;
}

.submission-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
}

@media (max-width: 768px) {
  .submission-action-wrapper {
    gap: 6px;
  }
  
  .submission-action-wrapper .action-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
  
  .action-text {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .submission-action-wrapper {
    flex-direction: row; /* Keep buttons in a row even on small screens */
    gap: 4px;
  }
  
  .submission-action-wrapper .action-btn {
    padding: 6px 8px;
    min-width: auto;
  }
  
  /* On very small screens, you might want to show only icons */
  .submission-action-wrapper .action-text {
    display: none;
  }
  
  .submission-action-wrapper .action-icon {
    width: 10px;
    height: 10px;
  }
}

.copy-gray {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  margin-bottom: 1px;
}

.copy-gray:hover {
  cursor: pointer;
  transform: scale(1.05);
}

.action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  color: black;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  background-color: transparent;
  border: none;
}

.action-btn:hover {
  background: #a5a5a5;
  color: black;
  border-radius: 8px;
}

.action-btn:active {
  transform: translateY(0);
}

.action-icon {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .submission-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .action-buttons {
    align-self: flex-end;
  }
  
  .action-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .submission-header {
    flex-direction: row;
    justify-content: space-between;
  }
  
  .action-buttons {
    align-self: center;
  }
  
  .action-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .action-text {
    display: none; /* Hide text on very small screens, show only icons */
  }
}

/* Submission content styling */
.submission-content {
  margin-top: 0;
}

/* New submission header styling */
.submission-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  width: 100%;
}

.solution-title {
  font-size: 10px; 
  font-weight: 500;
  color: #333;
  margin: 0;
  font-family: inherit;
  flex-shrink: 0;
}

/* Action wrapper and button styling */
.submission-action-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.submission-action-wrapper .action-btn {
  flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Style for when there are multiple buttons (text-only case) */
.submission-action-wrapper .copy-btn {
  border-radius: 6px;
}

.submission-action-wrapper .copy-btn:hover {
  background-color: #f3f3f2;
}

.submission-action-wrapper .download-btn {
  color: black;
  border-radius: 6px;
}

.submission-action-wrapper .download-btn:hover {
  background-color: #f3f3f2;
  color: black;
}


.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  color: black;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
  outline: none;
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn:focus {
  border-color: var(--primary-color);
}

.action-text {
  font-size: 10px;
  line-height: 1;
  font-weight: 500;
}

/* Submission content styling */
.submission-content {
  margin-top: 0;
}

.text-submission {
  line-height: 1.4;
  word-break: break-word;
}

/* Image gallery improvements */
.image-gallery {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  margin-top: 12px;
  scroll-behavior: smooth;
}

.image-gallery::-webkit-scrollbar {
  height: 6px;
}

.image-gallery::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.image-gallery::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.image-gallery::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.submission-image-container {
  flex: 0 0 auto;
  max-width: 120px;
  position: relative;
}

.submission-image-container img {
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  opacity: 0.8;
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 4px;
}

.submission-image-container img:hover {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0px 0px 5px -2px black;
}

/* PDF submission styling */
.pdf-submission {
  margin-top: 12px;
  text-align: left;
}

.pdf-icon {
  max-width: 80px;
  height: auto;
  opacity: 0.8;
  transition: all 0.3s ease;
  border-radius: 4px;
}

.pdf-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .submission-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .submission-action-wrapper {
    align-self: flex-end;
    justify-content: flex-end;
  }
  
  .action-btn {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .action-text {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .submission-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .solution-title {
    font-size: 14px;
  }
  
  .action-btn {
    padding: 8px 12px;
    font-size: 11px;
    min-width: auto;
  }
  
  .action-text {
    display: none; /* Hide text on very small screens */
  }
  
  .action-icon {
    width: 10px;
    height: 10px;
  }
}

/* Remove the old copy button styles that were positioned absolutely */
.copy-btn.old-style {
  display: none;
}

/* Ensure proper spacing for submission ID footer */
.submission-id-footer {
  margin-top: 20px;
  padding-top: 16px;
  color: #888;
  font-style: italic;
}

.submission-id-value {
  cursor: pointer;
  font-style: italic;
  font-size: 12px;
  color: #888;
  transition: color 0.2s ease;
}

.submission-id-value:hover {
  text-decoration: underline;
  color: #666;
}


/* Copy Button for text input solution */
/* .copy-btn {
  position: absolute;
  top: -24px;
  right: -20px;
  background: #cac8c8;
  border: none;
  border-radius: 6px;
  padding: 4px 1px;
  cursor: pointer;
  z-index: 10;

  height: 32px;
  min-width: 100px;
  width: 100px; 
  text-align: center;
  box-sizing: border-box;
} */

/* .copy-btn:hover {
  background-color: #a9a9a9;
  cursor: pointer;
}

.copy-text {
  position: relative;
} */

/* .download-text {
  position: relative;
  top: 0.5px;
} */

.submission-id-footer {
  margin-top: 20px;
  color: #888;
  font-style: italic;
}

.submission-id-value {
  cursor: pointer;
  font-style: italic;
  font-size: 12px; 
  color: #888;
}

.submission-id-value:hover {
  text-decoration: underline;
}
/* .problem-pill {
  position: absolute;
  right: 70px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: white;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  z-index: 5;
  line-height: 1;
  white-space: nowrap;
} */

.timer-problem-container {
  position: fixed;
  display: flex;
  align-items: center;
  z-index: 10030;
}

/* Desktop positioning */
@media (min-width: 769px) {
  .timer-problem-container {
    right: 20px;
    bottom: 20px;
  }
}

/* Mobile positioning */
@media (max-width: 768px) {
  .timer-problem-container {
    right: 15px;
    bottom: 15px;
  }
}

/* Problem pill styling when inline with timer */
.problem-pill-with-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background: white;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  line-height: 1;
  white-space: nowrap;
  position: relative;
}

.problem-pill-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--dark-gray);
  margin: 0;
}

/* Timer circle inside the pill */
.pill-timer-circle {
  position: relative;
  width: 24px;
  height: 24px;
  background-color: #f8f9fa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
}

/* Timer number inside the integrated circle */
.pill-timer-circle .timer {
  font-size: 10px;
  font-weight: 600;
  color: #374151;
  z-index: 2;
  position: relative;
}


/* Spinner around the timer circle */
.pill-timer-spinner {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top: 2px solid var(--primary-color);
  animation: popupSpin 0.6s linear infinite;
}

/* Remove the old CSS pseudo-elements */
.timer-circle,
.timer-spinner,
.problem-pill-inline {
  display: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .problem-pill-with-timer {
    font-size: 12px;
    padding: 5px 10px;
    gap: 6px;
  }
  
  .problem-pill-text {
    font-size: 12px;
  }
  
  .pill-timer-circle {
    width: 20px;
    height: 20px;
  }
  
  .pill-timer-circle .timer {
    font-size: 9px;
  }
  
  .pill-timer-spinner {
    width: 20px;
    height: 20px;
    top: -1px;
    left: -1px;
    border-width: 1.5px;
  }
}

.timer-circle,
.timer-spinner,
.problem-pill-inline {
  display: none;
}


@media (max-width: 780px) {
  /* Show integrated pill during loading on mobile */
  .problem-pill-with-timer {
    position: fixed !important;
    right: 15px !important;
    bottom: 15px !important;
    z-index: 10030 !important;
  }
}

.pdf-icon {
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.7
}

.pdf-icon:hover {
  opacity: 1.0;
  transform: scale(1.1);
}