* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 登录页面 */
.login-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.login-header h1 {
  margin: 0;
  color: #007AFF;
}

.login-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 30px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.server-select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  background-color: white;
}

.server-select:focus {
  outline: none;
  border-color: #007AFF;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #666;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #007AFF;
}

/* 按钮 */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background-color: #007AFF;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background-color: #0051D5;
}

.btn-back {
  background-color: white;
  color: #007AFF;
  padding-left:5px;
  padding-right:5px;
}

.btn-back:hover {
  background-color: white;
  color: #0051D5;
}

.btn-login {
  background-color: white;
  color: #007AFF;
}

.btn-login:hover {
  background-color: white;
  color: #0051D5;
}

.btn-block {
  width: 100%;
  margin-bottom: 15px;
}

.btn-success {
  background-color: #34C759;
  color: white;
  margin-right: 10px;
}

.btn-danger {
  background-color: #FF3B30;
  color: white;
  width: 100%;
}

/* 主页面 */
.header {
  background: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.user-name {
  font-size: 18px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s;
}

.icon-btn:hover {
  background: #e0e0e0;
}

.main-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  padding-bottom: 80px;
  margin-top: 70px;
}

.boxes-container {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 20px;
}

.box-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.box-card:hover {
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.box-card h3 {
  margin-bottom: 15px;
  color: #007AFF;
  font-size: 18px;
}

.box-card .box-count {
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

.box-card .box-count::after {
  content: '件';
  font-size: 18px;
  margin-left: 2px;
}

.scan-btn {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 40px;
  background: #007AFF;
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(0,122,255,0.3);
  cursor: pointer;
  transition: all 0.3s;
}

.scan-btn:hover {
  background: #0051D5;
  box-shadow: 0 6px 15px rgba(0,122,255,0.4);
}

/* 扫码页面 */
.scan-header {
  background: white;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.scan-header h2 {
  margin-left: 20px;
  font-size: 18px;
}

.scan-container {
  flex: 1;
  position: relative;
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
}

#scanVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flash-btn {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 30px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 20px;
  font-size: 16px;
  cursor: pointer;
}

/* 详情页面 */
.detail-header {
  background: white;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.detail-header h2 {
  margin-left: 20px;
  font-size: 18px;
}

.detail-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  max-width: 800px;
  margin-top: 70px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.detail-item {
  background: white;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-item h3 {
  margin-bottom: 10px;
  color: #333;
}

.detail-item p {
  margin: 5px 0;
  color: #666;
  line-height: 1.6;
}

.item-list {
  margin-top: 10px;
}

.item-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  margin: 5px 5px 5px 0;
  background: #f0f0f0;
  border-radius: 15px;
  font-size: 14px;
}

.item-tag .status {
  margin-left: 7px;
  margin-right: -5.5px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  color: white;
}

.status.in-stock {
  background-color: #34C759;
}

.status.out-stock {
  background-color: #FF3B30;
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.action-buttons .btn {
  flex: 1;
}

/* 搜索结果 */
.search-results {
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 5px;
  display: none;
}

.search-results.show {
  display: block;
}

.search-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

.search-item:hover {
  background-color: #f5f5f5;
}

.selected-admins {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: #007AFF;
  color: white;
  border-radius: 15px;
  font-size: 14px;
}

.admin-tag .remove {
  margin-left: 8px;
  cursor: pointer;
  font-weight: bold;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.modal-content p {
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.6;
}

/* 编辑模式 */
.editable {
  border: 1px dashed #007AFF;
  padding: 5px;
  border-radius: 3px;
  cursor: text;
}

.edit-input {
  width: 100%;
  padding: 8px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

/* 输入框与扫码按钮组合 */
.input-with-scan {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-with-scan input {
  flex: 1;
}

.scan-inline-btn {
  padding: 8px 12px;
  background-color: #007AFF;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

.scan-inline-btn:hover {
  background-color: #0051D5;
}

/* 输入框前缀 */
.input-prefix {
  display: inline-block;
  padding: 12px 0;
  margin-right: 5px;
  color: #666;
  font-size: 16px;
  vertical-align: top;
}

.input-with-prefix {
  display: inline-block;
  width: calc(100% - 40px);
}

.input-with-prefix input {
  width: 100%;
}

.input-with-prefix-and-scan {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 40px);
}

/* 转移记录 */
.transfer-history {
  margin-top: 15px;
}

.transfer-item {
  padding: 10px;
  background: #f8f8f8;
  margin-bottom: 8px;
  border-radius: 5px;
  font-size: 14px;
  color: #666;
}

/* 响应式 */
@media (max-width: 768px) {
  .login-container {
    margin: 50px 20px;
  }

  .detail-content {
    padding: 15px;
  }
}
