/* ==========================================================================
   EduConecta AI Chat Widget Styles
   ========================================================================== */

/* Hide intrusive floating social share bar that intercepts touch/click events */
.sharemypost-share-bar.sharemypost-floating-bar,
.sharemypost-floating-bar,
.smp-floating-container,
div[class*="sharemypost-floating"] {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  z-index: -1 !important;
}

/* Launcher Floating Button */
.ec-chat-launcher-wrap {
  position: fixed;
  bottom: 2rem;
  right: 6.5rem;
  z-index: 999999;
  display: flex;
  align-items: center;
}

.ec-chat-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #1D428A 0%, #0F234A 100%);
  color: #FFFFFF;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 0.5rem 1.15rem 0.5rem 0.5rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(29, 66, 138, 0.4);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  font-family: inherit;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}


.ec-chat-toggle-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(29, 66, 138, 0.45);
}

.launcher-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #22C55E;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
}

.launcher-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

.launcher-text strong {
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.launcher-text span {
  font-size: 0.75rem;
  color: #93C5FD;
}

.launcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #D12027;
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Chat Window Container */
.ec-chat-container {
  display: none !important;
  position: fixed;
  bottom: 5.5rem;
  right: 2rem;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 580px;
  max-height: calc(100vh - 7rem);
  max-height: calc(100dvh - 7rem);
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
  flex-direction: column;
  z-index: 1000000;
  overflow: hidden;
  font-family: inherit;
}

.ec-chat-container.ec-chat-open {
  display: flex !important;
  animation: slide-in-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-in-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* Chat Header */
.ec-chat-header {
  flex-shrink: 0;
  background: linear-gradient(135deg, #1D428A 0%, #0F234A 100%);
  color: #FFFFFF;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.ec-chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  background: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  position: relative;
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22C55E;
  border: 2px solid #1D428A;
  border-radius: 50%;
}

.ec-chat-header-info h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
}

.ec-chat-header-info p {
  margin: 0;
  font-size: 0.75rem;
  color: #93C5FD;
}

.ec-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.chat-icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #FFFFFF;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Chat Messages */
.ec-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #F8FAFC;
  scroll-behavior: smooth;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: ec-msg-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ec-msg-pop {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg.bot-msg {
  align-self: flex-start;
}

.chat-msg.user-msg {
  align-self: flex-end;
}

.msg-bubble {
  padding: 0.85rem 1rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: break-word;
}

.bot-msg .msg-bubble {
  background: #FFFFFF;
  color: #1F2937;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  border: 1px solid #E5E7EB;
}

.user-msg .msg-bubble {
  background: #1D428A;
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.msg-bubble p {
  margin: 0 0 0.5rem 0;
}

.msg-bubble p:last-child {
  margin-bottom: 0;
}

.msg-bubble strong {
  font-weight: 700;
}

.bot-msg .msg-bubble a {
  color: #1D428A;
  font-weight: 700;
  text-decoration: underline;
}

.bot-msg .msg-bubble a:hover {
  color: #D12027;
}

.user-msg .msg-bubble a {
  color: #93C5FD;
}

.msg-bubble ul, .msg-bubble ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.msg-bubble li {
  margin-bottom: 0.25rem;
}

.msg-time {
  font-size: 0.6875rem;
  color: #9CA3AF;
  margin-top: 0.25rem;
  align-self: flex-end;
}

/* Quick Starter Prompts */
.ec-chat-quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.quick-pill {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: #1D428A;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.quick-pill:hover {
  background: #EFF6FF;
  border-color: #93C5FD;
  transform: translateX(3px);
}

/* Typing Indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.75rem 1rem !important;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #9CA3AF;
  border-radius: 50%;
  animation: typing-wave 1.3s infinite ease-in-out;
}

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

@keyframes typing-wave {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Human Handover Banner */
.ec-chat-wa-handover {
  background: #F0FDF4;
  border-top: 1px solid #DCFCE7;
  border-bottom: 1px solid #DCFCE7;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.775rem;
  color: #166534;
}

.ec-chat-wa-handover a {
  color: #16A34A;
  font-weight: 700;
  text-decoration: none;
}

.ec-chat-wa-handover a:hover {
  text-decoration: underline;
}

/* Chat Input Form */
.ec-chat-form {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  background: #FFFFFF;
  border-top: 1px solid #E5E7EB;
  position: relative;
  z-index: 20;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  padding: 0.35rem 0.5rem 0.35rem 1rem;
  transition: border-color 0.2s;
}

.input-wrap:focus-within {
  border-color: #1D428A;
  background: #FFFFFF;
}

#ec-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: #1F2937;
  font-family: inherit;
}

#ec-chat-input::placeholder {
  color: #9CA3AF;
  font-size: 0.8125rem;
}

#ec-chat-send-btn {
  background: #1D428A;
  color: #FFFFFF;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

#ec-chat-send-btn:hover {
  background: #D12027;
  transform: scale(1.05);
}

#ec-chat-send-btn:disabled {
  background: #CBD5E1;
  cursor: not-allowed;
  transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .ec-chat-launcher-wrap {
    bottom: 4.75rem;
    right: 1rem;
    z-index: 999999;
  }

  .ec-chat-toggle-btn {
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    gap: 0.45rem;
    border-radius: 999px;
  }

  .launcher-avatar {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }

  .launcher-text strong {
    font-size: 0.8125rem;
  }

  .launcher-text span {
    font-size: 0.6875rem;
  }

  .ec-chat-container {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    width: 100vw !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    z-index: 1000000 !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }

  .ec-chat-container.ec-chat-open {
    display: flex !important;
    animation: slide-in-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .ec-chat-header {
    flex-shrink: 0 !important;
    border-radius: 0 !important;
    padding-top: max(0.85rem, env(safe-area-inset-top));
  }


  .ec-chat-messages {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0.85rem 1rem !important;
  }

  .ec-chat-wa-handover {
    flex-shrink: 0 !important;
    padding: 0.45rem 1rem !important;
  }

  .ec-chat-form {
    flex-shrink: 0 !important;
    padding: 0.65rem 0.85rem !important;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom)) !important;
    background: #FFFFFF !important;
    border-top: 1px solid #E2E8F0 !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08) !important;
    position: relative !important;
    z-index: 25 !important;
  }

  .input-wrap {
    padding: 0.35rem 0.5rem 0.35rem 0.85rem !important;
    background: #F1F5F9 !important;
    border: 1.5px solid #CBD5E1 !important;
  }

  #ec-chat-input {
    font-size: 16px !important; /* Prevents auto-zoom on mobile browsers */
  }
}

@media (max-width: 420px) {
  .ec-chat-launcher-wrap {
    bottom: 4.75rem;
    right: 1rem;
  }

  .ec-chat-toggle-btn {
    padding: 0.35rem 0.6rem 0.35rem 0.35rem;
    gap: 0.35rem;
  }

  .launcher-text span {
    display: none;
  }

  .launcher-text strong {
    font-size: 0.75rem;
  }
}


