/* ============================================================================
   SRI PRAYAG CLASSES - UNIFIED WHATSAPP AI COUNSELOR WIDGET
   Strictly scoped to Landing Pages. 1:1 Pixel-Perfect Match with Reference Mockup.
   ============================================================================ */

/* Hide duplicate static desktop-wa-pill so only the unified WhatsApp AI widget displays */
.desktop-wa-pill {
  display: none !important;
}

/* --- Floating Trigger Button (Unified WhatsApp & AI Widget) --- */
.spc-ai-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #ffffff;
  padding: 8px 18px 8px 10px;
  border-radius: 9999px;
  box-shadow: 0 6px 24px rgba(18, 140, 126, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  user-select: none;
  font-family: inherit;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.spc-ai-trigger:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 32px rgba(18, 140, 126, 0.48), 0 0 20px rgba(37, 211, 102, 0.55);
  background: linear-gradient(135deg, #20BD5A 0%, #075E54 100%);
}

.spc-ai-trigger:active {
  transform: translateY(0) scale(0.97);
}

.spc-ai-trigger-wa-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.spc-ai-trigger-wa-icon svg {
  width: 21px;
  height: 21px;
  fill: #25D366;
}

.spc-ai-trigger-label {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.spc-ai-trigger-text {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #FFFFFF;
}

.spc-ai-trigger-sub {
  font-size: 10.5px;
  font-weight: 600;
  color: #E7FFDB;
  letter-spacing: 0.3px;
}



/* --- Chat Modal Backdrop / Window --- */
.spc-chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1250;
  background: rgba(11, 20, 26, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.spc-chat-overlay.active {
  display: block;
  opacity: 1;
}

/* Main Modal Window Card (Matching 1:1 Rounded Aesthetics) */
.spc-chat-modal {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 1260;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 44px);
  background: #FFFFFF;
  border-radius: 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32), 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.spc-chat-modal.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* --- Header: Deep Emerald Forest Gradient (#09392B to #0F4E3C) --- */
.spc-chat-header {
  background: linear-gradient(180deg, #09392B 0%, #0F4E3C 100%);
  color: #FFFFFF;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 5;
}

.spc-chat-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Glowing Neon Halo Avatar */
.spc-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0B192C;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  flex-shrink: 0;
}

.spc-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spc-chat-header-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.spc-chat-header-title {
  font-size: 15px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.3px;
}

.spc-chat-header-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #86EFAC;
  font-weight: 500;
  margin-top: 2px;
}

.spc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #25D366;
  display: inline-block;
  box-shadow: 0 0 6px #25D366;
}

/* Header Actions */
.spc-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Circular Quota Bubble (Chats: 12/20 left) */
.spc-quota-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  color: #FFFFFF;
  font-family: inherit;
  flex-shrink: 0;
  user-select: none;
  transition: all 0.2s ease;
}

.spc-qc-label {
  font-size: 8.5px;
  opacity: 0.85;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.spc-qc-num {
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
}

.spc-qc-sub {
  font-size: 8.5px;
  opacity: 0.85;
  font-weight: 600;
}

.spc-quota-circle.spc-quota-low {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.25);
}

.spc-quota-circle.spc-quota-low .spc-qc-num {
  color: #FCA5A5;
}

/* Direct WhatsApp Button in Header */
.spc-chat-header-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #25D366;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 9999px;
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.35);
  transition: all 0.2s ease;
  user-select: none;
}

.spc-chat-header-wa-btn:hover {
  background: #20BD5A;
  transform: translateY(-1px);
  color: #FFFFFF;
  box-shadow: 0 5px 14px rgba(37, 211, 102, 0.5);
}

.spc-chat-header-wa-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* Close Button (✕) */
.spc-chat-close-btn {
  background: transparent;
  border: none;
  color: #FFFFFF;
  opacity: 0.85;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.spc-chat-close-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.spc-chat-close-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- Quick Chips Bar (Sub-header) --- */
.spc-quick-chips {
  background: #F4EFEA;
  padding: 10px 14px 8px 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  z-index: 2;
}

.spc-quick-chips::-webkit-scrollbar {
  display: none;
}

.spc-chip {
  background: #FFFFFF;
  border: 1px solid #E2D9CF;
  color: #1E293B;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.spc-chip:hover {
  background: #25D366;
  color: #FFFFFF;
  border-color: #25D366;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

.spc-chip.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Chat Messages Area with Clean Authentic WhatsApp Texture --- */
.spc-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background-color: #EFEAE2;
  background-image: url("/landing/images/whatsapp-doodle-bg.svg");
  background-repeat: repeat;
  background-size: 360px 360px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#spc-messages-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Message Rows & Avatars --- */
.spc-msg-row {
  display: flex;
  animation: spcFadeUp 0.22s ease-out;
}

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

.spc-msg-row.assistant {
  align-self: flex-start;
  gap: 10px;
  max-width: 92%;
}

.spc-msg-row.user {
  align-self: flex-end;
  max-width: 82%;
  justify-content: flex-end;
}

/* Academic Counselor Avatar on Left of Assistant */
.spc-counselor-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1.5px solid #25D366;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.spc-counselor-avatar svg {
  width: 22px;
  height: 22px;
  display: block;
}

.spc-msg-content-wrapper {
  display: flex;
  flex-direction: column;
}

.spc-msg-row.user .spc-msg-content-wrapper {
  align-items: flex-end;
}

/* Bubble Styling */
.spc-msg-bubble {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

/* Assistant Bubble: Pure White Rounded Card */
.spc-msg-row.assistant .spc-msg-bubble {
  background: #FFFFFF;
  color: #111827;
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.spc-msg-row.assistant .spc-msg-bubble strong {
  color: #0E4E3B;
  font-weight: 700;
}

/* User Bubble: WhatsApp Outgoing Green */
.spc-msg-row.user .spc-msg-bubble {
  background: #E7FFDB;
  color: #111B21;
  border-radius: 18px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(11, 20, 26, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.spc-msg-row.user .spc-msg-bubble strong {
  color: #0E4E3B;
  font-weight: 700;
}

/* --- Prominent In-Message WhatsApp Pill Button (📲 98303 78296 on WhatsApp) --- */
.spc-wa-btn-container {
  margin-top: 12px;
  display: block;
}

.spc-wa-bubble-btn {
  background: #25D366;
  color: #000000 !important;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.2s ease;
  user-select: none;
}

.spc-wa-bubble-btn:hover {
  background: #20BD5A;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.55);
  color: #000000 !important;
  text-decoration: none;
}

.spc-wa-bubble-btn:active {
  transform: translateY(0);
}

.spc-wa-btn-icon {
  font-size: 17px;
  line-height: 1;
}

.spc-wa-btn-num {
  letter-spacing: 0.2px;
}

.spc-text-link {
  color: #0284C7;
  font-weight: 600;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.spc-text-link:hover {
  color: #0369A1;
}

.spc-msg-bubble ul {
  margin: 6px 0;
  padding-left: 20px;
}

.spc-msg-bubble li {
  margin: 3px 0;
}

.spc-msg-bubble p {
  margin: 0 0 6px 0;
}

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

.spc-msg-time {
  font-size: 11px;
  color: #64748B;
  margin-top: 4px;
  padding: 0 6px;
}

/* Typing Indicator with Robot */
.spc-msg-row.typing .spc-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
  background: #FFFFFF;
  border: 1px solid rgba(11, 20, 26, 0.08);
  border-radius: 20px;
  width: fit-content;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.spc-typing-dot {
  width: 7px;
  height: 7px;
  background: #25D366;
  border-radius: 50%;
  animation: spcBounce 1.4s infinite ease-in-out both;
}

.spc-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.spc-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes spcBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Streaming Cursor Indicator */
.spc-stream-cursor {
  display: inline-block;
  width: 2.5px;
  height: 13px;
  background-color: #25D366;
  margin-left: 3px;
  vertical-align: middle;
  border-radius: 1px;
  animation: spcBlink 0.8s infinite;
}

@keyframes spcBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Quota Limit Finished Card --- */
.spc-quota-card {
  background: #FFFFFF;
  border: 2px solid #25D366;
  border-radius: 18px;
  padding: 18px 16px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.15);
  margin-top: 6px;
  animation: spcFadeUp 0.3s ease-out;
}

.spc-quota-badge {
  display: inline-block;
  background: #E8F5E9;
  color: #075E54;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid #86EFAC;
  margin-bottom: 8px;
}

.spc-quota-brand-title {
  font-size: 16px;
  font-weight: 800;
  color: #075E54;
  letter-spacing: 0.5px;
  margin: 0 0 8px 0;
  text-transform: uppercase;
}

.spc-quota-text {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  margin: 0 0 14px 0;
}

.spc-quota-helpline-box {
  background: #F0F2F5;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.spc-quota-helpline-label {
  font-size: 12.5px;
  color: #64748B;
  font-weight: 600;
}

.spc-quota-helpline-num {
  font-size: 14.5px;
  font-weight: 800;
  color: #075E54;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.spc-quota-helpline-num:hover {
  color: #25D366;
  text-decoration: underline;
}

.spc-quota-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #25D366;
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  transition: all 0.25s ease;
  user-select: none;
}

.spc-quota-wa-btn:hover {
  background: #20BD5A;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.55);
  color: #FFFFFF;
}

.spc-quota-wa-btn:active {
  transform: translateY(0);
}

.spc-quota-wa-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- Chat Footer / Input Form (Modern Translucent Pill Bar) --- */
.spc-chat-footer {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.spc-chat-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.spc-chat-input {
  width: 100%;
  border: 1px solid #E5E7EB;
  border-radius: 9999px;
  padding: 12px 20px;
  font-size: 13.5px;
  font-family: inherit;
  color: #111B21;
  background: #FFFFFF;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.spc-chat-input:focus {
  border-color: #25D366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

/* Right Vibrant WhatsApp Green Send Button */
.spc-chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #25D366;
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
}

.spc-chat-send-btn:hover:not(:disabled) {
  background: #20BD5A;
  transform: scale(1.06);
}

.spc-chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.spc-chat-send-btn svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .spc-ai-trigger {
    bottom: 18px;
    right: 16px;
    padding: 7px 14px 7px 8px;
  }
  
  .spc-ai-trigger-wa-icon {
    width: 28px;
    height: 28px;
  }
  
  .spc-ai-trigger-wa-icon svg {
    width: 17px;
    height: 17px;
  }
  
  .spc-ai-trigger-text {
    font-size: 12.5px;
  }
  
  .spc-ai-trigger-sub {
    font-size: 9.5px;
  }

  /* Full screen native app modal on mobile with dynamic viewport protection */
  html.spc-modal-open,
  body.spc-modal-open {
    overflow: hidden !important;
    height: 100% !important;
    touch-action: none;
    -webkit-overflow-scrolling: auto;
  }

  .spc-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  }

  .spc-chat-modal.active {
    transform: translateY(0);
  }

  .spc-chat-header {
    padding: 11px 14px;
    padding-top: max(11px, env(safe-area-inset-top));
    flex-shrink: 0;
  }

  .spc-quick-chips {
    padding: 8px 12px;
    flex-shrink: 0;
  }

  .spc-chat-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 12px;
    background-size: 320px 320px;
  }

  .spc-chat-footer {
    flex-shrink: 0;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  /* Prevent browser auto-zoom on input focus (minimum 16px font-size required) */
  .spc-chat-input {
    font-size: 16px !important;
    padding: 11px 18px;
  }
}
