/* === Practice Data Visualization === */

body.practice-page {
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
}

.practice-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* --- Stat Summary Row --- */
.stat-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 12px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Calendar Heatmap --- */
.calendar-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 20px;
}

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

.calendar-header .month-title {
  font-size: 1rem;
  font-weight: 600;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-nav button {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-nav button:active {
  background: var(--bg);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 4px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-cell {
  aspect-ratio: 1;
  max-width: 36px;
  width: 100%;
  margin: 0 auto;
  border-radius: 6px;
  background: var(--bg);
  position: relative;
  cursor: pointer;
  transition: transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.calendar-cell:active {
  transform: scale(0.92);
}

.calendar-cell.empty {
  background: transparent;
  cursor: default;
}

.calendar-cell.today {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.calendar-cell.level-1 {
  background: #c6e48b;
  color: #333;
}

.calendar-cell.level-2 {
  background: #7bc96f;
  color: #fff;
}

.calendar-cell.level-3 {
  background: #239a3b;
  color: #fff;
}

.calendar-cell.level-4 {
  background: #196127;
  color: #fff;
}

.calendar-cell.selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.calendar-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.calendar-legend .legend-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* Day detail popup */
.day-detail {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 0.85rem;
  display: none;
}

.day-detail.visible {
  display: block;
}

.day-detail .day-date {
  font-weight: 600;
  margin-bottom: 6px;
}

.day-detail .day-songs {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Song List --- */
.song-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.song-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.1s;
}

.song-card:active {
  transform: scale(0.98);
}

.song-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.song-card-info {
  flex: 1;
  min-width: 0;
}

.song-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.song-card-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.attempt-badge {
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.familiarity-tag {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 500;
}

.familiarity-tag.raw      { background: #f0f0f0; color: #999; }
.familiarity-tag.learning { background: #fff3e0; color: #e65100; }
.familiarity-tag.good     { background: #e8f5e9; color: #2e7d32; }

.song-card-expand {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform 0.2s;
}

.song-card.expanded .song-card-expand {
  transform: rotate(90deg);
}

/* Progress bar */
.song-progress-bar {
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.song-progress-bar .fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #c6e48b, #239a3b);
  transition: width 0.3s;
}

/* Expanded recording list */
.song-recordings {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.song-card.expanded .song-recordings {
  max-height: 600px;
}

.recording-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.recording-item:first-child {
  margin-top: 10px;
}

.recording-date {
  color: var(--text-secondary);
  font-size: 0.78rem;
  min-width: 80px;
}

.recording-duration {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.recording-play-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recording-play-btn:active {
  opacity: 0.8;
}

.recording-audio {
  flex: 1;
  min-width: 0;
}

.recording-audio audio {
  width: 100%;
  height: 32px;
}

/* --- Teacher Dashboard --- */
.teacher-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.dashboard-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.dashboard-summary .stat-card {
  flex: 1;
}

.student-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .student-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.student-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.1s;
  border-left: 4px solid var(--border);
}

.student-card:active {
  transform: scale(0.98);
}

.student-card.active-green {
  border-left-color: #2e7d32;
}

.student-card.active-orange {
  border-left-color: #e65100;
}

.student-card.active-gray {
  border-left-color: var(--text-muted);
}

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

.student-card-name {
  font-size: 1rem;
  font-weight: 600;
}

.student-card-code {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 8px;
}

.student-card-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.student-card-stats .label {
  color: var(--text-muted);
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

.activity-dot.green  { background: #2e7d32; }
.activity-dot.orange { background: #e65100; }
.activity-dot.gray   { background: var(--text-muted); }

/* Sort bar */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sort-bar .count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- Loading & Empty States --- */
.practice-loading {
  text-align: center;
  padding: 60px 0;
  color: var(--text-muted);
}

.practice-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.practice-empty .icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* --- Practice Stats Button (for student.html) --- */
.practice-stats-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.1s, opacity 0.2s;
}

.practice-stats-btn:active {
  transform: scale(0.97);
}

.practice-stats-btn .icon {
  font-size: 1.2rem;
}
