/* Pynky Floating Chat Widget Styles */

:root {
  --pynky-primary: #363062;
  --pynky-accent: #a29bfe;
  --pynky-bg: rgba(22, 19, 44, 0.85);
  --pynky-border: rgba(255, 255, 255, 0.08);
  --pynky-text: #ffffff;
  --pynky-text-secondary: rgba(255, 255, 255, 0.7);
  --pynky-msg-user: linear-gradient(135deg, #6c5ce7, #a29bfe);
  --pynky-msg-bot: rgba(255, 255, 255, 0.06);
}

.light-theme :root {
  --pynky-primary: #f0f0f5;
  --pynky-accent: #6c5ce7;
  --pynky-bg: rgba(255, 255, 255, 0.9);
  --pynky-border: rgba(0, 0, 0, 0.08);
  --pynky-text: #1e1e2f;
  --pynky-text-secondary: rgba(0, 0, 0, 0.6);
  --pynky-msg-user: linear-gradient(135deg, #6c5ce7, #855ade);
  --pynky-msg-bot: rgba(0, 0, 0, 0.05);
}

/* Floating Action Button (FAB) */
.pynky-fab {
  position: fixed;
  bottom: 85px; /* Offset to clear the bottom mobile nav */
  right: 25px;
  width: 70px;
  height: 70px;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: pynky-bob 3s ease-in-out infinite;
}

@media (min-width: 992px) {
  .pynky-fab {
    bottom: 30px;
    width: 80px;
    height: 80px;
  }
}

.pynky-fab:hover {
  transform: scale(1.12);
  animation-play-state: paused; /* Pause bobbing on hover for clean UX */
}

.pynky-fab img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25)) drop-shadow(0 0 8px rgba(108, 92, 231, 0.25));
  transition: transform 0.2s;
}

.pynky-fab:active img {
  transform: scale(0.9);
}

@keyframes pynky-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Notification badge on FAB */
.pynky-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #ff7675;
  border-radius: 50%;
  border: 2px solid white;
  animation: pulse 2s infinite;
}

/* Chat Drawer Container */
.pynky-container {
  position: fixed;
  bottom: 160px;
  right: 25px;
  width: 380px;
  height: 550px;
  max-height: calc(100vh - 200px);
  border-radius: 20px;
  background: var(--pynky-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--pynky-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(40px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.pynky-container.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 576px) {
  .pynky-container {
    width: calc(100vw - 30px);
    right: 15px;
    bottom: 160px;
    height: 480px;
  }
}

/* Chat Header */
.pynky-header {
  padding: 15px 20px;
  background: rgba(108, 92, 231, 0.15);
  border-bottom: 1px solid var(--pynky-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pynky-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pynky-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--pynky-accent);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pynky-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pynky-header-info h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pynky-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pynky-status-dot {
  width: 8px;
  height: 8px;
  background: #2ecc71;
  border-radius: 50%;
  display: inline-block;
}

.pynky-header-info p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--pynky-text-secondary);
}

.pynky-header-actions {
  display: flex;
  gap: 10px;
}

.pynky-btn-action {
  background: transparent;
  border: none;
  color: var(--pynky-text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 5px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pynky-btn-action:hover {
  color: var(--pynky-accent);
}

/* Chat Messages */
.pynky-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scroll-behavior: smooth;
}

.pynky-msg-row {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

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

.pynky-msg-row.bot {
  align-self: flex-start;
}

.pynky-msg-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pynky-msg-avatar img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.pynky-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--pynky-text);
  word-break: break-word;
}

.pynky-msg-row.user .pynky-bubble {
  background: var(--pynky-msg-user);
  border-bottom-right-radius: 4px;
}

.pynky-msg-row.bot .pynky-bubble {
  background: var(--pynky-msg-bot);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--pynky-border);
}

.pynky-bubble p {
  margin-bottom: 8px;
}

.pynky-bubble p:last-child {
  margin-bottom: 0;
}

.pynky-bubble ul {
  margin: 8px 0 8px 15px;
  padding: 0;
}

.pynky-bubble li {
  margin-bottom: 6px;
}

.pynky-bubble a {
  color: var(--pynky-accent);
  text-decoration: underline;
  font-weight: 600;
  transition: opacity 0.2s;
}

.pynky-bubble a:hover {
  opacity: 0.8;
}

/* Divider inside messages */
.pynky-bubble hr {
  margin: 10px 0;
  border: 0;
  border-top: 1px solid var(--pynky-border);
}

/* Typing Indicator */
.pynky-typing-dots {
  display: flex;
  gap: 4px;
  padding: 5px 0;
}

.pynky-typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--pynky-text-secondary);
  border-radius: 50%;
  animation: typing 1.4s infinite both;
}

.pynky-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.pynky-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Quick Action Pills */
.pynky-quick-actions {
  display: flex;
  gap: 8px;
  padding: 0 20px 10px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.pynky-quick-actions::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.pynky-pill {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--pynky-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--pynky-text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pynky-pill:hover {
  border-color: var(--pynky-accent);
  background: rgba(108, 92, 231, 0.1);
  color: var(--pynky-text);
}

/* Chat Input Footer */
.pynky-input-area {
  padding: 15px 20px;
  border-top: 1px solid var(--pynky-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pynky-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--pynky-border);
  border-radius: 12px;
  padding: 10px 15px;
  color: var(--pynky-text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.light-theme .pynky-input {
  background: rgba(0, 0, 0, 0.03);
}

.pynky-input:focus {
  border-color: var(--pynky-accent);
}

.pynky-btn-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--pynky-msg-user);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.pynky-btn-send:hover {
  transform: scale(1.05);
}

.pynky-btn-send:active {
  transform: scale(0.95);
}

/* Greeting Popups */
.pynky-greeting-bubble {
  position: fixed;
  bottom: 110px;
  right: 25px;
  width: 280px;
  padding: 15px 20px;
  border-radius: 18px;
  background: var(--pynky-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--pynky-border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  z-index: 999;
  display: flex;
  gap: 12px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  pointer-events: none;
}

.pynky-greeting-bubble.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pynky-greeting-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--pynky-text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
}

.pynky-greeting-content p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--pynky-text);
  line-height: 1.4;
}

/* Keyframe Animations */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 118, 117, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(255, 118, 117, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 118, 117, 0); }
}

@keyframes typing {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Pynky Search Card Integration Styles */
.pynky-search-results {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--pynky-border);
  padding-top: 10px;
  width: 100%;
}

.pynky-search-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--pynky-accent);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pynky-search-card {
  display: block;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--pynky-border);
  border-radius: 10px;
  padding: 8px 10px;
  text-decoration: none !important;
  color: var(--pynky-text) !important;
  transition: all 0.2s ease-in-out;
}

.light-theme .pynky-search-card {
  background: rgba(0, 0, 0, 0.02);
}

.pynky-search-card:hover {
  background: rgba(108, 92, 231, 0.12);
  border-color: var(--pynky-accent);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 10px rgba(108, 92, 231, 0.15);
}

.pynky-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.pynky-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pynky-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pynky-card-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--pynky-primary);
  color: var(--pynky-text-secondary);
  border: 1px solid var(--pynky-border);
  white-space: nowrap;
}

.light-theme .pynky-card-badge {
  background: var(--pynky-accent);
  color: white;
}

.pynky-card-preview {
  font-size: 0.72rem;
  color: var(--pynky-text-secondary);
  margin: 0;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
