/* 基础样式 */
:root {
  --primary: #FF6B6B;
  --primary-light: #FFE8E8;
  --secondary: #4ECDC4;
  --secondary-light: #E8F8F7;
  --warning: #FFE66D;
  --text: #2C3E50;
  --text-light: #7F8C8D;
  --bg: #F8F9FA;
  --card: #FFFFFF;
  --border: #E9ECEF;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  max-width: 100%;
  overflow-x: hidden;
}

/* 顶部标题 */
.header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 20px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.header .subtitle {
  font-size: 14px;
  opacity: 0.9;
}

/* 统计卡片 */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
  background: white;
  margin: -20px 16px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 10;
}

.stat-item {
  text-align: center;
}

.stat-item .num {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-item .label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* 快速操作按钮 */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 16px 16px;
}

.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

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

.btn .icon {
  font-size: 28px;
  margin-bottom: 4px;
}

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

.btn-diaper {
  background: var(--secondary-light);
  color: var(--secondary);
}

.btn-weight {
  background: #FFF3CD;
  color: #856404;
}

/* 区块标题 */
.section {
  padding: 16px;
}

.section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

/* 记录列表 */
.records-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-item {
  background: white;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease;
}

.record-item:active {
  transform: scale(0.98);
}

.record-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.record-icon.feeding {
  background: var(--primary-light);
}

.record-icon.diaper {
  background: var(--secondary-light);
}

.record-icon.weight {
  background: #FFF3CD;
}

.record-content {
  flex: 1;
  min-width: 0;
}

.record-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-detail {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.record-time {
  font-size: 12px;
  color: var(--text-light);
  flex-shrink: 0;
}

.loading {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 14px;
}

.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-light);
  font-size: 14px;
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 500px;
  border-radius: 20px 20px 0 0;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

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

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-btn:hover {
  background: var(--bg);
}

.modal-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-option {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-option:hover {
  border-color: var(--primary);
}

.btn-option.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid var(--border);
}

.btn-cancel {
  flex: 1;
  padding: 12px;
  background: var(--bg);
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.btn-submit {
  flex: 2;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.btn-submit:hover {
  background: #ff5252;
}

.btn-submit:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Toast 提示 */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 2000;
  text-align: center;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* 响应式 */
@media (max-width: 360px) {
  .stats-bar {
    gap: 8px;
  }
  
  .stat-item .num {
    font-size: 24px;
  }
  
  .quick-actions {
    gap: 8px;
  }
  
  .btn {
    padding: 12px 8px;
  }
  
  .btn .icon {
    font-size: 24px;
  }
}
