/* ===== LOTO 工业安全风格 ===== */
:root {
  --safety-yellow: #FFD100;
  --safety-yellow-dark: #E6BC00;
  --industrial-dark: #1F2328;
  --industrial-darker: #121518;
  --industrial-gray: #2D3238;
  --industrial-light: #3A4048;
  --text-primary: #F5F6F7;
  --text-secondary: #B0B5BC;
  --text-muted: #7A7F86;
  --success: #2E7D32;
  --success-light: #4CAF50;
  --danger: #C62828;
  --danger-light: #EF5350;
  --warning: #F57C00;
  --border: rgba(255, 255, 255, 0.08);
  --card-bg: rgba(255, 255, 255, 0.04);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background: var(--industrial-darker);
  color: var(--text-primary);
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#root {
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* 滚动条 */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--industrial-light); border-radius: 2px; }

/* 警示条纹 */
.hazard-stripe {
  background: repeating-linear-gradient(
    -45deg,
    var(--safety-yellow),
    var(--safety-yellow) 12px,
    var(--industrial-dark) 12px,
    var(--industrial-dark) 24px
  );
  height: 8px;
  width: 100%;
}

.hazard-stripe-horizontal {
  background: repeating-linear-gradient(
    -45deg,
    var(--safety-yellow),
    var(--safety-yellow) 8px,
    var(--industrial-dark) 8px,
    var(--industrial-dark) 16px
  );
}

/* 工业按钮 */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 20px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  user-select: none;
}

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

.btn-primary {
  background: var(--safety-yellow);
  color: var(--industrial-darker);
  box-shadow: 0 4px 0 var(--safety-yellow-dark), 0 6px 12px rgba(255, 209, 0, 0.25);
}

.btn-primary:active {
  box-shadow: 0 2px 0 var(--safety-yellow-dark);
  transform: translateY(2px) scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 0 #8E1E1E, 0 6px 12px rgba(198, 40, 40, 0.3);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 0 #1B5E20, 0 6px 12px rgba(46, 125, 50, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--industrial-light);
}

.btn-ghost:active {
  background: var(--industrial-light);
}

.btn-small {
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 8px;
}

/* 卡片 */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(10px);
}

/* 页面容器 */
.page {
  min-height: 100vh;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  background: var(--industrial-darker);
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--industrial-dark);
  border-bottom: 1px solid var(--border);
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}

.page-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header h1 {
  font-size: 19px;
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--industrial-gray);
  border-radius: 10px;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.back-btn:active { background: var(--industrial-light); }

.page-body {
  padding: 16px;
}

/* 底部操作栏 */
.bottom-action {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--industrial-darker) 30%);
  z-index: 50;
}

/* Tab切换 */
.tabs {
  display: flex;
  background: var(--industrial-gray);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  border: none;
  background: transparent;
}

.tab.active {
  background: var(--safety-yellow);
  color: var(--industrial-darker);
  box-shadow: 0 2px 8px rgba(255, 209, 0, 0.3);
}

/* 步骤指示器 */
.steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 8px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  background: var(--industrial-gray);
  color: var(--text-muted);
  border: 2px solid var(--industrial-light);
  transition: all 0.3s ease;
}

.step-item.active .step-circle {
  background: var(--safety-yellow);
  color: var(--industrial-darker);
  border-color: var(--safety-yellow);
  box-shadow: 0 0 20px rgba(255, 209, 0, 0.4);
}

.step-item.done .step-circle {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.step-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.step-item.active .step-label { color: var(--safety-yellow); }
.step-item.done .step-label { color: var(--success-light); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--industrial-light);
  margin: 0 -12px 22px;
}

.step-line.done { background: var(--success); }

/* 表单 */
.form-group {
  margin-bottom: 20px;
}

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

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--industrial-gray);
  border: 1.5px solid var(--industrial-light);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  transition: border-color 0.2s ease;
}

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

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23B0B5BC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

/* 选项卡/选项按钮 */
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.option-btn {
  padding: 14px 12px;
  background: var(--industrial-gray);
  border: 2px solid var(--industrial-light);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.option-btn:active { transform: scale(0.96); }

.option-btn.selected {
  background: rgba(255, 209, 0, 0.15);
  border-color: var(--safety-yellow);
  color: var(--safety-yellow);
}

.option-btn.verified {
  background: rgba(46, 125, 50, 0.2);
  border-color: var(--success);
  color: var(--success-light);
}

.option-btn.unverified {
  background: rgba(198, 40, 40, 0.15);
  border-color: var(--danger);
  color: var(--danger-light);
}

/* 锁定点卡片 */
.lock-point-card {
  background: var(--industrial-gray);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  border-left: 4px solid var(--industrial-light);
  transition: all 0.2s ease;
}

.lock-point-card.verified {
  border-left-color: var(--success);
  background: rgba(46, 125, 50, 0.1);
}

.lock-point-card.unverified {
  border-left-color: var(--danger);
}

.lock-point-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.lock-point-id {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.lock-point-tag {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.tag-electric { background: rgba(66, 165, 245, 0.2); color: #42A5F5; }
.tag-pneumatic { background: rgba(76, 175, 80, 0.2); color: #4CAF50; }
.tag-potential { background: rgba(255, 152, 0, 0.2); color: #FF9800; }
.tag-signal { background: rgba(156, 39, 176, 0.2); color: #CE93D8; }
.tag-hydraulic { background: rgba(244, 67, 54, 0.2); color: #EF5350; }

.lock-point-detail {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.lock-point-verify {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--industrial-light);
  font-size: 13px;
  color: var(--text-muted);
}

/* A/B 循环标签 */
.cycle-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-weight: 900;
  font-size: 14px;
}

.cycle-a {
  background: var(--danger);
  color: white;
}

.cycle-b {
  background: #1565C0;
  color: white;
}

/* 列表项 */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.list-item:active { background: var(--industrial-gray); }

.list-item-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 209, 0, 0.15);
}

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

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

.list-item-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.list-item-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Hero 区 */
.hero {
  position: relative;
  padding: 32px 20px 28px;
  background: linear-gradient(135deg, var(--industrial-dark) 0%, var(--industrial-gray) 100%);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at 80% 20%, rgba(255, 209, 0, 0.12), transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255, 209, 0, 0.15);
  color: var(--safety-yellow);
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.hero-title {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 8px;
}

.hero-title span {
  color: var(--safety-yellow);
}

.hero-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 入口卡片 */
.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
  margin-top: -20px;
  position: relative;
  z-index: 2;
}

.entry-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(10px);
}

.entry-card:active { transform: scale(0.96); }

.entry-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.entry-card-icon.yellow { background: rgba(255, 209, 0, 0.2); }
.entry-card-icon.green { background: rgba(76, 175, 80, 0.2); }
.entry-card-icon.red { background: rgba(244, 67, 54, 0.2); }
.entry-card-icon.blue { background: rgba(33, 150, 243, 0.2); }

.entry-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.entry-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 状态徽章 */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status-active { background: rgba(46, 125, 50, 0.2); color: var(--success-light); }
.status-completed { background: rgba(33, 150, 243, 0.2); color: #42A5F5; }
.status-pending { background: rgba(255, 152, 0, 0.2); color: #FFB74D; }

/* 签名画布 */
.signature-pad {
  background: white;
  border-radius: 10px;
  border: 2px solid var(--industrial-light);
  touch-action: none;
}

/* 相机视图 */
.camera-container {
  position: relative;
  width: 100%;
  background: black;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4/3;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-shutter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: white;
  border: 4px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.camera-shutter:active { transform: translateX(-50%) scale(0.92); }

.camera-shutter-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--safety-yellow);
}

/* 搜索框 */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--industrial-gray);
  border-radius: 12px;
  margin-bottom: 16px;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.search-box input::placeholder { color: var(--text-muted); }

/* 分组标题 */
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 20px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--safety-yellow);
  border-radius: 2px;
}

/* 信息网格 */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.info-item-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.info-item-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  opacity: 0.3;
}

.empty-state-text {
  font-size: 15px;
  margin-bottom: 4px;
}

.empty-state-desc {
  font-size: 13px;
}

/* 权限提示条 */
.permission-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 152, 0, 0.12);
  border-bottom: 1px solid rgba(255, 152, 0, 0.2);
  font-size: 13px;
  color: #FFB74D;
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  z-index: 1000;
  pointer-events: none;
  animation: toastIn 0.2s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 安全提示滚动字幕 */
@keyframes safetyMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.safety-scroll-inner {
  animation: safetyMarquee 30s linear infinite;
}

/* 进度环 */
.progress-ring-bg {
  stroke: var(--industrial-light);
}
.progress-ring-fg {
  stroke: var(--safety-yellow);
  transition: stroke-dashoffset 0.5s ease;
}

/* 折叠面板 */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.collapsible-title {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.collapsible-arrow {
  transition: transform 0.2s ease;
}

.collapsible-arrow.open {
  transform: rotate(180deg);
}

.collapsible-body {
  padding: 12px 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--industrial-dark);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  display: flex;
  z-index: 100;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  border: none;
  background: transparent;
  font-family: inherit;
}

.bottom-nav-item.active {
  color: var(--safety-yellow);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
}

/* 响应式：桌面端居中显示手机样式 */
@media (min-width: 768px) {
  body {
    display: flex;
    justify-content: center;
    background: #0A0C0E;
  }

  #root {
    max-width: 430px;
    width: 100%;
    min-height: 100vh;
    background: var(--industrial-darker);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
    position: relative;
  }
}
