<script setup lang="ts">
const props = defineProps<{ isActive: boolean }>();
const emit = defineEmits(['closeBookFormModal'])
function sendBookData()  {
  console.log("PROUT")
  emit('closeBookFormModal')
}
</script>

<template>
  <div :class="props.isActive ? 'opened-modal' : 'closed-modal'">
    <div class="overlay"></div>

    <div class="modale card">
      <button class="btn-close" @click="$emit('closeBookFormModal')">X</button>

      <h2>COUCOU</h2>

      <div class="actions">
        <button class="send" @keyup.enter="sendBookData" @click="sendBookData">prout</button>
      </div>
    </div>
  </div>
</template>

<style scoped>
.opened-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.closed-modal {
  display: none;
}

.overlay {
  background-color: rgba(0, 0, 0, 0.7);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.modale {
  position: relative;
  z-index: 2;
  background-color: light-dark(#ffffff, #282828);
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  min-width: 300px;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.btn-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: light-dark(#868686, #999999);
}

.btn-close:hover {
  transition: 0.3s;
  color: light-dark(black, white);
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.send {
  padding: 10px 20px;
  background-color: #1e90ff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.send:hover {
  transition: 0.3s;
  background-color: #176cc0;
}
</style>
