/* Template Base Styles */
.agent-message-template {
  margin: 1rem 0;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.agent-message-template:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.template-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #2d3748;
}

.template-description {
  font-size: 1rem;
  color: #718096;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Text Template */
.template-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.template-text-content {
  max-width: 800px;
  margin: 0 auto;
}

.template-text-body {
  font-size: 1.1rem;
  line-height: 1.8;
  text-align: justify;
}

/* Video Template */
.template-video {
  color: white;
}

.template-video-content {
  max-width: 1000px;
  margin: 0 auto;
}

.video-item {
  margin-bottom: 2rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.template-video-player {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
}

/* Image Template */
.template-image {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.template-image-content {
  max-width: 1200px;
  margin: 0 auto;
}

.image-gallery {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Grid Layout */
.template-image-grid .image-gallery {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Masonry Layout */
.template-image-masonry .image-gallery {
  columns: 3;
  column-gap: 1rem;
}

.template-image-masonry .image-item {
  break-inside: avoid;
  margin-bottom: 1rem;
}

/* Carousel Layout */
.template-image-carousel .image-gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 1rem;
  padding: 1rem 0;
}

.template-image-carousel .image-item {
  flex: 0 0 300px;
  scroll-snap-align: start;
}

.image-item {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.image-item:hover {
  transform: scale(1.05);
}

.template-image {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Slides Template */
.template-slides {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  color: #2d3748;
}

.template-slides-content {
  max-width: 1000px;
  margin: 0 auto;
}

.slides-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.slide-item {
  display: none;
  position: relative;
}

.slide-item.active {
  display: block;
}

.slide-image,
.slide-video,
.slide-pdf {
  width: 100%;
  height: 400px;
  object-fit: cover;
}

.slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 1rem;
  font-size: 0.9rem;
}

/* Mixed Template */
.template-mixed {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  color: #2d3748;
}

.template-mixed-content {
  max-width: 1000px;
  margin: 0 auto;
}

.mixed-text {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
}

.mixed-images,
.mixed-videos,
.mixed-documents {
  margin-bottom: 2rem;
}

.mixed-image {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 8px;
  margin: 0.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mixed-video {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 8px;
  margin: 0.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mixed-document {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  margin: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  color: #2d3748;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.mixed-document:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .agent-message-template {
    padding: 1rem;
    margin: 0.5rem 0;
  }

  .template-title {
    font-size: 1.25rem;
  }

  .template-image-carousel .image-item {
    flex: 0 0 250px;
  }

  .template-image-masonry .image-gallery {
    columns: 2;
  }

  .slide-image,
  .slide-video,
  .slide-pdf {
    height: 250px;
  }
}

@media (max-width: 480px) {
  .template-image-masonry .image-gallery {
    columns: 1;
  }

  .template-image-grid .image-gallery {
    grid-template-columns: 1fr;
  }
}

/* Animation Classes */
.template-slides-fade .slide-item {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.template-slides-fade .slide-item.active {
  opacity: 1;
}

.template-slides-slide .slide-item {
  transform: translateX(100%);
  transition: transform 0.5s ease;
}

.template-slides-slide .slide-item.active {
  transform: translateX(0);
}

/* Loading States */
.template-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.template-loading::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
