/**
 * Styles principaux AmiSphere - Version Responsive
 * Approche Mobile First
 */

:root {
  --primary: #4d8a3f;
  --primary-light: #6bae50;
  --primary-dark: #3a6d2e;
  --primary-ultra-light: #f5fbf5;
  --secondary: #e6f5e6;
  --dark: #2a5321;
  --text: #333333;
  --text-light: #666666;
  --white: #ffffff;
  --gray-light: #f5f5f5;
  --gray: #e0e0e0;
  --gray-dark: #999999;
  --danger: #dc3545;
  --success: #28a745;
  --warning: #ffc107;
  --info: #17a2b8;

  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 15px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 12px;

  /* Variables pour mobile */
  --header-height: 60px;
  --input-height: 56px;
}

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

body {
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--gray-light);
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Layout principal - Mobile First */
.app-container {
  display: flex;
  height: 100vh;
  background: var(--white);
  position: relative;
}

/* Overlay pour mobile */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.mobile-overlay.active {
  display: block;
}

/* Bouton menu mobile */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}

/* Sidebar - Mobile First */
.sidebar {
  position: fixed;
  left: -100%;
  top: 0;
  bottom: 0;
  width: 85%;
  max-width: 350px;
  background: var(--white);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: left 0.3s ease;
  z-index: 999;
}

.sidebar.active {
  left: 0;
}

.sidebar-header {
  background: var(--primary);
  color: var(--white);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

.sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* Profil utilisateur */
.user-profile {
  padding: 1rem;
  border-bottom: 1px solid var(--gray);
  background: var(--gray-light);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  color: var(--text);
}

.user-status {
  font-size: 0.875rem;
  color: var(--text-light);
}

/* Liste des conversations */
.conversation-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.conversation-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-light);
  cursor: pointer;
  transition: background-color 0.2s;
}

.conversation-item:active {
  background-color: var(--gray-light);
}

.conversation-item.active {
  background-color: var(--secondary);
}

.conversation-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-right: 0.75rem;
  object-fit: cover;
  flex-shrink: 0;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.125rem;
  font-size: 0.9rem;
}

.conversation-last-message {
  color: var(--text-light);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.conversation-time {
  font-size: 0.7rem;
  color: var(--text-light);
}

.unread-badge {
  background: var(--primary);
  color: var(--white);
  font-size: 0.7rem;
  padding: 0.125rem 0.375rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Zone de chat - Mobile First */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.chat-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  min-height: var(--header-height);
}

.chat-header-info {
  display: flex;
  align-items: center;
  flex: 1;
  padding-left: 3.5rem; /* Espace pour le bouton menu */
}

.chat-header-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.chat-header-details {
  flex: 1;
  min-width: 0;
}

.chat-header-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-status {
  font-size: 0.75rem;
  color: var(--text-light);
}

.chat-header-actions {
  display: flex;
  gap: 0.5rem;
}

/* Messages - Mobile First */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--gray-light);
  -webkit-overflow-scrolling: touch;
}

.message {
  display: flex;
  margin-bottom: 0.75rem;
  align-items: flex-end;
  position: relative;
}

.message.sent {
  justify-content: flex-end;
}

.message-content {
  max-width: 80%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  word-wrap: break-word;
  font-size: 0.9rem;
}

.message.received .message-content {
  background: var(--white);
  border-bottom-left-radius: 4px;
}

.message.sent .message-content {
  background: var(--primary);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 0.65rem;
  color: var(--text-light);
  margin-top: 0.125rem;
  padding: 0 0.5rem;
}

.message.sent .message-time {
  text-align: right;
  color: rgba(255, 255, 255, 0.8);
}

/* Zone de saisie - Mobile First */
.message-input-container {
  background: var(--white);
  border-top: 1px solid var(--gray);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--input-height);
}

.message-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--gray-light);
  border-radius: 25px;
  padding: 0.5rem 1rem;
  min-height: 40px;
}

.message-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  min-height: 20px;
  resize: none;
}

.message-input::placeholder {
  color: var(--text-light);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-icon:active {
  background: var(--gray-light);
  color: var(--primary);
}

.btn-send {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.btn-send:active {
  background: var(--primary-dark);
}

/* Page vide */
.no-conversation {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--gray-light);
  text-align: center;
  padding: 2rem;
}

.no-conversation h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.no-conversation p {
  color: var(--text-light);
}

/* Formulaires (login/register) */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    to bottom,
    var(--primary-ultra-light),
    var(--secondary)
  );
  padding: 1rem;
}

.auth-box {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo img {
  height: 60px;
}

.auth-logo h2 {
  margin-top: 0.5rem;
  color: var(--primary);
  font-size: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
  font-size: 1rem;
}

.btn:active {
  background: var(--primary-dark);
}

.btn-block {
  display: block;
  width: 100%;
}

/* Utilitaires */
.text-center {
  text-align: center;
}
.mt-1 {
  margin-top: 0.5rem;
}
.mt-2 {
  margin-top: 1rem;
}
.mt-3 {
  margin-top: 1.5rem;
}
.mb-1 {
  margin-bottom: 0.5rem;
}
.mb-2 {
  margin-bottom: 1rem;
}
.mb-3 {
  margin-bottom: 1.5rem;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--gray-light);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-dark);
  border-radius: 3px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

.loading i {
  font-size: 1.5rem;
  color: var(--primary);
}

/* ========== STYLES POUR LES PIÈCES JOINTES DANS LES MESSAGES ========== */

/* Conteneur des pièces jointes */
.message-attachments {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 300px;
}

/* Images jointes */
.attachment-image {
    position: relative;
    display: block;
    max-width: 250px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.attachment-image .image-preview {
    display: block;
    position: relative;
    cursor: pointer;
    width: 100%;
}

.attachment-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    cursor: zoom-in;
}

.attachment-image .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.attachment-image:hover .image-overlay {
    opacity: 1;
}

.attachment-image .image-overlay i {
    color: white;
    font-size: 2rem;
}

/* Animation de zoom au clic sur les images */
.attachment-image.zoomed {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw !important;
    max-height: 90vh !important;
    z-index: 9999;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.8);
    cursor: zoom-out;
}

.attachment-image.zoomed img {
    max-width: 90vw !important;
    max-height: 90vh !important;
    object-fit: contain !important;
}

/* Vidéos jointes */
.attachment-video {
    max-width: 300px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.attachment-video video {
    width: 100%;
    display: block;
}

.attachment-video .video-info {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    font-size: 0.875rem;
}

.attachment-video .video-info i {
    color: var(--primary);
}

.attachment-video .file-size {
    margin-left: auto;
    color: var(--text-light);
    font-size: 0.75rem;
}

/* Audio joints */
.attachment-audio {
    background: white;
    border: 1px solid var(--gray);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    max-width: 280px;
    min-width: 250px;
}

.audio-player {
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 12px;
}

.audio-player > i {
    font-size: 1.5rem;
    color: var(--primary);
    flex-shrink: 0;
}

.audio-info {
    flex: 1;
    min-width: 0;
}

.audio-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-info audio {
    width: 100%;
    height: 32px;
}

.audio-player .file-size {
    color: var(--text-light);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Documents joints */
.attachment-document {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid var(--gray);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    max-width: 300px;
    min-width: 250px;
}

.attachment-document:hover {
    background: var(--gray-light);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.document-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-ultra-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.document-icon i {
    font-size: 1.25rem;
    color: var(--primary);
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.document-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

.download-icon {
    flex-shrink: 0;
    color: var(--text-light);
    transition: color 0.2s ease;
}

.attachment-document:hover .download-icon {
    color: var(--primary);
}

/* Ajustements pour les messages envoyés */
.message.sent .attachment-document {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message.sent .attachment-document:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.message.sent .document-icon {
    background: rgba(255, 255, 255, 0.2);
}

.message.sent .document-icon i {
    color: rgba(255, 255, 255, 0.9);
}

.message.sent .document-name,
.message.sent .document-meta {
    color: rgba(255, 255, 255, 0.95);
}

.message.sent .download-icon {
    color: rgba(255, 255, 255, 0.7);
}

.message.sent .attachment-document:hover .download-icon {
    color: white;
}

/* Icônes de type de fichier avec couleurs spécifiques */
.fa-file-pdf { color: #dc3545 !important; }
.fa-file-word { color: #2b579a !important; }
.fa-file-excel { color: #217346 !important; }
.fa-file-powerpoint { color: #d24726 !important; }
.fa-file-archive { color: #6c757d !important; }
.fa-file-code { color: #28a745 !important; }
.fa-file-image { color: #17a2b8 !important; }
.fa-file-video { color: #fd7e14 !important; }
.fa-file-audio { color: #e83e8c !important; }

/* ========== FONCTIONNALITÉS AVANCÉES DE MESSAGERIE ========== */

/* Message avec réponse */
.message-reply-to {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-size: 0.875rem;
}

.message-reply-to i {
    color: var(--primary);
    font-size: 0.75rem;
}

.reply-content strong {
    display: block;
    color: var(--primary);
    margin-bottom: 2px;
}

.reply-content p {
    margin: 0;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer du message */
.message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    overflow: visible !important;
}

/* Actions du message */
.message-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    position: relative;
    overflow: visible !important;
}

.message:hover .message-actions {
    opacity: 1;
}

/* Boutons d'action */
.btn-action {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

.btn-action.active {
    color: var(--primary);
}

.btn-favorite.active i {
    color: #ffc107;
}

.btn-delete:hover {
    color: var(--danger);
}

/* Conteneur des réactions */
.reactions-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reactions-display {
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(77, 138, 63, 0.1);
    border-radius: 12px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reaction-badge:hover {
    background: rgba(77, 138, 63, 0.2);
    transform: scale(1.1);
}

.reaction-count {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Sélecteur d'émojis */
.reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: none;
    gap: 8px;
    z-index: 100;
    margin-bottom: 8px;
    white-space: nowrap;
    flex-direction: row;
}

.reaction-picker::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

.reaction-picker button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.reaction-picker button:hover {
    background: #f0f0f0;
    transform: scale(1.2);
}

.message.sent .reaction-picker {
    left: auto;
    right: 20px;
    transform: none;
}

/* Message supprimé */
.message.deleted .message-content {
    opacity: 0.6;
}

.deleted-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    font-style: italic;
}

/* Barre de réponse */
.reply-bar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--secondary);
    border-top: 1px solid var(--gray);
    border-bottom: 1px solid var(--gray);
    margin-bottom: -1px;
}

.reply-bar-content {
    flex: 1;
}

.reply-bar-title {
    font-size: 0.75rem;
    color: var(--primary);
    margin-bottom: 2px;
}

.reply-bar-text {
    font-size: 0.875rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-bar-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1.25rem;
}

.reply-bar-close:hover {
    color: var(--danger);
}

/* Fenêtre des favoris */
.favorites-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.favorites-wrapper {
    width: 100%;
    max-width: 600px;
}

.favorites-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.favorites-container h3 {
    margin: 0 0 16px 0;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.no-favorites {
    text-align: center;
    color: var(--text-light);
    padding: 32px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

/* Bouton favoris dans la sidebar */
.btn-show-favorites {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-show-favorites:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== UPLOAD DE FICHIERS ===== */
.upload-zone {
    border: 2px dashed var(--gray);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    background: var(--gray-light);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1rem;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-ultra-light);
}

.upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--secondary);
    transform: scale(1.02);
}

.upload-zone i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.upload-input {
    display: none;
}

/* ===== MEDIA QUERIES ===== */

/* TABLETTES (768px+) */
@media (min-width: 768px) {
  .sidebar-header h1 {
    font-size: 1.5rem;
  }

  .conversation-avatar {
    width: 50px;
    height: 50px;
  }

  .conversation-name {
    font-size: 1rem;
  }

  .conversation-last-message {
    font-size: 0.875rem;
  }

  .chat-header {
    padding: 1rem;
  }

  .chat-header-avatar {
    width: 40px;
    height: 40px;
  }

  .chat-header-name {
    font-size: 1rem;
  }

  .chat-header-status {
    font-size: 0.875rem;
  }

  .messages-container {
    padding: 1rem;
  }

  .message {
    margin-bottom: 1rem;
  }

  .message-content {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    max-width: 70%;
  }

  .message-time {
    font-size: 0.75rem;
  }

  .message-input-container {
    padding: 1rem;
    gap: 1rem;
  }

  .message-input {
    font-size: 1rem;
  }

  .btn-icon {
    font-size: 1.25rem;
  }

  .btn-send {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

/* DESKTOP (1024px+) */
@media (min-width: 1024px) {
  /* Masquer le bouton menu sur desktop */
  .mobile-menu-btn {
    display: none !important;
  }

  .mobile-overlay {
    display: none !important;
  }

  /* Sidebar visible en permanence */
  .sidebar {
    position: static;
    left: 0;
    width: 350px;
    border-right: 1px solid var(--gray);
    box-shadow: none;
  }

  /* Ajuster le header du chat */
  .chat-header-info {
    padding-left: 0;
  }

  /* Hover effects sur desktop */
  .conversation-item:hover {
    background-color: var(--gray-light);
  }

  .btn-icon:hover {
    background: var(--gray-light);
    color: var(--primary);
  }

  .btn-send:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
  }

  .btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
  }

  .form-control:hover {
    border-color: var(--primary-light);
  }
}

/* GRAND DESKTOP (1440px+) */
@media (min-width: 1440px) {
  .sidebar {
    width: 400px;
  }

  .conversation-item {
    padding: 1rem;
  }

  .auth-box {
    padding: 2rem;
  }

  .auth-logo img {
    height: 80px;
  }
}

/* MOBILE PAYSAGE */
@media (max-width: 767px) and (orientation: landscape) {
  .messages-container {
    padding: 0.5rem;
  }

  .message {
    margin-bottom: 0.5rem;
  }

  .message-content {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }

  .message-input-container {
    padding: 0.4rem;
    min-height: 48px;
  }
}

/* TRÈS PETITS ÉCRANS (< 360px) */
@media (max-width: 359px) {
  .sidebar {
    width: 100%;
    max-width: none;
  }

  .conversation-avatar {
    width: 40px;
    height: 40px;
  }

  .btn-send {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  .auth-box {
    padding: 1rem;
  }
}

/* Ajustements mobile pour les pièces jointes */
@media (max-width: 768px) {
  .attachment-image {
    max-width: 200px;
  }
  
  .attachment-image img {
    max-height: 150px;
  }
  
  .message-attachments,
  .attachment-video,
  .attachment-audio,
  .attachment-document {
    max-width: 100%;
  }
  
  .message-actions {
    opacity: 1;
  }
  
  .btn-action {
    padding: 8px;
  }
  
  .reaction-picker {
    bottom: auto;
    top: 100%;
  }
  
  .favorites-container {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}
/* ========== CORRECTIONS DES PROBLÈMES D'INTERFACE ========== */

/* Fix pour les emojis qui s'affichent mal */
.reaction-badge,
.reaction-picker button {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

/* Fix pour la modal des réactions du premier message */
.messages-wrapper {
    position: relative;
    overflow: visible; /* Permettre aux modals de sortir */
}

.messages-container {
    position: relative;
    overflow-y: auto;
    overflow-x: visible;
    padding-top: 1rem; /* Espace pour les réactions du premier message */
}

/* Ajuster la position du reaction picker pour qu'il ne soit pas caché */
.message:first-child .reaction-picker {
    bottom: auto;
    top: 100%;
    margin-top: 8px;
    margin-bottom: 0;
}

.message:first-child .reaction-picker::after {
    top: auto;
    bottom: 100%;
    border-top: none;
    border-bottom: 8px solid white;
}

/* Retirer le bouton favoris de la sidebar */
.btn-show-favorites {
    display: none !important;
}

/* Styles pour le menu d'options de conversation */
.chat-options-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--gray);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 100;
    display: none;
    margin-top: 4px;
}

.chat-options-menu.active {
    display: block;
}

.chat-options-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
}

.chat-options-menu .menu-item:hover {
    background: var(--gray-light);
}

.chat-options-menu .menu-item i {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

.chat-options-menu .menu-divider {
    height: 1px;
    background: var(--gray);
    margin: 4px 0;
}

/* Position relative pour le conteneur des actions du header */
.header-actions {
    position: relative;
}

/* Fix pour les emojis dans MessageController.php */
.reaction-emoji {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

/* S'assurer que les réactions sont toujours visibles */
.message {
    position: relative;
    z-index: 1;
}

.message:hover {
    z-index: 10; /* Élever le message survolé */
}

/* Ajustements mobiles */
@media (max-width: 768px) {
    .chat-options-menu {
        right: 10px;
    }
    
    .message:first-child .reaction-picker {
        left: 10px;
        right: auto;
        transform: none;
    }
}


/* Styles pour les notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.5rem;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    max-width: 350px;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-content i {
    font-size: 1.25rem;
}

.notification-success {
    border-left: 4px solid #28a745;
}

.notification-success i {
    color: #28a745;
}

.notification-error {
    border-left: 4px solid #dc3545;
}

.notification-error i {
    color: #dc3545;
}

.notification-info {
    border-left: 4px solid #17a2b8;
}

.notification-info i {
    color: #17a2b8;
}

/* Animation de badge */
#friend-requests-badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
.load-more-container {
    text-align: center;
    padding: 1rem;
}

.btn-load-more {
    background: var(--gray-light);
    border: 1px solid var(--gray);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-load-more:hover {
    background: var(--secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.no-more-messages {
    text-align: center;
    padding: 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
    font-style: italic;
}
.typing-indicator {
    background: var(--secondary);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gray);
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.typing-text {
    font-style: italic;
}
/* Messages d'erreur et de succès pour le formulaire de connexion */
#error-message .error,
#error-message .success {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease-out;
}

#error-message .error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

#error-message .success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

#error-message i {
    font-size: 1.1rem;
}

/* Animation d'apparition */
@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Style pour la checkbox "Se souvenir de moi" */
.form-group input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-group label[for="remember_me"] {
    cursor: pointer;
    user-select: none;
}

/* Message d'info pour l'auto-connexion */
.info-message {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.75rem;
    border-radius: 8px;
    margin: 0.5rem 0;
    text-align: center;
    font-size: 0.9rem;
    border: 1px solid #bbdefb;
}

.info-message i {
    margin-right: 0.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* Ajustements pour le bouton flottant */
@media (max-width: 1023px) {
    /* Réduire le padding en bas pour laisser place au FAB */
    .chat-area {
        padding-bottom: 80px;
    }
    
    /* S'assurer que le FAB est au-dessus du contenu */
    .quick-action-container {
        z-index: 1100;
    }
    
    /* Masquer les anciens boutons s'ils restent */
    .glass-icon.invitations,
    .glass-icon.friends {
        display: none !important;
    }
}

/* Ajustement pour la zone de message */
.message-input-container {
    margin-bottom: 0;
}

/* Dark mode support pour Quick Actions */
@media (prefers-color-scheme: dark) {
    .quick-action-fab {
        background: var(--primary);
        color: white;
    }
    
    .quick-action-sheet {
        background: #1a1a1a;
        color: white;
    }
}
/* CSS pour la modal de confirmation - À ajouter dans votre CSS principal */

.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.confirm-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.confirm-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.confirm-header {
    padding: 1.5rem 1.5rem 0;
}

.confirm-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.confirm-body {
    padding: 1rem 1.5rem;
}

.confirm-body p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.confirm-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.confirm-footer .btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

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

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

.text-muted {
    color: #6c757d !important;
    font-size: 0.9em;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        transform: translateY(20px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .confirm-content {
        width: 95%;
        margin: 1rem;
    }
    
    .confirm-footer {
        flex-direction: column;
    }
    
    .confirm-footer .btn {
        width: 100%;
    }
}
