/* ============================================
   组件样式 · 表单/按钮/导航/标签等
   ============================================ */

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  padding: var(--space-2) var(--space-1) var(--space-3);
  background: var(--paper-bg);
  border-top: 1.5px dashed var(--accent-brown);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--paper-ink-light);
  padding: var(--space-1) 2px;
  cursor: pointer;
  transition: color 0.15s;
  flex: 1;
  min-width: 0;
}

.nav-item .nav-icon {
  font-size: 18px;
  color: var(--accent-brown-dark);
  transition: color 0.15s, transform 0.1s;
}

.nav-item.active {
  color: var(--accent-brown);
}

.nav-item.active .nav-icon {
  color: var(--accent-brown);
  transform: scale(1.1);
}

.nav-item:active .nav-icon {
  transform: scale(0.95);
}

/* 浮动新增按钮 */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--accent-brown);
  color: white;
  border: none;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(212, 165, 116, 0.4);
  z-index: 99;
  transition: transform 0.15s, box-shadow 0.15s;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.fab:active {
  transform: scale(0.92);
  box-shadow: 0 1px 6px rgba(212, 165, 116, 0.3);
}

/* 表单元素 */
.form-group {
  margin-bottom: var(--space-3);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--paper-ink-light);
  margin-bottom: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--paper-border);
  border-radius: var(--radius-sm);
  background: var(--paper-bg);
  color: var(--paper-ink);
  font-size: 15px;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-brown);
}

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

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23B8845A' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--paper-border);
  border-radius: var(--radius-sm);
  background: var(--paper-card);
  color: var(--paper-ink);
  font-size: 15px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-primary {
  background: var(--accent-brown);
  color: white;
  border-color: var(--accent-brown);
}

.btn-primary:active {
  background: var(--accent-brown-dark);
}

.btn-danger {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: transparent;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: var(--space-1) var(--space-2);
  font-size: 13px;
}

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: rgba(212, 165, 116, 0.15);
  color: var(--accent-brown-dark);
}

.tag.alt {
  background: rgba(168, 184, 154, 0.2);
  color: var(--accent-green-text);
}

.tag.warn {
  background: rgba(239, 170, 23, 0.15);
  color: var(--color-warning);
}

.tag.danger {
  background: rgba(201, 112, 100, 0.15);
  color: var(--color-danger);
}

.tag.success {
  background: rgba(139, 155, 122, 0.2);
  color: var(--accent-green-text);
}

/* 列表项 */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--paper-card);
  border: 1.5px solid var(--paper-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  position: relative;
  cursor: pointer;
  transition: transform 0.1s;
}

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

.list-item .item-icon {
  font-size: 20px;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

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

.list-item .item-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--paper-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .item-subtitle {
  font-size: 12px;
  color: var(--paper-ink-light);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .item-action {
  font-size: 18px;
  color: var(--paper-ink-light);
  flex-shrink: 0;
}

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(180, 150, 100, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-2);
}

.progress-fill {
  height: 100%;
  background: var(--accent-brown);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* 弹窗/模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(92, 74, 58, 0.4);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--paper-bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-5);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0));
  animation: slideUp 0.2s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--paper-ink);
}

.modal-close {
  font-size: 24px;
  color: var(--paper-ink-light);
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
}

/* 标签页切换 */
.tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
  background: rgba(180, 150, 100, 0.1);
  border-radius: var(--radius-full);
  padding: 3px;
}

.tab {
  flex: 1;
  text-align: center;
  padding: var(--space-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--paper-ink-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s;
}

.tab.active {
  background: var(--accent-brown);
  color: white;
}

/* 搜索框 */
.search-bar {
  position: relative;
  margin-bottom: var(--space-3);
}

.search-bar input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) 36px;
  border: 1.5px solid var(--paper-border);
  border-radius: var(--radius-full);
  background: var(--paper-bg);
  color: var(--paper-ink);
  font-size: 14px;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent-brown);
}

.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.6;
}

/* 星级评分 */
.stars {
  display: inline-flex;
  gap: 2px;
}

.star {
  font-size: 18px;
  color: rgba(180, 150, 100, 0.3);
  cursor: pointer;
}

.star.filled {
  color: var(--accent-brown);
}

/* 数值展示 */
.metric {
  font-size: 24px;
  font-weight: 600;
  font-family: var(--font-metric);
  color: var(--paper-ink);
}

.metric-label {
  font-size: 12px;
  color: var(--paper-ink-light);
}

/* 行内操作按钮 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--paper-ink-light);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s;
}

.icon-btn:active {
  background: rgba(180, 150, 100, 0.15);
}

/* 复选框 */
.checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--paper-border);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.checkbox.checked {
  background: var(--accent-brown);
  border-color: var(--accent-brown);
  color: white;
}

.checkbox.checked::after {
  content: '✓';
  font-size: 14px;
}

/* 提示文字 */
.hint-text {
  font-size: 12px;
  color: var(--paper-ink-light);
  margin-top: var(--space-1);
}

/* 分隔线 */
.divider {
  height: 1px;
  border-top: 1px dashed var(--paper-line);
  margin: var(--space-3) 0;
  opacity: 0.5;
}

/* 角标 */
.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--color-danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
