/* ===================================================================
   Universal Radhe — Radhe AI Floating Chat Assistant Styles
   Engineered with Deep Navy (#15253A) and Teal (#119C99) Design Tokens
   =================================================================== */

/* Widget Root Container */
#urRadheAiWidgetRoot {
  position: relative;
  max-width: 100vw;
  box-sizing: border-box;
}

/* --- 0. Proactive Greeting Teaser Popup (Appears after 3-5 seconds) --- */
.ur-chat-teaser {
  position: fixed;
  bottom: 94px;
  right: 24px;
  left: auto;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  box-shadow: 0 10px 28px -4px rgba(15, 23, 42, 0.18),
              0 2px 8px rgba(17, 156, 153, 0.12);
  z-index: 1045;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem 0.65rem 1rem;
  animation: urTeaserFadeIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: min(340px, calc(100vw - 32px));
  box-sizing: border-box;
  overflow: hidden;
}

.ur-chat-teaser::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 22px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-right: 1px solid rgba(15, 23, 42, 0.12);
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  transform: rotate(45deg);
  pointer-events: none;
}

.ur-chat-teaser-bubble {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.ur-chat-teaser-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(17, 156, 153, 0.25);
}

.ur-chat-teaser-wave {
  font-size: 1.35rem;
  display: inline-block;
  animation: urWaveAnimation 1.8s infinite;
  transform-origin: 70% 70%;
}

@keyframes urWaveAnimation {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.ur-chat-teaser-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
}

.ur-chat-teaser-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #15253a;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.ur-chat-teaser-msg {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.ur-chat-teaser-btn-voice {
  background: rgba(17, 156, 153, 0.1);
  border: 1px solid rgba(17, 156, 153, 0.25);
  color: #119c99;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.ur-chat-teaser-btn-voice:hover {
  background: #119c99;
  color: #ffffff;
  border-color: #119c99;
  transform: scale(1.08);
}

.ur-chat-teaser-btn-voice.ur-speaking {
  background: #119c99;
  color: #ffffff;
  border-color: #119c99;
  animation: urVoicePulse 1.2s infinite ease-in-out;
}

@keyframes urVoicePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(17, 156, 153, 0.5);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(17, 156, 153, 0);
  }
}

.ur-chat-teaser-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.ur-chat-teaser-close:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

@keyframes urTeaserFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- 1. Floating Launcher Button --- */
.ur-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15253a 0%, #0d1724 100%);
  color: #ffffff;
  border: 2px solid rgba(17, 156, 153, 0.4);
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.35),
              0 2px 6px rgba(17, 156, 153, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1045;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  outline: none;
}

.ur-chat-launcher:hover {
  transform: scale(1.06) translateY(-2px);
  border-color: #119c99;
  box-shadow: 0 12px 28px -4px rgba(17, 156, 153, 0.4),
              0 4px 10px rgba(15, 23, 42, 0.3);
}

.ur-chat-launcher:focus-visible {
  outline: 3px solid #119c99;
  outline-offset: 4px;
}

.ur-chat-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  background-color: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.ur-chat-launcher-icon-chat,
.ur-chat-launcher-icon-close {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ur-chat-launcher-icon-close {
  display: none;
}

.ur-chat-open .ur-chat-launcher-icon-chat {
  display: none;
}

.ur-chat-open .ur-chat-launcher-icon-close {
  display: flex;
}

/* --- 2. Chat Panel Container --- */
.ur-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 430px;
  height: 640px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 20px 48px -12px rgba(15, 23, 42, 0.25),
              0 4px 12px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 1045;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s ease,
              width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.ur-chat-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Maximized / Expanded State */
.ur-chat-panel.maximized {
  width: min(760px, calc(100vw - 32px));
  height: min(840px, calc(100vh - 110px));
}

.ur-chat-panel.maximized .ur-icon-maximize {
  display: none !important;
}

.ur-chat-panel.maximized .ur-icon-restore {
  display: inline-block !important;
}

/* --- 3. Chat Header --- */
.ur-chat-header {
  background: linear-gradient(135deg, #15253a 0%, #0d1724 100%);
  color: #ffffff;
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

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

.ur-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(17, 156, 153, 0.15);
  border: 1px solid rgba(17, 156, 153, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #119c99;
  flex-shrink: 0;
  overflow: hidden;
}

.ur-chat-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.ur-chat-title-group {
  display: flex;
  flex-direction: column;
}

.ur-chat-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.2;
}

.ur-chat-chip-ai {
  font-size: 0.6875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #119c99;
  background: rgba(17, 156, 153, 0.15);
  border: 1px solid rgba(17, 156, 153, 0.3);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ur-chat-subtitle {
  font-size: 0.775rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.2;
}

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

.ur-chat-btn-action {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ur-chat-btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.ur-chat-btn-action:focus-visible {
  outline: 2px solid #119c99;
  outline-offset: 1px;
}

/* --- 4. Chat Messages Scroll Area --- */
.ur-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f8fafc;
  scroll-behavior: smooth;
  box-sizing: border-box;
  max-width: 100%;
}

.ur-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ur-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ur-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.ur-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Message Bubble Rows */
.ur-msg-row {
  display: flex;
  gap: 0.55rem;
  max-width: 88%;
  min-width: 0;
  box-sizing: border-box;
}

.ur-msg-assistant > div,
.ur-msg-user > div {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

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

.ur-msg-row.ur-msg-assistant {
  align-self: flex-start;
}

.ur-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #15253a;
  color: #119c99;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  overflow: hidden;
}

.ur-msg-bubble {
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  font-size: 0.9125rem;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: break-word;
  position: relative;
  box-sizing: border-box;
  max-width: 100%;
}

.ur-msg-user .ur-msg-bubble {
  background: linear-gradient(135deg, #15253a 0%, #1e3553 100%);
  color: #ffffff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.ur-msg-assistant .ur-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

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

.ur-msg-bubble pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.8125rem;
  margin: 0.5rem 0;
}

.ur-msg-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background: rgba(15, 23, 42, 0.06);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.ur-msg-user .ur-msg-bubble code {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.ur-msg-bubble pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.ur-msg-bubble a {
  color: #119c99;
  text-decoration: underline;
}

.ur-msg-user .ur-msg-bubble a {
  color: #38bdf8;
}

/* Markdown Tables in Chat */
.ur-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  margin: 0.55rem 0;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.ur-chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: left;
}

.ur-chat-table th {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
  padding: 0.45rem 0.65rem;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
}

.ur-chat-table th:last-child {
  border-right: none;
}

.ur-chat-table td {
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
}

.ur-chat-table td:last-child {
  border-right: none;
}

.ur-chat-table tr:last-child td {
  border-bottom: none;
}

.ur-chat-table tr:hover td {
  background: #f8fafc;
}

/* Headings in Chat */
.ur-chat-heading {
  font-weight: 700;
  color: #0f172a;
  margin: 0.65rem 0 0.3rem 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

h5.ur-chat-heading {
  font-size: 0.975rem;
}

h6.ur-chat-heading {
  font-size: 0.8875rem;
}

.ur-msg-user .ur-chat-heading {
  color: #ffffff;
}

.ur-chat-quote {
  border-left: 3px solid #119c99;
  padding-left: 0.65rem;
  margin: 0.4rem 0;
  color: #64748b;
  font-style: italic;
}

.ur-msg-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.725rem;
  color: #64748b;
  flex-wrap: wrap;
  max-width: 100%;
}

.ur-msg-voice-btn {
  background: transparent;
  border: none;
  color: #64748b;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.725rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.ur-msg-voice-btn:hover {
  color: #119c99;
  background-color: #f0fdfa;
}

.ur-msg-voice-btn.ur-btn-speaking {
  color: #ffffff;
  background-color: #119c99;
  box-shadow: 0 1px 4px rgba(17, 156, 153, 0.3);
  animation: urVoiceBtnPulse 1.4s infinite ease-in-out;
}

@keyframes urVoiceBtnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.ur-msg-copy-btn {
  background: transparent;
  border: none;
  color: #64748b;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.725rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.ur-msg-copy-btn:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

/* Suggestions Container */
.ur-chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.ur-chat-suggestions-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.ur-suggestion-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #15253a;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1.35;
  box-sizing: border-box;
  max-width: 100%;
  word-break: break-word;
}

.ur-suggestion-chip span {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.ur-suggestion-chip svg {
  flex-shrink: 0;
  margin-left: 0.4rem;
}

.ur-suggestion-chip:hover {
  background: #f0fdfa;
  border-color: #119c99;
  color: #119c99;
  transform: translateX(2px);
}

.ur-suggestion-chip:focus-visible {
  outline: 2px solid #119c99;
}

/* Typing Indicator */
.ur-chat-typing-row {
  display: none;
  align-self: flex-start;
  gap: 0.55rem;
  max-width: 80%;
}

.ur-chat-typing-row.active {
  display: flex;
}

.ur-typing-bubble {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.65rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ur-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #94a3b8;
  animation: urTypingBounce 1.4s infinite ease-in-out both;
}

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

@keyframes urTypingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background-color: #119c99; }
}

/* Error Notice in Chat */
.ur-msg-error {
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #991b1b !important;
}

.ur-msg-retry-btn {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background-color 0.15s ease;
}

.ur-msg-retry-btn:hover {
  background: #fecaca;
}

/* --- 5. Message Composer --- */
.ur-chat-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 0.75rem 1rem 0.6rem 1rem;
  flex-shrink: 0;
}

.ur-chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.35rem 0.45rem 0.35rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ur-chat-input-wrapper:focus-within {
  border-color: #119c99;
  box-shadow: 0 0 0 3px rgba(17, 156, 153, 0.15);
  background: #ffffff;
}

.ur-chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-size: 0.9125rem;
  font-family: inherit;
  color: #0f172a;
  max-height: 110px;
  min-height: 24px;
  line-height: 1.4;
  padding: 0.25rem 0;
}

.ur-chat-textarea::placeholder {
  color: #94a3b8;
}

.ur-chat-send-btn {
  background: #119c99;
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.ur-chat-send-btn:hover:not(:disabled) {
  background: #0d7f7c;
  transform: scale(1.04);
}

.ur-chat-send-btn:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

.ur-chat-disclaimer {
  font-size: 0.7rem;
  color: #64748b;
  text-align: center;
  margin-top: 0.45rem;
  margin-bottom: 0;
  line-height: 1.3;
}

/* --- 6. Mobile Responsiveness --- */
@media (max-width: 767.98px) {
  .ur-chat-panel {
    right: 12px;
    left: 12px;
    bottom: 76px;
    width: auto;
    max-width: calc(100vw - 24px);
    height: calc(100dvh - 90px);
    max-height: calc(100dvh - 90px);
    border-radius: 14px;
    box-sizing: border-box;
  }

  .ur-chat-launcher {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  .ur-chat-teaser {
    bottom: 74px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 0.55rem 0.75rem;
    gap: 0.35rem;
    box-shadow: 0 6px 18px -3px rgba(15, 23, 42, 0.15),
                0 2px 6px rgba(17, 156, 153, 0.1);
  }

  .ur-chat-teaser::after {
    right: 20px;
  }

  .ur-msg-row {
    max-width: 96%;
  }

  .ur-chat-messages {
    padding: 0.85rem;
  }
}
