/* Featured Collection Swiper Styles - Simplified */
:root {
  /* Swiper configuration variables */
  --swiper-slide-gap: 20px;
  --swiper-slides-desktop: 6;
  --swiper-slides-laptop: 4;
  --swiper-slides-tablet: 3;
  --swiper-slides-mobile: 2;

  /* アイコンが42pxだから半分の21px */
  --swiper-navigation-sides-offset: -21px;
}

/* コンテンツ幅1600px + アイコンの半分21px + 余白9px */
/* スクロールバーの分があるので余分にとる*/
@media screen and (max-width: 1680px) {
  .swiper-button-next {
    display: none !important;
  }
  .swiper-button-prev {
    display: none !important;
  }
}

.featured-collection-swiper-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem 30px;
  padding-bottom: 3rem;
  position: relative;
  width: 100%;
  overflow: visible;
  box-sizing: border-box;
}

/* Title styling to match container padding */
.collection .collection__title {
  max-width: 1600px;
  margin: 0 auto;
  padding-left: 30px;
  padding-right: 30px;
}

/* Dual language title styling */
.featured-collection__title-container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.featured-collection__en-title {
  margin: 0;
  font-weight: 700;
}

.featured-collection__jp-title {
  color: #505050;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 4px;
}

/* Ensure all elements use border-box sizing */
.featured-collection-swiper-container *,
.featured-collection-swiper-container *::before,
.featured-collection-swiper-container *::after {
  box-sizing: border-box;
}

.featured-collection-swiper {
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Initial layout before Swiper initializes - prevent single column */
.featured-collection-swiper:not(.swiper-initialized) .swiper-wrapper {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--swiper-slide-gap);
}

/* Hide overflow during initialization */
.featured-collection-swiper:not(.swiper-initialized) {
  overflow: hidden;
}

/* Slide Layout - Individual product slides */
.featured-collection-slide {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: auto;
}

/* Swiperが初期化された後のスライド高さ統一 */
.swiper-initialized .featured-collection-slide {
  height: auto;
}

.swiper-initialized .swiper-wrapper {
  align-items: stretch;
}

/* Ensure slides are visible before Swiper init */
.featured-collection-swiper:not(.swiper-initialized) .swiper-slide {
  flex: 0 0
    calc(
      (100% / var(--swiper-slides-desktop)) -
        (
          var(--swiper-slide-gap) * (var(--swiper-slides-desktop) - 1) /
            var(--swiper-slides-desktop)
        )
    );
  max-width: calc(
    (100% / var(--swiper-slides-desktop)) -
      (
        var(--swiper-slide-gap) * (var(--swiper-slides-desktop) - 1) /
          var(--swiper-slides-desktop)
      )
  );
  display: flex;
  flex-direction: column;
}

.featured-collection-product-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 3px;
  overflow: hidden;
}

.featured-collection-product-item .nicobay-product-ranking__item {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.featured-collection-product-item .nicobay-product-ranking__card {
  overflow: visible;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.featured-collection-product-item .nicobay-product-ranking__card-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

/* Fix image overflow issue */
.featured-collection-product-item .nicobay-product-ranking__image-wrapper {
  overflow: hidden;
  padding: 0.75rem;
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.featured-collection-product-item .nicobay-product-ranking__image-wrapper img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.featured-collection-product-item .nicobay-product-ranking__info {
  /* flex: 1; */
  width: 100%;
}

/* Cart Button Styles */
.featured-collection-card__cart-button-wrapper {
  padding: 0 1rem 1rem;
  /* margin-top: -0.75rem; */ /* Further reduce gap from product info */
  display: flex;
  gap: 0.5rem;
  align-items: center;
  visibility: visible;
  position: relative;
}

.featured-collection-card__cart-button {
  flex: 1;
  display: block;
  visibility: visible;
}

.featured-collection-card__info-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.featured-collection-card__info-icon:hover {
  transform: scale(1.1);
}

.featured-collection-card__info-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.featured-collection-cart-btn {
  width: 100%;
  padding: 0.25rem 1rem;
  color: white;
  background-color: #168707;
  border: none;
  border-radius: 16px;
  font-size: 12px;
  /* font-weight: 600; */
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  visibility: visible;
  line-height: 1;
  height: 3.5rem;
}

@media screen and (max-width: 750px) {
  .collection-results-main .featured-collection-cart-btn .icon-cart {
    display: none !important;
  }

  .featured-collection__title-container {
    flex-direction: column;
    align-items: start;
    gap: 5px;
  }

  .featured-collection__header {
    gap: 2px;
  }

  .featured-collection__view-all-btn {
    padding: 7px 15px !important;
  }
}

/* Cart icon for featured collection */
.featured-collection-cart-btn .icon-cart {
  display: inline-block;
  width: 30px;
  height: 30px;
  stroke: white;
  stroke-width: 0.5px;
  visibility: visible;
  flex-shrink: 0;
}

.featured-collection-cart-btn svg {
  display: inline-block;
  width: 16px;
  height: 16px;
  fill: currentColor;
  visibility: visible;
  flex-shrink: 0;
  vertical-align: middle;
}

.featured-collection-cart-btn:hover:not(:disabled) {
  opacity: 0.75;
  transform: translateY(-1px);
}

.featured-collection-cart-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Loading spinner */
.featured-collection-cart-btn .loading__spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
}

.featured-collection-cart-btn .loading__spinner.hidden {
  display: none;
}

.featured-collection-cart-btn.loading span {
  visibility: hidden;
}

.featured-collection-cart-btn {
  position: relative;
}

/* Spinner animation */
.featured-collection-cart-btn .spinner {
  animation: rotator 1.4s linear infinite;
}

@keyframes rotator {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(270deg);
  }
}

.featured-collection-cart-btn .path {
  stroke-dasharray: 187;
  stroke-dashoffset: 0;
  transform-origin: center;
  animation: dash 1.4s ease-in-out infinite;
  stroke: currentColor;
}

@keyframes dash {
  0% {
    stroke-dashoffset: 187;
  }
  50% {
    stroke-dashoffset: 47;
    transform: rotate(135deg);
  }
  100% {
    stroke-dashoffset: 187;
    transform: rotate(450deg);
  }
}

/* Navigation Arrows */
.featured-collection-button-next,
.featured-collection-button-prev {
  width: 42px !important;
  height: 42px !important;
  margin-top: -8px !important;
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 100 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  display: flex;
  align-items: center !important;
  justify-content: center !important;
  border: none;
  background: transparent;
}

.featured-collection-button-next:hover,
.featured-collection-button-prev:hover {
  transform: translateY(-50%) scale(1.1) !important;
}

.featured-collection__arrow-img {
  width: 42px !important;
  height: 42px !important;
  object-fit: contain !important;
}

/* Remove ::after pseudo-elements since we're using img tags */
.featured-collection-button-next::after,
.featured-collection-button-prev::after {
  content: none !important;
  display: none !important;
}

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

/* Responsive grid for different screen sizes before Swiper init */
@media screen and (max-width: 1200px) {
  .featured-collection-swiper:not(.swiper-initialized) .swiper-slide {
    flex: 0 0
      calc(
        (100% / var(--swiper-slides-laptop)) -
          (
            var(--swiper-slide-gap) * (var(--swiper-slides-laptop) - 1) /
              var(--swiper-slides-laptop)
          )
      );
    max-width: calc(
      (100% / var(--swiper-slides-laptop)) -
        (
          var(--swiper-slide-gap) * (var(--swiper-slides-laptop) - 1) /
            var(--swiper-slides-laptop)
        )
    );
  }
}

@media screen and (max-width: 990px) {
  .featured-collection-swiper:not(.swiper-initialized) .swiper-slide {
    flex: 0 0
      calc(
        (100% / var(--swiper-slides-tablet)) -
          (
            var(--swiper-slide-gap) * (var(--swiper-slides-tablet) - 1) /
              var(--swiper-slides-tablet)
          )
      );
    max-width: calc(
      (100% / var(--swiper-slides-tablet)) -
        (
          var(--swiper-slide-gap) * (var(--swiper-slides-tablet) - 1) /
            var(--swiper-slides-tablet)
        )
    );
  }
}

@media screen and (max-width: 768px) {
  :root {
    --swiper-slide-gap: 10px;
  }
  .featured-collection-swiper:not(.swiper-initialized) .swiper-wrapper {
    gap: var(--swiper-slide-gap);
  }
  .featured-collection-swiper:not(.swiper-initialized) .swiper-slide {
    flex: 0 0
      calc(
        (100% / var(--swiper-slides-mobile)) -
          (
            var(--swiper-slide-gap) * (var(--swiper-slides-mobile) - 1) /
              var(--swiper-slides-mobile)
          )
      );
    max-width: calc(
      (100% / var(--swiper-slides-mobile)) -
        (
          var(--swiper-slide-gap) * (var(--swiper-slides-mobile) - 1) /
            var(--swiper-slides-mobile)
        )
    );
  }
}

@media screen and (max-width: 768px) {
  .featured-collection-swiper-container {
    padding: 1rem 30px;
    max-width: 100%;
  }

  .featured-collection__pagination {
    margin-top: 1.5rem;
    gap: 6px;
  }

  .featured-collection__pagination .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
  }
}

/* Product Card Height Consistency - Swiper-safe approach */
/* 注意: height: 100%はSwiperのslidesPerView計算を妨げるため使用しない */

/* Define consistent heights for product cards */
:root {
  /* Card section heights */
  --card-image-height: 200px;
  --card-info-min-height: 100px;
  --card-title-lines: 2;
  --card-title-line-height: 1.4;
  --card-button-wrapper-height: 42px; /* 32px button + 20px padding */
  --card-min-height: 380px; /* 全体の最小高さ */
}

/* Ensure consistent card structure with flexbox */
.featured-collection-swiper .nicobay-product-ranking__card {
  display: flex;
  flex-direction: column;
  /* min-height: var(--card-min-height); */
  height: 100%;
  min-width: 100%;
}

.featured-collection-swiper .nicobay-product-ranking__card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: flex-start;
  text-align: left;
}

/* Fixed height for image wrapper */
.featured-collection-swiper .nicobay-product-ranking__image-wrapper {
  /* height: var(--card-image-height); */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* .featured-collection-swiper .nicobay-product-ranking__image-wrapper img {
  max-height: 100%;
  object-fit: contain;
} */

/* Flexible info section with minimum height */
.featured-collection-swiper .nicobay-product-ranking__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  /* min-height: var(--card-info-min-height); */
  padding: 0px !important;
  padding-left: 2rem !important;
  gap: 0px !important;
}

/* Product meta section with fixed height */
.featured-collection-swiper .nicobay-product-ranking__product-meta {
  /* min-height: 1.5em; */
  /* line-height: 1.5; */
  /* margin-bottom: 0.5rem; */
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  align-content: center;
  /* flex-wrap: nowrap; */
  /* gap: 0.25rem; */
  padding-right: 1rem;
}

/* Inline puffs display - moved to puffs-badge.css for shared use */
/* @import 'puffs-badge.css'; */

/* Product title with consistent height */
.featured-collection-swiper .card__heading,
.featured-collection-swiper .nicobay-product-ranking__product-title {
  display: -webkit-box;
  -webkit-line-clamp: var(--card-title-lines);
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--card-title-line-height);
  /* min-height: calc(var(--card-title-lines) * var(--card-title-line-height) * 1em); */
  /* height: calc(var(--card-title-lines) * var(--card-title-line-height) * 1em); */
  margin: 0;
}

/* Fixed height for cart button wrapper */
.featured-collection-swiper .featured-collection-card__cart-button-wrapper {
  height: var(--card-button-wrapper-height);
  margin-top: auto;
  flex-shrink: 0;
}

/* Ensure puffs badge is visible */
.nicobay-product-ranking__puffs-badge {
  display: inline-block !important;
}

/* Mobile adjustments */
@media screen and (max-width: 750px) {
  :root {
    --card-image-height: 160px;
    --card-info-min-height: 120px;
    --card-title-lines: 3;
    --card-min-height: 340px;
  }
}

/* Flavor Radar Modal Styles */
.flavor-modal {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  z-index: 9999;
  display: none;
}

.flavor-modal[open] {
  display: block;
}

.flavor-modal__content {
  /* background: white; */
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 1.5rem;
  width: 100%;
  animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flavor-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.flavor-modal__close:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.flavor-modal__close svg {
  width: 16px;
  height: 16px;
  fill: #666;
}

.flavor-modal__title {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  color: #333;
}

.flavor-modal__canvas {
  display: block;
  margin: 0 auto;
}

/* Ensure info icon is clickable */
.featured-collection-card__info-icon {
  cursor: pointer;
  position: relative;
  z-index: 10;
}

/* Mobile responsive adjustments */
@media screen and (max-width: 768px) {
  .featured-collection-swiper-container {
    padding: 2rem 15px;
  }
  .collection .collection__title {
    padding: 0 15px;
  }

  .flavor-modal__content {
    padding: 1.5rem;
    max-width: calc(100vw - 2rem);
  }

  .flavor-modal__canvas {
    width: 250px;
    height: 250px;
  }
}

@media screen and (max-width: 480px) {
  .flavor-modal__content {
    padding: 1rem;
  }

  .flavor-modal__title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  .flavor-modal__canvas {
    width: 200px;
    height: 200px;
  }

  .featured-collection-card__info-icon {
    display: none;
  }
}

/* Heart/Like Button Styles */
.featured-collection__like-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 30px;
  height: 30px;
  /* border-radius: 50%; */
  /* background-color: white; */
  /* border: 1px solid rgba(0, 0, 0, 0.1); */
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 2;
  padding: 0;
}

/* PUFFS badge container and badge */
.featured-collection-puffs-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  /* margin-bottom: 0.5rem; */
  /* margin-left: 1rem; */ /* Add more space from brand */
}

.featured-collection-puffs-badge {
  display: inline-block;
  font-size: 1rem;
  color: white;
  background-color: #3abb1e;
  padding: 1px 7px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.featured-collection-puffs-placeholder {
  display: inline-block;
  font-size: 1rem;
  padding: 0.2rem 0.8rem;
}

.featured-collection__like-btn:hover {
  transform: scale(1.1);
  /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); */
}

.featured-collection__like-btn:active {
  transform: scale(0.95);
}

.featured-collection__like-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.featured-collection__like-icon {
  width: 30px;
  height: 30px;
  color: #afb2ac;
  transition: all 0.3s ease;
}

@media screen and (max-width: 768px) {
  .featured-collection__like-icon {
    width: 24px;
    height: 24px;
  }
}

/* .featured-collection__like-btn:hover .featured-collection__like-icon {
  color: #ff4757;
} */

/* Liked state */
.featured-collection__like-btn.liked .featured-collection__like-icon {
  color: #ff4757;
  fill: #ff4757;
}

.featured-collection__like-btn.liked {
  /* background-color: #ffe4e6;
  border-color: #ff4757; */
}

/* Animation for like action */
@keyframes likeAnimation {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

.featured-collection__like-btn.animating {
  animation: likeAnimation 0.4s ease;
}

/* Scrollbar Styles */
.featured-collection__scrollbar {
  --swiper-scrollbar-size: 3px;
  --swiper-scrollbar-bg-color: #ffffff;
  --swiper-scrollbar-sides-offset: 25%;
  display: block;
  max-width: 50%;
  margin: 20px auto 0;
}

.featured-collection__scrollbar .swiper-scrollbar-drag {
  background: #505050;
  opacity: 0.8;
  border-radius: 3px;
  cursor: grab;
  position: relative;
  height: 100%;
  display: block;
}

.featured-collection__scrollbar.swiper-scrollbar-horizontal {
  width: 100%;
}

/* Hide scrollbar when navigation arrows are visible (PC) */
@media screen and (min-width: 1681px) {
  .featured-collection__scrollbar {
    display: none;
  }
}

/* 一覧グリッドでは ⓘ を 480px 以下でも出す。
   本番は sections/main-collection-product-grid.liquid:94 のインライン <style> で
   display:block !important を当てており、上の 480px の display:none を打ち消している。 */
.nicobay-collection .featured-collection-card__info-icon {
  display: block !important;
}

/* CTA が ⓘ の分だけ縮まず、カード右端から 14px はみ出していた。
   本番の中身は Shopify の <product-form><form> で min-content が小さく、
   flex:1 で 119px まで縮む。移植版は <a> + nowrap の span なので min-width:auto が
   142px の下限になってしまう。min-width:0 で本番と同じ 119px に揃える。
   実測（390px・カード幅 176）: 本番 CTA 119 + gap 5 + ⓘ 32 + 左右 padding 20。 */
.featured-collection-card__cart-button {
  min-width: 0;
}
