/* ==================== 全局重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
}

/* ==================== 通用组件 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

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

.btn-primary { background: #1890ff; color: #fff; }
.btn-success { background: #52c41a; color: #fff; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-warning { background: #faad14; color: #fff; }
.btn-default { background: #fff; color: #333; border: 1px solid #d9d9d9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* 状态标签 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.badge-pending { background: #f0f0f0; color: #888; }
.badge-sharing { background: #e6f7ff; color: #1890ff; }
.badge-completed { background: #f6ffed; color: #52c41a; }
.badge-cancelled { background: #fff1f0; color: #ff4d4f; }
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.badge-dot.online { background: #52c41a; animation: pulse 1.5s infinite; }
.badge-dot.offline { background: #ccc; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ==================== 管理后台布局 ==================== */
.admin-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: #001529;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1000;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection-status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.connection-status::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #faad14;
}
.connection-status.connected::before { background: #52c41a; }
.connection-status.disconnected::before { background: #ff4d4f; }

.admin-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ==================== 地图区域 ==================== */
.map-container {
  flex: 1;
  position: relative;
  background: #e8eaed;
}

#map {
  width: 100%;
  height: 100%;
}

.map-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
}

.map-stats {
  display: flex;
  gap: 12px;
  background: rgba(255,255,255,0.95);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  backdrop-filter: blur(8px);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1890ff;
  line-height: 1.2;
}

.stat-label {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

/* ==================== 订单面板 ==================== */
.order-panel {
  width: 380px;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.order-panel-header {
  padding: 16px;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-panel-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: #1890ff; }

.order-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.order-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.order-card:hover {
  border-color: #1890ff;
  box-shadow: 0 2px 8px rgba(24,144,255,0.12);
}
.order-card.active {
  border-color: #1890ff;
  background: #f0f8ff;
}
.order-card.has-location::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #52c41a;
  border-radius: 8px 0 0 8px;
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.order-card-title {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.order-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #666;
}

.order-card-meta-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f5f5f5;
}

.order-card-time {
  font-size: 11px;
  color: #999;
}

/* ==================== 空状态 ==================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: #999;
}
.empty-state p { margin-bottom: 4px; }
.empty-state .hint { font-size: 12px; color: #bbb; }

/* ==================== 模态框 ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal.show { display: flex; }

.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #e8e8e8;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}
.modal-close:hover { background: #f5f5f5; color: #333; }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e8e8e8;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

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

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
}
.form-label .required { color: #ff4d4f; }

.form-input,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-input:focus,
.form-textarea:focus { border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.1); }

.form-textarea { resize: vertical; min-height: 70px; }

/* ==================== 详情面板 ==================== */
.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
}
.detail-row:last-child { border-bottom: none; }

.detail-label { color: #666; font-size: 13px; }
.detail-value { color: #333; font-size: 13px; font-weight: 500; text-align: right; }

.tracking-link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f5f7fa;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #e8e8e8;
}

.tracking-link-text {
  flex: 1;
  font-size: 12px;
  color: #1890ff;
  word-break: break-all;
  font-family: 'Consolas', monospace;
}

.qr-container {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #fafafa;
  border-radius: 8px;
  margin-top: 8px;
}

.location-info {
  background: #f0f8ff;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #bae7ff;
}
.location-info-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
.location-info-label { color: #666; }
.location-info-value { color: #333; font-weight: 500; }

/* ==================== Toast 通知 ==================== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 200px;
  max-width: 360px;
  animation: toastIn 0.3s ease;
  border-left: 3px solid #1890ff;
}
.toast.success { border-left-color: #52c41a; }
.toast.error { border-left-color: #ff4d4f; }
.toast.warning { border-left-color: #faad14; }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-icon { font-size: 16px; }

/* ==================== 首页 ==================== */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.landing-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  max-width: 560px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.landing-logo {
  font-size: 56px;
  margin-bottom: 16px;
}

.landing-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}

.landing-subtitle {
  font-size: 14px;
  color: #888;
  margin-bottom: 32px;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.landing-feature {
  padding: 16px 8px;
  background: #f5f7fa;
  border-radius: 8px;
}

.landing-feature-icon { font-size: 28px; margin-bottom: 8px; }
.landing-feature-text { font-size: 12px; color: #666; }

.landing-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ==================== 图片预览 ==================== */
.image-preview-box {
  width: 100%;
  min-height: 160px;
  max-height: 320px;
  background: #f5f7fa;
  border: 1px dashed #d9d9d9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-preview-empty {
  color: #bbb;
  font-size: 14px;
  text-align: center;
}

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bfbfbf; }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .order-panel { width: 100%; max-height: 40vh; }
  .admin-main { flex-direction: column; }
  .map-container { flex: 1; min-height: 50vh; }
  .map-stats { gap: 8px; padding: 8px 12px; }
  .stat-value { font-size: 18px; }
  .header { padding: 0 12px; }
  .header h1 { font-size: 15px; }
  .landing-features { grid-template-columns: 1fr; }
}
