/* Styles personnalisés pour le dashboard WhatsApp Management */

/* Scrollbar personnalisée pour les modales API Keys */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation pour les transitions */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Styles optimisés pour les messages - Interface compacte */
.message-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  transition: all 0.2s ease;
}

.message-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-color: #3b82f6;
}

.message-item.incoming {
  border-left: 3px solid #10b981;
}

.message-item.outgoing {
  border-left: 3px solid #3b82f6;
}

/* Badge pour les groupes */
.group-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 6px;
}

.group-badge i {
  margin-right: 4px;
}

/* Styles pour les types de messages */
.message-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-left: 8px;
}

.message-type-text {
  background: #dbeafe;
  color: #1e40af;
}

.message-type-image {
  background: #d1fae5;
  color: #065f46;
}

.message-type-video {
  background: #fef3c7;
  color: #92400e;
}

.message-type-audio {
  background: #e0e7ff;
  color: #3730a3;
}

.message-type-document {
  background: #f3e8ff;
  color: #6b21a8;
}

/* Pagination compacte */
#messagesPagination {
  border-radius: 0 0 8px 8px;
}

/* Messages compacts */
.message-content-compact {
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.message-meta-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Responsive pour les messages */
@media (max-width: 768px) {
  .message-item {
    padding: 8px;
    margin-bottom: 8px;
  }
  
  .group-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
  }
}

/* Styles pour les onglets de navigation */
.nav-tab {
  transition: all 0.2s ease-in-out;
}

.nav-tab.active {
  color: white;
  border-bottom-color: #10b981;
}

.nav-tab:not(.active):hover {
  color: white;
  border-bottom-color: #6b7280;
}

/* Styles pour les cartes de statistiques */
.stat-card {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Styles pour les sessions WhatsApp */
.session-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease-in-out;
}

.session-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.session-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.session-status.connected {
  background-color: #d1fae5;
  color: #065f46;
}

.session-status.connecting {
  background-color: #fef3c7;
  color: #92400e;
}

.session-status.disconnected {
  background-color: #fee2e2;
  color: #991b1b;
}

.session-status.qr_pending {
  background-color: #dbeafe;
  color: #1e40af;
}

/* Styles pour le QR Code */
.qr-code-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background-color: #f9fafb;
  border-radius: 0.5rem;
  border: 2px dashed #d1d5db;
}

.qr-code-image {
  max-width: 200px;
  max-height: 200px;
}

/* Styles pour les messages */
.message-item {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.5rem;
}

.message-item.outgoing {
  background-color: #f0f9ff;
  border-color: #0ea5e9;
}

.message-item.incoming {
  background-color: #f9fafb;
}

.message-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

.message-type-text { background-color: #e0e7ff; color: #3730a3; }
.message-type-image { background-color: #ecfdf5; color: #14532d; }
.message-type-audio { background-color: #fef3c7; color: #92400e; }
.message-type-video { background-color: #fce7f3; color: #be185d; }
.message-type-document { background-color: #f3e8ff; color: #6b21a8; }

/* Styles pour les webhooks */
.webhook-item {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.webhook-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.webhook-status.active {
  background-color: #d1fae5;
  color: #065f46;
}

.webhook-status.inactive {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Styles pour les logs */
.log-entry {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.25rem;
}

.log-entry.error {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.log-entry.warn {
  background-color: #fef3c7;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.log-entry.info {
  background-color: #dbeafe;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

/* Styles pour les modales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Styles pour les formulaires */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Styles pour les boutons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  border: none;
}

.btn-primary {
  background-color: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-success {
  background-color: #10b981;
  color: white;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-warning {
  background-color: #f59e0b;
  color: white;
}

.btn-warning:hover {
  background-color: #d97706;
}

.btn-secondary {
  background-color: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background-color: #4b5563;
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
}

/* Styles pour les badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background-color: #dbeafe;
  color: #1e40af;
}

/* Styles pour les indicateurs de chargement */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Styles pour les notifications toast */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  max-width: 400px;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.warning {
  border-left: 4px solid #f59e0b;
}

.toast.info {
  border-left: 4px solid #3b82f6;
}

/* Styles pour les nouveaux éléments API */
.api-examples-section {
  margin-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1.5rem;
}

.api-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.api-tab {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: #6b7280;
  font-weight: 500;
  transition: all 0.2s;
}

.api-tab:hover {
  color: #374151;
  background: #f9fafb;
}

.api-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  background: #eff6ff;
}

.api-example-content {
  display: none;
  margin-top: 1rem;
}

.api-example-content.active {
  display: block;
}

.example-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.example-header h5 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.example-code {
  background: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

/* URL endpoint display styles */
.endpoint-url-display {
  background-color: #f9fafb;
  padding: 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  border: 1px solid #e5e7eb;
}

/* Styles pour l'onglet API */
.api-section-btn {
  width: 100%;
  padding: 0.75rem;
  text-align: left;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.api-section-btn:hover {
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

.api-section-btn.active {
  background-color: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.api-endpoint {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.api-endpoint-header {
  padding: 0.75rem 1rem;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

.api-endpoint-header:hover {
  background-color: #f3f4f6;
}

.api-endpoint-content {
  padding: 1rem;
  display: none;
}

.api-endpoint-content.active {
  display: block;
}

.method-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  margin-right: 0.5rem;
}

.method-get { background-color: #3b82f6; }
.method-post { background-color: #10b981; }
.method-put { background-color: #f59e0b; }
.method-delete { background-color: #ef4444; }

.api-try-section {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f9fafb;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.api-response {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid;
  border-radius: 0.5rem;
}

.api-response.success {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
}

.api-response.error {
  background-color: #fef2f2;
  border-color: #fecaca;
}

.api-response-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.status-200, .status-201 { 
  background-color: #dcfce7; 
  color: #166534; 
}

.status-400, .status-401, .status-404, .status-500 { 
  background-color: #fee2e2; 
  color: #991b1b; 
}

.api-response-body {
  background-color: #1f2937;
  color: #10b981;
  padding: 1rem;
  border-radius: 0.375rem;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.875rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

.api-param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.api-param-table th {
  background-color: #f9fafb;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid #e5e7eb;
  font-size: 0.875rem;
}

.api-param-table td {
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  font-size: 0.875rem;
}

.param-name {
  font-family: 'Consolas', 'Monaco', monospace;
  color: #3b82f6;
  font-weight: 600;
}

.param-type {
  font-family: 'Consolas', 'Monaco', monospace;
  color: #7c3aed;
  font-size: 0.8125rem;
}

.param-required {
  color: #dc2626;
  font-weight: 600;
}

.param-optional {
  color: #16a34a;
}

.api-code-example {
  background-color: #1f2937;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 0.375rem;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.875rem;
  overflow-x: auto;
  margin: 1rem 0;
}

/* Responsive design */
@media (max-width: 768px) {
  .modal-content {
    margin: 1rem;
    width: calc(100% - 2rem);
  }
  
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .flex {
    flex-direction: column;
  }
  
  .flex > * {
    margin-bottom: 0.5rem;
  }
  
  .flex > *:last-child {
    margin-bottom: 0;
  }
}

/* Animation pour les éléments qui apparaissent */
.animate-slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Styles pour le menu déroulant utilisateur */
#userMenu {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Styles pour les codes de couleur de statut de connexion */
.connection-status-connected .status-dot {
  background-color: #10b981;
}

.connection-status-connecting .status-dot {
  background-color: #f59e0b;
}

.connection-status-disconnected .status-dot {
  background-color: #ef4444;
}

/* Styles pour les graphiques (si implémentés) */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

/* Styles pour les tableaux */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.table th {
  background-color: #f9fafb;
  font-weight: 500;
  font-size: 0.875rem;
  color: #374151;
}

/* Styles pour les onglets de contenu */
.tab-content {
  animation: fadeIn 0.2s ease-in-out;
}

/* Styles pour les codes et pre-formatted text */
.code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background-color: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.code-block {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* === STYLES POUR LES MINIATURES D'IMAGES === */

/* Conteneur miniature pour vue grille */
.media-thumbnail-container {
  width: 80px;
  height: 80px;
  margin: 0 auto 8px auto;
  border-radius: 8px;
  overflow: hidden;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e5e7eb;
}

.media-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.media-thumbnail:hover {
  transform: scale(1.05);
}

/* Conteneur miniature pour vue liste */
.media-thumbnail-container-small {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d1d5db;
  flex-shrink: 0;
}

.media-thumbnail-small {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Améliorations des cartes média */
.media-card {
  transition: all 0.2s ease;
  min-height: 240px;
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.media-card:hover .media-thumbnail {
  transform: scale(1.1);
}

/* Styles pour les checkboxes */
.media-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #3b82f6;
  border-radius: 3px;
}

/* Animation pour les actions */
.media-card .btn:hover {
  transform: scale(1.05);
}

/* Style pour les badges de type de fichier */
.media-type-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
  .media-thumbnail-container {
    width: 60px;
    height: 60px;
  }
  
  .media-card {
    min-height: 200px;
  }
  
  .media-card .btn {
    padding: 4px 8px;
    font-size: 12px;
  }
}