/* Collection Tabs Image v1.0.0 */

.shopify-section--collection-tabs-image {
  & zag-collection-tabs-image {
    display: block;
    position: relative;
    inline-size: calc(100% - 2 * var(--zag-gutter));
    max-inline-size: var(--max-inline-size, 90rem);
    margin-inline: auto;
    padding-top: var(--mobile-section-padding-top, 4rem);
    padding-bottom: var(--mobile-section-padding-bottom, 4rem);
  }

  & .collection-tabs-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0rem;
    inline-size: 100%;
  }

  /* Onglets de navigation */
  & .collection-tabs {
    height: 100%;
    display: flex;
    align-items: start;
    justify-content: center;
    flex-flow: column nowrap;
    flex-wrap: wrap;

    & .tab-header {
      display: flex;
      flex-flow: column nowrap;
      align-items: start;
      justify-content: left;
      text-align: left;
      margin-block-end: 1rem;

      & svg {
        display: inline-block;
        inline-size: 0.75rem;
        block-size: 0.75rem;
      }
    }
  }
  & .collection-tabs-items {
    display: flex;
    flex-flow: column nowrap;
    gap: 0.5rem;
    inline-size: 100%;
  }

  & .collection-tab {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    position: relative;
    border-bottom: 1px solid var(--grey-200-color);
    text-transform: uppercase;
    justify-content: space-between;

    & .tab-title {
      font-weight: 700;
      color: var(--text-color, #000);
      font-size: 2.375rem;
      line-height: 1;
      padding: 1rem;

      font-family: Countach, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
        Ubuntu, Helvetica Neue, sans-serif, Apple Color Emoji, Segoe UI Emoji,
        Segoe UI Symbol;
      text-transform: uppercase;

      @media (width < 60rem) {
        padding-inline-start: 0rem;
      }
    }

    & .tab-link-text {
      display: none;
      align-items: center;
      height: 100%;
      padding: 0 0 0 1rem;
    }

    & .tab-link:after {
      content: "";
      position: absolute;
      display: block;
      inline-size: 100%;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
    }

    & .tab-link:before {
      content: "";
      position: absolute;
      display: block;
      inline-size: 100%;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      z-index: 1;
    }

    & .tab-link-image {
      width: 80px;
      padding-top: 2rem;
      padding-bottom: 1rem;
      > img {
        object-fit: cover;
        width: 100%;
        aspect-ratio: 4/5;
        border-radius: 0.125rem;
        overflow: hidden;
      }
    }
  }

  /* Contenu des onglets */
  & .collection-tabs-content {
    display: none;
    position: relative;
    inline-size: 100%;
    overflow: hidden;
    aspect-ratio: 4 / 5;
  }

  & .collection-tab-panel {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    position: absolute;
    top: 0;
    left: 0;
    inline-size: 100%;
    block-size: 100%; /* Prendre toute la hauteur du conteneur */
    pointer-events: none;

    &.active {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
    }
  }

  & .tab-content-layout {
    display: flex;
    flex-flow: column nowrap;
    inline-size: 100%;
    height: 100%;
  }

  /* Container d'image */
  & .tab-image-container {
    inline-size: 100%;
    overflow: hidden;
    position: relative;
  }

  & .image-wrapper {
    position: relative;
    inline-size: 100%;
    block-size: 100%;
  }

  & .collection-image {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    aspect-ratio: 4 / 5;
  }

  & .image-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: var(--white-color);
  }

  & .option-title {
    display: inline-flex;
    gap: 0.5rem;
    margin-inline-end: auto;

    & svg {
      inline-size: 0.625rem;
      block-size: 0.625rem;
    }
  }

  & .collection-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color, #000);
    margin: 0;
  }

  /* Responsive Desktop */
  @media (width >= 60rem) {
    & zag-collection-tabs-image[data-modifiers*="breakpoint:60"] {
      & .collection-tabs-container {
        grid-template-columns: 1fr 1fr;
        gap: 0rem;
        align-items: flex-start;
      }

      & .collection-tab {
        &.active:after {
          content: "";
          position: absolute;
          display: block;
          inline-size: 100%;
          block-size: 1px;
          background-color: var(--black-color);
          height: 1px;
          width: 40%;
          bottom: 0px;
        }

        & .tab-title {
          font-size: 3.25rem;
        }

        &.active {
          & .tab-link-text {
            display: flex;
          }
        }

        & .tab-link {
          height: 100%;
        }

        & .tab-link:after {
          content: none;
          position: relative;
          width: 0%;
          height: 0%;
          top: 0;
          left: 0;
        }
      }
      & .collection-tabs {
        border-bottom: none;
        padding-bottom: 0;
      }

      & .collection-tabs-items {
        & .tab-link-image {
          display: none;
        }
      }

      & .collection-tabs-content {
        display: flex;
        flex: 1;
      }

      & .tab-content-layout {
        flex-flow: row nowrap;
        gap: 4rem;
        align-items: center;
      }

      & .tab-image-container {
        flex: 1;
        aspect-ratio: 4/5;
      }

      /* Layout image à gauche (par défaut) */
      &[data-modifiers*="layout-direction:image-left"] {
        & .collection-tabs {
          order: 1;
        }
        & .collection-tabs-content {
          order: 0;
        }

        & .tab-content-layout {
          padding-right: 4rem;
        }
      }

      /* Layout image à droite */
      &[data-modifiers*="layout-direction:image-right"] {
        & .collection-tabs {
          order: 0;
        }
        & .collection-tabs-content {
          order: 1;
        }

        & .tab-content-layout {
          padding-left: 4rem;
        }
      }
    }
  }

  /* États de chargement */
  & .collection-tabs-container:empty::before {
    display: block;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted-color, #666);
  }
}

/* Modifiers pour la direction du layout */
.shopify-section--collection-tabs-image
  zag-collection-tabs-image[data-modifiers*="layout-direction:image-right"]
  .tab-content-layout {
  flex-direction: row-reverse;
}
