
/* ── JURIS GLOBAL CHATBOT (LEX) — HIGH CONTRAST ── */

/* Launcher */
#lex-launcher {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #c9983a, #e8b84b);
  color: #fff;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(201,152,58,0.4), 0 2px 8px rgba(0,0,0,0.3);
  z-index: 9999;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
#lex-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(201,152,58,0.6);
}

/* Chat window — ALWAYS dark, always readable */
#lex-window {
  position: fixed;
  bottom: 4.75rem;
  right: 1.5rem;
  width: 340px;
  max-height: 520px;
  height: 75vh;
  background: #0d1220;
  border: 1px solid rgba(201,152,58,0.18);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  z-index: 9998;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  overflow: hidden;
  font-family: 'Inter', -apple-system, sans-serif;
}
#lex-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
#lex-header {
  padding: 1rem 1.25rem;
  background: rgba(201,152,58,0.1);
  border-bottom: 1px solid rgba(201,152,58,0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
#lex-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #f5e6c8;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
#lex-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  line-height: 1;
}
#lex-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Messages */
#lex-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,152,58,0.3) transparent;
}
#lex-messages::-webkit-scrollbar { width: 4px; }
#lex-messages::-webkit-scrollbar-thumb { background: rgba(201,152,58,0.3); border-radius: 4px; }

.lex-msg {
  max-width: 88%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  animation: lexPopIn 0.25s cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes lexPopIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bot bubble — ALWAYS light text on dark bg */
.lex-msg.bot {
  background: #1a2235;
  color: #e2e8f0;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255,255,255,0.06);
}

/* User bubble — gold */
.lex-msg.user {
  background: linear-gradient(135deg, #c9983a, #e8b84b);
  color: #1a1200;
  font-weight: 500;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Quick reply buttons */
.lex-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-self: flex-start;
  max-width: 95%;
}
.lex-btn {
  background: rgba(201,152,58,0.1);
  border: 1px solid rgba(201,152,58,0.35);
  color: #e8b84b;
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
}
.lex-btn:hover {
  background: rgba(201,152,58,0.25);
  border-color: #c9983a;
  color: #fff;
  transform: translateY(-1px);
}

/* Input area */
#lex-input-area {
  padding: 0.85rem 1rem;
  background: #0a0e1a;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
#lex-input {
  flex: 1;
  background: #1a2235;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  padding: 0.6rem 1rem;
  color: #e2e8f0;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
#lex-input:focus { border-color: rgba(201,152,58,0.5); }
#lex-input::placeholder { color: rgba(255,255,255,0.28); }
#lex-send {
  background: linear-gradient(135deg, #c9983a, #e8b84b);
  color: #1a1200;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  transition: 0.2s;
}
#lex-send:hover { transform: scale(1.08); }

/* Typing dots */
.typing-indicator {
  display: flex;
  gap: 0.3rem;
  padding: 0.75rem 1rem;
  background: #1a2235;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background: rgba(201,152,58,0.7);
  border-radius: 50%;
  animation: lexTyping 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lexTyping {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%       { transform: translateY(-4px); opacity: 1; }
}

/* Mobile */
@media (max-width: 480px) {
  #lex-window { width: calc(100vw - 1.5rem); right: 0.75rem; bottom: 5rem; border-radius: 16px; }
  #lex-launcher { width: 50px; height: 50px; bottom: 5rem; right: 1rem; }
}

/* == HIGH-PRECISION MOBILE CHATBOT VIEWPORT STYLING == */
@media (max-width: 768px) {
  #lex-window {
    width: calc(100vw - 24px) !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 72px !important;
    max-height: calc(100vh - 90px) !important;
    height: 580px !important;
    border-radius: 16px !important;
    z-index: 10005 !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8) !important;
  }
  #lex-launcher {
    display: none !important;
  }
  #lang-selector-wrap {
    bottom: 70px !important;
    left: 12px !important;
    z-index: 9995 !important;
  }
  #jg-toast-widget {
    bottom: 72px !important;
    left: 12px !important;
    z-index: 9997 !important;
    max-width: calc(100vw - 24px) !important;
  }
  #lex-messages {
    max-height: calc(100% - 130px);
  }
  .lex-msg {
    font-size: 0.9rem;
    max-width: 92%;
  }
  .lex-options {
    gap: 6px;
  }
}

/* == DESKTOP & LAPTOP VISIBILITY RULE: MOBILE STICKY BAR == */
.mobile-sticky-bar, #mobile-sticky-bar {
  display: none !important;
}
@media screen and (max-width: 768px) {
  .mobile-sticky-bar, #mobile-sticky-bar {
    display: flex !important;
    padding: 10px 16px !important;
  }
}

/* == R4 STYLING: GUARDRAIL DISCLAIMER & DYNAMIC CHIPS == */
.lex-guardrail {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid #d4af37;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #cbd5e1;
  font-style: italic;
  line-height: 1.4;
}

.lex-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 8px;
  align-self: flex-start;
  width: 100%;
}

.lex-chip {
  background: rgba(212, 175, 55, 0.12) !important;
  border: 1px solid rgba(212, 175, 55, 0.4) !important;
  color: #e8b84b !important;
  padding: 5px 12px !important;
  border-radius: 20px !important;
  font-size: 0.8rem !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
}

.lex-chip:hover {
  background: #d4af37 !important;
  color: #0b0f19 !important;
  border-color: #d4af37 !important;
  transform: translateY(-1px);
}

