/* ── Mémos ────────────────────────────────────────────────────────────────── */

.memo-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
}

.memo-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.memo-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

.memo-back {
  color: var(--color-primary, #6c63ff);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Formulaire création ────────────────────────────────────────────────── */

.memo-create-details {
  background: #fff;
  border: 1.5px solid #e9ecef;
  border-radius: 14px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.memo-create-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary, #6c63ff);
  min-height: 52px;
  display: flex;
  align-items: center;
}
.memo-create-summary::-webkit-details-marker { display: none; }

.memo-create-form,
.memo-edit-form {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.memo-form-row { display: flex; flex-direction: column; gap: 0.3rem; }
.memo-form-row-inline { flex-direction: row; align-items: center; }

.memo-form-input {
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #dee2e6;
  border-radius: 10px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
}

.memo-form-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.memo-form-textarea {
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #dee2e6;
  border-radius: 10px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.5;
}

.memo-form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 44px;
}

.memo-form-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; }

/* ── Boutons ────────────────────────────────────────────────────────────── */

.memo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
}
.memo-btn-primary {
  background: linear-gradient(135deg, #6c63ff, #a29bfe);
  color: #fff;
  box-shadow: 0 2px 8px rgba(108,99,255,.3);
}
.memo-btn-primary:hover { filter: brightness(1.07); }
.memo-btn-danger-sm {
  background: #ff4757;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── Grille de cartes ───────────────────────────────────────────────────── */

.memo-section { margin-bottom: 1.75rem; }
.memo-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 0 0 0.75rem;
}

.memo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 420px) {
  .memo-grid { grid-template-columns: 1fr; }
}

.memo-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1.5px solid #e9ecef;
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.memo-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.09); }
.memo-card-shared { border-color: #c8b8ff; }

.memo-card-cover {
  width: 100%;
  height: 110px;
  overflow: hidden;
  background: #f1f3f5;
}
.memo-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.memo-card-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.memo-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.3rem;
}

.memo-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-word;
  flex: 1;
}

.memo-shared-badge {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.memo-card-preview {
  font-size: 0.8rem;
  color: #666;
  margin: 0;
  line-height: 1.4;
}

.memo-card-date {
  font-size: 0.72rem;
  color: #aaa;
  margin-top: auto;
}

.memo-empty {
  color: #888;
  font-style: italic;
  text-align: center;
  padding: 2rem 0;
}

/* ── Page détail ────────────────────────────────────────────────────────── */

.memo-view { margin-bottom: 1.5rem; }

.memo-view-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.memo-view-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0;
  flex: 1;
}

.memo-view-content {
  font-size: 1rem;
  line-height: 1.65;
  color: #333;
  margin-bottom: 0.75rem;
}

.memo-view-meta {
  font-size: 0.78rem;
  color: #aaa;
}

/* ── Galerie images ─────────────────────────────────────────────────────── */

.memo-images-section { margin-top: 1.5rem; }

.memo-images-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.memo-image-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #e9ecef;
}

.memo-image-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.memo-image-caption {
  font-size: 0.72rem;
  color: #666;
  padding: 0.2rem 0.4rem;
  background: rgba(255,255,255,.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.memo-image-delete-form { position: absolute; top: 4px; right: 4px; margin: 0; }
.memo-image-delete-btn {
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.memo-image-add-details { margin-top: 0.5rem; }
.memo-image-add-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary, #6c63ff);
  padding: 0.4rem 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.memo-image-add-summary::-webkit-details-marker { display: none; }

.memo-image-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 10px;
  margin-top: 0.4rem;
}

.memo-file-input { font-size: 0.88rem; flex: 1; min-width: 140px; }
.memo-caption-input {
  padding: 0.4rem 0.75rem;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.88rem;
  flex: 1;
  min-width: 120px;
  min-height: 40px;
}


/* ── Checklists ─────────────────────────────────────────────────────────── */

.memo-checklists-section {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mcl-card {
  background: #fff;
  border: 1.5px solid #e9ecef;
  border-radius: 14px;
  padding: 1rem;
}

.mcl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .75rem;
}

.mcl-title-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  flex: 1;
}

.mcl-title {
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a2e;
}

.mcl-progress {
  font-size: .78rem;
  font-weight: 600;
  color: #6c63ff;
  background: #ede9fe;
  padding: .15rem .5rem;
  border-radius: 20px;
}

.mcl-progress-bar {
  width: 80px;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.mcl-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6c63ff, #857dff);
  border-radius: 3px;
  transition: width .3s;
}

.mcl-btn-delete-cl {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1rem;
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 6px;
  line-height: 1;
  min-height: 32px;
  min-width: 32px;
}
.mcl-btn-delete-cl:hover { color: #dc2626; background: #fee2e2; }

/* Liste d'items */
.mcl-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.mcl-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem .2rem;
  border-radius: 8px;
  transition: background .15s;
}
.mcl-item:hover { background: #f8f9fa; }

.mcl-item-toggle-form { margin: 0; flex-shrink: 0; }

.mcl-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.mcl-checkbox--checked {
  background: #6c63ff;
  border-color: #6c63ff;
}

.mcl-item-text {
  flex: 1;
  font-size: .95rem;
  line-height: 1.4;
}
.mcl-item--done .mcl-item-text {
  text-decoration: line-through;
  color: #9ca3af;
}

.mcl-item-actions {
  display: flex;
  gap: .2rem;
  flex-shrink: 0;
}

.mcl-btn-move {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: .9rem;
  cursor: pointer;
  padding: .15rem .35rem;
  border-radius: 6px;
  min-height: 30px;
  min-width: 28px;
  line-height: 1;
}
.mcl-btn-move:hover { color: #6c63ff; background: #ede9fe; }

.mcl-btn-delete-item {
  background: none;
  border: none;
  color: #d1d5db;
  font-size: .85rem;
  cursor: pointer;
  padding: .15rem .35rem;
  border-radius: 6px;
  min-height: 30px;
  min-width: 28px;
  line-height: 1;
}
.mcl-btn-delete-item:hover { color: #dc2626; background: #fee2e2; }

/* Formulaire d'ajout d'item */
.mcl-item-add-form {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid #f3f4f6;
}

.mcl-item-input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: .5rem .75rem;
  font-size: .95rem;
  min-height: 40px;
  outline: none;
}
.mcl-item-input:focus { border-color: #6c63ff; }

.mcl-btn-add-item {
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0 .9rem;
  min-height: 40px;
  min-width: 40px;
  cursor: pointer;
  transition: background .15s;
}
.mcl-btn-add-item:hover { background: #5b53ee; }

/* Bouton "Ajouter une checklist" */
.mcl-add-details { margin-top: .25rem; }

.mcl-add-summary {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: #6c63ff;
  padding: .5rem .25rem;
  list-style: none;
  user-select: none;
}
.mcl-add-summary::-webkit-details-marker { display: none; }

.mcl-add-form {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
  flex-wrap: wrap;
}

.mcl-add-input {
  flex: 1;
  min-width: 160px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: .6rem .9rem;
  font-size: 1rem;
  min-height: 44px;
  outline: none;
}
.mcl-add-input:focus { border-color: #6c63ff; }
