/* ----------------------------------------------------------------
   SECTION: Results and Submissions Base
   ---------------------------------------------------------------- */

/* Container for the table */
#past_submissions {
  margin: 50px auto;
  width: 100%;
}

/* Submissions Table Styles */
.table-wrapper {
  box-shadow: 0px 0px 5px -2px black;
  background-color: #fff; /* required to make the shadow pop */
  border-radius: 5px;
}

.submissions-table {
  width: 100%;
  font-size: 1rem;
  border-collapse: collapse;
  table-layout: fixed;
}

.submissions-table td:nth-child(1) {
  width: 25%; /* Wide Problem Name column */
}

.submissions-table td:nth-child(2) {
  width: 10%; /* Small XP column */
  text-align: center;
}

.submissions-table td:nth-child(3) {
  width: 55%; /* Submissions column takes remaining space */
}

/* General cell styling */
.submissions-table td {
  padding: 11px;
  text-align: left;
  word-wrap: break-word;
  overflow: hidden;
}

.submissions-table th {
  background-color: #f7f7f7;
  font-weight: 700;
}

.submissions-table td {
  overflow: hidden; /* Hide overflow text */
}

.submissions-table tr {
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: border-left 0.2s ease; /* smooth transition */
}
.submissions-table tr:hover {
  border-left: 4px solid var(--primary-color);
}

/* Grades List Styles */
.grades-list {
  display: flex;
  align-items: center;
  gap: 0px;
}
.other-results {
  display: flex;
  align-items: center;
  padding-left: 0;
  margin-left: 0;
  gap: 10px;
  /* overflow-x: auto; */
  /* overflow-y: hidden; */
  /* max-width: 465px; */
  /* padding: 4px 0 4px 0px; */
}

.other-results-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 465px;
  padding: 4px 0;
  margin-left: -30px;
  padding-left: 30px;
  display: inline-block;
}

.grades-list a {
  padding: 9px 8px;
  margin-right: 10px;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  text-decoration: none;
  border-radius: 4px;
  transition: filter 0.2s, transform 0.2s; /* Smooth transition for hover effects */
  cursor: pointer; /* Change cursor to pointer */
  text-align: center;
  flex-shrink: 0;
}
.grades-list a div {
  line-height: 100%;
}
.grades-list a div {
  font-size: 10px;
  font-weight: 400;
}
.grades-list a div.grade-value {
  font-size: var(--text-base);
  margin-bottom: 4px;
  font-weight: 700;
}

.grades-list a:hover {
  filter: brightness(0.9); /* Darken the background color by 10% */
  transform: scale(1.05); /* Slight scaling effect */
}

.best-result {
  width: 64px;
  min-width: 64px;
  height: 60px;
  min-height: 60px;
}

.grades-list a.best-grade {
  width: 64px;
  min-width: 64px;
  height: 60px;
  min-height: 60px;
  display: inline-block;
}

/* Submission Details Styles */
#submission-details {
  font-size: 16px;
  color: #333;
}

/* Paragraph Styles */
p {
  white-space: pre-wrap;
}

/* Response Field Styles */
.response-field {
  margin-bottom: 0;
  margin-top: 0;
}

#loading-results-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.loading-results-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top: 4px solid #374b6a; /* Primary color */
  animation: spin-results 0.8s linear infinite;
}

#loading-results-container p {
  color: #374b6a; /* Text color */
  font-size: 16px;
  margin-top: 10px;
}

.loading {
  display: flex;
  align-items: center;
  gap: 20px;
  width: auto;
  padding-right: 15px;
}

.submission-info {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  line-height: 100%;
}
.submission-info:last-child {
  margin-bottom: 0px;
}
.submission-info:first-child {
  margin-bottom: 9px;
}

.submission-info-label {
  font-size: var(--text-small);
  color: #949494;
}

.submission-info-value {
  font-size: var(--text-small);
}

/* Stats styles */
#stats {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 40px;
}

.brain-cells {
  width: 25%;
  position: relative;
  background: #fff;
  box-shadow: 0px 0px 5px -2px black;
  padding: 20px 0;
  height: 221px;
  border-radius: 5px;
}
.brain-cells h2 {
  font-size: 18px;
  text-align: center;
  margin-bottom: 5px;
}
.brain-cells-value {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.stats-xp-value {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  font-size: 18px;
  font-weight: 700;
}
.brain-cells img {
  position: absolute;
  bottom: 7px;
  right: 7px;
  width: 24px;
}

.problems-solved {
  flex: 1;
  background: #fff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  height: 100%;
}

.donut {
  width: 150px;
  height: 150px;
  display: inline-block;
}

.donut svg {
  width: 150px;
  height: 150px;
  display: block; /* instead of flex */
  transform: rotate(90deg);
}

.donut svg .track {
  stroke: var(--light-purple);
  stroke-width: 20;
  fill: none;
}

.donut-skeleton svg .track {
  stroke: #e0e0e0;
  stroke-width: 20;
  fill: none;
}

.donut svg .fill {
  stroke: var(--purple);
  stroke-linecap: round;
  stroke-width: 20;
  fill: none;
  transition: stroke-dashoffset 1s ease;
}

.donut-skeleton svg .fill {
  stroke: #e0e0e0;
  stroke-linecap: round;
  stroke-width: 20;
  fill: none;
  transition: stroke-dashoffset 1s ease;
}

.donut svg .track {
  stroke: var(--light-purple);
}

.donut-skeleton svg .track {
  stroke: #e0e0e0;
}

.donut svg text {
  transform: rotate(90deg);
  font-size: 20px;
  fill: #c6e8d7;
  font-family: sans-serif;
}

.dashboard-card {
  background-color: white;
  box-shadow: 0px 0px 5px -2px black;
  padding: 24px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  height: 221px;
  border-radius: 5px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

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

.score {
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

.progress-bar {
  height: 24px;
  background-color: #f0f0f0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  margin-bottom: 16px;
}

.progress-segment-perfect {
  background-color: #7ed321;
  height: 100%;
  width: 50%;
}

.progress-segment-nearly {
  background-color: #c5f29c;
  height: 100%;
  width: 12.5%;
}

.progress-segment-partial {
  background-color: #fff9c4;
  height: 100%;
  width: 12.5%;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 40px;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #333;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
}

.legend-dot-perfect {
  background-color: #7ed321;
}

.legend-dot-nearly {
  background-color: #c5f29c;
}

.legend-dot-partial {
  background-color: #fff9c4;
}

.submissions {
  font-size: 14px;
  color: #777;
}

.target-icon-img {
  width: 24px;
  height: 24px;
}

.dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Skeleton base style */
.skeleton-text,
.skeleton-bar,
.skeleton-circle-text,
.skeleton-img-placeholder,
.skeleton-grade-box,
.skeleton-divider,
/* .progress-bar, */
.skeleton-row .skeleton-problem-num,
.skeleton-problem-name,
.skeleton-label,
.skeleton-value,
.skeleton-xp-circle {
  background-color: #e0e0e0;
  border-radius: 4px;
  animation: skeleton-loading 1.5s infinite ease-in-out; /* here */
}

/* Sizes */
.skeleton-text.tiny {
  width: 100px;
  height: 12px;
}
.skeleton-text.short {
  width: 94%;
  height: 18px;
  margin-left: 5px;
  margin-right: 5px;
}
.skeleton-text.medium {
  width: 120px;
  height: 18px;
}
.skeleton-bar {
  width: 100%;
  height: 24px;
  border-radius: 12px;
}
.skeleton-circle-text {
  position: absolute;
  width: 50px;
  height: 20px;
  background-color: #e0e0e0;
  border-radius: 4px;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
}
.skeleton-img-placeholder {
  width: 24px;
  height: 24px;
  background-color: #e0e0e0;
  border-radius: 4px;
  position: absolute;
  bottom: 7px;
  right: 7px;
}

/* Skeleton animation */
@keyframes skeleton-loading {
  0% {
    background-color: #e0e0e0;
  }
  50% {
    background-color: #f0f0f0;
  }
  100% {
    background-color: #e0e0e0;
  }
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .legend {
    flex-direction: column;
    gap: 12px;
  }
}

/* Submissions Skeleton Styles */
.skeleton-table-wrapper {
  width: 100%;
  overflow: hidden;
}

.skeleton-submissions-table {
  width: 100%;
  border-collapse: collapse;
}

.skeleton-row {
  height: 120px;
  border-bottom: 1px solid #f0f0f0;
}

.skeleton-row td {
  padding: 15px;
  vertical-align: top;
}

.skeleton-problem-num {
  width: 30px;
  height: 20px;
  background: #f0f0f0;
  border-radius: 4px;
  margin-bottom: 8px;
  display: inline-block;
}

.skeleton-problem-name {
  width: 150px;
  height: 20px;
  background: #f0f0f0;
  border-radius: 4px;
  margin-left: 10px;
  display: inline-block;
}

.skeleton-label {
  width: 100px;
  height: 14px;
  background: #f0f0f0;
  border-radius: 4px;
  margin: 8px 0 4px 0;
}

.skeleton-value {
  width: 120px;
  height: 14px;
  background: #f0f0f0;
  border-radius: 4px;
}

.skeleton-value.short {
  width: 60px;
}

.skeleton-xp-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #f0f0f0;
  margin: 0 auto;
  margin-bottom: 30px;
}

.skeleton-grades-container {
  display: flex;
  align-items: center;
  height: 100%;
  margin-bottom: 10px;
}

.skeleton-grade-box {
  width: 64px;
  height: 60px;
  background: #f0f0f0;
  border-radius: 6px;
  margin-right: 8px;
}

.skeleton-divider {
  width: 1px;
  height: 60px;
  background: #f0f0f0;
  margin: 0 10px;
}

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

/* media queries for smaller screen for results screen */
@media (max-width: 768px) {
  /* Make #stats stack vertically instead of side-by-side */
  #stats {
    flex-direction: column;
    gap: 20px;
  }

  /* Ensure .brain-cells remains square and full width */
  .brain-cells {
    width: 100%;
    height: auto;
  }

  .donut {
    width: 100%;
    height: auto;
    max-width: 150px;
    margin: auto;
  }

  .donut svg {
    width: 100%;
    height: auto;
  }

  /* Make dashboard-card (Problems Solved) full width */
  .dashboard-card {
    width: 100%;
    height: auto;
    padding: 16px;
    box-sizing: border-box;
  }

  /* Legend stacked vertically with smaller gaps */
  .legend {
    flex-direction: column;
    gap: 12px;
  }

  /* Submissions table wrapper scrollable horizontally */
  .table-wrapper {
    overflow-x: auto;
    width: 100%;
  }

  .submissions-table tr {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
    border-bottom: 1px solid #eee;
    padding: 8px;
    padding-top: 28px;
    padding-bottom: 12px;
    flex-wrap: wrap;
  }
  .submissions-table td {
    width: 100% !important;
    padding: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .submissions-table td:nth-child(1) {
    flex-direction: column;
    align-items: flex-start;
  }

  .submissions-table td:nth-child(2),
  .submissions-table td:nth-child(3) {
    justify-content: flex-start;
  }

  .submissions-table td:last-child {
    width: 100%;
  }

  .grades-list {
    justify-content: center;
    margin-bottom: 12px;
  }

  .problem-info-cell {
    flex: 1;
    min-width: 0;
  }

  .xp-circle-cell {
    width: 60px !important;
    flex: 0 0 60px;
  }
}
