/* ── Shared Report Table ── */
/* Used by: public/app/index.html (progress + accuracy)
            public/app/quiz.html  (SRS: total + due + review + new)
   Customise per-page via modifier classes on the <table>:
     .report-table--srs  → overrides for the SRS breakdown table          */

.report-table-wrap {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.report-table th {
  text-align: left;
  padding: 12px 12px;
  background: var(--bg);
  border-bottom: 1.5px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.report-table th:first-child {
  padding-left: 20px;
  width: 55%;
  border-top-left-radius: var(--radius-lg);
}
.report-table th:last-child {
  padding-right: 20px;
  text-align: right;
  border-top-right-radius: var(--radius-lg);
}

.report-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.report-table td:first-child { padding-left: 20px; }
.report-table td:last-child  { padding-right: 20px; text-align: right; }

.report-table tr:last-child td {
  border-bottom: none;
}

/* Week / section group header row */
.report-week-header td {
  background: var(--bg);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  padding: 10px 20px !important;
  border-bottom: 1.5px solid var(--border);
  text-align: left !important;
}

.week-header-title {
  margin-bottom: 8px;
}

.week-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.week-summary-stats {
  display: flex;
  gap: 10px;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-2);
  flex-wrap: nowrap;
}

.week-summary-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  transition: all 200ms ease;
  cursor: default;
  position: relative;
}

.week-summary-item:hover {
  background: var(--accent);
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 168, 0.3);
}

.week-summary-item:hover .week-summary-lbl,
.week-summary-item:hover .week-summary-val {
  color: white !important;
}

.week-summary-lbl {
  color: var(--text-3);
  font-weight: 400;
}

.week-summary-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
}

.week-summary-item.goal {
  background: none;
  border: 1px dashed var(--accent-light);
  color: var(--accent);
}

.week-summary-item.goal:hover {
  border-style: solid;
  background: var(--accent);
}

.week-summary-item.goal .week-summary-lbl {
  color: var(--accent);
  opacity: 0.8;
}

/* Sortable column headers */
.report-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.report-table th.sortable:hover {
  color: var(--accent);
}
.sort-icon {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.7rem;
  opacity: 0.7;
  vertical-align: middle;
}

/* Clickable pill inside a table cell */
.report-pill-btn {
  background: none;
  border: none;
  padding: 2px 8px;
  margin: -2px -8px;
  font-weight: 400;
  color: var(--accent);
  font-size: 0.75rem;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  border-radius: 4px;
  transition: all 150ms;
  display: inline-block;
}

.report-pill-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.report-pill-btn.selected {
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 400;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

/* Progress column: total (left) + dots + bar stack (fills remainder) */
.srs-report-progress-cell {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.srs-report-total-cell {
  flex-shrink: 0;
}

.srs-report-progress-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.srs-report-top-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-2);
  width: 100%;
  min-width: 0;
}

.srs-report-top-count .dot-bar {
  width: 100%;
  box-sizing: border-box;
}

.report-table .prog-label {
  font-size: 0.6rem;
}

/* Dot series for compact question/card counts (5 questions per dot). */
.dot-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding-left: 0;
  margin-bottom: 0;
}

.q-dot {
  width: 3px;
  height: 3px;
  background: #3abcf0;
  border-radius: 0.5px;
  flex-shrink: 0;
}

.q-dot-topic {
  background: #8a9be5;
}

/* Accuracy badge pill */
.report-accuracy {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
}

.accuracy-red    { background: var(--wrong-bg);   color: var(--wrong);   }
.accuracy-yellow { background: #fef9c3;            color: #854d0e;        }
.accuracy-orange { background: #ffedd5;            color: #9a3412;        }
.accuracy-green  { background: var(--correct-bg);  color: var(--correct); }
.accuracy-none   { background: var(--surface-2);   color: var(--text-3);  }

/* ── SRS variant — numeric stat cells ── */
.report-table--srs .rt-num {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-width: 24px;
  height: 16px;
  padding: 0 3px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
}

.report-table--srs .rt-num.due      { background: #fce8e6; color: #ea4335; } /* Google Red tint */
.report-table--srs .rt-num.learning { background: #fef7e0; color: #fbbc04; } /* Google Yellow tint */
.report-table--srs .rt-num.review   { background: #e6f4ea; color: #34a853; } /* Google Green tint */
.report-table--srs .rt-num.new-c    { background: #e8f0fe; color: #4285f4; } /* Google Blue tint */
.report-table--srs .rt-num.ly       { background: #e7e5e4; color: #57534e; } /* Low-yield (stone) */
.report-table--srs .rt-num.zero     { background: transparent; color: var(--text-3); font-weight: 400; }

.report-table--srs .rt-stat-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* SRS table: Topic column */
.report-table--srs th:first-child { width: 35%; }
.report-table--srs td:first-child { vertical-align: middle; }

/* SRS Progress Bar Segments (80% of progress stack width; dot-bar remains full width) */
.rt-prog-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-2);
  width: 80%;
  box-sizing: border-box;
  margin-top: 4px;
}
.rt-seg { height: 100%; transition: width 0.3s ease; }
.rt-seg-due    { background: #ea4335; } /* Google Red */
.rt-seg-lrn    { background: #fbbc04; } /* Google Yellow */
.rt-seg-rev    { background: #34a853; } /* Google Green */
.rt-seg-new    { background: #4285f4; opacity: 0.3; } /* Google Blue */
.rt-seg-ly {
  background: linear-gradient(90deg, #78716c, #d6d3d1, #78716c);
  background-size: 200% 100%;
  min-width: 0;
}

.rt-ly-sup {
  font-size: 0.58rem;
  font-weight: 700;
  margin-left: 1px;
  opacity: 0.88;
}

/* Numeric columns in SRS table */
.report-table--srs th:nth-child(3),
.report-table--srs td:nth-child(3) {
  text-align: left; /* Align Status header with first number */
  padding-left: 12px;
}

.report-table--srs th:last-child,
.report-table--srs td:last-child {
  text-align: right;
}

/* Responsive ── */
@media (max-width: 600px) {
  .week-summary-lbl {
    display: none;
  }
  .week-summary-item {
    padding: 1px 6px;
    font-size: 0.55rem;
  }
  .report-table th,
  .report-table td {
    padding-left: 8px;
    padding-right: 8px;
  }
  .report-table th:first-child,
  .report-table td:first-child {
    padding-left: 12px;
  }
  .report-table th:last-child,
  .report-table td:last-child {
    padding-right: 12px;
  }
}
