/* ========== 燈箱基礎樣式 ========== */
.hidden {
  display: none !important;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  overflow-y: auto;
  transition: opacity 0.3s ease;
}

.lightbox-overlay.hidden {
  display: none;
  opacity: 0;
}

.lightbox {
  width: fit-content;
  max-width: calc(100% - 40px);
  /* min-height: 70vh; */
  background: #fff;
  padding: 48px;
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 關閉按鈕 */
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 10;
  font-size: 2.5rem;
}

.lightbox-close:hover {
  background: #f5f5f5;
  color: #333;
}

.lightbox-close:focus {
  outline: 2px solid #a59768;
  outline-offset: 2px;
}

/* 載入中狀態 */
.lightbox-loading {
  text-align: center;
  padding: 80px 20px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f0f0f0;
  border-top-color: #a59768;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.lightbox-loading p {
  color: #666;
  font-size: 1rem;
}

.lightbox-content.hidden {
  display: none;
}

/* ========== 三欄佈局 ========== */
.lightbox-grid {
  display: grid;
  grid-template-columns: 285px 385px 435px;
  column-gap: 40px;
  align-items: start;
  justify-content: center;
}

/* 左欄：聯絡資訊 */
.col-left {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.store-logo-box {
  width: 250px;
  height: 250px;
  background: #fff;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.store-logo-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.store-contact {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: #666;
  text-transform: uppercase;
}

.contact-text {
  font-size: 0.875rem;
  color: #333;
  line-height: 1.6;
}

.store-website-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px; /* Restore padding */
  background: transparent;
  color: #a59768;
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 4px; /* Restore border-radius */
  transition: all 0.3s ease;
  margin-top: 8px;
  width: fit-content;
  border: 1px solid #a59768; /* Add border */
}

.store-website-btn:hover {
  color: #8f7f57;
  border-color: #8f7f57;
  background: rgba(165, 151, 104, 0.05);
}

.store-website-btn:focus {
  outline: 2px solid #a59768;
  outline-offset: 2px;
}

/* 中欄：商家介紹 */
.col-mid {
  display: flex;
  flex-direction: column;
  max-height: 520px;
  /* overflow-y and padding-right are moved to .store-description */
}

/* 自訂滾動條 for description */
.store-description::-webkit-scrollbar {
  width: 8px;
}

.store-description::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.store-description::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 4px;
}

.store-description::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

.store-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: #333;
  margin: 0 0 16px 0;
  letter-spacing: 1px;
}

.title-divider {
  width: 100%;
  height: 1px;
  background: #e0e0e0;
  margin-bottom: 24px;
}

.store-description {
  font-size: 0.9375rem;
  color: #555;
  line-height: 1.8;
  flex: 1; /* Allow this area to grow and fill the space */
  overflow-y: auto; /* Apply scrollbar only to this area */
  padding-right: 16px; /* Move padding here for scrollbar spacing */
}

.store-description h3,
.store-description h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #333;
  margin: 24px 0 12px 0;
}

.store-description p {
  margin-bottom: 16px;
}

.store-description > *:first-child {
  margin-top: 0;
}

/* 右欄：圖片輪播 */
.col-right {
  width: 420px;
  position: relative;
}

.store-swiper {
  width: 100%;
  aspect-ratio: 1 / 1; /* Make it a square */
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.store-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
}

.store-swiper .swiper-slide img {
  width: 100%;
  height: 100%; /* Fill the square container */
  object-fit: cover;
  cursor: grab;
}

.store-swiper .swiper-slide img:active {
  cursor: grabbing;
}

/* Swiper 導航按鈕 */
.swiper-button-prev,
.swiper-button-next {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.swiper-button-prev::after,
.swiper-button-next::after {
  content: none;
}

.swiper-button-prev {
  left: 16px;
}

.swiper-button-next {
  right: 16px;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.swiper-button-prev:focus,
.swiper-button-next:focus {
  outline: 2px solid #a59768;
  outline-offset: 2px;
}

.swiper-button-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* 單張圖片顯示 */
.store-single-image {
  width: 100%;
  height: 420px;
  border-radius: 4px;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store-single-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 商家簡介 */
.store-summary {
  padding: 16px;
  background: #f9f9f9;
  border-left: 3px solid #a59768;
  margin-bottom: 24px;
  font-size: 0.9375rem;
  line-height: 1.8;
  color: #666;
}



/* ========== 響應式設計 ========== */


/* 筆電 */
@media screen and (max-width: 1399px) {

  .store-title {
    font-size: 1.6rem;
  }
  .lifeListBox .storeLogo {
    height: 160px;
  }
  .lightbox-grid {
    column-gap: 5px;
  }
  .col-right {
    width: 400px;
  }
}

/* 平板 */
@media screen and (max-width: 1250px) {
  .lightbox {
    padding: 40px;
    min-height: auto;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .lightbox-grid {
    grid-template-columns: 1fr; /* Switch to single column */
    gap: 32px;
  }

  .col-left {
    flex-direction: row; /* Make logo and contact info side-by-side */
    align-items: center;
    gap: 40px;
  }
  
  .col-mid, .col-right {
    width: 100%;
    min-width: 0; /* Prevent overflow */
  }

  .store-logo-box {
    width: 300px;
    height: 300px;
    flex-shrink: 0; /* Prevent logo from shrinking */
  }
  

  .col-mid {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}



/* 手機版 */
@media screen and (max-width: 768px) {
  .lightbox-overlay {
    padding: 50px 15px 20px; /* 增加上邊距，讓燈箱下移 */
    align-items: flex-start; /* 從頂部對齊 */
  }
  
  .lightbox {
    width: 100%; /* It will respect the overlay's padding */
    max-width: 100%;
    height: auto; /* Let height be determined by content */
    max-height: calc(100vh - 40px); /* Ensure it doesn't exceed viewport height */
    padding: 24px;
    border-radius: 4px; /* Restore border-radius for a nicer look */
    overflow-y: auto; /* Allow lightbox itself to scroll if content is too tall */
  }

  .store-title {
    font-size: 1.45rem; 
    text-align: center;
  }
  

  .swiper-button-prev,
  .swiper-button-next {
    width: 36px;
    height: 36px;
    opacity: 1; /* 在手機上強制顯示 */
  }

  .swiper-button-next svg,
  .swiper-button-prev svg {
    opacity: 1; /* 在手機上強制顯示圖示 */
  }
  
  .swiper-button-prev {
    left: 12px;
  }
  
  .swiper-button-next {
    right: 12px;
  }
}

@media screen and (max-width: 480px) {
  .lightbox {
    padding: 40px 20px;
  }
  
  .store-logo-box {
    width: 165px;
    height: 165px;
  }
  
  .store-title {
    font-size: 1.45rem;
  }
  
}

/* Prevent unwanted text selection on fast clicks in Swiper */
.store-swiper,
.store-swiper .swiper-slide,
.store-swiper .swiper-button-next,
.store-swiper .swiper-button-prev {
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none;    /* Firefox */
  -ms-user-select: none;     /* IE10+/Edge */
  user-select: none;         /* Standard */
}

/* Swiper SVG Icon Opacity */
.swiper-button-next svg,
.swiper-button-prev svg {
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.swiper-button-prev:hover svg,
.swiper-button-next:hover svg {
  opacity: 1;
}