/* Period pills — Cyberdeck style */
.period-pill {
  padding: 8px 14px;
  background: transparent;
  color: var(--ink-2);
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: all 0.15s ease;
}
.period-pill:hover { color: var(--ink); }
.period-pill.active {
  background: var(--red);
  color: #0A0A0A;
}

/* History mid grid responsive */
.history-mid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
@media (max-width: 900px) { .history-mid { grid-template-columns: 1fr !important; } }

/* Selector de período */
.period-selector {
  display: flex;
  gap: 4px;
  background: var(--color-surface);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.period-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.period-btn:hover { color: var(--color-text); }
.period-btn.active {
  background: var(--color-primary);
  color: #fff;
}

/* Grid de estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow: hidden;
}

.stat-chart-card h4 {
  margin-bottom: 4px;
}

.stat-chart-card p {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.stat-chart-card canvas {
  max-width: 100%;
}

/* Tarjetas de resumen rápido */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.quick-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.quick-stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-primary);
  display: block;
}

.quick-stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  display: block;
}

/* Tabla de historial */
.history-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 24px;
}

.history-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

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

.history-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
}

.history-table td {
  padding: 12px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--color-border);
}

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

.history-table tr:hover td {
  background: var(--color-surface-2);
}

.session-type-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

.session-type-badge.study {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-info);
}

.session-type-badge.practice {
  background: var(--color-primary-dim);
  color: var(--color-primary);
}

/* Score pill */
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.score-pill.high { background: rgba(34, 197, 94, 0.15); color: var(--color-success); }
.score-pill.mid { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.score-pill.low { background: rgba(239, 68, 68, 0.15); color: var(--color-error); }

/* Heatmap de consistencia */
.heatmap-wrapper {
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(52, 12px);
  gap: 3px;
  padding: 8px 0;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

.heatmap-cell.level-1 { background: rgba(255, 42, 42, 0.25); }
.heatmap-cell.level-2 { background: rgba(255, 42, 42, 0.5); }
.heatmap-cell.level-3 { background: rgba(255, 42, 42, 0.75); }
.heatmap-cell.level-4 { background: var(--color-primary); box-shadow: 0 0 4px var(--red-glow); }

@media (max-width: 900px) {
  .quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-table th:nth-child(3),
  .history-table td:nth-child(3) {
    display: none;
  }
}

@media (max-width: 480px) {
  .period-selector {
    flex-wrap: wrap;
  }
}
