/* ============================================================
 * components.css —— 公共组件（Toast/Modal/Loading/授权弹窗/列表项）
 * ============================================================ */

/* Toast */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  pointer-events: none;
}
.toast {
  max-width: 80vw;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  border-radius: 8px;
  text-align: center;
  line-height: 1.5;
  margin-top: 8px;
  animation: toastIn .2s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loading */
.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  width: 300px;
  max-width: 86vw;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: scale(1); }
}
.modal-title {
  padding: 20px 24px 10px;
  font-size: 16px;
  font-weight: bold;
  color: #222;
  text-align: center;
}
.modal-content {
  padding: 0 24px 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  text-align: center;
  max-height: 50vh;
  overflow-y: auto;
}
.modal-actions {
  display: flex;
  border-top: 1px solid #f0f0f0;
}
.modal-btn {
  flex: 1;
  height: 46px;
  line-height: 46px;
  font-size: 15px;
  text-align: center;
  color: #333;
  background: #fff;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.modal-btn:active { background: #f5f5f5; }
.modal-btn + .modal-btn { border-left: 1px solid #f0f0f0; }
.modal-btn.is-primary { color: #1a6eff; font-weight: bold; }

/* 底部弹层 */
.action-sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9000;
}
.action-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f4f4f4;
  border-radius: 16px 16px 0 0;
  z-index: 9001;
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheetIn .25s ease;
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.action-sheet-title {
  padding: 14px;
  text-align: center;
  color: #999;
  font-size: 13px;
  background: #fff;
}
.action-sheet-item {
  padding: 14px;
  text-align: center;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  font-size: 15px;
}
.action-sheet-item.is-danger { color: #ff3333; }
.action-sheet-cancel {
  margin-top: 8px;
  padding: 14px;
  text-align: center;
  background: #fff;
  font-size: 15px;
  color: #666;
}

/* 授权弹窗 */
.auth-popup-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-popup {
  width: 300px;
  background: #fff;
  border-radius: 14px;
  padding: 30px 20px 20px;
  text-align: center;
}
.auth-popup-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}
.auth-popup-desc {
  font-size: 13px;
  color: #999;
  margin-bottom: 20px;
}
.auth-popup-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 14px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px dashed #ccc;
}
.auth-popup-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.auth-popup input.nickname {
  width: 100%;
  height: 40px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 14px;
  margin-bottom: 12px;
}
.auth-popup .auth-confirm {
  width: 100%;
  height: 44px;
  line-height: 44px;
  background: linear-gradient(135deg, #1a6eff, #0052d9);
  color: #fff;
  font-weight: bold;
  border-radius: 22px;
  font-size: 15px;
}
.auth-popup .auth-cancel {
  display: block;
  margin-top: 14px;
  color: #999;
  font-size: 13px;
}

/* 列表项（通用） */
.list-item {
  display: flex;
  align-items: center;
  padding: 14px 14px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.list-item:last-child { border-bottom: none; }
.list-item-left {
  width: 28px;
  display: flex;
  justify-content: center;
}
.list-item-body {
  flex: 1;
  margin-left: 8px;
  font-size: 15px;
  color: #333;
}
.list-item-right {
  display: flex;
  align-items: center;
  color: #999;
  font-size: 13px;
}

/* Tab 选择器（上方切换） */
.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 0 10px;
}
.tabs .tab-item {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
  color: #666;
  position: relative;
}
.tabs .tab-item.is-active {
  color: #1a6eff;
  font-weight: bold;
}
.tabs .tab-item.is-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: #1a6eff;
  border-radius: 2px;
}

/* 分段胶囊 */
.seg {
  display: inline-flex;
  background: #f2f2f2;
  border-radius: 16px;
  padding: 2px;
}
.seg-item {
  padding: 6px 16px;
  font-size: 12px;
  color: #666;
  border-radius: 14px;
}
.seg-item.is-active {
  background: #1a6eff;
  color: #fff;
  font-weight: bold;
}

/* 无限滚动底部提示 */
.list-end {
  text-align: center;
  color: #bbb;
  font-size: 12px;
  padding: 14px 0;
}

/* 选择器（拣单、分类） */
.picker-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9200;
}
.picker {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-radius: 14px 14px 0 0;
  z-index: 9201;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.picker-header .cancel,
.picker-header .confirm {
  font-size: 14px;
  color: #1a6eff;
  padding: 4px 8px;
}
.picker-title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}
.picker-list {
  overflow-y: auto;
  padding: 4px 0;
}
.picker-item {
  padding: 14px 16px;
  font-size: 14px;
  color: #333;
  text-align: center;
}
.picker-item.is-active {
  color: #1a6eff;
  font-weight: bold;
}
