/* EHS隐患排查闭环管理系统 - 移动端小程序风格样式 */

/* ===== 基础重置 ===== */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif; background: #f3f4f6; }

/* ===== 布局 ===== */
.app-main { min-height: 100vh; }

/* ===== 表单样式 ===== */
.form-label { display: block; font-size: 12px; font-weight: 500; color: #6b7280; margin-bottom: 4px; }
.form-input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: #374151;
  background: #f9fafb;
  outline: none;
  transition: all 0.2s;
  -webkit-appearance: none;
}
.form-input:focus { border-color: #16a34a; background: #fff; box-shadow: 0 0 0 3px rgba(22,163,74,0.1); }
textarea.form-input { resize: none; }
select.form-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }

/* ===== 底部导航 ===== */
.bottom-nav { padding-bottom: env(safe-area-inset-bottom, 0); }
.bottom-nav-btn {
  color: #9ca3af;
  transition: color 0.2s;
  min-width: 56px;
}
.bottom-nav-btn.active { color: #16a34a; }
.bottom-nav-btn i { font-size: 20px; }
.bottom-nav-btn span { font-size: 11px; }
.report-fab { color: #6b7280; }
.report-fab span { font-size: 11px; }

/* ===== Tab页面 ===== */
.tab-page { animation: pageIn 0.25s ease; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 隐患卡片 ===== */
.hazard-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #f3f4f6;
  -webkit-user-select: none;
}
.hazard-card:active { transform: scale(0.98); background: #f9fafb; }

/* ===== 状态徽章 ===== */
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-assigned { background: #dbeafe; color: #2563eb; }
.badge-in_progress { background: #fed7aa; color: #ea580c; }
.badge-completed { background: #ede9fe; color: #7c3aed; }
.badge-closed { background: #dcfce7; color: #16a34a; }

/* ===== 风险等级徽章 ===== */
.level-low { background: #dcfce7; color: #16a34a; }
.level-medium { background: #fef9c3; color: #ca8a04; }
.level-high { background: #ffedd5; color: #ea580c; }
.level-critical { background: #fee2e2; color: #dc2626; }

/* ===== 进度条 ===== */
.progress-bar { height: 6px; border-radius: 3px; background: #e5e7eb; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }

/* ===== 时间线 ===== */
.timeline-item { position: relative; padding-left: 20px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 18px;
  bottom: -6px;
  width: 2px;
  background: #e5e7eb;
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute;
  left: 0;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #e5e7eb;
}

/* ===== 抽屉 ===== */
.drawer-overlay { }
.drawer-panel {
  animation: drawerUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 480px;
  margin: 0 auto;
}
@keyframes drawerUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.drawer-panel-exit {
  animation: drawerDown 0.25s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
@keyframes drawerDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

/* ===== 上传区域 ===== */
.upload-area { transition: all 0.2s; }
.upload-area:active { background: #f0fdf4; border-color: #16a34a; }

/* ===== 状态筛选标签 ===== */
.status-filter-btn { transition: all 0.2s; white-space: nowrap; }
.status-filter-btn.active { background: #16a34a; color: #fff; border-color: #16a34a; }

/* ===== 快捷按钮 ===== */
.quick-btn { transition: all 0.15s; }
.quick-btn:active { opacity: 0.7; transform: scale(0.96); }

/* ===== 我的菜单 ===== */
.mine-menu-btn { transition: background 0.15s; }
.mine-menu-btn:active { background: #f9fafb; }

/* ===== 通知面板 ===== */
#notifPanel { animation: slideDown 0.2s ease; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 图片对比 ===== */
.img-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== 滚动条隐藏 ===== */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-style: none; }

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* ===== 安全区域 ===== */
.pb-safe { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0)); }

/* ===== 桌面端适配（居中显示） ===== */
@media (min-width: 640px) {
  body { background: #e5e7eb; }
  .app-header .header-inner { max-width: 480px; }
  .app-main { max-width: 480px; margin: 0 auto; background: #f3f4f6; min-height: 100vh; }
  .bottom-nav > div { max-width: 480px; }
  .drawer-panel { max-width: 480px; left: 50%; transform: translateX(-50%); }
  @keyframes drawerUp {
    from { transform: translateX(-50%) translateY(100%); }
    to { transform: translateX(-50%) translateY(0); }
  }
  .drawer-panel-exit {
    animation: drawerDownDesktop 0.25s cubic-bezier(0.32, 0.72, 0, 1) forwards;
  }
  @keyframes drawerDownDesktop {
    from { transform: translateX(-50%) translateY(0); }
    to { transform: translateX(-50%) translateY(100%); }
  }
}

/* ===== 加载动画 ===== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 40px 20px; color: #9ca3af; }
.empty-state i { font-size: 40px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* ===== 级联菜单（Cascader）===== */
.cascader-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 12px;
  border: 1px solid #e5e7eb; border-radius: 12px;
  font-size: 14px; background: #f9fafb; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none; color: #374151;
}
.cascader-trigger:hover { border-color: #9ca3af; }
.cascader-trigger.open { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.15); background: #fff; }
.cascader-trigger .cs-placeholder { color: #9ca3af; }
.cascader-trigger .cs-value { color: #374151; font-weight: 500; }
.cascader-trigger .cs-chevron { flex-shrink: 0; transition: transform 0.2s; color: #9ca3af; font-size: 12px; }
.cascader-trigger.open .cs-chevron { transform: rotate(180deg); }
.cascader-trigger .cs-clear {
  flex-shrink: 0; color: #9ca3af; cursor: pointer;
  padding: 2px 4px; border-radius: 9999px;
  display: none; align-items: center; font-size: 12px;
}
.cascader-trigger:hover .cs-clear.visible { display: flex; }
.cascader-trigger:hover .cs-clear.visible ~ .cs-chevron { display: none; }

.cascader-dropdown {
  position: absolute; z-index: 200; margin-top: 4px;
  left: 0; right: 0;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  display: none; overflow: hidden;
  animation: csDropIn 0.15s ease;
}
.cascader-dropdown.open { display: flex; }
@keyframes csDropIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.cascader-panel {
  min-width: 90px; max-height: 240px; overflow-x: auto; overflow-y: auto;
  border-right: 1px solid #f3f4f6;
  flex: 1;
}
#csPanel1 { flex: 0 0 38%; }
#csPanel2 { flex: 1; }
.cascader-panel:last-child { border-right: none; }
.cascader-panel::-webkit-scrollbar { width: 4px; }
.cascader-panel::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 9999px; }

.cascader-panel-header {
  padding: 7px 12px 5px;
  font-size: 10px; font-weight: 600; color: #9ca3af;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid #f3f4f6;
  position: sticky; top: 0; background: #fff; z-index: 1;
}

.cascader-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; font-size: 13px; color: #374151;
  cursor: pointer; transition: background 0.08s; white-space: nowrap;
}
.cascader-item:hover  { background: #f9fafb; }
.cascader-item.previewing { background: #f0fdf4; color: #15803d; }
.cascader-item.selected   { background: #dcfce7; color: #16a34a; font-weight: 500; }
.cascader-item .cs-arrow  { color: #9ca3af; font-size: 10px; margin-left: 6px; flex-shrink: 0; }
.cascader-item.previewing .cs-arrow,
.cascader-item.selected   .cs-arrow { color: #86efac; }

/* detail input that appears after cascader selection */
.cascader-detail-wrap {
  overflow: hidden; max-height: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.2s ease;
  opacity: 0; margin-top: 0;
}
.cascader-detail-wrap.show { max-height: 80px; opacity: 1; margin-top: 6px; }

/* location preview tag */
.location-preview-tag {
  display: none; margin-top: 6px;
  align-items: center; gap: 5px; padding: 5px 10px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 8px; font-size: 12px; color: #15803d;
}
.location-preview-tag.show { display: flex; }

/* ===== 导出快捷选项标签 ===== */
.export-quick-chip {
  padding: 6px 13px; border-radius: 999px; font-size: 12px;
  border: 1px solid #e5e7eb; background: #f9fafb; color: #374151;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.export-quick-chip:active { transform: scale(0.94); }
.export-quick-chip.active { background: #16a34a; color: #fff; border-color: #16a34a; }

/* ===== 导出日期范围触发按钮 ===== */
.export-range-trigger {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 7px 12px; flex: 1; overflow: hidden;
  transition: border-color 0.15s;
  cursor: pointer;
}
.export-range-trigger.has-value { border-color: #16a34a; background: #fff; }
/* 透明 input 覆盖整个触发区，iOS 真实点击事件可触发 */
.export-range-trigger input[type="text"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  font-size: 16px; border: none; background: transparent;
  -webkit-appearance: none; z-index: 1;
}

/* ===== Air Datepicker 绿色主题 ===== */
.air-datepicker {
  --adp-accent-color: #16a34a;
  --adp-color-secondary: #15803d;
  --adp-background-color-selected-other-month-focused: #16a34a;
  --adp-background-color-selected-other-month: #16a34a;
  --adp-background-color-in-range: #dcfce7;
  --adp-background-color-in-range-focused: #bbf7d0;
  --adp-color-in-range: #15803d;
  --adp-border-radius: 16px;
  --adp-font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
  --adp-font-size: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15) !important;
  border: 1px solid #e5e7eb !important;
}
.air-datepicker-overlay { background: rgba(0,0,0,0.45) !important; }
.air-datepicker.-mobile- {
  border-radius: 20px 20px 0 0 !important;
  max-width: 480px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  bottom: 0 !important;
  top: auto !important;
}
.air-datepicker.-mobile- .air-datepicker--pointer { display: none !important; }
.air-datepicker--navigation-title { font-weight: 700 !important; }

