/* === Reset & Base === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
  line-height: 1.4;
}

/* === Navbar === */
.navbar{
  position:sticky;
  top:0;
  z-index:1100;
  display:flex;
  align-items:center;
  background:#fff;
  padding:12px 24px;
  box-shadow:0 2px 8px rgba(0,0,0,.05);
  font-size:.95rem;
  white-space:nowrap;
}

/* marque (brand) à gauche, taille auto */
.navbar > .nav-brand{
  flex:0 0 auto;
  text-align:left;
}

/* chaque lien (nav-item) prend la même place, centré */
.navbar > .nav-item{
  flex:1 1 auto;
  text-align:center;
}

/* logout à droite, taille auto, pas de soulignement */
.navbar > .logout-btn{
  flex:0 0 auto;
  text-align:right;
  text-decoration:none;
}

/* style des nav-items */
.navbar .nav-item{
  color:inherit;
  text-decoration:none;
  padding:0 8px;
  font-weight:500;
}
.navbar .nav-item:hover{
  color:#2563eb;
}

/* style du bouton Déconnexion (lien converti en “bouton”) */
.logout-btn{
  display:inline-block;
  padding:6px 12px;
  margin-left:8px;
  background:#fee2e2;
  color:#b91c1c;
  border:none;
  border-radius:4px;
  cursor:pointer;
  transition:background .2s;
}
.logout-btn:hover{
  background:#fecaca;
  color:#991b1b;
}

/* Option mobile */
@media(max-width:640px){
  .navbar{flex-wrap:wrap;}
  .navbar>*{
    flex:100%;
    text-align:left;
  }
}

/* === Container générique === */
.container {
  width: 90%;
  max-width: 640px;
  margin: 60px auto;
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

/* === Titres & formulaires === */
h1 {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 20px;
  color: #444;
}
form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
input, button, textarea {
  font-size: 1rem;
  border-radius: 6px;
  outline: none;
}
input[type="password"] {
  padding: 12px;
  border: 1px solid #ccc;
}
input[type="password"]:focus {
  border-color: #3b82f6;
}
button {
  padding: 12px;
  border: none;
  background: #3b82f6;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover {
  background: #2563eb;
}
.error-message {
  padding: 10px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  text-align: center;
}

/* === Galerie (mode conversation) === */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.gallery-item {
  position: relative;
  max-width: 70%;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  background: #fff;
  align-self: flex-start;
  transition: background 0.2s;
}
.gallery-item.mine {
  align-self: flex-end;
  background: #e0f7fa;
}
.gallery-item.theirs {
  align-self: flex-start;
  background: #f1f8e9;
}
.gallery-item .delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  font-size: 18px;
  color: #b91c1c;
  background: rgba(255,255,255,0.8);
  border: none;
  border-radius: 50%;
  padding: 4px;
  cursor: pointer;
  display: none;
}
.gallery-item:hover .delete-btn {
  display: block;
}

.gallery-item audio {
  display: block;
  width: 100%;
  border-radius: 6px;
}

/* aperçu fixe et crop (photos) */
.gallery-item img,
.gallery-item video {
  display: block;
  width: 200px;        /* largeur fixe */
  height: 200px;       /* hauteur fixe */
  object-fit: cover;   /* garde le ratio et croppe le surplus */
  object-position: center;
  border-radius: 6px;
  margin: 0 auto 12px; /* centré + marge dessous */
}

.gallery-item audio {
  position: relative;
  z-index: 1;
}
.gallery-item .note-box {
  background: #fff3cd;
  color: #856404;
  padding: 10px;
  border-radius: 6px;
  font-style: italic;
  white-space: pre-wrap;
}
.gallery-item .meta {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #555;
  text-align: right;
}

/* === Bouton rond “+” (ajout) === */
.add-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  font-size: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  transition: background 0.2s, transform 0.1s;
  z-index: 1000;
}
.add-btn:hover {
  background: #2563eb;
  transform: scale(1.1);
}

/* === Modal d’ajout (fenêtre modale) === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 900;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: #fff;
  padding: 20px;
  width: 90%;
  max-width: 360px;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.modal-content .close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
}
.modal-content h2 {
  text-align: center;
  margin-bottom: 16px;
}
.choices {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.choices button {
  flex: 1;
  padding: 8px;
  border: none;
  background: #e5e7eb;
  color: #333;  /* rendre le texte visible sur fond gris */
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.choices button:hover {
  background: #d1d5db;
}
.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-content form.hidden {
  display: none;
}
.modal-content form input,
.modal-content form textarea,
.modal-content form button {
  width: 100%;
}
.modal-content form textarea {
  min-height: 80px;
  resize: vertical;
}

/* === Responsive mobile === */
@media (max-width: 480px) {
  .container {
    margin: 40px auto;
    padding: 20px;
  }
  .add-btn {
    width: 56px;
    height: 56px;
    font-size: 32px;
    bottom: 16px;
    right: 16px;
  }
  .gallery-item {
    max-width: 90%;
  }
  .modal-content {
    max-width: 300px;
  }
}

/* === Utilitaire d’affichage === */
.hidden {
  display: none !important;
}

/* === Icônes “Like” & “Comment” === */
.icons {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.like-icon,
.comment-icon {
  font-size: 24px;
  color: #555;
  cursor: pointer;
  transition: color 0.2s;
}
.like-icon.fa-solid {
  color: #e0245e;
}
.like-icon:hover {
  color: #e0245e;
}
.comment-icon:hover {
  color: #1d9bf0;
}
.count {
  font-size: 0.85rem;
  color: #555;
}

/* === Animation de rebond (like) === */
.like-icon.clicked {
  animation: bounce 0.4s ease;
}
@keyframes bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.2); }
  50%  { transform: scale(0.9); }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* === Modale de commentaires === */
.comments-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 800;
}
.comments-modal.hidden {
  display: none;
}
.comments-content {
  background: #fff;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.comments-content h3 {
  margin: 0;
  padding: 16px;
  border-bottom: 1px solid #eee;
  font-size: 1.25rem;
  background: #f7f9fa;
}
.close-comments {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
}
.comments-list {
  min-height: 150px;
  max-height: calc(80vh - 120px);
  overflow-y: auto;
  padding: 16px;
  background: #fafafa;
}
.comment {
  background: #fff;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
}
.comment:last-child {
  margin-bottom: 0;
}
.comment small {
  display: block;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #666;
}
.delete-comment {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #c00;
  font-size: 1rem;
  cursor: pointer;
}

/* === Formulaire d’ajout de commentaire === */
.comment-form {
  border-top: 1px solid #eee;
  padding: 12px 16px;
  background: #f7f9fa;
  display: flex;
  gap: 8px;
}
.comment-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.comment-form button {
  padding: 8px 12px;
}

/* === Enregistrement audio & importation === */
.import-audio {
  text-align: center;
  margin-bottom: 12px;
}
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #e5e7eb;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.file-btn:hover {
  background: #d1d5db;
}
.or-divider {
  text-align: center;
  margin: 12px 0;
  color: #666;
  font-weight: bold;
}
.record-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  background: transparent !important;
}
.mic-btn,
#recordBtn,
#deleteRecording {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.mic-btn:hover:not(:disabled),
#recordBtn:hover:not(:disabled),
#deleteRecording:hover {
  background: #2563eb;
}
.mic-btn:disabled,
#recordBtn:disabled,
#deleteRecording:disabled {
  background: #aaa;
  cursor: default;
}
#recordingPlayback {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 4px;
  position: relative;
  z-index: 1;
}
#deleteRecording {
  position: relative;
  z-index: 10;
}
.record-warning {
  margin-top: 8px;
  color: #c00;
  font-size: 0.9rem;
}
.submit-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.submit-btn:hover {
  background: #2563eb;
}

/* Lightbox overlay : full‑screen, mais caché par défaut */
.lightbox-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.8);
  display: none;            /* invisible tant qu’on n’a pas la classe .active */
  justify-content: center;  /* centrage horizontal */
  align-items: center;      /* centrage vertical */
  z-index: 2000;
  overflow: hidden;
}

/* Quand on active la lightbox, on passe en flex */
.lightbox-overlay.active {
  display: flex;
}

/* Wrapper n’impose plus rien */
.lightbox-content {
  position: relative;
}

/* L’image seule applique la contrainte 80vw/80vh */
.lightbox-content img {
  display: block;
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
}

/* Croix centrée */
.lightbox-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255,255,255,0.9);
  color: #000;
  font-size: 20px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

