/**
 * Pottok Chatbot Widget Styles - Astro v2 Design
 * Matching pottok.club design system (Tailwind v4)
 */

/* Container */
#pottok-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font-sans, "Rethink Sans", system-ui, sans-serif);
}

/* Chat Bubble */
.pottok-chat-bubble {
  width: 64px;
  height: 64px;
  background: oklch(0.48 0.20 10);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 24px oklch(0.35 0.08 350 / 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  animation: gentlePulse 3s ease-in-out infinite, bounceIn 0.6s ease-out;
}

.pottok-chat-bubble:hover {
  transform: scale(1.05);
  box-shadow: 0 16px 32px oklch(0.35 0.08 350 / 0.25);
  animation: none;
  background: oklch(0.42 0.22 10);
}

.pottok-chat-bubble svg {
  width: 32px;
  height: 32px;
}

.pottok-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: oklch(0.92 0.04 350);
  color: oklch(0.48 0.20 10);
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px oklch(0.35 0.08 350 / 0.08);
  animation: badgeBounce 2s ease-in-out 1s infinite;
}

/* Animations */
@keyframes gentlePulse {
  0%, 100% {
    box-shadow: 0 12px 24px oklch(0.35 0.08 350 / 0.15);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 16px 28px oklch(0.35 0.08 350 / 0.22);
    transform: scale(1.02);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(20px);
  }
  50% {
    transform: scale(1.05) translateY(-5px);
  }
  70% {
    transform: scale(0.95) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

/* Chat Window */
.pottok-chat-window {
  width: 400px;
  height: 620px;
  background: oklch(1.0 0 0);
  border-radius: 24px;
  box-shadow: 0 12px 24px oklch(0.35 0.08 350 / 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid oklch(0.90 0.01 30);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header */
.pottok-chat-header {
  background: oklch(0.48 0.20 10);
  color: oklch(1.0 0 0);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pottok-chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pottok-chat-avatar {
  width: 44px;
  height: 44px;
  background: oklch(0.97 0.015 350);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.pottok-chat-title {
  font-family: var(--font-heading, "Bricolage Grotesque", system-ui, sans-serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.pottok-chat-status {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.9;
}

.pottok-chat-close {
  background: none;
  border: none;
  color: oklch(1.0 0 0);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  transition: background 0.2s;
  font-weight: 300;
}

.pottok-chat-close:hover {
  background: oklch(0.42 0.22 10);
}

/* Messages Container */
.pottok-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: oklch(0.97 0.015 350);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pottok-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.pottok-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.pottok-chat-messages::-webkit-scrollbar-thumb {
  background: oklch(0.90 0.01 30);
  border-radius: 3px;
}

.pottok-chat-messages::-webkit-scrollbar-thumb:hover {
  background: oklch(0.85 0.01 30);
}

/* Message */
.pottok-message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: messageIn 0.3s ease-out;
}

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

.pottok-message-bot {
  align-self: flex-start;
}

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

.pottok-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: oklch(1.0 0 0);
  box-shadow: 0 4px 12px oklch(0.35 0.08 350 / 0.08);
}

.pottok-message-user .pottok-message-avatar {
  background: oklch(0.48 0.20 10);
}

.pottok-message-content {
  background: oklch(1.0 0 0);
  padding: 12px 16px;
  border-radius: 24px;
  line-height: 1.6;
  font-size: 15px;
  color: oklch(0.45 0.01 30);
  box-shadow: 0 4px 12px oklch(0.35 0.08 350 / 0.08);
  font-weight: 400;
}

.pottok-message-user .pottok-message-content {
  background: oklch(0.48 0.20 10);
  color: oklch(1.0 0 0);
  font-weight: 500;
}

.pottok-message-content a {
  color: oklch(0.48 0.20 10);
  text-decoration: underline;
  font-weight: 600;
  transition: opacity 0.2s;
}

.pottok-message-user .pottok-message-content a {
  color: oklch(1.0 0 0);
}

.pottok-message-content a:hover {
  opacity: 0.7;
}

/* Typing Indicator */
.pottok-typing-indicator {
  display: flex;
  gap: 5px;
  padding: 6px 0;
}

.pottok-typing-indicator span {
  width: 8px;
  height: 8px;
  background: oklch(0.48 0.20 10);
  border-radius: 9999px;
  animation: typing 1.4s infinite;
}

.pottok-typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.pottok-typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* Input Container */
.pottok-chat-input-container {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  background: oklch(1.0 0 0);
  border-top: 1px solid oklch(0.90 0.01 30);
}

.pottok-chat-input {
  flex: 1;
  border: 1px solid oklch(0.90 0.01 30);
  border-radius: 9999px;
  padding: 12px 18px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
  color: oklch(0.45 0.01 30);
  background: oklch(1.0 0 0);
}

.pottok-chat-input::placeholder {
  color: oklch(0.55 0.01 30);
}

.pottok-chat-input:focus {
  border-color: oklch(0.48 0.20 10);
  box-shadow: 0 0 0 3px oklch(0.48 0.20 10 / 0.1);
}

.pottok-chat-input:disabled {
  background: oklch(0.97 0.015 350);
  cursor: not-allowed;
  opacity: 0.6;
}

.pottok-chat-send {
  width: 44px;
  height: 44px;
  background: oklch(0.48 0.20 10);
  border: none;
  border-radius: 9999px;
  color: oklch(1.0 0 0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.pottok-chat-send:hover:not(:disabled) {
  transform: scale(1.05);
  background: oklch(0.42 0.22 10);
  box-shadow: 0 4px 12px oklch(0.35 0.08 350 / 0.15);
}

.pottok-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
  #pottok-chatbot {
    bottom: 16px;
    right: 16px;
  }

  .pottok-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 32px);
    max-width: 400px;
    max-height: 620px;
  }

  .pottok-chat-bubble {
    width: 60px;
    height: 60px;
  }

  .pottok-chat-bubble svg {
    width: 28px;
    height: 28px;
  }

  .pottok-chat-messages {
    padding: 16px;
  }

  .pottok-chat-input-container {
    padding: 12px 16px;
  }
}
