/* ===================================================================
   JK SMART AI ASSISTANT - LUXURY LEFT-FLOATING REAL ESTATE ADVISOR
   =================================================================== */

:root {
  --ai-primary: #c59d4b;
  --ai-primary-glow: rgba(197, 157, 75, 0.45);
  --ai-bg-dark: #0b1320;
  --ai-bg-card: #131d2e;
  --ai-bg-msg: #1a273c;
  --ai-border: rgba(197, 157, 75, 0.35);
  --ai-text-muted: #94a3b8;
}

/* Floating Widget Container */
.jk-ai-widget {
  position: fixed;
  left: 24px;
  bottom: 30px;
  z-index: 99999;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* 1. Trigger Button (Floating on Left) */
.jk-ai-trigger {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #0b1320 0%, #162438 50%, #0b1320 100%);
  border: 1.5px solid var(--ai-primary);
  border-radius: 50px;
  padding: 8px 18px 8px 10px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 20px var(--ai-primary-glow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: #fff;
  outline: none;
}

.jk-ai-trigger:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(197, 157, 75, 0.7);
  border-color: #e4bd64;
}

.jk-ai-trigger-icon {
  position: relative;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #e4bd64 0%, #c59d4b 50%, #8c6a28 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b1320;
  font-size: 1.25rem;
  box-shadow: 0 4px 15px rgba(197, 157, 75, 0.6);
}

.jk-bot-icon {
  position: relative;
  z-index: 2;
}

.jk-sparkle-icon {
  position: absolute;
  top: -3px;
  right: -3px;
  font-size: 0.75rem;
  color: #fff;
  animation: jkAiSparkle 2s infinite ease-in-out;
}

@keyframes jkAiSparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.3) rotate(15deg); opacity: 0.7; }
}

/* Pulsing Rings Around Trigger */
.jk-ai-pulse-ring {
  position: absolute;
  top: 50%;
  left: 32px;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--ai-primary);
  animation: jkAiPulse 2.4s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  pointer-events: none;
  opacity: 0;
}

.jk-ai-pulse-ring.ring-2 {
  animation-delay: 1.2s;
}

@keyframes jkAiPulse {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.9); opacity: 0; }
}

.jk-ai-trigger-label {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.jk-ai-trigger-title {
  font-size: 0.90rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.jk-ai-trigger-status {
  font-size: 0.72rem;
  color: var(--ai-primary);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.jk-status-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #22c55e;
  animation: jkStatusBlink 1.8s infinite;
}

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

.jk-ai-badge-new {
  font-size: 0.65rem;
  background: var(--ai-primary);
  color: #0b1320;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 2px;
}

/* 2. Interactive AI Chat Window */
.jk-ai-window {
  position: absolute;
  left: 0;
  bottom: 70px;
  width: 385px;
  max-width: calc(100vw - 32px);
  height: 550px;
  max-height: calc(100vh - 120px);
  background: var(--ai-bg-dark);
  border: 1px solid var(--ai-border);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(197, 157, 75, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: jkAiSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(14px);
  z-index: 100000;
}

@keyframes jkAiSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Header */
.jk-ai-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, #0f192b 0%, #162438 100%);
  border-bottom: 1px solid var(--ai-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.jk-ai-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jk-ai-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #e4bd64, #b88d39);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b1320;
  font-size: 1.1rem;
}

.jk-avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border: 2px solid #0f192b;
  border-radius: 50%;
}

.jk-ai-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.jk-ai-sub {
  font-size: 0.72rem;
  color: var(--ai-primary);
  font-weight: 500;
}

.jk-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.jk-ai-btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.jk-ai-btn-icon:hover {
  background: var(--ai-primary);
  color: #0b1320;
  border-color: var(--ai-primary);
}

/* Chat Body (Messages) */
.jk-ai-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: radial-gradient(circle at 10% 20%, rgba(197, 157, 75, 0.04) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(20, 32, 52, 0.4) 0%, transparent 50%),
              #0b1320;
  scroll-behavior: smooth;
}

.jk-ai-body::-webkit-scrollbar {
  width: 5px;
}
.jk-ai-body::-webkit-scrollbar-thumb {
  background: rgba(197, 157, 75, 0.3);
  border-radius: 10px;
}

/* Chat Message Styles */
.jk-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: jkMsgFade 0.25s ease-out;
}

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

.jk-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.jk-msg.ai {
  align-self: flex-start;
}

.jk-msg-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.86rem;
  line-height: 1.55;
  word-break: break-word;
}

.jk-msg.user .jk-msg-bubble {
  background: linear-gradient(135deg, #c59d4b 0%, #b88d39 100%);
  color: #0b0f14;
  font-weight: 600;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(197, 157, 75, 0.25);
}

.jk-msg.ai .jk-msg-bubble {
  background: var(--ai-bg-card);
  color: #e2e8f0;
  border: 1px solid var(--ai-border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

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

.jk-msg-bubble ul {
  padding-left: 18px;
  margin-bottom: 6px;
}

.jk-msg-bubble li {
  margin-bottom: 4px;
}

.jk-msg-bubble strong {
  color: #f1c40f;
}

/* AI Action Pill Buttons inside response */
.jk-ai-action-btn-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(197, 157, 75, 0.3);
}

.jk-ai-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(197, 157, 75, 0.15);
  color: #fef08a;
  border: 1px solid var(--ai-primary);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.jk-ai-action-btn:hover {
  background: var(--ai-primary);
  color: #0b1320;
  transform: translateY(-2px);
}

/* Typing Indicator Animation */
.jk-ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: var(--ai-bg-card);
  border: 1px solid var(--ai-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.jk-ai-typing span {
  width: 6px;
  height: 6px;
  background: var(--ai-primary);
  border-radius: 50%;
  animation: jkTyping 1.4s infinite ease-in-out;
}

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

@keyframes jkTyping {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* 3. Quick Chips (Suggestions) */
.jk-ai-quick-chips {
  padding: 8px 14px;
  background: #0f192b;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
}

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

.jk-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(197, 157, 75, 0.35);
  color: #cbd5e1;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.jk-chip:hover {
  background: var(--ai-primary);
  color: #0b1320;
  border-color: var(--ai-primary);
  transform: translateY(-2px);
}

/* 4. Footer & Input Form */
.jk-ai-footer {
  padding: 12px 14px 10px;
  background: #0b1320;
  border-top: 1px solid var(--ai-border);
}

.jk-ai-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #141f32;
  border: 1.5px solid rgba(197, 157, 75, 0.4);
  border-radius: 30px;
  padding: 4px 6px 4px 14px;
  transition: all 0.2s ease;
}

.jk-ai-input-form:focus-within {
  border-color: var(--ai-primary);
  box-shadow: 0 0 15px rgba(197, 157, 75, 0.35);
}

.jk-ai-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.86rem;
}

.jk-ai-input::placeholder {
  color: #64748b;
  font-size: 0.82rem;
}

.jk-ai-send-btn {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #e4bd64, #b88d39);
  border: none;
  border-radius: 50%;
  color: #0b1320;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.jk-ai-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(197, 157, 75, 0.6);
}

.jk-ai-legal-note {
  text-align: center;
  font-size: 0.66rem;
  color: #64748b;
  margin-top: 6px;
}

/* ===================================================================
   RESPONSIVE OPTIMIZATIONS (MOBILE / TABLET)
   =================================================================== */
@media (max-width: 767.98px) {
  /* Positioned cleanly above Home Loan EMI button (which is at bottom: 68px) */
  .jk-ai-widget {
    left: 12px !important;
    bottom: 114px !important;
    z-index: 99999 !important;
  }

  .jk-ai-trigger {
    padding: 5px 12px 5px 6px !important;
    border-radius: 30px !important;
    width: auto !important;
    height: auto !important;
    gap: 8px !important;
    background: linear-gradient(135deg, #0b1320 0%, #162438 100%) !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55), 0 0 12px rgba(197, 157, 75, 0.4) !important;
  }

  .jk-ai-trigger-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.95rem !important;
  }

  .jk-ai-trigger-text {
    display: flex !important;
    flex-direction: column !important;
    text-align: left !important;
  }

  .jk-ai-trigger-title {
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
  }

  .jk-ai-trigger-subtitle {
    font-size: 0.62rem !important;
    line-height: 1.1 !important;
  }

  .jk-ai-pulse-ring {
    display: none !important; /* Cleaner mobile rendering without animation artifacts */
  }

  .jk-ai-window {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: 68px !important;
    width: auto !important;
    height: 74vh !important;
    max-height: 560px !important;
    border-radius: 16px !important;
    z-index: 100000 !important;
  }
}
