@import url("../../assets/css/common.css");

.side-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.bag-items-container {
  flex: 1; /* 关键属性 - 占据剩余空间 */
  min-height: 40px;
  overflow: hidden; /* 外层隐藏溢出 */
  .side-panel-item-header {
    background-color: #495057;
  }
  .bag-items-outer {
    height: calc(100% - 40px); /* 继承父容器高度 */
    overflow-y: auto; /* 内部滚动条 */
    .bag-items {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      padding: 8px;
      padding-bottom: 0px;
      img {
        width: 50px;
        height: 50px;
        object-fit: cover;
        border-radius: 4px;
      }
    }
  }
}

.shopping-list-container {
  flex-shrink: 0; /* 禁止高度收缩 */
  flex: 0 0 auto; /* 高度由内容决定 */
  min-height: 120px; /* 最小高度保证布局 */
}

/* 游戏区域网格布局 */
#shelf {
  display: grid;
  gap: 8px;
  padding: 12px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  grid-template-columns: var(--grid-columns);
  grid-template-rows: var(--grid-rows);

  /* 商品基本样式 */
  .goods-item {
    width: 100%;
    /* 保持为正方形 */
    aspect-ratio: 1/1;
    perspective: 1000px; /* 3D效果的视角 */
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: transform 0.1s;
    margin: 0 auto; /* 居中卡片 */
  }
  .goods-item-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    border-radius: 8px;
  }

  .goods-item-inner img {
    width: 100%;
    height: auto; /* 保持图片的原始比例 */
    display: block; /* 去除图片底部默认的空白间隙 */
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }
  .goods-item:hover {
    transform: scale(1.2);
  }
}

#shopping-list {
  max-height: 200px; /* 购物车最大高度限制 */
  overflow-y: auto; /* 购物车自身滚动 */
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  width: 100%;
  height: fit-content;
  min-height: 60px !important;
  /* height: 100%; */
  box-sizing: border-box;

  /* overflow-y: auto; */

  /* 商品基本样式 */
  .goods-item {
    width: max-content;
    height: max-content;
    cursor: pointer;
    user-select: none;
    margin: 0 auto; /* 居中卡片 */

    .goods-item-inner {
      position: relative;
      text-align: center;
      border-radius: 8px;
      img {
        width: 50px;
        height: 50px;
        display: block; /* 去除图片底部默认的空白间隙 */
        border-radius: 4px;
      }
      .goods-info {
        display: block;
        font-size: 12px;
        margin-top: 4px;
        border-radius: 4px;
        margin-top: 4px;
        .price-number {
          margin-left: 2px;
          color: #4caf50;
          transition: color 0.3s ease;
        }
        .price-number.unvalidated {
          color: #ffd700;
          font-weight: bold;
        }
        .price-unit {
          color: inherit; /* 继承父元素颜色 */
        }
      }
    }
  }
  .goods-item:hover {
    transform: scale(1.1);
  }
}

.side-panel-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  #checkout-btn {
    margin: 4px auto;
    width: 60px;
    height: 40px;
    border-radius: 8%;
    background: linear-gradient(145deg, #4caf50, #45a049);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #checkout-btn i {
    font-size: 28px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
  }

  #checkout-btn:hover i {
    transform: scale(1.2) rotate(-15deg);
  }

  #checkout-btn:active {
    transform: scale(0.95);
    background: linear-gradient(145deg, #45a049, #4caf50);
  }
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  .over-content {
    font-size: 56px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease-out;
    will-change: transform, opacity;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes textGlow {
  0% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  }
  50% {
    text-shadow: 0 0 30px rgba(255, 255, 255, 1);
  }
  100% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  }
}

@keyframes slideOut {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-30px);
    opacity: 0;
  }
}

/* 结账对话框核心样式 */
.confirm-box {
  .custom-content {
    /* padding: 15px; */
    background: #f8f9fa;
    border-radius: 12px;
    margin: 15px 0;
  }

  input[type="text"] {
    /* box-sizing: border-box; */
    height: 60px; /* 增加高度 */
    width: 260px;
    font-size: 28px; /* 放大字体 */
    padding: 16px; /* 增加内边距 */
    border-radius: 12px; /* 调大圆角 */
    margin-bottom: 20px; /* 增加下边距 */

    &:focus {
      outline: none;
      border-color: #4caf50;
      box-shadow: 0 0 8px rgba(76, 175, 80, 0.2);
    }
  }
}

/* 数字键盘网格系统 */
.numpad {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  /* padding: 10px; */

  button {
    aspect-ratio: 1;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #ffffff, #f1f3f5);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-size: 32px;
    color: #495057;
    transition: all 0.2s;

    &:hover {
      background: linear-gradient(145deg, #4caf50, #45a049);
      color: white;
      transform: translateY(-2px);
    }

    &:active {
      transform: scale(0.95);
    }
  }
  /* 确认按钮特殊样式 */
  button[data-key="✓"] {
    background: linear-gradient(145deg, #4caf50, #45a049) !important;
    color: white !important;
  }

  button[data-key="✓"]:hover {
    background: linear-gradient(145deg, #45a049, #3d8b40) !important;
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.4);
  }
}
