/* ── LISA CAT Chat Widget ── Deep Purple #26215C / Coral #F0997B ── */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --cat-purple:     #26215C;
  --cat-purple-mid: #3a3478;
  --cat-purple-light: #f0eeff;
  --cat-coral:      #F0997B;
  --cat-coral-dark: #d97a5a;
  --cat-white:      #ffffff;
  --cat-grey:       #f5f4fa;
  --cat-text:       #1a1730;
  --cat-muted:      #8b87a8;
  --cat-radius:     18px;
  --cat-shadow:     0 8px 40px rgba(38,33,92,0.18), 0 2px 8px rgba(38,33,92,0.10);
}

/* ── Toggle Button ── */
#lisa-cat-toggle {
  position: fixed;
  bottom: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--cat-toggle, #c4623d);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: 'DM Sans', sans-serif;
}
#lisa-cat-toggle.position-right { right: 28px; }
#lisa-cat-toggle.position-left  { left: 28px; }

#lisa-cat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(38,33,92,0.45);
}

#lisa-cat-toggle svg {
  width: 28px;
  height: 28px;
  transition: opacity 0.2s;
}
#lisa-cat-toggle .icon-chat { opacity: 1; }
#lisa-cat-toggle .icon-close { opacity: 0; position: absolute; }
#lisa-cat-toggle.is-open .icon-chat  { opacity: 0; }
#lisa-cat-toggle.is-open .icon-close { opacity: 1; }

/* ── Chat Window ── */
#lisa-cat-window {
  position: fixed;
  bottom: 104px;
  width: 370px;
  height: 540px;
  background: var(--cat-white);
  border-radius: var(--cat-radius);
  box-shadow: var(--cat-shadow);
  display: flex;
  flex-direction: column;
  z-index: 99997;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  font-family: 'DM Sans', sans-serif;
}
#lisa-cat-window.position-right { right: 28px; }
#lisa-cat-window.position-left  { left: 28px; }

#lisa-cat-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ── */
#lisa-cat-header {
  background: linear-gradient(135deg, var(--cat-header, #1a5c6e) 0%, var(--cat-header, #1a5c6e) 100%);
  padding: 18px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.cat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--cat-avatar-bg, #F0997B);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.cat-header-info { flex: 1; }

.cat-header-name {
  font-family: 'DM Serif Display', serif;
  font-size: 17px;
  color: var(--cat-white);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.cat-header-status {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5ddf8a;
  box-shadow: 0 0 0 2px rgba(93,223,138,0.3);
  animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(93,223,138,0.3); }
  50%       { box-shadow: 0 0 0 5px rgba(93,223,138,0.1); }
}

/* ── Messages ── */
#lisa-cat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--cat-grey);
  scroll-behavior: smooth;
}

#lisa-cat-messages::-webkit-scrollbar { width: 4px; }
#lisa-cat-messages::-webkit-scrollbar-track { background: transparent; }
#lisa-cat-messages::-webkit-scrollbar-thumb { background: var(--cat-muted); border-radius: 4px; }

.cat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  animation: msg-in 0.22s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cat-msg.cat-msg--bot {
  background: var(--cat-white);
  color: var(--cat-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(38,33,92,0.08);
  align-self: flex-start;
}

.cat-msg.cat-msg--user {
  background: var(--cat-user-msg, #1a5c6e);
  color: var(--cat-white);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ── Typing indicator ── */
.cat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
  background: var(--cat-white);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(38,33,92,0.08);
}

.cat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat-muted);
  animation: typing-bounce 1.2s ease infinite;
}
.cat-typing span:nth-child(2) { animation-delay: 0.2s; }
.cat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Input Area ── */
#lisa-cat-input-area {
  padding: 14px 16px;
  background: var(--cat-white);
  border-top: 1px solid rgba(38,33,92,0.08);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}

#lisa-cat-input {
  flex: 1;
  border: 1.5px solid rgba(38,33,92,0.15);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--cat-text);
  resize: none;
  outline: none;
  min-height: 42px;
  max-height: 100px;
  line-height: 1.45;
  background: var(--cat-grey);
  transition: border-color 0.2s;
}

#lisa-cat-input:focus {
  border-color: var(--cat-accent, #d97a5a);
  background: var(--cat-white);
}

#lisa-cat-input::placeholder { color: var(--cat-muted); }

#lisa-cat-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--cat-send, #c4623d);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(240,153,123,0.4);
}

#lisa-cat-send:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(240,153,123,0.5);
}

#lisa-cat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#lisa-cat-send svg {
  width: 18px;
  height: 18px;
  color: white;
}

/* ── Powered by ── */
.cat-powered {
  text-align: center;
  font-size: 10px;
  color: #666;
  padding: 6px 0 10px;
  background: var(--cat-white);
  letter-spacing: 0.03em;
}

.cat-powered a {
  color: var(--cat-accent, #d97a5a);
  text-decoration: none;
  font-weight: 500;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  #lisa-cat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 120px);
    right: 10px !important;
    left: 10px !important;
    bottom: 90px;
  }
}
