/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 50;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
}
.modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 20px;
  border-radius: 10px;
  width: 80%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
}

/* 可编辑行样式 */
.editable-line {
  border-bottom: 1px solid #000;
  display: inline-block;
  min-width: 120px;
  outline: none;
}

/* 打印样式 */
@media print {
  @page {
    margin: 0;
    size: auto;
  }
  /* 隐藏主容器 */
  body > .container {
    display: none !important;
  }
  /* 隐藏断开连接弹窗和活动指示器 */
  .disconnect-modal, .activity-indicator {
    display: none !important;
  }
  /* 统一html/body打印样式 */
  html, body {
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  /* 模态框打印样式 - 只显示小票弹窗 */
  .modal {
    display: none !important;
    position: static !important;
    background: none !important;
    height: auto !important;
  }
  /* 只显示小票弹窗 */
  #ticketModal {
    display: block !important;
  }
  .modal-content {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 5px !important;
    width: 100% !important;
    height: auto !important;
  }
  /* 隐藏操作按钮和关闭按钮 */
  .close, .modal-content > div.flex {
    display: none !important;
  }
  /* 打印时隐藏横线 */
  .editable-line {
    border-bottom: none !important;
  }
}

/* 数据下拉菜单 */
.data-dropdown { position: relative; display: inline-block; }
.data-dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: white;
  min-width: 140px;
  max-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 10;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  padding: 4px 0;
}
.data-dropdown-content.show { display: block; }
.data-dropdown-content a {
  padding: 8px 12px;
  text-decoration: none;
  display: block;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  white-space: nowrap;
  font-weight: 500;
}
.data-dropdown-content a i {
  width: 18px;
  margin-right: 6px;
  text-align: center;
  font-size: 0.875rem;
}
.new-record-item { color: #2563eb; }
.new-record-item:hover { background-color: #dbeafe; color: #1d4ed8; }
.export-csv-item { color: #059669; }
.export-csv-item:hover { background-color: #d1fae5; color: #047857; }

/* MQTT连接状态指示器（增强版） */
.mqtt-status {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: #f3f4f6;
  position: relative;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}
.status-connected { background-color: #10b981; }
.status-disconnected { background-color: #ef4444; }
.status-warning { background-color: #f59e0b; animation: pulse 2s infinite; }
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* 待发消息徽章 */
.pending-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #ef4444;
  color: white;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* 断开连接弹窗样式 */
.disconnect-modal { display: none; }
.disconnect-modal-content {
  background-color: #f8f9fa;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  border: 2px solid #e9ecef;
}
.disconnect-icon {
  font-size: 60px;
  color: #6b7280;
  margin-bottom: 20px;
}
.reconnect-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.reconnect-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

/* 活动指示器 */
.activity-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: #6b7280;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 1000;
}

/* 加载指示器 */
.loader {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 8px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}