* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: #F9F5F0;
  color: #333;
}

header {
  background: #ECECEC;
  color: #333;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ddd;
}

header h1 {
  font-size: 1.5rem;
}

/* Bouton burger (caché par défaut sur desktop) */
.btn-menu {
  display: none;
}

/* Bouton retour (caché sur desktop) */
.btn-back {
  background: none;
  border: none;
  color: #333;
  font-size: 1rem;
  padding: 0.5rem;
  cursor: pointer;
  margin-bottom: 1rem;
  text-align: left;
  width: auto;
}

.btn-back:hover {
  color: #555;
}

.container {
  display: flex;
  height: calc(100vh - 60px);
}

.notes-list {
  width: 300px;
  background: white;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.search-bar {
  margin-bottom: 1rem;
}

.search-bar input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#notes-container {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  margin-top: 1rem;
}

#notes-container li {
  padding: 0.75rem;
  border: 1px solid #ddd;
  margin-bottom: 0.5rem;
  cursor: pointer;
  border-radius: 4px;
}

#notes-container li:hover {
  background: #f0f0f0;
}

#notes-container li.active {
  background: #ECECEC;
  border-color: #333;
}

.editor {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  background: white;
}

#empty-state {
  text-align: center;
  color: #999;
  padding: 4rem 0;
}

#note-editor input,
#note-editor textarea {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

#note-title {
  font-size: 1.5rem;
  font-weight: bold;
}

#note-content {
  min-height: 300px;
  resize: vertical;
}

button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.btn-primary {
  background: #333;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #555;
}

.btn-danger {
  background: #d32f2f;
  color: white;
}

.btn-danger:hover {
  background: #b71c1c;
}

.editor-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.editor-actions button {
  flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
  /* Header plus compact */
  header {
    padding: 0.75rem;
  }

  header h1 {
    font-size: 1.2rem;
  }

  #btn-install {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  /* Container prend toute la hauteur */
  .container {
    height: calc(100vh - 50px);
  }

  /* Liste prend tout l'écran par défaut */
  .notes-list {
    width: 100%;
    height: 100%;
    border-right: none;
    padding: 0.75rem;
  }

  /* Éditeur caché par défaut sur mobile */
  .editor {
    display: none;
    width: 100%;
    padding: 1rem;
    height: 100%;
  }

  /* Quand l'éditeur est actif */
  .container.editing .notes-list {
    display: none;
  }

  .container.editing .editor {
    display: block;
  }

  /* Afficher le bouton retour sur mobile */
  .btn-back {
    display: block !important;
  }

  .search-bar {
    margin-bottom: 0.75rem;
  }

  .search-bar input {
    padding: 0.6rem;
    font-size: 1rem;
  }

  #notes-container {
    margin-top: 0.75rem;
  }

  #notes-container li {
    padding: 0.6rem;
    font-size: 0.95rem;
  }

  #note-title {
    font-size: 1.3rem;
    padding: 0.6rem;
  }

  #note-content {
    min-height: 200px;
    padding: 0.6rem;
    font-size: 1rem;
  }

  #note-tags {
    padding: 0.6rem;
    font-size: 0.95rem;
  }

  /* Boutons plus grands pour le tactile */
  button {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    min-height: 44px;
  }

  .btn-primary {
    padding: 0.8rem 1rem;
  }

  .editor-actions {
    gap: 0.75rem;
  }
}

/* Très petits écrans */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.1rem;
  }

  .notes-list {
    padding: 0.5rem;
  }

  .editor {
    padding: 0.75rem;
  }

  #note-title {
    font-size: 1.2rem;
  }

  #note-content {
    min-height: 150px;
  }
}
