/* ============================================================
 *  家庭打卡系统 - 移动端管理页样式
 * ============================================================ */

/* ========== 布局 ========== */
#app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 20px;
  position: relative;
}

/* ========== 顶部栏 ========== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(255, 140, 66, 0.3);
}

.header-title {
  font-size: 20px;
  font-weight: 600;
}

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

.profile-select {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  max-width: 120px;
}

.profile-select option {
  background: var(--color-primary);
  color: #fff;
}

.role-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.role-toggle:active {
  transform: scale(0.92);
}

/* ========== 用户信息卡片 ========== */
.user-info-card {
  margin: 16px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
}

.user-info-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFE4CC, #FFD6B3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.user-info-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-name {
  font-size: 18px;
  font-weight: 600;
}

.user-role {
  font-size: 12px;
  color: var(--color-text-tertiary);
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  width: fit-content;
}

.user-stars {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.star-icon-wrapper {
  line-height: 0;
}

.stars-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-star-dark);
  line-height: 1;
}

.stars-label {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

/* ========== Tab 导航 ========== */
.tab-nav {
  display: flex;
  padding: 0 20px;
  margin-top: 16px;
  border-bottom: 2px solid var(--color-border);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  font-weight: 300;
}

/* ========== 主内容 ========== */
.main-content {
  padding: 16px 20px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: pageEnter 0.3s ease;
}

/* ========== 日期头部 ========== */
.date-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.date-label {
  font-size: 20px;
  font-weight: 600;
}

.date-sub {
  font-size: 14px;
  color: var(--color-text-tertiary);
}

/* ========== 进度卡片 ========== */
.progress-card {
  margin-bottom: 20px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-label {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.progress-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.progress-bar {
  height: 10px;
  background: #F5F0E6;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), #73D13D);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.progress-stars {
  margin-top: 10px;
  font-size: 13px;
  color: var(--color-star-dark);
  font-weight: 500;
}

/* ========== 任务列表 ========== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-item {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.task-item.completed {
  opacity: 0.7;
}

.task-item.failed {
  border-left: 4px solid var(--color-danger);
}

.task-checkbox {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #D9D9D9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.task-checkbox.checked {
  background: var(--color-success);
  border-color: var(--color-success);
}

.task-checkbox.checked::after {
  content: '✓';
  color: #fff;
  font-size: 16px;
  font-weight: bold;
}

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

.task-name {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-item.completed .task-name-text {
  text-decoration: line-through;
  color: var(--color-text-tertiary);
}

.task-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.task-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.task-star-reward {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--color-star-dark);
  font-size: 15px;
}

.task-delete-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--color-text-tertiary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s ease;
}

.task-item:hover .task-delete-btn {
  opacity: 1;
}

.task-delete-btn:active {
  background: #FFECE8;
  color: var(--color-danger);
}

/* ========== 家长添加按钮区 ========== */
.parent-add-section {
  margin-top: 16px;
}

/* ========== 循环任务列表 ========== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
}

.recurring-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recurring-item {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.recurring-item.inactive {
  opacity: 0.5;
}

.recurring-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.recurring-name {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.recurring-switch {
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  background: #D9D9D9;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.recurring-switch.active {
  background: var(--color-success);
}

.recurring-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.recurring-switch.active::after {
  left: 22px;
}

.recurring-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.recurring-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.recurring-stars {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-star-dark);
  font-weight: 600;
}

.recurring-delete {
  color: var(--color-text-tertiary);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.recurring-delete:active {
  background: #FFECE8;
  color: var(--color-danger);
}

/* ========== 底部添加按钮组 ========== */
.parent-add-btns {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-icon {
  font-size: 18px;
  font-weight: 600;
}

/* ========== 弹窗（Modal） ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: #fff;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text-tertiary);
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close:active {
  transform: scale(0.9);
  background: #F0E6D8;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px 24px;
  flex-shrink: 0;
  border-top: 1px solid var(--color-border);
  margin: 0 -24px -20px;
  padding-top: 16px;
  margin-top: 10px;
}

.modal-footer .btn {
  flex: 1;
}

/* 表单必填标记 */
.form-required {
  color: var(--color-danger);
  font-weight: 600;
  margin-left: 2px;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 桌面端弹窗居中 */
@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }

  .modal-content {
    border-radius: 24px;
    max-height: 80vh;
  }
}

.form-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.form-type-switch {
  display: flex;
  background: var(--color-bg);
  border-radius: var(--radius-btn);
  padding: 4px;
  margin-bottom: 20px;
}

.type-switch-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  transition: all 0.2s ease;
}

.type-switch-btn.active {
  background: #fff;
  color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.task-form {
  animation: fadeIn 0.3s ease;
}

.form-help {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-top: 4px;
}

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

.form-actions .btn {
  flex: 1;
}

/* ========== 星期选择器 ========== */
.weekday-picker {
  display: flex;
  gap: 6px;
}

.weekday-btn {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: 14px;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.weekday-btn.selected {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ========== 日期选择器（月） ========== */
.monthday-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.monthday-btn {
  height: 36px;
  border-radius: 6px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: 13px;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.monthday-btn.selected {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ========== 底部栏 ========== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  padding: 12px 20px;
  text-align: center;
}

.bottom-text {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #E0D5C3;
  border-radius: 2px;
}
