/* ==========================================================================
   警用装备登记与查询管理平台 - 移动端统一样式体系
   ========================================================================== */

:root {
  --primary-color: #1a56db;
  --primary-hover: #1e429f;
  --primary-light: #ebf5ff;
  --primary-gradient: linear-gradient(135deg, #0d2b63 0%, #1a56db 100%);
  
  --police-navy: #0b1e3d;
  --police-blue: #143d78;
  --police-gold: #f59e0b;
  --police-gold-bg: #fef3c7;
  
  --success-color: #059669;
  --success-bg: #def7ec;
  --danger-color: #e02424;
  --danger-bg: #fde8e8;
  
  --bg-page: #f3f6fb;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 30, 60, 0.08);
  
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 15px;
  user-select: none;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  background-color: var(--bg-page);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.06);
}

/* 顶部导航 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--primary-gradient);
  color: #ffffff;
  padding-top: calc(var(--safe-top) + 12px);
  padding-bottom: 14px;
  padding-left: 16px;
  padding-right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(13, 43, 99, 0.2);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.police-badge-icon {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-title-box h1 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 11px;
  opacity: 0.85;
}

.header-user-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

/* 核心内容区 */
.app-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(75px + var(--safe-bottom));
  overflow-y: auto;
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding-bottom: var(--safe-bottom);
  display: flex;
  justify-content: space-around;
  z-index: 40;
  box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.05);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
}

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

.nav-item .nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  width: 24px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 0 0 3px 3px;
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--police-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* 按钮体系 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  width: 100%;
  transition: all 0.2s;
}

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

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(26, 86, 219, 0.25);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-danger {
  background: var(--danger-color);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  width: auto;
}

.btn-call {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

/* 表单组件 */
.form-group {
  margin-bottom: 16px;
}

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

.form-label .required {
  color: var(--danger-color);
  margin-left: 2px;
}

.form-label .optional {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: normal;
  margin-left: 4px;
}

.form-control {
  width: 100%;
  height: 46px;
  padding: 10px 14px;
  font-size: 15px;
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.form-control:focus {
  background-color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

/* 验证码输入框与按钮组合 */
.code-input-group {
  display: flex;
  gap: 10px;
}

.code-input-group .form-control {
  flex: 1;
}

.btn-code {
  width: 120px;
  height: 46px;
  font-size: 13px;
  padding: 0;
  white-space: nowrap;
  background: var(--primary-light);
  color: var(--primary-color);
  border: 1px solid rgba(26, 86, 219, 0.3);
}

.btn-code:disabled {
  background: #f1f5f9;
  color: var(--text-tertiary);
  border-color: var(--border-color);
  cursor: not-allowed;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

.badge-police {
  background: #ebf5ff;
  color: #1a56db;
  border: 1px solid #bfdbfe;
}

.badge-super {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-query {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

/* 搜索框 */
.search-bar-wrap {
  position: relative;
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  height: 48px;
  padding-left: 42px;
  padding-right: 40px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 15px;
  outline: none;
}

.search-icon-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-tertiary);
}

.search-clear-right {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
}

/* 记录卡片 */
.record-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.record-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-color);
}

.record-device-id {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--police-navy);
  display: flex;
  align-items: center;
  gap: 6px;
}

.record-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.info-item {
  display: flex;
  flex-direction: column;
}

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

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

.record-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.record-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* 弹窗与抽屉 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  background: #ffffff;
  width: 100%;
  max-width: 600px;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--police-navy);
}

.modal-close {
  font-size: 22px;
  color: var(--text-tertiary);
  cursor: pointer;
}

/* 开关 Switch */
.switch-control {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .switch-slider {
  background-color: var(--primary-color);
}

input:checked + .switch-slider:before {
  transform: translateX(24px);
}

/* Toast */
.toast-notice {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  text-align: center;
  pointer-events: none;
}

.empty-box {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.empty-icon {
  font-size: 42px;
  margin-bottom: 8px;
  opacity: 0.6;
}
