/* HartAI Chat Widget — Premium Dark Design */

/* ── Trigger ── */
.ha-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 11px;
  background: linear-gradient(135deg, #1B365D 0%, #0d1e3a 100%);
  color: #fff;
  border: 1px solid rgba(78,192,196,0.3);
  border-radius: 56px;
  padding: 12px 20px 12px 14px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(78,192,196,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.22s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.ha-trigger:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 24px rgba(78,192,196,0.2), 0 0 0 1px rgba(78,192,196,0.2);
}
.ha-trigger:active { transform: translateY(-1px) scale(0.99); }

.ha-trigger-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4EC0C4 0%, #2a9da0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.ha-trigger-icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(78,192,196,0.4);
  animation: haRing 2.5s ease-in-out infinite;
}
@keyframes haRing {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.18); opacity: 0; }
}

.ha-trigger-info { display: flex; flex-direction: column; gap: 1px; }
.ha-trigger-name { font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
.ha-trigger-status { display: flex; align-items: center; gap: 5px; font-size: 11px; color: rgba(255,255,255,0.6); }
.ha-trigger-dot {
  width: 6px; height: 6px;
  background: #22c55e;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(34,197,94,0.8);
}

.ha-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d1e3a;
  animation: haPopIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.ha-badge[hidden] { display: none; }

@keyframes haPopIn {
  from { transform: scale(0) rotate(-15deg); }
  to   { transform: scale(1) rotate(0deg); }
}

/* ── Panel ── */
.ha-panel {
  position: fixed;
  bottom: 94px;
  right: 28px;
  z-index: 9001;
  width: 390px;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  background: #0d1428;
  border-radius: 22px;
  border: 1px solid rgba(78,192,196,0.18);
  box-shadow:
    0 32px 80px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.04),
    0 0 60px rgba(78,192,196,0.06);
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.88) translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.3,0.64,1), opacity 0.22s ease;
}
.ha-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Accent bar top ── */
.ha-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #4EC0C4, #1B365D, #4EC0C4);
  background-size: 200% 100%;
  animation: haShift 4s linear infinite;
  z-index: 1;
}
@keyframes haShift {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* ── Header ── */
.ha-header {
  background: linear-gradient(180deg, #111c35 0%, #0e1830 100%);
  padding: 18px 16px 16px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  position: relative;
}

.ha-header-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4EC0C4 0%, #1a7c80 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 0 16px rgba(78,192,196,0.35);
}
.ha-header-avatar::after {
  content: '';
  position: absolute;
  bottom: 2px; right: 2px;
  width: 10px; height: 10px;
  background: #22c55e;
  border: 2px solid #111c35;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(34,197,94,0.7);
}

.ha-header-info { flex: 1; min-width: 0; }
.ha-header-name {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 3px;
  line-height: 1;
}
.ha-header-status {
  color: rgba(255,255,255,0.45);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ha-status-live {
  color: #4EC0C4;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ha-status-live::before {
  content: '';
  width: 5px; height: 5px;
  background: #4EC0C4;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #4EC0C4;
}

.ha-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.ha-close:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* ── Messages ── */
.ha-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background:
    radial-gradient(ellipse at 80% 0%, rgba(78,192,196,0.04) 0%, transparent 60%),
    #0a1020;
}
.ha-messages::-webkit-scrollbar { width: 3px; }
.ha-messages::-webkit-scrollbar-track { background: transparent; }
.ha-messages::-webkit-scrollbar-thumb { background: rgba(78,192,196,0.2); border-radius: 2px; }

/* ── Bubbles ── */
.ha-msg {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  animation: haFadeUp 0.28s ease;
}
.ha-msg--user { flex-direction: row-reverse; }

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

.ha-msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4EC0C4 0%, #1a7c80 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  box-shadow: 0 0 10px rgba(78,192,196,0.25);
}

.ha-msg-bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
}

.ha-msg--agent .ha-msg-bubble {
  background: rgba(255,255,255,0.06);
  color: #d4dce8;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px 18px 18px 18px;
}
.ha-msg--user .ha-msg-bubble {
  background: linear-gradient(135deg, #1B365D 0%, #1e4a6e 100%);
  color: #fff;
  border: 1px solid rgba(78,192,196,0.2);
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 16px rgba(27,54,93,0.4);
}

.ha-msg-bubble strong { font-weight: 700; color: #7dd3d6; }
.ha-msg--user .ha-msg-bubble strong { color: #a8e6e8; }

/* ── Typing ── */
.ha-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px 18px 18px 18px;
  width: fit-content;
}
.ha-typing span {
  width: 6px; height: 6px;
  background: #4EC0C4;
  border-radius: 50%;
  display: block;
  animation: haBounce 1.3s ease-in-out infinite;
}
.ha-typing span:nth-child(2) { animation-delay: 0.18s; }
.ha-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes haBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-7px); opacity: 1; }
}

/* ── Quick Actions ── */
.ha-quick-actions {
  padding: 6px 14px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #0a1020;
}
.ha-quick-actions[hidden] { display: none; }

.ha-chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(78,192,196,0.2);
  color: rgba(255,255,255,0.75);
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.01em;
}
.ha-chip:hover {
  background: rgba(78,192,196,0.12);
  border-color: rgba(78,192,196,0.5);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(78,192,196,0.15);
}
.ha-chip:active { transform: translateY(0); }

/* ── Input Area ── */
.ha-input-area {
  padding: 12px 14px 14px;
  background: #0e1830;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  gap: 9px;
  align-items: flex-end;
  flex-shrink: 0;
}

.ha-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: #d4dce8;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 96px;
  overflow-y: auto;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.ha-input:focus {
  border-color: rgba(78,192,196,0.5);
  background: rgba(78,192,196,0.04);
  box-shadow: 0 0 0 3px rgba(78,192,196,0.08);
}
.ha-input::placeholder { color: rgba(255,255,255,0.25); }

.ha-send {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4EC0C4 0%, #2a9da0 100%);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
  box-shadow: 0 4px 16px rgba(78,192,196,0.4);
}
.ha-send:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(78,192,196,0.55);
}
.ha-send:active { transform: scale(0.95); }
.ha-send:disabled { opacity: 0.35; cursor: default; transform: none; box-shadow: none; }
.ha-send svg { width: 17px; height: 17px; fill: #fff; }

/* ── Streaming cursor ── */
.ha-cursor {
  display: inline-block;
  width: 2px; height: 13px;
  background: #4EC0C4;
  margin-left: 2px;
  vertical-align: middle;
  border-radius: 1px;
  animation: haBlink 0.75s ease-in-out infinite;
}
@keyframes haBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Summary bar ── */
.ha-summary-bar {
  padding: 8px 14px;
  background: rgba(78,192,196,0.06);
  border-top: 1px solid rgba(78,192,196,0.12);
  flex-shrink: 0;
}
.ha-summary-btn {
  width: 100%;
  background: rgba(78,192,196,0.1);
  border: 1px solid rgba(78,192,196,0.25);
  color: #4EC0C4;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.18s, border-color 0.18s;
}
.ha-summary-btn:hover {
  background: rgba(78,192,196,0.18);
  border-color: rgba(78,192,196,0.5);
}

/* ── Footer branding ── */
.ha-branding {
  text-align: center;
  padding: 7px 0 9px;
  font-size: 10.5px;
  color: rgba(255,255,255,0.2);
  background: #0e1830;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.ha-branding a { color: rgba(78,192,196,0.7); text-decoration: none; font-weight: 600; }
.ha-branding a:hover { color: #4EC0C4; }

/* ── Mobile ── */
@media (max-width: 480px) {
  .ha-panel {
    bottom: 0; right: 0; left: 0;
    width: 100%;
    max-height: 88vh;
    border-radius: 24px 24px 0 0;
    transform-origin: bottom center;
    border-left: none; border-right: none; border-bottom: none;
  }
  .ha-trigger {
    bottom: 20px; right: 16px;
  }
}
@media (max-width: 360px) {
  .ha-trigger-info { display: none; }
  .ha-trigger { padding: 12px; border-radius: 50%; }
}
