html,
body {
  height: 100%;
  /* 父元素要有高度，子元素的百分比才生效 */
  margin: 0;
  background-color: #dcdcdc;
}

.container {
  display: flex;
  width: 100%;
  height: 100%;
}

.left-panel {
  margin-left: 2%;
  width: 40%;
  margin-top: 3%;
  display: flex;
  flex-direction: column;
}

.left-top {
  width: 100%;
  height: 130px;
  background-color: white;
  border-radius: 10px;
}

.adminP {
  font-size: 15px;
  padding: 0% 0%;
  margin-left: 9px;
  margin-top: 20px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.left-center {
  width: 100%;
  height: 370px;
  background-color: white;
  border-radius: 10px;
  margin-top: 5%;
}

.left-bottom {
  width: 100%;
  height: 300px;
  /* border: 1px solid blue; */
  margin-top: 5%;
  background-color: white;
}

.right-panel {
  margin-left: 4%;
  width: 51%;
  height: 90%;
  margin-top: 3%;
  background-color: white;
  border-radius: 15px;
  /* border: 2px solid yellow; */
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}

.user-table th,
.user-table td {
  padding: 10px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.user-table th {
  background-color: #f5f5f5;
  font-weight: bold;
}

.user-table tr:hover {
  background-color: #f9f9f9;
}

.edit-btn {
  background-color: #6e8cfb;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}

.edit-btn:hover {
  background-color: #5d7ff9;
}

.update-btn {
  background-color: #6e8cfb;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}

.update-btn:hover {
  background-color: #5d7ff9;
}

@media (max-width: 768px) {
  /* 整体容器改为竖直排列，宽度适应 */
  .container {
    flex-direction: column;
    align-items: center;
    padding: 10px;
    width: 100%;
    max-width: 100%; /* 保证宽度最大不超过屏幕宽度 */
    box-sizing: border-box;
  }

  /* 左面板：铺满宽度，左右间距一致 */
  .left-panel{
    width: 100%; /* 保证左右面板宽度一致 */
    margin: 0;
    margin-top: 10px;
    height: auto; /* 高度根据内容自动调整 */
    border-radius: 10px;
    max-width: 100%; /* 保证不超出屏幕 */
    box-sizing: border-box;
  }

  /* 左面板的顶部区域 */
  .left-top {
    height: auto;
    padding: 10px;
    border-radius: 10px;
    width: 135%;
  }

  .left-center,
  .left-bottom {
    width: 135%;
    height: auto;
    margin-top: 15px;
    border-radius: 10px;
  }

  /* 右面板 */
  .right-panel {
    width: 135%; 
    margin-top: 20px;
    margin-left: 140px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto;
  }

  /* 表格样式 */
  .user-table {
    width: 100%;
    display: table;
    border-spacing: 0 8px;
    white-space: normal;
    font-size: 13px;
    overflow-x: auto; /* 使表格在宽度不足时可横向滚动 */
    min-width: 0; /* 防止超出容器 */
  }

  .user-table th,
  .user-table td {
    font-size: 13px;
    padding: 8px 5px;
    word-wrap: break-word; /* 保证长单词换行 */
  }

  /* 确保输入框、按钮等元素在手机端适应屏幕 */
  #addStockForm .form-control {
    font-size: 14px;
    padding: 6px 8px;
  }

  #addStockForm label {
    font-size: 14px;
  }

  .update-btn,
  .edit-btn {
    font-size: 13px;
    padding: 6px 10px;
    width: 100%; /* 使按钮适应屏幕宽度 */
  }

  /* 防止按钮溢出 */
  .update-btn,
  .edit-btn {
    font-size: 13px;
    padding: 6px 12px;
    width: 100%;
    box-sizing: border-box;
  }

  /* 确保容器不超出屏幕 */
  .left-panel{
    max-width: 100%; /* 保证容器宽度不超过屏幕宽度 */
    box-sizing: border-box; /* 确保不溢出 */
  }
}
