/* ---------- Styles Globaux ---------- */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #202124;
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------- Barre Supérieure ---------- */
.top-bar {
  background-color: #181a1b;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  flex-wrap: wrap;
}

.top-bar h1 {
  margin: 0;
  color: #fff;
  font-size: 1.5em;
}

.icons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.top-icon {
  cursor: pointer;
  font-size: 20px;
  color: #fff;
}

/* Zone de recherche */
.search-container {
  position: absolute;
  top: 100%;
  right: 15px;
  background-color: #fff;
  padding: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  display: none;
}

.search-container input {
  padding: 5px;
  width: 200px;
  color: #000;
}

/* ---------- Conteneur Principal ---------- */
.main-container {
  display: flex;
  flex: 1;
  padding: 20px;
  flex-wrap: wrap;
}

.content {
  flex: 3;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  width: 100%;
}

.note {
  background-color: #00BBF0;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
  position: relative;
  cursor: pointer;
  color: #fff;
}

.note h3 {
  margin: 0 0 8px 0;
  max-width: 100%;
}

.note p {
  overflow-wrap: break-word;
  word-break: break-word;
}

.note small {
  display: block;
  color: #e0e0e0;
}

.note .btn-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  color: #fff;
}

/* ---------- Barre Latérale ---------- */
.sidebar {
  flex: 1;
  background-color: #181a1b;
  padding: 20px;
  margin-left: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  color: #fff;
  min-width: 250px;
}

.sidebar h2 {
  margin-top: 0;
  color: #fff;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar li {
  margin-bottom: 8px;
  padding: 4px;
  background: #181a1b;
  border-radius: 4px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- Menu Plus (dropdown) ---------- */
.plus-menu {
  position: absolute;
  top: 50px;
  right: 15px;
  background: #202124;
  border: 1px solid #ddd;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  display: none;
  z-index: 100;
}

.plus-menu button {
  display: block;
  width: 100%;
  border: none;
  background: none;
  padding: 10px 15px;
  text-align: left;
  cursor: pointer;
  color: #fff;
}

.plus-menu button:hover {
  background-color: #333;
}

/* ---------- Styles Modaux ---------- */
.modal {
  display: none;
  position: fixed;
  z-index: 200;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
  background-color: #333;
  margin: 10% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 90%;
  max-width: 400px;
  border-radius: 5px;
  position: relative;
  color: #fff;
}

.modal-content input,
.modal-content textarea,
.modal-content button {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border: none;
  border-radius: 5px;
}

.modal-content input,
.modal-content textarea {
  color: #000;
}

.modal-content button {
  background-color: #37789D;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

.close {
  color: #fff;
  position: absolute;
  top: 5px;
  right: 10px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

/* ---------- Vue Agrandie pour l'Édition d'une Note ---------- */
.expanded-note {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #202124;
  z-index: 300;
  overflow-y: auto;
  color: #fff;
}

.expanded-header {
  padding: 15px;
  background-color: #418ADF;
  display: flex;
  align-items: center;
  color: #fff;
}

.back-arrow {
  font-size: 24px;
  cursor: pointer;
  margin-right: 15px;
  color: #fff;
}

.expanded-content {
  padding: 20px;
  color: #fff;
}

.expanded-toolbar {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.expanded-toolbar button,
.expanded-toolbar select {
  padding: 8px 12px;
  border: none;
  background-color: #ddd;
  border-radius: 4px;
  cursor: pointer;
  color: #000;
}

.expanded-toolbar button:hover,
.expanded-toolbar select:hover {
  background-color: #ccc;
}

#expandedContent {
  border: 1px solid #ddd;
  min-height: 400px;
  padding: 10px;
  width: 100%;
  margin-bottom: 10px;
  background-color: #303134;
  color: #fff;
}

#saveExpandedNote {
  margin-top: 10px;
  padding: 10px;
  border: none;
  border-radius: 5px;
  background-color: #418ADF;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
}

.search-wrapper {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

#inlineSearch {
  padding: 8px 12px;
  border-radius: 20px;
  border: 2px solid #000;
  width: 250px;
  color: #000;
}

#inlineSearch::placeholder {
  color: #333;
}

.note .highlight {
  background-color: rgb(74, 199, 36);
  padding: 0 2px;
}

@keyframes blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0e0e0e;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#loaderLogo {
  width: 200px;
  height: 200px;
  animation: zoomPop 1.5s ease-in-out;
}

@keyframes zoomPop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

#h1 {
  margin-right: 1200px;
}

/* ---------- Responsive Design ---------- */
@media (max-width: 1100px) {
  .main-container {
    flex-direction: column;
    padding: 10px;
  }

  .sidebar {
    margin-left: 0;
    margin-top: 20px;
    box-shadow: none;
    padding: 10px;
    width: 100%;
  }

  .content {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 800px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
  }

  .top-bar h1 {
    margin-right: 0;
    font-size: 1.3em;
  }

  .search-wrapper {
    position: static;
    transform: none;
    width: 100%;
    margin: 10px 0;
  }

  #inlineSearch {
    width: 100%;
  }

  .sidebar {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
  }

  .content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .main-container {
    padding: 5px;
  }

  .sidebar {
    padding: 5px;
  }

  .sidebar h2 {
    font-size: 1.1em;
  }

  .sidebar li {
    font-size: 1em;
    padding: 6px 4px;
  }

  .note {
    padding: 10px;
    font-size: 0.95em;
  }

  .modal-content {
    width: 95vw;
    min-width: unset;
    padding: 10px;
  }

  .expanded-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .expanded-toolbar button,
  .expanded-toolbar select {
    width: 100%;
  }

  #expandedContent {
    min-height: 300px;
  }

  #loaderLogo {
    width: 120px;
    height: 120px;
  }
}