<template>
  <div id="Fonctionnalites">
    <LayoutContainer>
      <div class="container-green">
        <v-row class="custom-row">
          <v-col cols="6">
            <LayoutUISubTitle
              title-color="#fff"
              :iconSize="6"
              :iconClasses="iconClasses"
              :titleText="'Découvrez TOUTES LES FONCTIONNALITÉS DE NOTRE solution'"
              :iconColor="iconColor"
            />
            <LayoutUITitle
              title="Des fonctionnalités adaptées à vos besoins"
              title-color="#fff"
            />
          </v-col>

          <v-col cols="6">
            <div class="d-flex align-center">
              <div class="carousel-button" @click="previousAction">
                <i class="fas fa-chevron-left"></i>
              </div>
              <div class="carousel-button" @click="nextAction">
                <i class="fas fa-chevron-right"></i>
              </div>
            </div>
          </v-col>
        </v-row>

        <v-row >
          <v-col cols="12"> </v-col>
        </v-row >
        <v-row class="custom-row">
          <v-col cols="12">
            <Carousel
              ref="functionCarousel"
              :items-to-show="5"
              :items-to-scroll="1"
              class="carousel"
              :wrap-around="true"
            >
              <Slide
                v-for="(card, index) in cards"
                :key="index"
                :class="{
                  card: true
                }"
              >
                <div class="card-container">
                  <v-card>
                    <v-img
                      :src="card.logo"
                      :alt="card.title"
                      class="mx-auto card-img"
                    />
                    <v-card-title>
                      <h5 class="card-title">{{ card.title }}</h5>
                    </v-card-title>
                    <v-card-item>
                      <v-card-text  class="review-description">
                        <ul>
                          <li
                            class="list-detail"
                            v-for="item in card.list"
                            :key="item"
                          >
                          <p v-html="item"></p>
                          </li>
                        </ul>
                      </v-card-text>
                      <div class="card-footer">
                          <p
                            class="reviewer-structure"
                            v-for="option in card.options"
                            :key="option"
                          >
                            {{ option }}
                        </p>
                      </div>
                    </v-card-item>
                  </v-card>
                </div>
              </Slide>
            </Carousel>
          </v-col>
        </v-row>
      </div>
    </LayoutContainer>
  </div>
</template>

<script setup>
import { ref, computed } from "vue";
import { Carousel, Slide } from "vue3-carousel";
import "vue3-carousel/dist/carousel.css";
import { useDisplay } from "vuetify/lib/framework.mjs";

const props = defineProps({
  cards: Array,
  itemsToScroll: {
    type: Number,
    default: 1,
  },
  itemsToShow: {
    type: Number,
    default: 5,
  },
});

const { width, mdAndDown } = useDisplay();
const functionCarousel = ref(null);
const activeCardIndex = ref(0);

const itemsToShow = computed(() => {
  if (width.value >= 1280 && width.value <= 1920) {
    return 3;
  } else if (width.value > 1920) {
    return 6;
  }
  return props.itemsToShow;
});

const nextAction = () => {
  functionCarousel.value.next();
};

const previousAction = () => {
  functionCarousel.value.prev();
};
</script>

<style scoped>

.custom-row{
  width: 95%;
  margin-left: auto;
  margin-right: auto;
}


.card-img {
  width: 5rem;
  height: 3rem;
  margin-top: 1rem;
}
.list-detail {
  font-weight: 300;
  font-size: 0.9rem;
  line-height: 1.2rem;
  margin-bottom: 1rem;
  color: #000000;
  word-break: none;
}
.card-title {
  white-space: pre-wrap;
}
.carousel {
  margin-left: 2rem;
  margin-right: 2rem;
}

.card.active-card {
}

.title-container {
  display: flex;
  align-items: center;
}
.subtitle-avantage {
  font-weight: 600;
  font-size: 3rem;
  line-height: 18px;
  color: white;
}
.subtitle {
  color: white;
  font-size: 1rem;
  font-weight: 600;
  line-height: 15px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.icon-title {
  color: #fac20a;
  margin-right: 0.5rem;
}
.card {
  font-weight: 300;
  transition: transform 0.3s;
}

.card.active-card {
  transform: scale(1.05);
}
.carousel-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  background-color: transparent;
  border: 2px solid #fff;
  cursor: pointer;
  margin-right: 1rem;
  margin-top: 5rem;
}

.carousel-button i {
  color: #fff;
}

.reviewer-structure {
  font-weight: 300;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  color: #071b1f;
}

.review-description {
  text-align: left;
}
.card-footer {
  position: absolute;
  right: 0;
  margin-right: 2rem;
}

.card {
  box-sizing: border-box;
}

.card {
  min-height: 35rem;
  max-height: 35rem;
  border-radius: 1rem;
  transition: transform 0.3s;
}

.v-card {
  border-radius: 1rem;
  min-height: 25rem;
}

.card-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 3rem;
  margin-right: 2rem;
}

.container-green {
  background-color: #0e2d32;
}
</style>
