/* WhatsApp Template Preview Styles */
.whatsapp-preview-container {
  border-left: 1px solid #F4F4F7;
  margin-left: 10px;
  padding-left: 20px;
  height: 100%;
}

.whatsapp-preview-frame {
  background: #ffffff;
  border-radius: 20px;
  padding: 0;
  margin-top: 20px;
  max-height: calc(100vh - 200px);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.whatsapp-header {
  display: flex;
  align-items: center;
  background: #ffffff;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
  border-radius: 20px 20px 0 0;
}

.whatsapp-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #00644B;
  margin-right: 12px;
  position: relative;
}

.whatsapp-avatar::after {
  content: "💎";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
}

.whatsapp-avatar.MARKETING {
  background: #00644B;
}
.whatsapp-avatar.MARKETING::after {
  content: "⚡";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
}

.whatsapp-avatar.UTILITY {
  background: rgb(238, 175, 103);
}
.whatsapp-avatar.UTILITY::after {
  content: "🏠";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
}

/*
.whatsapp-avatar::after {
  content: "📄";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
}
*/
.whatsapp-contact-info {
  flex: 1;
}

.whatsapp-contact-name {
  font-weight: 600;
  font-size: 16px;
  color: #000;
  margin-bottom: 2px;
}

.whatsapp-contact-status {
  font-size: 13px;
  color: #667781;
}

.whatsapp-messages-area {
  background-image: url('https://media.etihub.it/pingueen/6a244df5-9b73-4acf-b5cf-6a77f0bd2082.jpeg');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  padding: 20px;
  min-height: 400px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  /* Aggiungo un overlay leggero per migliorare la leggibilità */
  position: relative;
}

.whatsapp-messages-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /*background: rgba(255, 255, 255, 0.85);*/
  pointer-events: none;
}

.whatsapp-message-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.whatsapp-message-bubble {
  background-color: #E1FFC7;
  border-radius: 18px;
  padding: 12px 16px;
  max-width: 85%;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  border: 1px solid #D1E7DD;
}

.whatsapp-message-bubble.template-message {
  background: linear-gradient(135deg, #FFF8E1 0%, #E8F5E8 100%);
  border: 2px solid #25D366;
  border-radius: 16px;
}

.whatsapp-message-bubble::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid #E1FFC7;
  border-bottom: 8px solid transparent;
}

.template-message::after {
  border-left-color: #E8F5E8 !important;
}

/* Template Header Styles */
.template-header {
  margin-bottom: 12px;
}

.header-text {
  font-weight: 600;
  font-size: 16px;
  color: #1f2937;
  margin-bottom: 8px;
}

.header-media {
  margin-bottom: 8px;
}

.media-placeholder {
  background: #f3f4f6;
  border: 2px dashed #9ca3af;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.image-placeholder {
  background: linear-gradient(45deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
  color: #92400e;
}

.video-placeholder {
  background: linear-gradient(45deg, #ddd6fe, #c4b5fd);
  border-color: #8b5cf6;
  color: #5b21b6;
}

.document-placeholder {
  background: linear-gradient(45deg, #fecaca, #fca5a5);
  border-color: #ef4444;
  color: #991b1b;
}

.media-placeholder i {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

/* Template Body Styles */
.template-body {
  margin-bottom: 12px;
}

.body-text {
  font-size: 15px;
  line-height: 1.4;
  color: #1f2937;
  white-space: pre-wrap;
}

.template-variable {
  background: #dcfce7;
  color: #166534;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  border: 1px solid #bbf7d0;
}

/* Template Footer Styles */
.template-footer {
  margin-bottom: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.footer-text {
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}

/* Template Buttons Styles */
.template-buttons {
  margin-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.1);
  padding-top: 8px;
}

.button-preview {
  background: #ffffff;
  border: 1px solid #25D366;
  border-radius: 20px;
  padding: 8px 16px;
  margin: 4px 0;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #25D366;
  cursor: pointer;
  transition: all 0.2s ease;
}

.button-preview:hover {
  background: #25D366;
  color: white;
}

.button-quick_reply {
  background: #E3F2FD;
  border-color: #2196F3;
  color: #1565C0;
}

.button-url {
  background: #FFF3E0;
  border-color: #FF9800;
  color: #E65100;
}

.button-phone_number {
  background: #E8F5E8;
  border-color: #4CAF50;
  color: #2E7D32;
}

.button-copy_code {
  background: #F3E5F5;
  border-color: #9C27B0;
  color: #6A1B9A;
}

.button-flow {
  background: #E1F5FE;
  border-color: #00BCD4;
  color: #006064;
}

.button-preview i {
  margin-right: 6px;
  font-size: 12px;
}

/* Message Time */
.message-time {
  font-size: 11px;
  color: #667781;
  text-align: right;
  margin-top: 8px;
  margin-bottom: 2px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .whatsapp-preview-frame {
    padding: 15px;
  }

  .whatsapp-message-bubble {
    max-width: 95%;
  }
}

/* Scrollbar styling for preview area */
.whatsapp-preview-frame::-webkit-scrollbar {
  width: 6px;
}

.whatsapp-preview-frame::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
}

.whatsapp-preview-frame::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.3);
  border-radius: 3px;
}

.whatsapp-preview-frame::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.5);
}

/* Animation for dynamic changes */
.template-header, .template-body, .template-footer, .template-buttons {
  transition: all 0.3s ease;
}

/* Large modal adjustments */
.popeye-modal-container .popeye-modal.large {
  width: 80%;
  max-width: 1400px;
}
