/* Shared SamDU AI chat design with Futuristic Typography & Dynamic Cards */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=Space+Grotesk:wght@500;600;700;800&display=swap');

/* Typography applied to all AI Modals & Dialogs */
.ai-modal,
.ai-dialog-modal,
.ai-chat-body,
.ai-dialog-body,
.ai-suggestions,
.ai-chat-foot,
.ai-dialog-footer {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif !important;
  letter-spacing: -0.01em;
}

.ai-title,
.ai-dialog-header h4 {
  font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif !important;
  letter-spacing: -0.02em;
}

html.ai-modal-active,
body.ai-modal-active {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none !important;
  height: 100% !important;
}

.ai-modal-overlay {
  background: rgba(6, 26, 68, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 24px;
  overscroll-behavior: contain !important;
  touch-action: none !important;
}

.ai-modal {
  width: min(640px, 100%);
  max-width: 640px;
  height: min(740px, 88svh);
  border: 1px solid rgba(194, 229, 255, 0.8);
  border-radius: 30px;
  background: #ffffff;
  box-shadow: 0 28px 90px rgba(0, 45, 102, 0.35);
  overflow: hidden;
  overscroll-behavior: contain !important;
  touch-action: pan-y !important;
}

.ai-modal-hdr {
  padding: 22px 24px;
  background: linear-gradient(115deg, #009eff 0%, #0065f2 100%);
  position: relative;
  flex-shrink: 0;
}

.ai-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  gap: 13px;
  line-height: 1.4;
  padding-right: 15px;
}

.ai-title i {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 21px;
}

.ai-close-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.ai-close-btn:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: rotate(90deg);
}

.ai-chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  padding: 24px;
  gap: 16px;
  background: radial-gradient(ellipse at 90% 0, #dcefff 0%, transparent 65%), linear-gradient(#f4faff, #edf7ff);
  scroll-behavior: smooth;
}

/* User Message */
.ai-msg {
  font-size: 14.5px;
  line-height: 1.65;
  padding: 14px 18px;
  max-width: 88%;
  overflow-wrap: anywhere;
}

.ai-msg.user {
  background: linear-gradient(125deg, #009aff 0%, #006bee 100%);
  color: #ffffff;
  border-radius: 20px 20px 5px 20px;
  box-shadow: 0 6px 18px rgba(0, 125, 255, 0.22);
  font-weight: 500;
  align-self: flex-end;
}

/* Bot Message Styling */
.ai-msg.bot {
  background: #ffffff;
  border: 1px solid #d5e9fb;
  border-radius: 20px 20px 20px 6px;
  color: #1a2e4c;
  box-shadow: 0 8px 24px -6px rgba(0, 80, 200, 0.08), 0 2px 6px rgba(0, 0, 0, 0.02);
  padding: 16px 20px;
  max-width: 92%;
  position: relative;
  overflow: hidden;
}

/* Futuristic vertical accent bar on bot response */
.ai-msg.bot::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #00d2ff 0%, #0077ff 100%);
  border-radius: 4px 0 0 4px;
}

/* Text & Paragraphs inside AI messages */
.ai-p {
  margin: 0 0 10px 0;
  color: #1a2e4c;
  font-size: 14.5px;
  line-height: 1.65;
}
.ai-p:last-child {
  margin-bottom: 0;
}

/* Bold / Key Concept Highlight */
.ai-bold {
  font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  color: #0b254a;
  letter-spacing: -0.01em;
}

/* Points list container */
.ai-points-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

/* Point item modern card */
.ai-point-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f8fcff 0%, #f1f8ff 100%);
  border: 1px solid #d4e9fc;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 80, 180, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ai-point-item:hover {
  transform: translateY(-1px);
  border-color: #92cdff;
  box-shadow: 0 6px 16px rgba(0, 120, 255, 0.08);
}

/* Futuristic Number Badge */
.ai-point-num {
  font-family: 'Space Grotesk', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
  background: linear-gradient(135deg, #00b4d8 0%, #0066ff 100%);
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 140, 255, 0.32);
  margin-top: 1px;
}

/* Point Body */
.ai-point-body {
  flex: 1;
  min-width: 0;
}

.ai-point-title {
  font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #0b254a;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.ai-point-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: #3b5270;
}

/* Interactive Telegram Pill */
.ai-tg-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 4px 12px;
  border-radius: 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(34, 158, 217, 0.35);
  transition: all 0.2s ease;
  vertical-align: middle;
  margin: 0 2px;
}
.ai-tg-pill:hover {
  background: linear-gradient(135deg, #1d98db 0%, #1588c2 100%);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 14px rgba(34, 158, 217, 0.5);
  color: #ffffff !important;
}
.ai-tg-pill i {
  font-size: 14px;
}

/* Callout / Contact Box */
.ai-callout-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, #eef7ff 0%, #e2effe 100%);
  border: 1px solid #b7daff;
  border-radius: 14px;
  padding: 12px 15px;
  margin: 12px 0 8px 0;
  box-shadow: 0 3px 10px rgba(0, 80, 200, 0.05);
}
.ai-callout-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0099ff 0%, #0055ff 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 3px 8px rgba(0, 102, 255, 0.28);
}
.ai-callout-text {
  flex: 1;
  font-size: 13.5px;
  line-height: 1.6;
  color: #1a3250;
}

/* Outro / Friendly concluding text */
.ai-outro-text {
  font-size: 13.5px;
  font-weight: 600;
  color: #0077b6;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 180, 216, 0.08);
  border-radius: 10px;
  width: fit-content;
}

/* Loading status spinner */
.ai-msg-loading {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #0077cc;
  font-weight: 600;
  font-size: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.ai-msg-loading i {
  color: #0099ff;
  font-size: 16px;
}

/* Staggered Entrance Animation */
@keyframes aiCardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.ai-rendered-content > * {
  animation: aiCardIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ai-rendered-content > *:nth-child(1) { animation-delay: 0.03s; }
.ai-rendered-content > *:nth-child(2) { animation-delay: 0.10s; }
.ai-rendered-content > *:nth-child(3) { animation-delay: 0.17s; }
.ai-rendered-content > *:nth-child(4) { animation-delay: 0.24s; }
.ai-rendered-content > *:nth-child(5) { animation-delay: 0.31s; }

/* Suggestions below chat */
.ai-suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 22px 0;
  background: #ffffff;
}
.ai-suggestion {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #c9e5ff;
  border-radius: 999px;
  background: #f1f9ff;
  color: #346394;
  padding: 8px 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.ai-suggestion:hover {
  background: #dcefff;
  color: #006bdf;
  border-color: #92cdff;
  transform: translateY(-1px);
}

.ai-chat-foot {
  padding: 16px 22px 22px;
  border: 0;
  gap: 10px;
  align-items: center;
}
.ai-input {
  height: 52px;
  min-width: 0;
  background: #f1f8ff;
  border: 1px solid #c9e3fb;
  border-radius: 17px;
  padding: 0 16px;
  font-size: 14px;
  color: #163761;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.ai-input:focus {
  border-color: #008cff;
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.12);
  background: #ffffff;
  outline: none;
}
.ai-send-btn {
  height: 52px;
  width: 52px;
  flex-shrink: 0;
  border-radius: 17px;
  background: linear-gradient(135deg, #009fff 0%, #0067ff 100%);
  box-shadow: 0 6px 15px rgba(0, 140, 255, 0.3);
  font-size: 18px;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ai-send-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 20px rgba(0, 140, 255, 0.45);
}

.ai-fab {
  background: linear-gradient(110deg, #00a5ff 0%, #0069ff 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  height: 58px;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 140, 255, 0.4);
}
.ai-fab i {
  font-size: 19px;
}

@media(max-width: 600px) {
  .ai-modal-overlay {
    padding: 12px;
    align-items: center;
  }
  .ai-modal {
    height: 88svh;
    max-width: 100%;
    border-radius: 24px;
    margin-top: 0;
  }
  .ai-modal-hdr {
    padding: 17px;
  }
  .ai-title {
    font-size: 14px;
    gap: 10px;
  }
  .ai-title i {
    width: 36px;
    height: 36px;
    font-size: 17px;
  }
  .ai-chat-body {
    padding: 16px;
    gap: 12px;
  }
  .ai-msg {
    font-size: 13.5px;
    max-width: 95%;
    padding: 12px 14px;
  }
  .ai-point-item {
    padding: 10px 12px;
    gap: 10px;
  }
  .ai-point-num {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    font-size: 11px;
    border-radius: 7px;
  }
  .ai-point-title {
    font-size: 13px;
  }
  .ai-point-desc {
    font-size: 12.5px;
  }
  .ai-suggestions {
    padding: 12px 14px 0;
    gap: 6px;
  }
  .ai-suggestion {
    font-size: 11px;
    padding: 7px 10px;
  }
  .ai-chat-foot {
    padding: 14px;
    gap: 8px;
  }
  .ai-input {
    height: 48px;
    font-size: 13px;
  }
  .ai-send-btn {
    width: 46px;
    height: 48px;
  }
}

/* Animated robot mascot */
.samdu-robot {
  display: inline-block;
  position: relative;
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0, 104, 222, 0.3));
  animation: robot-hover 3s ease-in-out infinite;
}
.samdu-robot svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.samdu-robot .robot-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: robot-blink 4.8s infinite;
}
.samdu-robot .robot-mouth {
  transform-box: fill-box;
  transform-origin: center;
  animation: robot-talk 2.7s ease-in-out infinite;
}
.samdu-robot .robot-hand {
  transform-origin: 19px 47px;
  animation: robot-wave 2.8s ease-in-out infinite;
}
.samdu-robot .robot-antenna {
  animation: robot-light 1.8s ease-in-out infinite;
}
.btn-ai-hdr, .hdr-r .btn-ai {
  gap: 7px !important;
  padding-left: 8px !important;
}
.ai-fab {
  padding-left: 9px !important;
  gap: 9px !important;
}
.ai-fab .samdu-robot {
  width: 47px;
  height: 47px;
  flex-basis: 47px;
}
.ai-title .samdu-robot {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  filter: drop-shadow(0 2px 6px rgba(0, 39, 141, 0.32));
}

@keyframes robot-hover {
  0%, 100% { transform: translateY(1px) rotate(-2deg); }
  50% { transform: translateY(-2px) rotate(2deg); }
}
@keyframes robot-blink {
  0%, 37%, 41%, 72%, 76%, 100% { transform: scaleY(1); }
  39%, 74% { transform: scaleY(0.12); }
}
@keyframes robot-talk {
  0%, 20%, 42%, 70%, 100% { transform: scale(1, 1); }
  10%, 32%, 60%, 82% { transform: scale(0.8, 0.35); }
  52%, 92% { transform: scale(1.12, 1.25); }
}
@keyframes robot-wave {
  0%, 45%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(-19deg); }
  20%, 40% { transform: rotate(14deg); }
}
@keyframes robot-light {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media(max-width: 600px) {
  .samdu-robot {
    width: 35px;
    height: 35px;
    flex-basis: 35px;
  }
  .ai-title .samdu-robot {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
}

@media(prefers-reduced-motion: reduce) {
  .samdu-robot, .samdu-robot * {
    animation: none !important;
  }
}
