<template>
  <main class="flex flex-col items-stretch | w-full">
    <header class="flex | bg-white | rounded-2xl | p-8 mb-16">
      <h1 class="font-serif | px-8">{{ page.content.title }}</h1>
      <button class="btn | ml-auto">Demander un RDV</button>
    </header>

    <!-- 1. Créez votre premier brief de projet ! -->
    <!--
    <section class="h-full | grid-center">
      <div class="card | items-center | text-center | w-full max-w" style="--row-gap:var(--space-32); --max-w:27.5rem">
        <h2 class="font-serif text-lg">Créez votre premier brief de projet !</h2>
        <p class="text-grey-700">Bienvenu à votre nouvel espace de projet. <br>Commencez par consulter les inspirations <br>et partagez vos intentions !</p>
        <button class="btn | w-full">Commencer</button>
      </div>
    </section>
    -->

    <!-- 2. Créez via la plateforme / Ajouter un PDF -->
    <!--
    <section class="h-full | flex flex-col justify-center items-center | mx-auto | max-w" style="--max-w:42rem; --row-gap: var(--space-32)">
      <div class="flex">
        <div class="card card--cta | flex-1 | h-full" style="--padding:var(--space-32);--row-gap:var(--space-32)">
          <svg aria-hidden="true" width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M92.8571 46.4292H64.2857C62.3133 46.4292 60.7143 48.0282 60.7143 50.0006V92.8577C60.7143 94.8302 62.3133 96.4292 64.2857 96.4292H92.8571C94.8296 96.4292 96.4286 94.8302 96.4286 92.8577V50.0006C96.4286 48.0282 94.8296 46.4292 92.8571 46.4292Z" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M92.8571 3.57202H64.2857C62.3133 3.57202 60.7143 5.171 60.7143 7.14345V21.5006C60.7143 23.473 62.3133 25.072 64.2857 25.072H92.8571C94.8296 25.072 96.4286 23.473 96.4286 21.5006V7.14345C96.4286 5.171 94.8296 3.57202 92.8571 3.57202Z" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M35.7143 3.57202H7.14284C5.17039 3.57202 3.57141 5.171 3.57141 7.14345V50.0006C3.57141 51.973 5.17039 53.572 7.14284 53.572H35.7143C37.6867 53.572 39.2857 51.973 39.2857 50.0006V7.14345C39.2857 5.171 37.6867 3.57202 35.7143 3.57202Z" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M35.7143 74.9291H7.14284C5.17039 74.9291 3.57141 76.5281 3.57141 78.5005V92.8577C3.57141 94.8301 5.17039 96.4291 7.14284 96.4291H35.7143C37.6867 96.4291 39.2857 94.8301 39.2857 92.8577V78.5005C39.2857 76.5281 37.6867 74.9291 35.7143 74.9291Z" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
          <h2 class="font-serif text-lg">Créer via la plateforme</h2>
          <p class="text-sm text-grey-700">Ajouter différents éléments tels que des images et du texte sur la plateforme afin de créer votre brief.</p>
        </div>
        <div class="card card--cta | flex-1 | h-full" style="--padding:var(--space-32);--row-gap:var(--space-32)">
          <svg aria-hidden="true" width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M3.57153 75.0001V82.143C3.57153 85.9318 5.07663 89.5654 7.75572 92.2445C10.4348 94.9236 14.0684 96.4287 17.8572 96.4287H82.143C85.9318 96.4287 89.5654 94.9236 92.2445 92.2445C94.9236 89.5654 96.4287 85.9318 96.4287 82.143V75.0001M28.5715 28.5715L50.0001 3.57153M50.0001 3.57153L71.4287 28.5715M50.0001 3.57153V67.8573" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
          <h2 class="font-serif text-lg">Ajouter un pdf</h2>
          <p class="text-sm text-grey-700">Vous avez déjà constitué votre brief en amont et souhaitez directement l’importer.</p>
        </div>
      </div>
      <div class="card | bg-grey-200 | items-center | text-center | w-full" style="--padding:var(--space-32);--row-gap:var(--space-16)">
        <h2 class="font-serif text-lg">Qu’est ce que le brief ?</h2>
        <p class="text-sm text-grey-700">Le brief est un outil créatif qui permet de définir les perspectives esthétiques de votre projet. Il s’agit d’une planche d’inspiration qui aide à affirmer l’ambiance et les influences que vous souhaitez apporter à votre projet.</p>
      </div>
    </section>
    -->

    <!-- 3. Ajouter une ou plusieurs images -->
    <section class="h-full | flex flex-col" style="--row-gap: var(--space-32)">
      <header class="project-details | flex items-baseline | bg-white | rounded-2xl | p-16 | w-full">
        <div class="project-details__description | flex-1">
          <h2 class="text-sm text-grey-700 | mb-8">Description du projet</h2>
          <textarea name="description" id="description" placeholder="Ajoutez une description générale de votre projet…" rows="3" class="border border-grey-200 | rounded-xl | p-16 | w-full"></textarea>
        </div>
        <div class="project-details__filters | flex-1">
          <h2 class="text-sm text-grey-700 | mb-8">Filtrer par tags</h2>
          <div class="flex" style="gap:var(--space-8)">
            <button class="btn btn--sm btn--grey" id="all">Voir tout</button>
            <button class="btn btn--sm btn--primary">Bouchon</button>
            <button class="btn btn--sm btn--primary">Bouton Poussoir</button>
            <button class="btn btn--sm btn--primary">Coloris & Nuances</button>
            <button class="btn btn--sm btn--primary">DA Globale</button>
            <button class="btn btn--sm btn--primary">Forme & Design</button>
            <button class="btn btn--sm btn--primary">Matériaux & Textures</button>
            <button class="btn btn--sm btn--primary">Parachèvements</button>
          </div>
        </div>
      </header>
      <div class="h-full | masonry">
        <button data-icon="upload" class="flex flex-col | bg-white | border border-grey-200 | text-grey-800 | font-medium | rounded-2xl">Ajouter une ou plusieurs images</button>
        <figure class="image">
          <span class="tag | btn btn--sm">Tag</span>
          <img
            src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/6ed93d6950-1725442486/d82f18573c439d6edd434ffca62471a7.png"
            alt=""
          />
        </figure>
        <figure class="image">
          <span class="tag | btn btn--sm">Tag</span>
          <img
            src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/7b0fcc5012-1725442486/37a038883c87973036232aa0e43f6da2.png"
            alt=""
          />
        </figure>
        <figure class="image">
          <span class="tag | btn btn--sm">Tag</span>
          <img
            src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/1bbe051c5a-1725442486/0c41d3266e9ce2872f30608cceb28239.png"
            alt=""
          />
        </figure>
        <figure class="image">
          <span class="tag | btn btn--sm">Tag</span>
          <img
            src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/6ed93d6950-1725442486/d82f18573c439d6edd434ffca62471a7.png"
            alt=""
          />
        </figure>
        <figure class="image">
          <span class="tag | btn btn--sm">Tag</span>
          <img
            src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/7b0fcc5012-1725442486/37a038883c87973036232aa0e43f6da2.png"
            alt=""
          />
        </figure>
        <figure class="image">
          <span class="tag | btn btn--sm">Tag</span>
          <img
            src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/1bbe051c5a-1725442486/0c41d3266e9ce2872f30608cceb28239.png"
            alt=""
          />
        </figure>
      </div>
    </section>

    <!-- Kanban: Status Brief Enrichi -->
    <!--
    <div class="kanban">
      <section 
        class="flex-1"
        aria-labelledby="votre-brief-label"
        data-status="done"
      >
        <h2 id="votre-brief-label">
          <span data-icon="votre-brief">Votre brief</span>
        </h2>
        <div class="cards | flow">
          <article class="card">
            <hgroup class="order-last">
              <h3 class="card__title | font-serif | text-lg">Votre Brief</h3>
            </hgroup>
            <div class="card__meta | flex">
              <time class="card__date | text-grey-700" datetime="2024-06-12">12 juin 2024</time>
            </div>
            <figure class="card__images" data-count="13">
              <img
                src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/6ed93d6950-1725442486/d82f18573c439d6edd434ffca62471a7.png"
                alt=""
              />
              <img
                src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/7b0fcc5012-1725442486/37a038883c87973036232aa0e43f6da2.png"
                alt=""
              />
              <img
                src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/1bbe051c5a-1725442486/0c41d3266e9ce2872f30608cceb28239.png"
                alt=""
              />
            </figure>
          </article>
        </div>
      </section>
      <section 
        class="flex-1"
        aria-labelledby="offre-commerciale-label"
        data-status="done"
      >
        <h2 id="offre-commerciale-label">
          <span data-icon="offre-commerciale">Offre Commerciale</span>
        </h2>
        <div class="cards | flow">
          <article class="card">
            <hgroup class="order-last">
              <h3 class="card__title | font-serif | text-lg">Offre - 2</h3>
              <p class="text-primary | font-medium">4 commentaires</p>
            </hgroup>
            <div class="card__meta | flex">
              <time class="card__date | text-grey-700" datetime="2024-06-12">12 juin 2024</time>
              <span class="text-primary | font-medium | ml-auto">Validé</span>
            </div>
            <figure class="card__images">
              <img
                src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/6ed93d6950-1725442486/d82f18573c439d6edd434ffca62471a7.png"
                alt=""
              />
            </figure>
          </article>
          <article class="card">
            <hgroup class="order-last">
              <h3 class="card__title | font-serif | text-lg">Offre - 3</h3>
              <p class="text-primary | font-medium">4 commentaires</p>
            </hgroup>
            <div class="card__meta | flex">
              <time class="card__date | text-grey-700" datetime="2024-06-12">12 juin 2024</time>
            </div>
          </article>
          <article class="card">
            <hgroup class="order-last">
              <h3 class="card__title | font-serif | text-lg">Offre Initiale</h3>
              <p class="text-primary | font-medium">4 commentaires</p>
            </hgroup>
            <div class="card__meta | flex">
              <time class="card__date | text-grey-700" datetime="2024-06-12">12 juin 2024</time>
            </div>
          </article>
        </div>
      </section>
      <section 
        class="flex-1"
        aria-labelledby="brief-enrichi-label"
        data-status="in-progress"
        >
        <h2 id="brief-enrichi-label">
          <span data-icon="brief-enrichi">Brief Enrichi</span>
        </h2>
        <div class="cards | flow">
          <article class="card">
            <hgroup class="order-last">
              <h3 class="card__title | font-serif | text-lg">Brief enrichi</h3>
              <p class="text-primary | font-medium">4 commentaires</p>
            </hgroup>
            <div class="card__meta | flex">
              <time class="card__date | text-grey-700" datetime="2024-06-12">12 juin 2024</time>
              <span class="text-primary | font-medium | ml-auto">Validé</span>
            </div>
            <figure class="card__images" data-count="15">
              <img
                src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/6ed93d6950-1725442486/d82f18573c439d6edd434ffca62471a7.png"
                alt=""
              />
              <img
                src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/7b0fcc5012-1725442486/37a038883c87973036232aa0e43f6da2.png"
                alt=""
              />
              <img
                src="http://localhost:8888/media/pages/inspirations/shape-of-the-nature/1bbe051c5a-1725442486/0c41d3266e9ce2872f30608cceb28239.png"
                alt=""
              />
            </figure>
          </article>
        </div>
      </section>
      <section
        class="flex-1"
        aria-labelledby="echantillon-virtuel-label"
        data-status="uncompleted"
      >
        <h2 id="echantillon-virtuel-label">
          <span data-icon="echantillon-virtuel">Échantillon Virtuel</span>
        </h2>
        <div class="cards | flow">
          <div class="flex flex-col justify-center | rounded-2xl | bg-grey-200 text-grey-700">
            <p>Prochainement disponible</p>
          </div>
        </div>
      </section>
    </div>
    -->
  </main>
</template>

<script setup>
import { usePageStore } from "../stores/page";
import { useUserStore } from "../stores/user";
import { ref, computed } from "vue";
import { storeToRefs } from "pinia";

const { page } = storeToRefs(usePageStore());
const user = useUserStore().user;
</script>

<style scope>

/* Porject details */
.project-details textarea {
  resize: none;
  max-height: 5rem;
}
.project-details__filters button:first-of-type {
  margin-right: calc(var(--space-12) + 1px);
}
.project-details__filters button:first-of-type::after {
  content: '';
  width: 1px;
  height: 1.7rem;
  background-color: var(--color-black-20);
  position: absolute;
  right: calc(-.75rem);
}

button[data-icon="upload"] {
  padding: 6.875rem 4.875rem;
}

/* Masonry */
.masonry > * {
  margin-bottom: var(--space-16);
}
.masonry > *:only-child {
  column-span: all;
  transform: translateY(50%);
}
@media (min-width: 40rem) {
  .masonry {
    column-count: 2;
  }
}
@media (min-width: 65rem) {
  .masonry {
    column-count: 3;
  }
}
@media (min-width: 90rem) {
  .masonry {
    column-count: 4;
  }
}

/* Image */
.image {
  border-radius: var(--rounded-2xl);
  overflow: hidden;
  position: relative;
}
.image .tag {
  position: absolute;
  top: var(--space-12);
  left: var(--space-12);
}
.image::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background: var(--icon-color, currentColor);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 1rem;
  mask-image: var(--icon-description);
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
}

/* Kanban */
.kanban {
  --header-height: 2.25rem; /* 36px */
  --header-bg-color: var(--color-grey-200);
  --header-title-bg-color: var(--color-grey-700);
  --gap: var(--gutter);
  position: relative;
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
  height: calc(100vh - var(--gutter) * 2 - var(--header-height) - 2.25rem);
}
.kanban > section {
  min-width: 20rem;
  position: relative;
}

.kanban > section h2 {
  position: relative;
  background-color: var(--header-bg-color);
  border-radius: var(--rounded-md);
  font-size: var(--text-sm);
  height: var(--header-height); 
}
.kanban > section h2 > span {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-8);
  background-color: var(--header-title-bg-color);
  color: var(--color-white);
  height: 100%;
  width: fit-content;
  padding: 0 var(--space-12);
  border-top-left-radius: inherit;
  border-bottom-left-radius: inherit;
  font-weight: 500;
}
.kanban > section + section h2::before {
  content: "";
  display: inline-block;
  position: absolute;
  top: calc(var(--header-height) / 2 - 1.5px);
  right: 100%;
  width: var(--gap);
  height: 3px;
  background-color: var(--color-grey-200);
  z-index: -1;
}

.kanban [data-status="done"] h2::after {
  content: "";
  position: absolute;
  top: 0;
  right: var(--space-4);
  bottom: 0;
  display: inline-block;
  width: var(--icon-size, var(--header-height));
  height: var(--icon-size, var(--header-height));
  background: var(--icon-color, currentColor);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: var(--icon-size, 1rem);
  mask-image: var(--icon, var(--icon-check));
}

.kanban [data-status="in-progress"] {
  --header-bg-color: var(--color-primary-20);
  --header-title-bg-color: var(--color-primary);
}
.kanban [data-status="in-progress"] h2::after {
  content: "";
  color: var(--color-primary);
  position: absolute;
  top: 0;
  right: var(--space-4);
  bottom: 0;
  display: inline-block;
  width: var(--icon-size, var(--header-height));
  height: var(--icon-size, var(--header-height));
  background: var(--icon-color, currentColor);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: var(--icon-size, 1rem);
  mask-image: var(--icon-point-active);
}
.kanban [data-status="in-progress"]::after {
  content: "En cours";
  position: absolute;
  top: 0;
  right: calc(var(--icon-size, var(--header-height)) + var(--space-4));
  color: var(--color-primary);
  font-weight: 500;
  font-size: var(--text-sm);
  line-height: 2.125rem;
}

.kanban [data-status="uncompleted"] h2 {
  background: none;
}
.kanban [data-status="uncompleted"] h2::before {
  background-color: transparent;
  background-repeat: repeat-x;
  background-position: left center;
  background-image: url("data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='50%' cy='50%' r='2' opacity='0.15' fill='black'/%3E%3C/svg%3E%0A");
  background-size: .5rem;
  right: calc(-1 * var(--gap));
  left: calc(-1 * var(--gap));
  width: auto;
}
.kanban [data-status="uncompleted"] h2 > span {
  border-radius: inherit;
}
.kanban [data-status="uncompleted"] .cards > * {
  min-height: 10rem;
}
.kanban [data-status="uncompleted"]::after {
  content: "En attente";
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--color-grey-50);
  color: var(--color-grey-700);
  font-weight: 500;
  font-size: var(--text-sm);
  line-height: 2.125rem;
  padding: 0 var(--space-12);
}

.kanban .cards {
  padding-top: var(--space-16);
  max-height: calc(100% - var(--header-height));
  overflow-y: auto;
}
</style>
