/* Chat Preview Section Styles */
.chat-preview {
  background: var(--background);
  padding: var(--spacing) 10vw;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.chat-preview-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.chat-preview-title {
  color: var(--text);
  text-align: left;
  line-height: 1.2;
  margin: 0 0 1rem 0;
  opacity: 0;
  transform: translateY(50px);
}

.chat-preview-subtitle {
  font-size: 1.25rem;
  color: var(--gray);
  text-align: left;
  max-width: 500px;
  margin: 0 0 3rem 0;
  font-weight: 500;
  opacity: 0;
  transform: translateY(50px);
}

.chat-iframe-container {
  position: relative;
  width: 100%; /* Use full width of content container instead of viewport */
  height: 70vh;
  min-height: 500px;
  border-radius: 2.5rem;
  overflow: hidden;
  box-shadow: 0 20px 20px rgba(0, 0, 0, 0.05);
  opacity: 0;
  transform: translateY(50px);
  border: solid 1px rgba(0, 0, 0, 0.1);
  margin: 0 auto; /* Center the container */
  /* No CSS transition - GSAP will handle all animations */
  transition: height 2s ease;
}

.chat-iframe-container.fullscreen {
  /* Positioning will be handled by GSAP animations */
  border-radius: 0;
  box-shadow: none;
  max-width: none !important; /* Override max-width constraints in fullscreen */
}

.chat-iframe-container.transitioning {
  transition: none; /* Disable CSS transitions during GSAP animation */
  max-width: none !important; /* Override max-width constraints during transition */
}

#chat-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: inherit;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  top: 0;
  left: 0;
  transform: none;
}

.chat-iframe-container.transitioning #chat-iframe {
  transition: none; /* Disable CSS transitions during GSAP animation */
}

.chat-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: all 0.5s ease;
  cursor: pointer;
}

.chat-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s ease;
}

.chat-now-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.chat-now-btn:hover {
  background-color: #005bb5;
}

.chat-now-btn:active {
  background-color: #004494;
  transform: scale(0.98);
  transition: color 0.75s ease;
}

.chat-now-btn:focus {
  outline: none;
}

/* Mobile Responsive */
/* Tablet landscape and small desktop */
@media screen and (max-width: 1024px) and (min-width: 769px) {
  .chat-iframe-container:not(.fullscreen):not(.transitioning) {
    /* JavaScript will handle responsive dimensions */
    min-height: 450px;
  }
}

/* Tablet portrait */
@media screen and (max-width: 768px) and (min-width: 481px) {
  .chat-preview {
    padding: 80px 5vw;
  }

  .chat-preview-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
  }

  .chat-iframe-container:not(.fullscreen):not(.transitioning) {
    /* JavaScript will handle responsive dimensions */
    min-height: 400px;
    border-radius: 2.5rem;
  }

  .chat-now-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
  }
}

/* Mobile */
@media screen and (max-width: 480px) {
  .chat-preview {
    padding: 60px 0.75rem;
  }

  .chat-preview-title {
    padding: 0 0.75rem;
  }

  .chat-preview-subtitle {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    padding: 0 0.75rem;
  }

  .chat-iframe-container:not(.fullscreen):not(.transitioning) {
    /* JavaScript will handle responsive dimensions */
    min-height: 350px;
    border-radius: 12px;
  }

  .chat-now-btn {
    padding: 0.9rem 1.8rem;
    font-size: 0.95rem;
  }
}

/* Smooth transition for fullscreen */
.chat-iframe-container.transitioning {
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure iframe scales properly in fullscreen */
.chat-iframe-container.fullscreen #chat-iframe {
  transform: scale(1);
}

/* Loading state for iframe */
#chat-iframe {
  opacity: 1;
  background: var(--light-gray);
}

#chat-iframe[data-loading='true'] {
  background: var(--light-gray)
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z" opacity=".25"/><path d="M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"><animateTransform attributeName="transform" dur="1s" from="0 12 12" repeatCount="indefinite" to="360 12 12" type="rotate"/></path></svg>')
    center center no-repeat;
  background-size: 40px 40px;
}

/* Ensure iframe starts transparent until loaded */
#chat-iframe:not([src]) {
  background: var(--light-gray)
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z" opacity=".25"/><path d="M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"><animateTransform attributeName="transform" dur="1s" from="0 12 12" repeatCount="indefinite" to="360 12 12" type="rotate"/></path></svg>')
    center center no-repeat;
  background-size: 40px 40px;
}

/* Loading overlay for iframe */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.3s ease;
}
