:root {
  /* Dark aurora theme */
  --bg: #050816;
  --panel: #0b1020;
  --panel-soft: #11172b;
  --border: #2f3550;

  --text: #f4f7ff;
  --text-soft: #c0c6e6;

  /* Teal + violet core */
  --accent: #4ef2e8;          /* main teal accent */
  --accent-soft: #b784ff;     /* soft violet accent */
  --accent-soft-dim: #8b6cd6; /* dimmer violet for states */

  /* Roles */
  --bot: #b784ff;             /* bot = violet */
  --user: #4ef2e8;           /* keep as brand teal for borders/accents */
  --user-text: #eafdfb;      /* near-white with a tiny teal tint */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top, #151c3a 0, var(--bg) 55%);
  color: var(--text);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* Shell */

.chat-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 860px;
  height: 100vh;
  padding: 1rem;
  gap: 0.75rem;
}

/* Header */

.chat-header {
  flex: 0 0 auto;
  padding: 0.8rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(183, 132, 255, 0.45);  /* violet edge */
  background: linear-gradient(
    135deg,
    rgba(16, 21, 39, 0.96),
    rgba(28, 24, 72, 0.98)
  );
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(6px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
}

.chat-header-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);        /* teal title */
}

.chat-header-meta {
  font-size: 0.82rem;
  color: var(--accent-light);
  opacity: 0.9;
}


/* Main chat area */

.chat-main {
  flex: 1 1 auto;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Slim scrollbar for desktop */

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 142, 0.6);
  border-radius: 999px;
}

.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 114, 142, 0.6) transparent;
}

/* Message rows */

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-row.bot {
  justify-content: flex-start;
}



/* Bubbles */

.msg-bubble {
  max-width: 100%;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  font-size: 0.94rem;
  line-height: 1.45;
  border: 1px solid transparent;
  white-space: normal;
  word-wrap: break-word;        /* breaks only when absolutely needed */
  overflow-wrap: break-word;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.05s ease, box-shadow 0.05s ease, border-color 0.1s ease;
}

/* user bubble: darker teal glass + light text */
.msg-bubble.user {
  background: linear-gradient(
    135deg,
    rgba(10, 48, 60, 0.96),   /* dark teal base on the left */
    rgba(6, 30, 40, 0.98)     /* slightly deeper on the right */
  );
  border-color: rgba(78, 242, 232, 0.85);  /* same teal edge */
  color: var(--user-text);                  /* no more teal-on-teal */
  white-space: pre-wrap;
}

/* bot bubble */

/* bot bubble: darker base, subtle violet edge for better contrast */
/* bot bubble: deep violet, not black, good contrast with light text */
.msg-bubble.bot {
  background: linear-gradient(
    135deg,
    #201a46 0%,    /* rich violet */
    #181f3f 45%,   /* mid-dark blue-violet */
    #101527 100%   /* dark, but not black */
  );
  border-color: rgba(183, 132, 255, 0.7);
  color: var(--text);
}



.msg-bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5);
}

/* Bot message links (search results) */

.msg-bubble.bot a.search-link {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}

.msg-bubble.bot a.search-link:hover {
  text-decoration: underline;
  filter: brightness(1.15);
}

/* Highlight titles inside results */

.msg-bubble.bot .search-title {
  font-weight: 700;
  color: var(--accent-soft);
}

/* wrapper so bubble width doesn't fight avatar width */
.msg-bubble-wrap {
  display: flex;
  max-width: calc(100% - 44px); /* 32px avatar + ~12px gap */
}

/* user status states */
.msg-user-pending {
  opacity: 0.8;
}

.msg-user-failed {
  border-color: rgba(255, 94, 168, 0.9);
}

/* retry button inside user bubble */
.msg-retry {
  margin-top: 0.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 94, 168, 0.6);
  background: transparent;
  color: var(--accent-soft);
  font-size: 0.75rem;
  cursor: pointer;
}

.msg-retry:hover {
  background: rgba(255, 94, 168, 0.1);
}

/* typing indicator */
.typing-bubble {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding: 0.2rem 0.4rem;
}

.typing-dots {
  display: inline-flex;
  gap: 0.2rem;
}

.typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-soft);
  opacity: 0.4;
  animation: typing-bounce 1s infinite ease-in-out;
}

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

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

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

/* Avatar container */
.msg-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

/* user avatar: teal halo */
.msg-avatar.user {
  background: radial-gradient(circle at 30% 20%,
    rgba(78, 242, 232, 0.40),
    rgba(5, 12, 18, 1)
  );
  color: var(--user);
}

/* bot avatar: violet halo */
.msg-avatar.bot {
  background: radial-gradient(circle at 30% 20%,
    rgba(183, 132, 255, 0.45),
    rgba(5, 8, 22, 1)
  );
  color: var(--bot);
}

/* Avatar SVG sizing */
.msg-avatar-icon {
  width: 22px;
  height: 22px;
  display: block;
}

/* Timestamp (if you add it) */

.msg-time {
  display: block;
  margin-top: 0.2rem;
  line-height: 1.45;
  font-size: 0.75rem;
  opacity: 0.7;
  color: var(--text-soft);
}

/* Input area */

.chat-input-bar {
  flex: 0 0 auto;
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
}

.chat-input {
  flex: 1 1 auto;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.95rem;
  resize: none;
  min-height: 2.4rem;
  max-height: 6rem;
}

.chat-input::placeholder {
  color: var(--text-soft);
  opacity: 0.7;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 245, 255, 0.5);
}

/* Send button */

.chat-send {
  flex: 0 0 auto;
  padding: 0 1.1rem;
  border-radius: 10px;
  border: none;
  background: linear-gradient(
    135deg,
    var(--accent),
    #45ffe6
  );
  color: #020308;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.1s ease, transform 0.05s ease, box-shadow 0.08s ease;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

.chat-send:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.7);
}

.chat-send:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
}

/* Status line */

.chat-status {
  flex: 0 0 auto;
  font-size: 0.8rem;
  color: var(--text-soft);
  opacity: 0.8;
  margin-top: 0.1rem;
  min-height: 1rem;
}

/* Add styles for the new action buttons (copy, like, dislike) */
.msg-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.msg-action-copy,
.msg-action-like,
.msg-action-dislike {
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.1s ease, opacity 0.2s;
  opacity: 0.7;
}


.msg-action-icon {
  width: 1rem;       /* keep current visual size */
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.msg-action-copy:hover,
.msg-action-like:hover,
.msg-action-dislike:hover {
  color: var(--accent);
  transform: translateY(-1px);
  opacity: 1;
}

.msg-action-like:focus,
.msg-action-dislike:focus {
  outline: none;
  color: var(--accent-soft);
}

/* Copy focus = teal */
.msg-action-copy:focus {
  outline: none;
  color: var(--user);
}

/* Like highlighted = teal */
.msg-action-like.selected {
  font-weight: 600;
  color: var(--user);
  transform: scale(1.05);
}

/* Dislike highlighted = muted violet instead of "angry red" */
.msg-action-dislike.selected {
  font-weight: 600;
  color: var(--accent-soft-dim);
  transform: scale(1.05);
}

/* Copy highlighted = teal pulse */
.msg-action-copy.selected {
  font-weight: 600;
  color: var(--user);
  transform: scale(1.05);
}

.contact-results-header {
  margin: 0 0 0.25rem 0;
  padding: 0.45rem;
  line-height: 1.2;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;        /* tighter vertical spacing between cards */
  margin-top: 0.25rem;
}

.contact-card {
  padding: 0.45rem 0.65rem;   /* significantly denser */
  border-radius: 6px;
  border: 1px solid rgba(255, 94, 168, 0.32);
  background: linear-gradient(
    135deg,
    rgba(11, 16, 32, 0.96),
    rgba(17, 23, 43, 0.97)
  );
}

.msg-bubble.bot .contact-card {
  margin: 0;          /* kill inherited bubble spacing */
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  background: linear-gradient(
    135deg,
    rgba(17, 23, 43, 0.96),
    rgba(15, 20, 38, 0.97)
  );
}


.contact-name {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.05rem;     /* essentially no gap */
  color: var(--accent-soft);
}

.contact-details {
  font-size: 0.84rem;
  line-height: 1.25;
  color: var(--text-soft);
  opacity: 0.9;
  margin-bottom: 0.1rem;      /* minimal gap */
}

.contact-phone {
  font-size: 0.88rem;
  line-height: 1.25;
}

.contact-phone a {
  font-weight: 600;
  color: var(--accent-soft);
  text-decoration: none;
}

.contact-phone a:hover {
  text-decoration: underline;
}

.contact-phone-missing {
  font-size: 0.84rem;
  color: var(--accent-soft-dim);
}

.login-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  margin: 0 auto;
  padding: 1rem;
  justify-content: center;
  align-items: stretch;
}
.login-panel {
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.login-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--accent);
}
.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 0.8rem;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.8rem;
}
.login-label {
  font-size: 0.85rem;
  color: var(--text-soft);
}
.login-input {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.95rem;
}
.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 245, 255, 0.5);
}
.login-button {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #45ffe6);
  color: #020308;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55);
  transition: filter 0.1s ease, transform 0.05s ease, box-shadow 0.08s ease;
}
.login-button:hover {
  filter: brightness(1.05);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.7);
}
.login-button:active {
  transform: translateY(1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
}
.login-error {
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: var(--accent-soft);
}

.ai-line a {
  color: #00FFFC;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-line a:hover {
  color: #EC217A;     /* your pink accent */
}


/* Responsive */

@media (max-width: 600px) {
  .chat-shell {
    padding: 0.5rem;
  }
  .msg-bubble {
    max-width: 100%;
  }
}

/* --- Palette cleanup: remove old pink/red accents --- */

/* User failed state: use dim violet instead of hot pink */
.msg-user-failed {
  border-color: rgba(139, 108, 214, 0.95); /* var(--accent-soft-dim) style */
}

/* Retry button: use violet border / hover, not pink */
.msg-retry {
  border: 1px solid rgba(139, 108, 214, 0.7);  /* accent-soft-dim */
  color: var(--accent-soft);
}
.msg-retry:hover {
  background: rgba(139, 108, 214, 0.15);
}

/* Contact card border: swap old pink for violet */
.contact-card {
  border: 1px solid rgba(139, 108, 214, 0.4);  /* accent-soft-dim */
}

/* If you want the card background slightly more on the violet side: */
.msg-bubble.bot .contact-card {
  background: linear-gradient(
    135deg,
    rgba(17, 23, 43, 0.96),
    rgba(20, 26, 50, 0.98)
  );
}

