/* ═══════════════════════════════════════════════════════════════════════════
   Petstore Kenya Chat Widget – Frontend Styles
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── CSS Variables ──────────────────────────────────────────────────────── */

:root {
  --petstore-primary: #e94560;
  --petstore-primary-dark: #c73a52;
  --petstore-bg-dark: #1a1a2e;
  --petstore-bg-darker: #16213e;
  --petstore-bg-card: #0f3460;
  --petstore-text-primary: #ffffff;
  --petstore-text-secondary: #a0aec0;
  --petstore-text-muted: #718096;
  --petstore-border: rgba(255, 255, 255, 0.08);
  --petstore-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  --petstore-radius: 16px;
  --petstore-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Chat Bubble (FAB) ─────────────────────────────────────────────────── */

#petstore-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--petstore-primary) 0%, #ff6b6b 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(233, 69, 96, 0.4);
  z-index: 99999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: petstore-pulse 2s infinite;
}

#petstore-chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(233, 69, 96, 0.6);
}

#petstore-chat-bubble svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  transition: transform 0.3s ease;
}

#petstore-chat-bubble.open svg {
  transform: rotate(90deg);
}

@keyframes petstore-pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(233, 69, 96, 0.4); }
  50% { box-shadow: 0 8px 32px rgba(233, 69, 96, 0.7); }
}

/* ─── Notification Badge ─────────────────────────────────────────────────── */

#petstore-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid #ffffff;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: petstore-badge-bounce 0.5s ease;
}

@keyframes petstore-badge-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* ─── Chat Window ────────────────────────────────────────────────────────── */

#petstore-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-height: 560px;
  background: var(--petstore-bg-dark);
  border-radius: var(--petstore-radius);
  box-shadow: var(--petstore-shadow);
  z-index: 99998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--petstore-font);
  border: 1px solid var(--petstore-border);
  animation: petstore-slide-up 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#petstore-chat-window.visible {
  display: flex;
}

@keyframes petstore-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Chat Header ────────────────────────────────────────────────────────── */

.petstore-chat-header {
  background: linear-gradient(135deg, var(--petstore-bg-darker) 0%, var(--petstore-bg-card) 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--petstore-border);
}

.petstore-chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--petstore-primary) 0%, #ff6b6b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.petstore-chat-header-info {
  flex: 1;
}

.petstore-chat-header-info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--petstore-text-primary);
}

.petstore-chat-header-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
}

.petstore-chat-header-info p::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.petstore-chat-close {
  background: none;
  border: none;
  color: var(--petstore-text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.petstore-chat-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--petstore-text-primary);
}

.petstore-chat-close svg {
  width: 18px;
  height: 18px;
}

/* ─── Chat Body ──────────────────────────────────────────────────────────── */

.petstore-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 300px;
  max-height: 360px;
  scroll-behavior: smooth;
}

.petstore-chat-body::-webkit-scrollbar {
  width: 4px;
}

.petstore-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.petstore-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* ─── Welcome Message ────────────────────────────────────────────────────── */

.petstore-welcome {
  text-align: center;
  padding: 20px 0;
}

.petstore-welcome-emoji {
  font-size: 48px;
  margin-bottom: 12px;
  animation: petstore-wave 1.5s ease-in-out infinite;
}

@keyframes petstore-wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-15deg); }
}

.petstore-welcome h4 {
  color: var(--petstore-text-primary);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
}

.petstore-welcome p {
  color: var(--petstore-text-secondary);
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}

/* ─── Lead Form ──────────────────────────────────────────────────────────── */

.petstore-lead-form {
  padding: 8px 0;
}

.petstore-form-group {
  margin-bottom: 14px;
}

.petstore-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--petstore-text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.petstore-form-group input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--petstore-border);
  border-radius: 10px;
  color: #ffffff !important;
  font-family: var(--petstore-font);
  font-size: 14px;
  transition: all 0.2s;
  box-sizing: border-box;
}

.petstore-form-group input:focus {
  outline: none;
  border-color: var(--petstore-primary);
  background: rgba(233, 69, 96, 0.06);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

.petstore-form-group input::placeholder {
  color: var(--petstore-text-muted);
}

.petstore-submit-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--petstore-primary) 0%, #ff6b6b 100%);
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-family: var(--petstore-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 4px;
}

.petstore-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(233, 69, 96, 0.4);
}

.petstore-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ─── Messages ───────────────────────────────────────────────────────────── */

.petstore-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.petstore-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: petstore-message-in 0.3s ease;
}

@keyframes petstore-message-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.petstore-message.visitor {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--petstore-primary) 0%, #ff6b6b 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.petstore-message.agent {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: var(--petstore-text-primary);
  border-bottom-left-radius: 4px;
}

.petstore-message.system {
  align-self: center;
  background: transparent;
  color: var(--petstore-text-muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  max-width: 100%;
}

.petstore-message-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  display: block;
}

.petstore-message.agent .petstore-message-time {
  color: var(--petstore-text-muted);
}

/* ─── Typing Indicator ──────────────────────────────────────────────────── */

.petstore-typing {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  align-items: center;
}

.petstore-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--petstore-text-muted);
  animation: petstore-typing-bounce 1.4s infinite ease-in-out;
}

.petstore-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.petstore-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes petstore-typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ─── Chat Footer (Input) ───────────────────────────────────────────────── */

.petstore-chat-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--petstore-border);
  background: rgba(0, 0, 0, 0.2);
}

.petstore-chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--petstore-border);
  transition: all 0.2s;
}

.petstore-chat-input-wrap:focus-within {
  border-color: var(--petstore-primary);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.petstore-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #ffffff !important;
  font-family: var(--petstore-font);
  font-size: 13px;
  padding: 8px 0;
  outline: none;
}

.petstore-chat-input::placeholder {
  color: var(--petstore-text-muted);
}

.petstore-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--petstore-primary) 0%, #ff6b6b 100%);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.petstore-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
}

.petstore-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.petstore-send-btn svg {
  width: 16px;
  height: 16px;
  fill: #ffffff;
}

/* ─── End Chat Button ────────────────────────────────────────────────────── */

.petstore-chat-end-btn {
  background: rgba(233, 69, 96, 0.15);
  border: 1px solid rgba(233, 69, 96, 0.3);
  color: #ff6b6b;
  cursor: pointer;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: none;
}

.petstore-chat-end-btn:hover {
  background: rgba(233, 69, 96, 0.3);
  border-color: #ff6b6b;
  color: #ffffff;
}

/* ─── Powered By ─────────────────────────────────────────────────────────── */

.petstore-powered-by {
  text-align: center;
  padding: 8px;
  font-size: 10px;
  color: var(--petstore-text-muted);
}

.petstore-powered-by a {
  color: var(--petstore-primary);
  text-decoration: none;
}


/* ─── Confirmation Overlay ──────────────────────────────────────────────── */

.petstore-confirm-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 46, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 24px;
  text-align: center;
  box-sizing: border-box;
}

.petstore-confirm-overlay p {
  color: var(--petstore-text-primary);
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 18px;
  line-height: 1.4;
}

.petstore-confirm-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 240px;
}

.petstore-confirm-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--petstore-font);
  transition: all 0.2s;
}

.petstore-confirm-btn.yes {
  background: var(--petstore-primary);
  color: #ffffff;
}

.petstore-confirm-btn.yes:hover {
  background: var(--petstore-primary-dark);
}

.petstore-confirm-btn.no {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--petstore-border);
  color: var(--petstore-text-secondary);
}

.petstore-confirm-btn.no:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--petstore-text-primary);
}


/* ─── Ended Banner ──────────────────────────────────────────────────────── */

.petstore-ended-banner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  background: linear-gradient(180deg, rgba(22, 33, 62, 0.8) 0%, var(--petstore-bg-darker) 100%);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--petstore-border);
  box-sizing: border-box;
  text-align: center;
  animation: petstore-fade-in 0.3s ease;
}

@keyframes petstore-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.petstore-ended-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.petstore-ended-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--petstore-text-secondary);
}

.petstore-ended-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--petstore-text-primary);
  margin: 0;
}

.petstore-ended-msg {
  font-size: 13px;
  color: var(--petstore-text-secondary);
  line-height: 1.5;
  margin: 0 0 4px 0;
  max-width: 280px;
}

.petstore-ended-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--petstore-primary) 0%, #ff6b6b 100%);
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-family: var(--petstore-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.petstore-ended-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.4);
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */


@media (max-width: 480px) {
  #petstore-chat-window {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  #petstore-chat-bubble {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
}
