/* public/widget/styles.css - Fixed bottom gap issue */

/* Reset and base styles */
* {
  box-sizing: border-box;
}

/* Overlay styles */
.delightful-ai-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  padding: 0; /* Remove any padding */
  margin: 0; /* Remove any margin */
}

/* Modal container - KEY FIXES HERE */
.delightful-ai-modal {
  background: white;
  /* border-radius: 16px; */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  /* width: 90%; */
  width: 100%;
  max-width: 1600x;
  /* height: 95vh; */
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: delightful-ai-modal-appear 0.3s ease-out;
  margin: 0; /* Remove any margin */
  padding: 0; /* Remove any padding */
  position: relative; /* Ensure proper positioning */
}

@keyframes delightful-ai-modal-appear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header - Fixed height */
.delightful-ai-header {
  /* height: 62px; */
  height: 50px; /* Fixed total height including padding */
  flex-shrink: 0; /* Prevent shrinking */
  color: #1e293b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  box-sizing: border-box;
  margin: 0; /* Remove any margin */
}

/* Close button */
.delightful-ai-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  line-height: 1;
  margin: 0;
}

.delightful-ai-close:hover {
  background-color: #f1f5f9;
  color: #1e293b;
  transform: scale(1.1);
}

.delightful-ai-close:active {
  transform: scale(0.95);
}

/* Iframe - CRITICAL: This eliminates the bottom gap */
.delightful-ai-modal iframe {
  width: 100% !important;
  height: calc(100% - 62px) !important; /* Match exact header height */
  border: none !important;
  display: block !important;
  flex: 1 !important; /* Take all remaining space */
  margin: 0 !important; /* Remove any margin */
  padding: 0 !important; /* Remove any padding */
  background: white !important; /* Ensure white background */
  vertical-align: top !important;
}

/* Additional iframe content fixes */
.delightful-ai-modal iframe html,
.delightful-ai-modal iframe body {
  margin: 0 !important;
  padding: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

/* Prevent textarea collapse in iframe */
.delightful-ai-modal iframe textarea {
  min-height: 40px !important;
  box-sizing: border-box !important;
}

/* Launcher button */
.delightful-ai-launcher {
  position: fixed;
  z-index: 999998;
  transition: all 0.3s ease;
}

.delightful-ai-bottom-right {
  bottom: 24px;
  right: 24px;
}

.delightful-ai-bottom-left {
  bottom: 24px;
  left: 24px;
}

.delightful-ai-top-right {
  top: 24px;
  right: 24px;
}

.delightful-ai-top-left {
  top: 24px;
  left: 24px;
}

.delightful-ai-launcher-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  animation: delightful-ai-launcher-bounce 2s infinite;
}

/* .delightful-ai-launcher-btn:hover { */
/* transform: scale(1.1); */
/* box-shadow: 0 15px 35px -3px rgba(59, 130, 246, 0.4); */
/* } */

.delightful-ai-launcher-btn:active {
  transform: scale(0.95);
}
/* 
@keyframes delightful-ai-launcher-bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
} */

/* Mobile responsiveness - NO GAPS */
@media (max-width: 768px) {

  .delightful-ai-modal {
    width: 100vw !important;
    height: calc(100vh - 50px) !important;
    border-radius: 0 !important;
    max-width: none !important;
    margin: 0 !important;
  }
  
  .delightful-ai-overlay {
    padding: 0 !important;
  }
  
  .delightful-ai-launcher {
    bottom: 20px;
    right: 20px;
  }
  
  .delightful-ai-launcher-btn {
    width: 50px;
    height: 50px;
  }
  
  .delightful-ai-header {
    padding: 12px 16px;
    height: 50px; /* Adjusted for mobile */
  }
  .delightful-ai-header span {
    font-size: 14px; /* Adjust the font size for mobile */
  }
  
  .delightful-ai-modal iframe {
    height: calc(100% - 50px) !important;
  }
}

/* Dark theme support */
.delightful-ai-modal[data-theme="dark"] {
  background: #1e293b;
}

.delightful-ai-modal[data-theme="dark"] .delightful-ai-header {
  background: #334155;
  color: #f1f5f9;
  border-bottom-color: #475569;
}

.delightful-ai-modal[data-theme="dark"] .delightful-ai-close {
  color: #94a3b8;
}

.delightful-ai-modal[data-theme="dark"] .delightful-ai-close:hover {
  background-color: #475569;
  color: #f1f5f9;
}

/* Focus styles for accessibility */
.delightful-ai-close:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.delightful-ai-launcher-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Prevent body scroll when modal is open */
body.delightful-ai-no-scroll {
  overflow: hidden !important;
}

/* ADDITIONAL FIX: Reset any default iframe styling */
iframe#delightful-ai-iframe {
  vertical-align: top !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Fix for any container padding/margin issues */
#delightful-ai-container {
  margin: 0 !important;
  padding: 0 !important;
}

#delightful-ai-container * {
  box-sizing: border-box !important;
}
.delightful-ai-launcher {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition:
    transform 0.25s ease,
    filter 0.25s ease;
}

.delightful-ai-launcher:hover {
  transform: translateY(-1px) scale(1.01);
  filter: brightness(1.08);
}

.delightful-ai-launcher img {
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #2b7fff;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.25),
    0 0 0 4px rgba(255, 255, 255, 0.2);
  z-index: 2;
  background: radial-gradient(circle at 30% 30%, #fff, #e0e0e0);
}

.ai-launcher-text {
  position: relative;
  background: rgba(255, 255, 255, 0.6);
  padding: 12px 20px 12px 50px;
  border-radius: 14px;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateX(-42px);
  z-index: -999;
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
}

.ai-launcher-text h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.ai-launcher-text p {
  margin: 3px 0 0 0;
  font-size: 0.85rem;
  color: #334155;
}

.non-highlight {
  color: #7d7c7c;
  font-weight: 300;
}
