﻿/**
 * Ingemino Cloud + AI — Chat Widget Styles
 * Design Rules:
 *   - border-radius: 0 on all UI containers (No-Round-Corners rule)
 *   - border-radius: 50% retained on avatar circles and status dot only
 *   - Glassmorphism on .chat-wrap
 *   - Primary Indigo: #000666 | Secondary Cyan: #006876 | Gold: #705D00
 *   - Spectral glow micro-animations on interactive elements
 */

/* ── Chat Container ─────────────────────────────────────────────────────────── */
.chat-wrap {
  border: 0.5px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 560px;
  background: rgba(var(--surface-1-rgb, 255, 255, 255), 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 6, 102, 0.12), 0 1px 0 rgba(0, 6, 102, 0.06);
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.chat-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #000666;
  flex-shrink: 0;
}

.chat-avatar-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;               /* Avatar shape — intentional exception */
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-avatar-ring i {
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
}

.header-name {
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  margin: 0;
  line-height: 1.3;
}

.header-status {
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  margin: 0;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;               /* Dot shape — intentional exception */
  background: #4ade80;
  margin-right: 4px;
  vertical-align: middle;
  animation: status-pulse 2.5s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  50%       { opacity: 0.85; box-shadow: 0 0 0 4px rgba(74, 222, 128, 0); }
}

/* ── Chat Body ──────────────────────────────────────────────────────────────── */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border, #ddd) transparent;
}

.chat-body::-webkit-scrollbar       { width: 4px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: var(--border, #ddd); border-radius: 0; }

/* ── Message Layout ─────────────────────────────────────────────────────────── */
.msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 86%;
}

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

/* ── Avatars ────────────────────────────────────────────────────────────────── */
.msg-av {
  width: 26px;
  height: 26px;
  border-radius: 50%;               /* Avatar shape — intentional exception */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
  margin-top: 2px;
}

.bot-av  { background: #000666; color: #fff; }
.user-av { background: var(--bg-accent, #e8eaff); color: var(--text-accent, #000666); }

/* ── Bubbles ────────────────────────────────────────────────────────────────── */
.bubble {
  padding: 9px 13px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  border-radius: 0;                 /* No-Round-Corners rule */
}

.bot .bubble {
  background: var(--surface-2, #f4f5f8);
  border: 0.5px solid var(--border, #e2e4e9);
  color: var(--text-primary, #191c1e);
}

.user .bubble {
  background: #000666;
  color: #fff;
}

/* ── Typing Indicator ───────────────────────────────────────────────────────── */
.typing-ring {
  background: var(--surface-2, #f4f5f8);
  border: 0.5px solid var(--border, #e2e4e9);
  border-radius: 0;                 /* No-Round-Corners rule */
  padding: 10px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;               /* Dot shape — intentional exception */
  background: var(--text-muted, #9aa0a9);
  animation: pulse 1.2s infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

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

/* ── Suggestion Chips ───────────────────────────────────────────────────────── */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.chip {
  padding: 5px 11px;
  border: 0.5px solid var(--border-strong, #b0b8c4);
  border-radius: 0;                 /* No-Round-Corners rule */
  font-size: 12px;
  cursor: pointer;
  background: var(--surface-2, #f4f5f8);
  color: var(--text-secondary, #5a6070);
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease,
              box-shadow 0.15s ease;
}

.chip:hover {
  border-color: #000666;
  color: var(--text-primary, #191c1e);
  background: var(--surface-1, #fff);
  box-shadow: 0 0 0 2px rgba(0, 6, 102, 0.12),
              0 0 8px rgba(0, 6, 102, 0.08);
}

/* ── Input Row ──────────────────────────────────────────────────────────────── */
.input-row {
  border-top: 0.5px solid var(--border, #e2e4e9);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--surface-2, #f4f5f8);
  flex-shrink: 0;
}

#chatInput {
  flex: 1;
  border: 0.5px solid var(--border-strong, #b0b8c4);
  border-radius: 0;                 /* No-Round-Corners rule */
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font-sans, inherit);
  background: var(--surface-1, #fff);
  color: var(--text-primary, #191c1e);
  resize: none;
  min-height: 36px;
  max-height: 100px;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#chatInput:focus {
  outline: none;
  border-color: #000666;
  box-shadow: 0 0 0 2px rgba(0, 6, 102, 0.14),
              0 0 12px rgba(0, 6, 102, 0.07);
}

/* ── Send Button ────────────────────────────────────────────────────────────── */
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 0;                 /* No-Round-Corners rule */
  background: #000666;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.send-btn:hover {
  background: #0011aa;
  box-shadow: 0 0 0 2px rgba(0, 6, 102, 0.2),
              0 0 16px rgba(0, 6, 102, 0.18);
}

.send-btn:active {
  background: #000444;
  box-shadow: none;
}

.send-btn:disabled {
  background: var(--fill-disabled, #c8cacf);
  cursor: not-allowed;
  box-shadow: none;
}

.send-btn i {
  color: #fff;
  font-size: 16px;
}

/* ── Powered By Footer ──────────────────────────────────────────────────────── */
.powered {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted, #9aa0a9);
  padding: 5px 0 6px;
  background: var(--surface-2, #f4f5f8);
  flex-shrink: 0;
  border-top: 0.5px solid var(--border, #e2e4e9);
}

/* ── Responsive — Mobile ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .chat-wrap {
    height: 100svh;
    border: none;
    box-shadow: none;
  }
}

/* ── Floating Launcher Button ────────────────────────────────────────────────── */
.chat-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 0;                 /* No-Round-Corners rule */
  background: #000666;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 6, 102, 0.35), 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  outline: none;
}

.chat-launcher:hover {
  background: #0011aa;
  box-shadow: 0 6px 28px rgba(0, 6, 102, 0.45), 0 0 0 3px rgba(0, 6, 102, 0.18);
  transform: translateY(-2px);
}

.chat-launcher:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 6, 102, 0.3);
}

.chat-launcher--active {
  background: #006876;
}

.chat-launcher--active:hover {
  background: #007f90;
}

.chat-launcher-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.chat-launcher-icon .material-symbols-outlined {
  font-size: 26px;
}

/* Unread badge */
.chat-launcher-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4ade80;
  color: #000;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: badge-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badge-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── Chat Panel (hidden by default) ──────────────────────────────────────────── */
.chat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 9997;
  width: 380px;
  max-width: calc(100vw - 40px);
  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease;
  /* Ensure no stray border-radius from any reset */
  border-radius: 0;
}

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

/* ── Screen-reader only helper ───────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive — Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .chat-launcher {
    bottom: 16px;
    right: 16px;
  }

  .chat-panel {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    transform-origin: bottom center;
  }

  .chat-panel .chat-wrap {
    height: 100svh;
    border: none;
    box-shadow: none;
  }
}
