* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
body {
  background: #f9f9f9;
  color: #212529;
  padding: 16px;
}

/* 顶部按钮栏 */
.top-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: space-between;
}

.user-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #4CAF50;
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.user-btn:hover {
  background: #388E3C;
  transform: scale(1.05);
}

/* 标签页 */
.tab-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  background: #e0e0e0;
  color: #333;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab-btn.active {
  background: #4CAF50;
  color: white;
}

.page { display: none; }
.page.active { display: block; }

/* 视图切换按钮（单个按钮） */
.view-switcher-single {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.view-toggle-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #4CAF50;
  color: white;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.view-toggle-btn:hover {
  background: #388E3C;
  transform: translateY(-1px);
}

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

/* 日历视图 */
.calendar-container {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  height: 380px;
  display: flex;
  flex-direction: column;
}

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

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.calendar-btn:hover {
  background: #e0e0e0;
}

.calendar-title {
  font-weight: bold;
  font-size: 16px;
  color: #333;
  min-width: 140px;
  text-align: center;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
  text-align: center;
  font-weight: bold;
  color: #666;
  font-size: 12px;
  flex-shrink: 0;
}

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

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  padding: 4px;
  min-height: 40px;
}

.calendar-day:hover {
  background: #f5f5f5;
}

.calendar-day.selected {
  border: 2px solid #2196F3;
}

.calendar-day.today {
  border: 2px solid #4CAF50;
}

.calendar-day.has-workout {
  background: #4CAF50;
  color: white;
}

.calendar-day.has-workout:hover {
  background: #388E3C;
}

.calendar-day.other-month {
  color: #ccc;
}

.day-number {
  font-size: 14px;
  font-weight: bold;
}

.workout-dots {
  position: absolute;
  bottom: 2px;
  display: flex;
  gap: 1px;
}

.workout-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: white;
}

/* 列表视图 */
.list-container {
  display: flex;
  flex-direction: column;
  height: 380px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
  margin-bottom: 20px;
}

.list-main {
  flex: 1;
  overflow-y: auto;
}

.list-header {
  padding: 16px;
  border-bottom: 1px solid #eee;
  font-weight: bold;
  color: #333;
  font-size: 16px;
  flex-shrink: 0;
  background: #f9f9f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-content {
  flex: 1;
  overflow-y: auto;
}

.list-item {
  padding: 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.2s;
}

.list-item:hover {
  background: #f9f9f9;
}

.list-item.selected {
  background: #e8f5e9;
}

.list-item:last-child {
  border-bottom: none;
}

.list-date {
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-badge {
  background: #2196F3;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.date-badge.today {
  background: #4CAF50;
}

.list-exercises {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.exercise-tag {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: bold;
}

.no-exercises {
  color: #999;
  font-size: 12px;
  font-style: italic;
}

/* 记录页 */
.controls {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

button {
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:active {
  transform: scale(0.98);
}

.btn-add { background: #2196F3; color: white; }
.btn-add:hover { background: #1976D2; }
.btn-add-group { background: #9C27B0; color: white; }
.btn-add-group:hover { background: #7B1FA2; }
.btn-save { background: #4CAF50; color: white; }
.btn-save:hover { background: #388E3C; }

/* 记录表格容器（新增） */
.mobile-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: white;
}

/* 隐藏滚动条但保持可滚动 */
.mobile-table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.mobile-table-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.mobile-table-wrapper::-webkit-scrollbar-thumb {
  background: #4CAF50;
  border-radius: 10px;
}

/* 调整表格为固定宽度以支持左右滑动 */
.mobile-table-wrapper .log-table {
  min-width: 700px;
  width: auto;
  margin: 0;
  table-layout: auto;
  box-shadow: none;
  border-radius: 0;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin: 16px 0;
  table-layout: fixed;
}

.log-table th,
.log-table td {
  padding: 12px 4px;
  text-align: center;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  word-break: break-word;
}

.log-table th {
  background: #f1f8e9;
  color: #2e7d32;
}

.col-action { width: 28%; min-width: 100px; }
.col-type   { width: 12%; }
.col-weight { width: 12%; }
.col-group  { width: 10%; }
.col-op     { width: 60px; }

.action-cell input,
.action-cell select,
.weight-input {
  width: 100%;
  padding: 6px 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
}

.action-cell input { text-align: left; padding-left: 8px; }

.group-input {
  width: 100%;
  padding: 6px 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
}

/* 操作列样式 */
.row-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0;
}

.row-btn {
  padding: 4px 8px;
  font-size: 12px;
  border: none;
  border-radius: 6px;
  background: #ffebee;
  color: #d32f2f;
  cursor: pointer;
  transition: background-color 0.2s;
}

.row-btn:hover {
  background: #ffcdd2;
}

/* 统计表格 */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin: 16px 0;
  table-layout: fixed;
}

.stats-table th,
.stats-table td {
  padding: 12px 6px;
  text-align: center;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  word-break: break-word;
}

.stats-table th {
  background: #e8f5e9;
  color: #2e7d32;
}

.stats-table td:first-child {
    text-align: left;
}
            
/* 列宽设置 */
.stats-table th:nth-child(1),
.stats-table td:nth-child(1) {
    width: 38%;
}

.stats-table th:nth-child(2),
.stats-table td:nth-child(2) {
    width: 16%;
}

.stats-table th:nth-child(3),
.stats-table td:nth-child(3) {
    width: 12%;
}

.stats-table th:nth-child(4),
.stats-table td:nth-child(4) {
    width: 12%;
}

.stats-table th:nth-child(5),
.stats-table td:nth-child(5) {
    width: 22%;
}

.main-row {
    background: #fff;
    font-weight: bold;
    cursor: pointer;
}

.main-row:hover {
    background: #f0f8f0;
}

.sub-row {
    display: none;
    background: #f9f9f9;
}

/* 统计卡片 */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.value {
  font-size: 28px;
  font-weight: bold;
  color: #2196F3;
  margin: 8px 0;
}

.label {
  font-size: 14px;
  color: #666;
}

/* 折叠控制 */
.main-row {
  background: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.main-row:hover {
  background: #f0f8f0;
}

.sub-row {
  display: none;
  background: #f9f9f9;
  font-size: 13px;
}

.toggle-icon {
  display: inline-block;
  width: 8px;
  text-align: center;
  margin-right: 2px;
  transition: transform 0.2s;
}

.expanded .toggle-icon {
  transform: rotate(90deg);
}

.footer-note {
  text-align: center;
  color: #777;
  font-size: 13px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

/* 加载状态 */
.loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

.spinner {
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top: 3px solid #4CAF50;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

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

/* 用户和配置弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.modal-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #f5f5f5;
}

/* 用户信息表单 */
.user-info {
  text-align: center;
  margin-bottom: 24px;
}

.user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #4CAF50;
  color: white;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.user-name {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 8px;
}

.user-id {
  color: #666;
  font-size: 14px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-label {
  font-weight: bold;
  font-size: 14px;
  color: #333;
  text-align: left;
}

.form-input {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.form-input:focus {
  outline: none;
  border-color: #4CAF50;
}

/* 按钮组 */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.modal-btn {
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  transition: background-color 0.2s;
}

.modal-btn.primary {
  background: #4CAF50;
  color: white;
}

.modal-btn.primary:hover {
  background: #388E3C;
}

.modal-btn.secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
}

.modal-btn.secondary:hover {
  background: #e0e0e0;
}

.modal-btn.warning {
  background: #ff9800;
  color: white;
}

.modal-btn.warning:hover {
  background: #f57c00;
}

/* 配置表单 */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.form-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

.form-btn.primary {
  background: #4CAF50;
  color: white;
}

.form-btn.primary:hover {
  background: #388E3C;
}

.form-btn.secondary {
  background: #f5f5f5;
  color: #333;
}

.form-btn.secondary:hover {
  background: #e0e0e0;
}

/* 状态提示 */
.status-message {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.status-error {
  background: #ffebee;
  color: #d32f2f;
  border: 1px solid #ffcdd2;
}

.status-warning {
  background: #fff3e0;
  color: #f57c00;
  border: 1px solid #ffe0b2;
}

.status-icon {
  font-size: 18px;
}

/* 无数据提示 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-text {
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-subtext {
  font-size: 14px;
  color: #aaa;
}

/* 列表视图控制 */
.list-controls {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  background: #f9f9f9;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.year-month-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.control-label {
  font-size: 12px;
  color: #666;
  font-weight: bold;
  white-space: nowrap;
}

select {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  min-width: 80px;
  width: 100%;
}

select:focus {
  outline: none;
  border-color: #4CAF50;
}

.list-buttons {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: nowrap;
  margin-top: 8px;
  width: 100%;
  justify-content: space-between;
}

.list-btn {
  padding: 8px 10px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  white-space: nowrap;
}

.list-btn:hover {
  background: #f0f0f0;
}

.list-btn.primary {
  background: #4CAF50;
  color: white;
  border-color: #4CAF50;
  flex: 1.2;
}

.list-btn.primary:hover {
  background: #388E3C;
}

/* 列表视图空状态 */
.list-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.list-placeholder h4 {
  margin-bottom: 8px;
  color: #555;
}

.list-placeholder p {
  font-size: 14px;
  color: #aaa;
}

/* 列表控制栏折叠功能 */
.list-controls {
  background: #f9f9f9;
  border-bottom: 1px solid #eee;
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
}

.list-controls.collapsed {
  max-height: 44px;
}

.list-controls:not(.collapsed) {
  max-height: 180px;
}

.list-controls-toggle {
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  text-align: left;
}

.list-controls-toggle:hover {
  background: #f0f0f0;
}

.toggle-icon {
  transition: transform 0.3s ease;
  font-size: 12px;
}

.list-controls.collapsed .toggle-icon {
  transform: rotate(0deg);
}

.list-controls:not(.collapsed) .toggle-icon {
  transform: rotate(180deg);
}

.list-controls-content {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: white;
}

/* 添加滑动指示器动画 */
@keyframes slideHint {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.mobile-table-wrapper.scroll-hint::after {
  animation: slideHint 2s ease-in-out infinite;
}

/* 优化表头固定 */
.mobile-table-wrapper .log-table thead {
  position: sticky;
  top: 0;
  background: #f1f8e9;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* ===== 表格字体优化 ===== */
/* 记录表格字体缩小 */
.mobile-table-wrapper .log-table {
  font-size: 12px;
}

.log-table th,
.log-table td {
  padding: 10px 4px;
  font-size: 12px;
}

/* 输入框和按钮也缩小 */
.action-cell input,
.action-cell select,
.weight-input,
.group-input {
  font-size: 12px;
  padding: 5px 3px;
}

.row-btn {
  font-size: 11px;
  padding: 3px 6px;
}

/* 统计表格字体缩小 */
.table-container {
  font-size: 12px;
}


/* 折叠行字体 */
.sub-row {
  font-size: 11px;
}

/* 表头保持稍大一点 */
.stats-table th {
  font-size: 12px; /* 或者保持13px以区分 */
}

/* 响应式调整 */
@media (max-width: 768px) {
  .log-table th,
  .log-table td {
    font-size: 11px;
    padding: 8px 3px;
  }
  
  .stats-table th,
  .stats-table td {
    font-size: 11px;
    padding: 8px 4px;
  }
  
  .action-cell input,
  .action-cell select,
  .weight-input,
  .group-input {
    font-size: 11px;
  }
}