/**
 * PEPTIQ — Your PEPTYZ Research Assistant
 * Premium Luxury Dark Emerald & Clean Clinical White Styles
 */

:root {
  --peptiq-forest: #022B1E;
  --peptiq-forest-light: #03402C;
  --peptiq-emerald: #10B981;
  --peptiq-mint: #34D399;
  --peptiq-dark: #10251D;
  --peptiq-gray-bg: #F8FAF9;
  --peptiq-border: #E2E8F0;
  --peptiq-text-muted: #64748B;
  --peptiq-radius: 20px;
}

/* ========================================================
   1. FLOATING LAUNCHER BUTTON
   ======================================================== */
.peptiq-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #022B1E 0%, #034832 100%);
  color: #FFFFFF;
  border: 2px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 10px 25px -5px rgba(2, 43, 30, 0.45), 0 0 0 1px rgba(2, 43, 30, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  outline: none;
}

.peptiq-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 30px -5px rgba(2, 43, 30, 0.55), 0 0 20px rgba(16, 185, 129, 0.3);
  border-color: #34D399;
}

.peptiq-launcher:active {
  transform: scale(0.96);
}

.peptiq-launcher-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.peptiq-launcher-close {
  display: none;
  width: 24px;
  height: 24px;
}

.peptiq-launcher.is-active .peptiq-launcher-icon {
  display: none;
}
.peptiq-launcher.is-active .peptiq-launcher-close {
  display: block;
}

/* Online Pulsing Indicator */
.peptiq-online-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10B981;
  border: 2.5px solid #022B1E;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
}

.peptiq-online-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid #34D399;
  animation: peptiqPulse 2s infinite;
}

@keyframes peptiqPulse {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ========================================================
   2. MAIN CHAT WINDOW CONTAINER
   ======================================================== */
.peptiq-window {
  position: fixed;
  bottom: 98px;
  right: 24px;
  width: 395px;
  max-width: calc(100vw - 32px);
  height: 590px;
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 24px 50px -10px rgba(2, 43, 30, 0.35), 0 0 0 1px rgba(2, 43, 30, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  touch-action: manipulation;
  box-sizing: border-box;
}

.peptiq-window *,
.peptiq-window *::before,
.peptiq-window *::after {
  box-sizing: border-box;
}

.peptiq-window.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ========================================================
   3. HEADER & NOTICE BANNER
   ======================================================== */
.peptiq-header {
  background: linear-gradient(135deg, #022B1E 0%, #033E2B 100%);
  padding: 12px 16px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.peptiq-header-brand-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.peptiq-brand-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.peptiq-official-logo {
  height: 16px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.peptiq-official-chip {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(52, 211, 153, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #6EE7B7;
  padding: 1px 6px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.peptiq-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.peptiq-header-logo {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.peptiq-header-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  line-height: 1.2;
  display: flex;
  align-items: center;
}

.peptiq-badge-pro {
  font-size: 8.5px;
  font-weight: 800;
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.05em;
}

.peptiq-online-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 6px #34D399;
  margin-right: 4px;
}

.peptiq-header-subtitle {
  font-size: 10.5px;
  color: #86EFAC;
  font-weight: 500;
  line-height: 1.2;
}

.peptiq-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.peptiq-hdr-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #FFFFFF;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 14px;
  line-height: 1;
}

.peptiq-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Compliance Notice Strip */
.peptiq-notice-bar {
  background: #FFFBEB;
  color: #92400E;
  font-size: 10.5px;
  font-weight: 700;
  padding: 6px 14px;
  text-align: center;
  border-bottom: 1px solid #FDE68A;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

/* ========================================================
   4. CHAT MESSAGES STREAM
   ======================================================== */
.peptiq-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: #F8FAF9;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.peptiq-body::-webkit-scrollbar {
  width: 5px;
}
.peptiq-body::-webkit-scrollbar-track {
  background: transparent;
}
.peptiq-body::-webkit-scrollbar-thumb {
  background: rgba(2, 43, 30, 0.15);
  border-radius: 10px;
}

/* Initial Welcome View (Empty State matching Screen 1) */
.peptiq-welcome-stage {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  animation: peptiqWelcomeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.peptiq-mascot-hero {
  width: 105px;
  height: 105px;
  margin-bottom: 16px;
  filter: drop-shadow(0 8px 16px rgba(2, 43, 30, 0.12));
}

.peptiq-welcome-title {
  font-size: 21px;
  font-weight: 800;
  color: #10251D;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.peptiq-welcome-subtitle {
  font-size: 13.5px;
  font-weight: 700;
  color: #023E2B;
  margin-bottom: 8px;
}

.peptiq-welcome-desc {
  font-size: 12px;
  line-height: 1.5;
  color: #64748B;
  max-width: 280px;
}

/* Quick Prompts Container */
.peptiq-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: 16px;
  max-width: 320px;
}

.peptiq-prompt-pill {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #0F172A;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  outline: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.peptiq-prompt-pill:hover {
  background: #022B1E;
  color: #FFFFFF;
  border-color: #022B1E;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(2, 43, 30, 0.2);
}

.peptiq-prompt-pill:active {
  transform: scale(0.96);
}

/* Quick In-Chat Order Reservation Card */
.peptiq-quick-order-card {
  background: #FFFFFF;
  border: 1.5px solid #10B981;
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.12);
  text-align: left;
}

.peptiq-quick-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 8px;
}

.peptiq-quick-order-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: #065F46;
}

.peptiq-order-badge {
  background: #D1FAE5;
  color: #047857;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.peptiq-order-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.peptiq-order-full {
  grid-column: span 2;
}

/* ========================================================
   5. MESSAGE BUBBLES
   ======================================================== */
.peptiq-msg-row {
  display: flex;
  gap: 9px;
  align-items: flex-end;
  animation: peptiqMsgIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.peptiq-msg-row.user {
  flex-direction: row-reverse;
}

.peptiq-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  padding: 2px;
}

.peptiq-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 12.5px;
  line-height: 1.48;
  word-break: break-word;
  position: relative;
}

.peptiq-msg-row.bot .peptiq-bubble {
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.peptiq-msg-row.user .peptiq-bubble {
  background: #022B1E;
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(2, 43, 30, 0.2);
}

.peptiq-time {
  font-size: 9.5px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.75;
}

.peptiq-msg-row.user .peptiq-time {
  justify-content: flex-end;
  color: #A7F3D0;
}
.peptiq-msg-row.bot .peptiq-time {
  color: #94A3B8;
}

/* ========================================================
   6. ANIMATED TYPING INDICATOR (Matching Screen 2)
   ======================================================== */
.peptiq-typing-bubble {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.peptiq-dot {
  width: 6.5px;
  height: 6.5px;
  background: #10B981;
  border-radius: 50%;
  animation: peptiqDotBounce 1.2s infinite ease-in-out;
}

.peptiq-dot:nth-child(2) {
  animation-delay: 0.18s;
}
.peptiq-dot:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes peptiqDotBounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ========================================================
   7. RICH PRODUCT CARD (Matching Screen 3)
   ======================================================== */
.peptiq-product-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 12px;
  margin-top: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  width: 100%;
}

.peptiq-prod-grid {
  display: flex;
  gap: 12px;
  align-items: center;
}

.peptiq-prod-img-box {
  width: 70px;
  height: 70px;
  background: #FAFAFA;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.peptiq-prod-img-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.peptiq-prod-meta {
  flex: 1;
  min-width: 0;
}

.peptiq-prod-name {
  font-size: 14px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.2;
}

.peptiq-prod-cat {
  font-size: 10.5px;
  color: #64748B;
  font-weight: 500;
  margin-bottom: 5px;
}

.peptiq-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.peptiq-badge-purity {
  font-size: 9.5px;
  font-weight: 700;
  color: #047857;
  border: 1px solid #A7F3D0;
  background: #ECFDF5;
  padding: 1px 6px;
  border-radius: 6px;
}

.peptiq-badge-stock {
  font-size: 9.5px;
  font-weight: 700;
  color: #065F46;
  background: #D1FAE5;
  padding: 1px 6px;
  border-radius: 6px;
}

.peptiq-strengths {
  font-size: 10px;
  color: #475569;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.peptiq-strength-pill {
  background: #F1F5F9;
  color: #334155;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9.5px;
}

.peptiq-price-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #F1F5F9;
}

.peptiq-price {
  font-size: 13.5px;
  font-weight: 800;
  color: #022B1E;
}

.peptiq-btn-view {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: #022B1E;
  color: #FFFFFF !important;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.peptiq-btn-view:hover {
  background: #03402C;
}

.peptiq-prod-footnote {
  font-size: 11px;
  color: #64748B;
  margin-top: 8px;
  line-height: 1.35;
}

/* ========================================================
   8. LEAVE A MESSAGE FORM CARD (Matching Screen 4)
   ======================================================== */
.peptiq-enquiry-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 14px;
  margin-top: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}

.peptiq-enquiry-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 10px;
}

.peptiq-form-group {
  margin-bottom: 8px;
}

.peptiq-input {
  width: 100%;
  min-width: 0;
  background: #F8FAF9;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #0F172A;
  font-family: inherit;
  box-sizing: border-box;
  touch-action: manipulation;
  color: #0F172A;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.peptiq-input:focus {
  border-color: #10B981;
  background: #FFFFFF;
}

.peptiq-textarea {
  min-height: 55px;
  resize: vertical;
}

.peptiq-btn-submit {
  width: 100%;
  background: #022B1E;
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.peptiq-btn-submit:hover {
  background: #03402C;
}

.peptiq-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ========================================================
   9. BOTTOM INPUT BAR
   ======================================================== */
.peptiq-footer {
  padding: 12px 14px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  flex-shrink: 0;
}

.peptiq-input-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F8FAF9;
  border: 1px solid #E2E8F0;
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: all 0.2s ease;
}

.peptiq-input-wrapper:focus-within {
  border-color: #10B981;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.peptiq-chat-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  line-height: 1.4;
  color: #0F172A;
  padding: 6px 0;
  font-family: inherit;
  touch-action: manipulation;
}

.peptiq-chat-input::placeholder {
  color: #94A3B8;
}

.peptiq-btn-paperclip {
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: color 0.2s ease;
}

.peptiq-btn-paperclip:hover {
  color: #022B1E;
}

.peptiq-btn-send {
  width: 32px;
  height: 32px;
  background: #022B1E;
  color: #FFFFFF;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.peptiq-btn-send:hover {
  background: #034832;
  transform: scale(1.06);
}

.peptiq-btn-send:disabled {
  background: #CBD5E1;
  cursor: not-allowed;
  transform: none;
}

/* ========================================================
   10. RESPONSIVE VIEWPORT, TOUCH & NO-ZOOM OPTIMIZATIONS
   ======================================================== */
/* Prevent iOS/Android mobile browsers from zooming in on input focus */
@media (max-width: 1024px), (pointer: coarse) {
  .peptiq-chat-input,
  .peptiq-input,
  .peptiq-textarea {
    font-size: 16px !important;
    line-height: 1.4 !important;
    touch-action: manipulation;
  }
}

/* Tablet & short landscape laptop viewports */
@media (max-width: 1024px) and (min-width: 641px) {
  .peptiq-window {
    right: 16px;
    bottom: 88px;
    width: min(390px, calc(100vw - 32px));
    max-height: calc(100dvh - 108px);
  }
}

@media (max-height: 660px) and (min-width: 641px) {
  .peptiq-window {
    bottom: 82px;
    height: calc(100dvh - 96px);
    max-height: calc(100dvh - 96px);
  }
  .peptiq-header {
    padding: 10px 14px;
  }
  .peptiq-body {
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .peptiq-launcher {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
    touch-action: manipulation;
  }

  .peptiq-window {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh;
    height: 100vh; /* Fallback */
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 999999 !important;
    transform: translateY(100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .peptiq-window.is-open {
    transform: translateY(0) !important;
  }

  .peptiq-header {
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-radius: 0;
  }

  .peptiq-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 12px;
  }

  .peptiq-footer {
    flex-shrink: 0;
    padding: 10px 12px max(12px, env(safe-area-inset-bottom)) !important;
    background: #FFFFFF;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    z-index: 10;
  }

  .peptiq-input-wrapper {
    padding: 6px 8px 6px 12px;
  }

  .peptiq-quick-prompts {
    max-width: 100%;
    padding: 0 2px;
  }

  .peptiq-prompt-pill {
    font-size: 11px;
    padding: 6px 10px;
  }
}

@media (max-width: 380px) {
  .peptiq-order-grid {
    grid-template-columns: 1fr;
  }
  .peptiq-msg-content {
    max-width: 90%;
  }
  .peptiq-bubble {
    padding: 9px 12px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .peptiq-window,
  .peptiq-msg-row,
  .peptiq-dot,
  .peptiq-launcher {
    animation: none !important;
    transition: none !important;
  }
}

