/* ==================================================================
 * 《机械方志》小程序 H5 预览 —— 手机屏幕外壳样式
 * 状态栏 / 导航栏 / 标签栏 / 轻提示 / 弹窗 / 加载 / 图片查看 / 选择器
 * ================================================================== */

/* ---------------------------- 状态栏 ---------------------------- */

.mp-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 44px;
  padding: 0 22px;
  background: #1A1918;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  user-select: none;
}

.mp-statusbar.mp-statusbar-light {
  background: #ffffff;
  color: #1A1918;
}

.mp-status-right {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mp-status-bars {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 11px;
}

.mp-status-bars i {
  display: block;
  width: 3px;
  background: currentColor;
  border-radius: 1px;
}

.mp-status-bars i:nth-child(1) { height: 4px; }
.mp-status-bars i:nth-child(2) { height: 6px; }
.mp-status-bars i:nth-child(3) { height: 8px; }
.mp-status-bars i:nth-child(4) { height: 11px; }

.mp-status-wifi {
  width: 15px;
  height: 11px;
}

.mp-status-battery {
  position: relative;
  width: 24px;
  height: 11px;
  border: 1px solid currentColor;
  border-radius: 3px;
  opacity: 0.9;
}

.mp-status-battery::before {
  content: '';
  position: absolute;
  inset: 1.5px;
  right: 7px;
  background: currentColor;
  border-radius: 1px;
}

.mp-status-battery::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 3px;
  width: 2px;
  height: 4px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
}

/* ---------------------------- 导航栏 ---------------------------- */

.mp-navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 44px;
  padding: 0 44px;
  background: #1A1918;
  color: #ffffff;
  user-select: none;
}

.mp-navbar.mp-navbar-hidden {
  display: none;
}

.mp-nav-title {
  max-width: 100%;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-nav-back {
  position: absolute;
  left: 4px;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 44px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.95;
}

.mp-nav-back:hover {
  opacity: 0.7;
}

.mp-nav-capsule {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 15px;
  font-size: 13px;
  opacity: 0.85;
}

.mp-nav-capsule span {
  cursor: pointer;
  line-height: 1;
}

/* ---------------------------- 标签栏 ---------------------------- */

.mp-tabbar {
  display: flex;
  flex-shrink: 0;
  height: 56px;
  padding-bottom: 0;
  background: #ffffff;
  border-top: 1px solid #DDDAD2;
  user-select: none;
}

.mp-tabbar.mp-tabbar-hidden {
  display: none;
}

.mp-tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: #8a9099;
}

.mp-tab.mp-tab-active {
  color: #9A4315;
}

.mp-tab img {
  width: 23px;
  height: 23px;
  object-fit: contain;
  filter: grayscale(1) opacity(0.55);
}

.mp-tab.mp-tab-active img {
  filter: none;
}

.mp-tab span {
  font-size: 10px;
  line-height: 1;
}

.mp-tab-badge {
  position: absolute;
  top: 5px;
  left: 50%;
  margin-left: 6px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: #dc2626;
  color: #ffffff;
  font-size: 10px;
  line-height: 15px;
  text-align: center;
}

.mp-home-indicator {
  flex-shrink: 0;
  height: 20px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mp-home-indicator::after {
  content: '';
  width: 120px;
  height: 4px;
  border-radius: 2px;
  background: #1A1918;
  opacity: 0.75;
}

/* ---------------------------- 轻提示 ---------------------------- */

.mp-toast-layer,
.mp-overlay-layer {
  position: absolute;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}

.mp-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 70%;
  padding: 16px 20px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.86);
  color: #ffffff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  word-break: break-word;
  animation: mp-fade-in 0.12s ease-out;
}

.mp-toast.mp-toast-icon::before {
  content: '✓';
  display: block;
  margin-bottom: 6px;
  font-size: 22px;
  color: #4ade80;
}

.mp-toast.mp-toast-error::before {
  content: '!';
  display: block;
  margin-bottom: 6px;
  font-size: 22px;
  font-weight: 700;
  color: #fca5a5;
}

@keyframes mp-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------------------------- 加载中 ---------------------------- */

.mp-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 96px;
  padding: 18px 20px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.82);
  color: #ffffff;
  font-size: 13px;
}

.mp-loading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: mp-spin 0.8s linear infinite;
}

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

/* ---------------------------- 模态弹窗 ---------------------------- */

.mp-modal-mask {
  position: absolute;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.mp-modal {
  width: 270px;
  max-width: 84%;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  animation: mp-pop 0.16s ease-out;
}

@keyframes mp-pop {
  from { transform: scale(0.94); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

.mp-modal-title {
  padding: 22px 22px 0;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: #1A1918;
}

.mp-modal-body {
  padding: 12px 22px 20px;
  max-height: 320px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.6;
  color: #4b5563;
  text-align: center;
  white-space: pre-wrap;
}

.mp-modal-actions {
  display: flex;
  border-top: 1px solid #DDDAD2;
}

.mp-modal-actions button {
  flex: 1;
  height: 48px;
  border: 0;
  background: none;
  font-size: 15px;
  color: #6E6B64;
  cursor: pointer;
}

.mp-modal-actions button + button {
  border-left: 1px solid #DDDAD2;
}

.mp-modal-actions button.mp-modal-primary {
  color: #9A4315;
  font-weight: 600;
}

.mp-action-item {
  padding: 14px 18px;
  font-size: 14px;
  color: #1A1918;
  text-align: center;
  border-bottom: 1px solid #EAE8E2;
  cursor: pointer;
}

.mp-action-item:active {
  background: #F4F3EF;
}

/* ---------------------------- 图片查看 ---------------------------- */

.mp-image-viewer {
  position: absolute;
  inset: 0;
  z-index: 960;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  cursor: zoom-out;
}

.mp-image-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ---------------------------- 选择器面板 ---------------------------- */

.mp-picker-mask {
  position: absolute;
  inset: 0;
  z-index: 940;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.4);
}

.mp-picker-sheet {
  width: 100%;
  max-height: 62%;
  border-radius: 14px 14px 0 0;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mp-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #EAE8E2;
  font-size: 14px;
  color: #6E6B64;
}

.mp-picker-head b {
  color: #9A4315;
  cursor: pointer;
  font-weight: 600;
}

.mp-picker-list {
  flex: 1;
  overflow-y: auto;
}

.mp-picker-option {
  padding: 13px 18px;
  font-size: 15px;
  color: #1A1918;
  border-bottom: 1px solid #F4F3EF;
  cursor: pointer;
}

.mp-picker-option:active {
  background: #F4F3EF;
}

.mp-picker-option.mp-picker-current {
  color: #9A4315;
  font-weight: 600;
}

/* ---------------------------- 下拉刷新 ---------------------------- */

.mp-pulldown {
  position: absolute;
  left: 0;
  right: 0;
  top: -32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #ABA8A0;
  transition: transform 0.2s ease;
}
