/* Penny AI Chat Widget */

/* Chat button */
.penny-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #4485e7;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(68,133,231,0.35);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.penny-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(68,133,231,0.45);
}
.penny-btn svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}
.penny-btn--close svg {
  width: 20px;
  height: 20px;
}

/* Chat window */
.penny-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: "Century Gothic", "WorkSans", Arial, sans-serif;
}
.penny-window--open {
  display: flex;
  animation: pennySlideUp 0.25s ease-out;
}
@keyframes pennySlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.penny-header {
  background: #4485e7;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.penny-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.penny-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}
.penny-header-text h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.penny-header-text p {
  margin: 0;
  font-size: 11px;
  opacity: 0.8;
}
/* Header action buttons (new chat + close) */
.penny-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.penny-close, .penny-new-chat {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: 0.8;
}
.penny-close:hover, .penny-new-chat:hover {
  opacity: 1;
}
.penny-close svg, .penny-new-chat svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* New chat confirmation overlay */
.penny-confirm-overlay {
  background: rgba(255,255,255,0.97);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin: 8px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.penny-confirm-overlay p {
  margin: 0 0 14px;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}
.penny-confirm-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.penny-confirm-btn {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: opacity 0.15s;
}
.penny-confirm-btn--yes {
  background: #1B5E3B;
  color: #fff;
  border-color: #1B5E3B;
}
.penny-confirm-btn--yes:hover {
  opacity: 0.9;
}
.penny-confirm-btn--cancel {
  background: #fff;
  color: #666;
  border-color: #ccc;
}
.penny-confirm-btn--cancel:hover {
  background: #f5f5f5;
}

/* Messages area */
.penny-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f2f7ff;
}

/* Message bubbles */
.penny-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.penny-msg--assistant {
  align-self: flex-start;
  background: #fff;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.penny-msg--user {
  align-self: flex-end;
  background: #4485e7;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.penny-typing {
  align-self: flex-start;
  display: none;
  padding: 12px 18px;
  background: #fff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.penny-typing--visible {
  display: flex;
  gap: 4px;
  align-items: center;
}
.penny-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #999;
  animation: pennyBounce 1.4s infinite ease-in-out;
}
.penny-typing-dot:nth-child(1) { animation-delay: 0s; }
.penny-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.penny-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pennyBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);    opacity: 1; }
}

/* Quick reply buttons */
.penny-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: #f2f7ff;
}
.penny-quick-btn {
  padding: 8px 14px;
  border: 1.5px solid #4485e7;
  border-radius: 20px;
  background: #fff;
  color: #4485e7;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.penny-quick-btn:hover {
  background: #4485e7;
  color: #fff;
}

/* Input area */
.penny-input-area {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #dee2e6;
  background: #fff;
  flex-shrink: 0;
  gap: 8px;
  position: relative;
}
.penny-input {
  flex: 1;
  border: 1.5px solid #dee2e6;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.3;
}
.penny-input:focus {
  border-color: #4485e7;
}
.penny-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #4485e7;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.penny-send:disabled {
  opacity: 0.4;
  cursor: default;
}
.penny-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Mobile: full screen */
@media (max-width: 480px) {
  .penny-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .penny-btn {
    bottom: 16px;
    right: 16px;
  }
}

/* Scrollbar styling */
.penny-messages::-webkit-scrollbar { width: 5px; }
.penny-messages::-webkit-scrollbar-track { background: transparent; }
.penny-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Character counter */
.penny-char-count {
  position: absolute;
  top: -20px;
  right: 0;
  font-size: 10px;
  color: #6c757d;
  display: none;
}

/* Streaming message animation */
.penny-msg--streaming .penny-msg-content::after {
  content: '▊';
  animation: pennyBlink 1s infinite;
  margin-left: 2px;
}
@keyframes pennyBlink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Powered by line */
.penny-powered {
  text-align: center;
  font-size: 10px;
  color: #aaa;
  padding: 4px 0;
  background: #fff;
}

/* Quote flow buttons - modern pill-shaped design */
.penny-quote-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.penny-quote-btn {
  display: inline-block;
  padding: 10px 18px;
  background: #fff;
  border: 1.5px solid #4485e7;
  border-radius: 20px;
  color: #4485e7;
  font-size: 13px;
  font-family: inherit;
  font-weight: normal;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.penny-quote-btn:hover:not(:disabled) {
  background: #4485e7;
  color: #fff;
}
.penny-quote-btn--selected {
  background: #4485e7;
  color: #fff;
}
.penny-quote-btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}