/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Microsoft Yahei", sans-serif;
}

body {
  background-color: #f5f5f5;
}

.container {
  width: 1200px;
  margin: 0 auto;
}

/* 顶部用户栏 */
.header-top {
  background-color: #ff4400;
  padding: 10px 0;
  color: #fff;
}

.user-actions {
  text-align: right;
}

.user-actions a {
  color: #fff;
  text-decoration: none;
  margin-left: 20px;
  font-size: 14px;
}

.user-actions a:hover {
  text-decoration: underline;
}

.cart-count {
  background-color: #fff;
  color: #ff4400;
  padding: 0 5px;
  border-radius: 10px;
}

/* 导航栏 */
.nav-main {
  background-color: #fff;
  padding: 10px 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-main .container {
  display: flex;
  align-items: center;
}

.logo img {
  width: 150px;
}

.category-nav {
  flex: 1;
  margin-left: 30px;
}

.category-nav ul {
  display: flex;
  list-style: none;
}

.category-nav li {
  margin-right: 30px;
  font-size: 16px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 5px;
}

.category-nav li.active {
  background-color: #ff4400;
  color: #fff;
}

.category-nav li:hover:not(.active) {
  background-color: #f5f5f5;
}

/* 轮播图 */
.banner-slider {
  position: relative;
  width: 100%;
  height: 580px;
  overflow: hidden;
  margin: 10px 0;
}

.slider-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.slider-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.slider-item.active {
  opacity: 1;
}

.slider-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 80px;
  background-color: rgba(0,0,0,0.3);
  color: #fff;
  border: none;
  outline: none;
  cursor: pointer;
  font-size: 20px;
  z-index: 10;
}

.slider-btn:hover {
  background-color: rgba(0,0,0,0.5);
}

.prev-btn {
  left: 0;
  border-radius: 0 5px 5px 0;
}

.next-btn {
  right: 0;
  border-radius: 5px 0 0 5px;
}

.slider-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}

.slider-indicator span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(255,255,255,0.5);
  cursor: pointer;
}

.slider-indicator span.active {
  background-color: #ff4400;
}

/* 商品展示区 */
.goods-section {
  padding: 20px 0;
}

.section-title {
  font-size: 24px;
  margin-bottom: 20px;
  color: #333;
  border-bottom: 2px solid #ff4400;
  padding-bottom: 10px;
}

.goods-list {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.goods-item {
  width: calc(25% - 15px);
  background-color: #fff;
  padding: 15px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

.goods-item:hover {
  transform: translateY(-5px);
}

/* 商品图片容器 - 核心放大特效 */
.goods-img-wrap {
  width: 100%;
  height: 200px;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: 5px;
  position: relative;
}

.goods-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease; /* 平滑过渡 */
}

/* 悬停放大特效 */
.goods-img-wrap:hover img {
  transform: scale(1.1); /* 放大1.1倍 */
}

.goods-name {
  font-size: 14px;
  margin-bottom: 10px;
  color: #333;
  height: 40px;
  overflow: hidden;
}

.goods-price {
  font-size: 18px;
  color: #ff4400;
  font-weight: bold;
  margin-bottom: 15px;
}

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

.goods-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}

.add-cart {
  background-color: #ff4400;
  color: #fff;
}

.add-collect {
  background-color: #f5f5f5;
  color: #333;
}

.add-cart:hover {
  background-color: #e63e00;
}

.add-collect:hover {
  background-color: #e0e0e0;
}

/* 弹窗基础样式 - 优化为独立悬浮层 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999; /* 最高层级 */
  display: none;
  overflow-y: auto;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6); /* 更深的遮罩 */
  backdrop-filter: blur(2px); /* 毛玻璃效果 */
}

.modal-content {
  position: relative;
  top: 100px;
  margin: 0 auto;
  background-color: #fff;
  padding: 0;
  border-radius: 8px;
  width: 400px;
  max-width: 90%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2); /* 立体阴影 */
  animation: modalFadeIn 0.3s ease; /* 淡入动画 */
}

/* 登录/注册弹窗专属样式 */
.login-content, .register-content {
  width: 450px;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  text-align: center;
}

/* 表单样式优化 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: #ff4400;
  box-shadow: 0 0 0 3px rgba(255, 68, 0, 0.1);
}

.code-group {
  margin-bottom: 25px;
}

.code-wrap {
  display: flex;
  gap: 10px;
}

.code-input {
  flex: 1;
}

.code-box {
  padding: 12px 20px;
  background-color: #f5f5f5;
  border-radius: 6px;
  color: #ff4400;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.3s ease;
}

.code-box:hover {
  background-color: #eee;
}

.modal-btn {
  width: 100%;
  padding: 12px 0;
  background-color: #ff4400;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.modal-btn:hover {
  background-color: #e63e00;
}

/* 弹窗动画 */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 10;
}

.close-btn:hover {
  color: #ff4400;
  background-color: #f5f5f5;
}

/* 购物车弹窗样式 */
.cart-content {
  width: 800px;
  top: 50px;
}

.cart-empty {
  text-align: center;
  padding: 50px 0;
  color: #999;
}

.cart-empty i {
  font-size: 50px;
  margin-bottom: 10px;
  color: #ccc;
}

.cart-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
  display: none;
  padding: 0 20px;
}

.cart-item {
  display: flex;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}

.cart-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  margin-right: 15px;
  border-radius: 5px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 14px;
  margin-bottom: 10px;
  color: #333;
}

.cart-item-price {
  font-size: 16px;
  color: #ff4400;
  font-weight: bold;
}

.cart-item-ctrl {
  display: flex;
  align-items: center;
}

.cart-num {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 3px;
  margin-right: 15px;
}

.cart-num-btn {
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border: none;
  background-color: #f5f5f5;
  cursor: pointer;
}

.cart-num-input {
  width: 40px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border: none;
  outline: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

.cart-del-btn {
  color: #ff4400;
  cursor: pointer;
}

.cart-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-top: 2px solid #ff4400;
  display: none;
}

.total-price {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.total-price span {
  color: #ff4400;
}

.checkout-btn {
  padding: 10px 20px;
  background-color: #ff4400;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 16px;
  cursor: pointer;
}

.checkout-btn:hover {
  background-color: #e63e00;
}

/* 成功弹窗 */
.success-icon {
  text-align: center;
  margin-bottom: 20px;
}

.success-icon i {
  font-size: 60px;
  color: #4CAF50;
}

#success-modal h3 {
  text-align: center;
  margin-bottom: 15px;
}

#success-modal p {
  text-align: center;
  margin-bottom: 20px;
  color: #666;
}

#success-modal span {
  color: #ff4400;
  font-weight: bold;
}

#back-home {
  width: 100%;
  padding: 12px 0;
  background-color: #ff4400;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

#back-home:hover {
  background-color: #e63e00;
}
