/* ============================================================
 *  家庭打卡系统 - 全局公共样式
 * ============================================================ */

/* ========== CSS 变量 ========== */
:root {
  /* 主色 */
  --color-primary: #FF8C42;
  --color-primary-light: #FFA366;
  --color-primary-dark: #E6732A;

  /* 辅助色 */
  --color-secondary: #4A90D9;
  --color-success: #52C41A;
  --color-warning: #FAAD14;
  --color-danger: #FF4D4F;

  /* 星星 */
  --color-star: #FFD700;
  --color-star-dark: #FFB800;

  /* 选做 */
  --color-optional: #8C8C8C;

  /* 背景 */
  --color-bg: #FFF9F0;
  --color-bg-card: #FFFFFF;
  --color-bg-tv: #1A1A2E;

  /* 文字 */
  --color-text-primary: #262626;
  --color-text-secondary: #595959;
  --color-text-tertiary: #8C8C8C;
  --color-text-inverse: #FFFFFF;

  /* 边框 & 阴影 */
  --color-border: #F0E6D8;
  --shadow-card: 0 4px 20px rgba(255, 140, 66, 0.1);
  --shadow-btn: 0 2px 8px rgba(255, 140, 66, 0.25);

  /* 圆角 */
  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-sm: 8px;
}

/* ========== 重置 & 基础 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* ========== 星星图标 ========== */
.star-icon {
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 1px 2px rgba(255, 184, 0, 0.3));
}

.star-glow {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
}

/* 星星弹出动画 */
@keyframes starPop {
  0% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.5) rotate(20deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.star-pop-anim {
  animation: starPop 0.5s ease-out;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  font-weight: 500;
  font-size: 15px;
  transition: all 0.15s ease;
  min-height: 44px;
  user-select: none;
}

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

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  background: var(--color-primary-light);
}

.btn-secondary {
  background: #F5F5F5;
  color: var(--color-text-secondary);
}

.btn-secondary:hover {
  background: #EEEEEE;
}

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  min-height: 32px;
  border-radius: 8px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 17px;
  min-height: 52px;
}

/* ========== 卡片 ========== */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

/* ========== 标签 ========== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.tag-required {
  background: rgba(74, 144, 217, 0.12);
  color: var(--color-secondary);
}

.tag-optional {
  background: rgba(140, 140, 140, 0.12);
  color: var(--color-optional);
}

.tag-success {
  background: rgba(82, 196, 26, 0.12);
  color: var(--color-success);
}

.tag-failed {
  background: rgba(255, 77, 79, 0.12);
  color: var(--color-danger);
}

.tag-pending {
  background: rgba(255, 140, 66, 0.12);
  color: var(--color-primary);
}

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: #fff;
  transition: border-color 0.2s ease;
  min-height: 44px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* 单选组 */
.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-item {
  flex: 1;
  min-width: 0;
  position: relative;
}

.radio-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-item label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
  text-align: center;
  min-height: 44px;
}

.radio-item input:checked + label {
  border-color: var(--color-primary);
  background: rgba(255, 140, 66, 0.08);
  color: var(--color-primary);
  font-weight: 500;
}

/* ========== Toast 提示 ========== */
.toast-container {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 80%;
  text-align: center;
  pointer-events: none;
}

.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-success {
  background: var(--color-success);
}

.toast-error {
  background: var(--color-danger);
}

.toast-warning {
  background: var(--color-warning);
}

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

.confirm-modal {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 24px;
  width: 85%;
  max-width: 320px;
  animation: slideUp 0.25s ease;
}

.confirm-message {
  font-size: 16px;
  margin-bottom: 20px;
  text-align: center;
  color: var(--color-text-primary);
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

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

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

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

/* ========== 加载动画 ========== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 140, 66, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-tertiary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 15px;
}

/* ========== 淡入动画 ========== */
.fade-in {
  animation: fadeIn 0.3s ease;
}

/* ========== 页面切换动画 ========== */
.page-enter {
  animation: pageEnter 0.3s ease;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
