/* AskZu Widget - Modern Enhanced Design */
#askzu-widget-container * {
  box-sizing: border-box;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

:root {
  --primary-color: #2c63db;
  --primary-dark: #0284c7;
  --secondary-color: #06b6d4;
  --bg-light: #f8fafc;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

.askzu-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 55px;
  height: 55px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: var(--radius-full);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 3px solid white;
  animation: pulse 2s infinite;
}

.askzu-bubble:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 30px rgba(53, 142, 210, 0.4);
}

.askzu-bubble svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

.askzu-chat {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-height: 600px;
  min-height: 500px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;      /* Hide it from the browser renderer */
  pointer-events: none;    /* Let clicks pass through it */
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border-color);
}

.askzu-chat.open {
  /* E-ENABLE CLICKS & VISIBILITY */
  opacity: 1;
  visibility: visible;     
  pointer-events: auto;  
  
  transform: translateY(0) scale(1);
}

.askzu-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 20px 24px 16px;
  position: relative;
}

.askzu-header-title {
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.askzu-header-subtitle {
  font-size: 13px;
  opacity: 0.95;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.askzu-header-subtitle::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.askzu-close {
  position: absolute;
  right: 20px;
  top: 20px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.2);
  transition: background-color 0.2s;
}

.askzu-close:hover {
  background: rgba(255,255,255,0.3);
}

.askzu-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-light);
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
}

.askzu-body::-webkit-scrollbar {
  width: 6px;
}

.askzu-body::-webkit-scrollbar-track {
  background: transparent;
}

.askzu-body::-webkit-scrollbar-thumb {
  background-color: var(--primary-color);
  border-radius: var(--radius-full);
}

.askzu-msg {
  margin: 12px 0;
  display: flex;
  animation: slideIn 0.3s ease-out;
}

.askzu-msg.bot {
  justify-content: flex-start;
}

.askzu-msg.user {
  justify-content: flex-end;
}

.askzu-msg .bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
}

.askzu-msg.bot .bubble {
  background: white;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  border-top-left-radius: var(--radius-sm);
}

.askzu-msg.user .bubble {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border-top-right-radius: var(--radius-sm);
}

.askzu-input {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: white;
  gap: 12px;
}

.askzu-input input {
  flex: 1;
  padding: 12px 18px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  outline: none;
  font-size: 15px;
  transition: all 0.2s;
  background: var(--bg-light);
}

.askzu-input input:focus {
  border-color: var(--primary-color);
  background: white;
  box-shadow: 0 0 0 3px rgba(53, 142, 210, 0.1);
}

.askzu-input button {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border: none;
  color: white;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  box-shadow: var(--shadow-md);
}

.askzu-input button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(53, 142, 210, 0.3);
}

.askzu-input button:active {
  transform: scale(0.95);
}

.askzu-thinking {
  font-style: italic;
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.askzu-thinking::after {
  content: "...";
  animation: dots 1.5s infinite;
}

.askzu-suggestions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.askzu-chip {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(53, 142, 210, 0.2);
}

.askzu-chip:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  box-shadow: var(--shadow-sm);
}

.askzu-tool-container {
  background: linear-gradient(135deg, #f0f9ff, #f8fafc);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 8px 0;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.askzu-tool-container:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.askzu-tool-container a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.askzu-tool-container a::before {
  content: "🔗";
  font-size: 14px;
}

/* Typing indicator */
.askzu-typing {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.askzu-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color);
  animation: typing 1.4s infinite;
}

.askzu-typing span:nth-child(2) { animation-delay: 0.2s; }
.askzu-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Welcome message badge */
.welcome-badge {
  display: inline-block;
  background: linear-gradient(135deg, #10b981, #34d399);
  color: white;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-left: 8px;
  animation: float 3s ease-in-out infinite;
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Enhanced responsive design */
/* Extra Small Devices (≤ 360px) */
@media (max-width: 360px) {
  .askzu-chat {
    width: calc(100vw - 40px);
    right: 20px;
    left: 20px;
    bottom: 80px;
    max-height: 70vh;
    min-height: 400px;
    border-radius: var(--radius-lg);
  }

  .askzu-bubble {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .askzu-header {
    padding: 16px 20px 12px;
  }

  .askzu-header-title {
    font-size: 16px;
  }

  .askzu-body {
    padding: 16px;
  }

  .askzu-input {
    padding: 12px 16px;
  }

  .askzu-input input {
    padding: 10px 16px;
    font-size: 14px;
  }

  .askzu-input button {
    width: 42px;
    height: 42px;
  }

  .askzu-chip {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* Small Mobile (≤ 480px) */
@media (max-width: 480px) {
  .askzu-chat {
    width: calc(100vw - 48px);
    right: 24px;
    left: auto;
    bottom: 88px;
    max-height: 75vh;
    min-height: 450px;
  }

  .askzu-bubble {
    bottom: 20px;
    right: 20px;
  }

  .askzu-msg .bubble {
    max-width: 90%;
    padding: 12px 16px;
  }

  .askzu-suggestions {
    gap: 6px;
  }
}

/* Enhanced Mobile Responsiveness 600px */
@media (max-width: 600px) {
  .askzu-chat {
    width: calc(100% - 32px) !important; /* Proper margin on sides */
    right: 16px !important;
    left: 16px !important;
    
    /* FIX: Reduce bottom gap so it sits lower */
    bottom: 20px !important; 
    
    /* FIX: Dynamic height limits to prevent cut-off */
    max-height: 80vh !important; /* Never exceed 80% of screen height */
    min-height: 350px !important; /* Lower minimum height */
    height: auto !important;
    
    border-radius: 20px !important;
  }

  /* Adjust bubble position */
  .askzu-bubble {
    bottom: 20px !important;
    right: 20px !important;
  }

  /* Ensure the body scrolls properly if height is restricted */
  .askzu-body {
    max-height: calc(80vh - 140px); /* Subtract header/input height */
  }
}

/* Tablet (601px – 768px) */
@media (min-width: 601px) and (max-width: 768px) {
  .askzu-chat {
    width: 400px;
    right: 32px;
    bottom: 110px;
    max-height: 65vh;
  }

  .askzu-bubble {
    bottom: 32px;
    right: 32px;
    width: 68px;
    height: 68px;
  }
}

/* Laptop (769px – 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .askzu-chat {
    width: 420px;
    right: 40px;
    bottom: 120px;
    max-height: 70vh;
  }

  .askzu-bubble {
    bottom: 40px;
    right: 40px;
    width: 72px;
    height: 72px;
  }
}

/* Large Screens (> 1024px) */
@media (min-width: 1025px) {
  .askzu-chat {
    width: 440px;
    right: 48px;
    bottom: 140px;
    max-height: 650px;
  }

  .askzu-bubble {
    bottom: 48px;
    right: 48px;
    width: 55px;
    height: 55px;
  }
}

/* Landscape Mode */
@media (max-height: 500px) and (orientation: landscape) {
  .askzu-chat {
    max-height: 80vh;
    min-height: 300px;
    bottom: 70px;
  }
  
  .askzu-bubble {
    bottom: 16px;
    right: 16px;
  }
}