:root {
  --color1: #ffffff;
  --color2: #1a1a1a;
  --color3: #e63746;
  --color4: #eeeeee;
  --color5: #999999;
  --color6: #fff8f0;
  --color7: #faf3e0;
}

/*----------------------------Header-------------------------------*/

header {
  background-color: var(--color1);
  position: fixed;
  width: 100%;
  top: 0;
  height: 80px;
  gap: 78px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 78px;
  padding: 0 40px;
  position: relative;
}

header .left-header,
header .right-header {
  display: flex;
  /* gap: 55px; */
  align-items: center;
  width: 330px;
}

.left-header{
  display: block;
}

.header-logo-wrapper a {
  display: block;
  margin: 0 auto;
}

.right-header {
  margin-right: 30px;
  display: block;
}

header .left-header li,
header .right-header li {
  border-bottom: 4px solid transparent;
  transition: border-color 0.3s ease;
  flex-grow: 1;
}

.header-logo {
  height: 29px;
  transition: all 0.3s ease, filter 0.05s linear;
  filter: brightness(1);
}

.header-logo:hover {
  filter: brightness(0) saturate(100%) invert(31%) sepia(76%) saturate(2613%)
    hue-rotate(340deg) brightness(98%) contrast(88%);
  transform: scale(1.1);
}

header .left-header li a:hover,
header .right-header li a:hover {
  color: var(--color3);
  transform: scale(1.5);
}

header .left-header li:hover,
header .right-header li:hover {
  border-bottom: 4px solid var(--color3);
}

/*a的預設值會大於繼承，所以要寫在a裡面*/
header a {
  font-size: 1em;
  font-weight: bold;
  display: block;
  padding: 4px;
  text-align: center;
  text-decoration: none;
  color: var(--color2);
  transition: all 0.3s ease;
}

.header-icon {
  width: 20px;
}

.header-fixed {
  position: absolute;
  right: 24px;
  top: 5px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.cart-icon,
.user-icon {
  position: relative; 
}

/* ------------------------------add : 購物車 swift pannel------------------------------ */
.cart-icon {
  position: relative;
}
.cart-icon a {
  display: block;
  cursor: pointer;
}

/* container */
.cart-panel-wrapper {
  position: absolute;
  top: 40px;
  right: -15px;
  /* width: 350px;
  max-width: 90vw; */
  display: none;
  z-index: 2000;
}

.cart-panel-wrapper.active {
  display: block; 
}

.cart-panel {
  background-color: var(--color1);
  border-radius: 12px;
  padding: 24px;
  transform: translateY(-10px);
  opacity: 0;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  transition: all 0.3s ease;
  border: 2px solid var(--color4);
  white-space: normal;
  width: 350px;
  max-width: 90vw;
}

/*hover*/
/* .cart-icon:hover .cart-panel {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.cart-panel:hover {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
} */

.cart-panel-wrapper.active .cart-panel {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.cart-panel::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--color4);
}

.cart-panel::after {
  content: "";
  position: absolute;
  top: -8px;
  right: 21px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 9px solid var(--color1);
}

/* 標題 */
.cart-panel h3 {
  font-size: 1.25em;
  font-weight: bold;
  color: var(--color2);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color4);
}

/* 購物車項目列表 */
.cart-items {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 8px;
}

/* 單個項目 */
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  /* background-color: var(--color6); */
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

.cart-item:hover {
  background-color: var(--color7);
}

.cart-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.cart-item h4 {
  font-size: 0.95em;
  font-weight: bold;
  color: var(--color2);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

/* 新增：數量和價格的容器 */
.cart-item-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cart-item p {
  font-size: 0.85em;
  color: var(--color5);
  margin: 0;
}

.cart-item .price {
  font-weight: bold;
  color: var(--color3);
  font-size: 1em;
  white-space: nowrap;
}

/* 總計 */
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 12px;
  background-color: var(--color7);
  border-radius: 8px;
  margin-bottom: 30px;
}

.cart-total h4 {
  font-size: 1.1em;
  font-weight: bold;
  color: var(--color2);
  margin: 0;
}

.cart-checkout {
  width: 160px;
  height: 48px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cart-total h4:last-child {
  color: var(--color3);
  font-size: 1.3em;
}

/* 滾動條樣式 */
.cart-items::-webkit-scrollbar {
  width: 6px;
}

.cart-items::-webkit-scrollbar-track {
  background: var(--color4);
  border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
  background: var(--color5);
  border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
  background: var(--color3);
}

.goToCheckOut {
  display: block;
  text-decoration: none;
  color: var(--color1);
  max-width: 120px;
  background-color: var(--color3);
  border-radius: 8px;
  text-align: center;
  line-height: 48px;
  font-size: 1.1em;
  z-index: 2;
  width: 100%;
  font-weight: normal;
}

.cart-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-close-btn:hover {
  transform: scale(1.1) rotate(90deg);
}

.cart-close-btn svg {
  display: block;
}


/*----------------------------Hamburger-------------------------------*/

.transition{
          transition: 1.5s;  
        }

.hamburgerWrapper{
    width: 800px;
    margin: 20px;
    display: none;
}

.menu{
    display: inline-block;
    position: relative;
    padding: 0 0 0 3px;
    cursor: pointer;
}

.menu.active{
    background-color: var(--color1);
}

.menu ul::after{
  content: "";
  position: absolute;
  top: -8px;
  right: 10px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 9px solid var(--color1);
}


.menu ul{
    position: absolute;
    left: auto;
    top: 80px;
    right: 20px;
    background-color: var(--color1);
    width: 460px;
    max-width: 85vw;
    opacity: 0;
    pointer-events: none; 
    z-index: 998;
    border-radius: 12px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    padding: 20px;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.menu.active ul {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.menu.active ul{
    opacity: 1;
    pointer-events: auto;
    /* outline: 2px solid rgba(230, 55, 70, 0.3); */
}

.menu ul li:active:has(h5){
  background-color: var(--color3);
  border-radius: 12px;
}

.menu ul li:active:has(h5) h5{
  color: var(--color1);
  transition: all 0.3s ease ;
  scale: 1.1;
}

.hamburgerWrapper ul li,
.menu ul li {
    list-style: none;
    padding: 12px 0;
    border-bottom: 1px solid var(--color4);
}

.menu ul li:last-child {
  border-bottom: none;
}

.hamburgerWrapper ul li a {
  text-decoration: none;
  display: block;
  transition: color 0.2s;
}


.hamburgerWrapper ul li a h5 {
  color: var(--color3);
  font-size: 1.75em;
  /* border-bottom: 2px solid rgba(230, 55, 70, 0.3); */
}

.menu ul li:last-child a h5 {
  border-bottom: none;
}


.bar{
    width: 28px;
    height: 4px;
    background-color: var(--color3);
    margin: 2px 0px 8px;
    border-radius: 2px;
}


.menu.active .bar1{transform: rotate(-45deg) translate(-9px, 7px);} /* x, y軸 */
.menu.active .bar2{opacity: 0;}
.menu.active .bar3{transform: rotate(45deg) translate(-9px, -8px);}





