/* =========================================
   NUTBOT — AI Health Advisor Widget Styles
   ========================================= */

/* ---- Launcher Button ---- */
.nutbot-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.nutbot-launch-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366 0%, #128c3b 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 6px 24px rgba(37,211,102,0.45);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  position: relative;
  padding: 0;
  overflow: hidden;
}

.nutbot-launch-btn img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  border-radius: 50%;
  display: block;
}
.nutbot-launch-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(37,211,102,0.55);
}
.nutbot-launch-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2.5px solid rgba(37,211,102,0.4);
  animation: nutbot-pulse 2.2s ease-out infinite;
}
@keyframes nutbot-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}

.nutbot-tooltip {
  background: #1a1a2e;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  letter-spacing: 0.3px;
  animation: nutbot-fadeup 0.4s ease;
}
.nutbot-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 22px;
  border: 6px solid transparent;
  border-top-color: #1a1a2e;
  border-bottom: none;
}

/* ---- Chat Window ---- */
.nutbot-window {
  position: fixed;
  bottom: 104px;
  right: 28px;
  width: 380px;
  max-height: 620px;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  z-index: 8999;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.34,1.3,0.64,1), opacity 0.25s ease;
}
.nutbot-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.nutbot-header {
  background: linear-gradient(135deg, #0a7a3c 0%, #25d366 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.nutbot-header-avatar {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2.5px solid rgba(255,255,255,0.8);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nutbot-header-avatar img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 50%;
}
.nutbot-header-info { flex: 1; }
.nutbot-header-name {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.2px;
}
.nutbot-header-status {
  color: rgba(255,255,255,0.85);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.nutbot-online-dot {
  width: 7px; height: 7px;
  background: #a6ffcb;
  border-radius: 50%;
  animation: nutbot-blink 1.8s ease-in-out infinite;
}
@keyframes nutbot-blink {
  0%,100% { opacity:1; } 50% { opacity:0.3; }
}
.nutbot-close-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.nutbot-close-btn:hover { background: rgba(255,255,255,0.35); }

/* Goal Strip */
.nutbot-goal-strip {
  background: linear-gradient(90deg, #e8f5e9, #f0fdf4);
  padding: 8px 14px;
  font-size: 0.72rem;
  color: #2e7d32;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #c8e6c9;
  flex-shrink: 0;
}
.nutbot-goal-strip.hidden { display: none; }

/* Messages */
.nutbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  /* Prevent flex from collapsing children */
  align-items: stretch;
}
/* Every direct child of the messages list must never compress */
.nutbot-messages > * {
  flex-shrink: 0;
}
.nutbot-messages::-webkit-scrollbar { width: 4px; }
.nutbot-messages::-webkit-scrollbar-track { background: #f5f5f5; }
.nutbot-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Bot message */
.nutbot-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: nutbot-msgIn 0.28s ease;
}
@keyframes nutbot-msgIn {
  from { opacity:0; transform: translateY(8px); }
  to   { opacity:1; transform: translateY(0); }
}
.nutbot-msg-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #25d366, #0a7a3c);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 2px;
}
.nutbot-msg-bubble {
  background: #f0fdf4;
  border: 1px solid #d1fae5;
  border-radius: 0 16px 16px 16px;
  padding: 10px 14px;
  font-size: 0.84rem;
  color: #1a1a1a;
  line-height: 1.5;
  max-width: 88%;
}
.nutbot-msg-bubble p { margin: 0 0 4px; }
.nutbot-msg-bubble p:last-child { margin: 0; }
.nutbot-msg-bubble b { color: #0a7a3c; }
.nutbot-msg-bubble ul { margin: 6px 0 0 16px; padding: 0; }
.nutbot-msg-bubble li { margin-bottom: 3px; font-size: 0.82rem; }

/* User message */
.nutbot-msg.user { flex-direction: row-reverse; }
.nutbot-msg.user .nutbot-msg-bubble {
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 16px 0 16px 16px;
}

/* Typing indicator */
.nutbot-typing .nutbot-msg-bubble {
  padding: 12px 18px;
  display: flex; gap: 5px; align-items: center;
}
.nutbot-typing-dot {
  width: 7px; height: 7px;
  background: #25d366;
  border-radius: 50%;
  animation: nutbot-bounce 1.1s infinite ease-in-out;
}
.nutbot-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.nutbot-typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes nutbot-bounce {
  0%,80%,100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Quick Replies */
.nutbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 0 2px 38px;
  animation: nutbot-msgIn 0.28s ease;
}
.nutbot-qr-btn {
  background: #fff;
  border: 1.5px solid #25d366;
  color: #0a7a3c;
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.nutbot-qr-btn:hover {
  background: #25d366;
  color: #fff;
}
.nutbot-qr-btn.selected {
  background: #25d366;
  color: #fff;
  pointer-events: none;
}

/* Preset Grid */
.nutbot-preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 4px 0 2px 38px;
  animation: nutbot-msgIn 0.28s ease;
}
.nutbot-preset-btn {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1a1a2e;
  line-height: 1.2;
}
.nutbot-preset-btn:hover {
  border-color: #25d366;
  background: #f0fdf4;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,211,102,0.15);
}
.nutbot-preset-icon { font-size: 1.2rem; flex-shrink: 0; }

/* Monthly Pack Card */
.nutbot-pack-card {
  margin: 4px 0 4px 38px;
  background: linear-gradient(135deg, #0a7a3c 0%, #1a9a50 100%);
  border-radius: 16px;
  padding: 14px 16px;
  color: #fff;
  animation: nutbot-msgIn 0.3s ease;
  position: relative;
  overflow: visible;
  flex-shrink: 0;
  display: block;
}
.nutbot-pack-card::before {
  content: '';
  position: absolute;
  top: -15px; right: -15px;
  width: 70px; height: 70px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
  pointer-events: none;
}
.nutbot-pack-badge {
  display: inline-flex;
  background: #ffd700;
  color: #1a1a2e;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nutbot-pack-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 4px;
  line-height: 1.2;
}
.nutbot-pack-desc {
  font-size: 0.75rem;
  opacity: 0.88;
  margin-bottom: 10px;
  line-height: 1.4;
}
.nutbot-pack-products {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}
.nutbot-pack-product-tag {
  background: rgba(255,255,255,0.18);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 10px;
  display: flex; align-items: center; gap: 3px;
}
.nutbot-pack-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.nutbot-pack-price {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.nutbot-pack-price-new {
  font-size: 1.1rem;
  font-weight: 800;
}
.nutbot-pack-price-old {
  font-size: 0.72rem;
  opacity: 0.7;
  text-decoration: line-through;
}
.nutbot-pack-add-btn {
  background: #fff;
  color: #0a7a3c;
  border: none;
  padding: 10px 18px;
  border-radius: 22px;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.nutbot-pack-add-btn:hover {
  background: #ffd700;
  color: #1a1a2e;
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.nutbot-pack-add-btn.added {
  background: #a6ffcb;
  color: #0a4a28;
  pointer-events: none;
}

/* AI answer box */
.nutbot-ai-answer {
  margin: 4px 0 4px 38px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-left: 4px solid #25d366;
  border-radius: 0 14px 14px 14px;
  padding: 14px 16px;
  animation: nutbot-msgIn 0.3s ease;
}
.nutbot-ai-answer-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: #0a7a3c;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nutbot-ai-answer-body {
  font-size: 0.82rem;
  color: #1a1a2e;
  line-height: 1.6;
}
.nutbot-ai-answer-body p { margin: 0 0 6px; }
.nutbot-ai-answer-body p:last-child { margin: 0; }
.nutbot-ai-answer-body b { color: #0a7a3c; }
.nutbot-ai-answer-body ul { margin: 6px 0 0 16px; padding: 0; }
.nutbot-ai-answer-body li { margin-bottom: 4px; }
.nutbot-ai-answer-body .nutbot-caution {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.76rem;
  color: #92400e;
  margin-top: 10px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

/* Product Cards Grid */
.nutbot-products-wrap {
  padding: 4px 0 4px 38px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: nutbot-msgIn 0.3s ease;
}
.nutbot-product-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.18s;
  cursor: pointer;
}
.nutbot-product-card:hover {
  border-color: #25d366;
  box-shadow: 0 4px 14px rgba(37,211,102,0.14);
  transform: translateY(-1px);
}
.nutbot-product-emoji-box {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, #f0fdf4, #d1fae5);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.nutbot-product-info { flex: 1; min-width: 0; }
.nutbot-product-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nutbot-product-meta {
  font-size: 0.7rem;
  color: #666;
  margin-top: 2px;
}
.nutbot-product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.nutbot-product-tag {
  background: #f0fdf4;
  color: #0a7a3c;
  font-size: 0.63rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  border: 1px solid #c8e6c9;
}
.nutbot-product-right { text-align: right; flex-shrink: 0; }
.nutbot-product-price {
  font-weight: 800;
  font-size: 0.92rem;
  color: #0a7a3c;
}
.nutbot-product-add-btn {
  background: linear-gradient(135deg, #25d366, #0a7a3c);
  border: none;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 5px;
  transition: all 0.15s;
  white-space: nowrap;
}
.nutbot-product-add-btn:hover { transform: scale(1.06); }
.nutbot-product-add-btn.added {
  background: #e8f5e9;
  color: #2e7d32;
  pointer-events: none;
}

/* Budget Slider / Input area */
.nutbot-budget-wrap {
  padding: 4px 0 4px 38px;
  animation: nutbot-msgIn 0.28s ease;
}
.nutbot-budget-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.nutbot-budget-input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid #d1fae5;
  border-radius: 12px;
  font-size: 0.84rem;
  color: #1a1a2e;
  outline: none;
  font-family: inherit;
  background: #f0fdf4;
}
.nutbot-budget-input:focus { border-color: #25d366; }
.nutbot-budget-go-btn {
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s;
}
.nutbot-budget-go-btn:hover { background: #0a7a3c; }
.nutbot-budget-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nutbot-budget-chip {
  background: #fff;
  border: 1.5px solid #d1d5db;
  color: #374151;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.nutbot-budget-chip:hover {
  border-color: #25d366;
  background: #f0fdf4;
  color: #0a7a3c;
}

/* Info box */
.nutbot-info-box {
  margin: 4px 0 4px 38px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 14px;
  padding: 12px 14px;
  animation: nutbot-msgIn 0.28s ease;
}
.nutbot-info-box-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: #92400e;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.nutbot-info-box-body {
  font-size: 0.78rem;
  color: #78350f;
  line-height: 1.5;
}
.nutbot-info-box-body b { color: #92400e; }

/* Divider */
.nutbot-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 38px;
  font-size: 0.72rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nutbot-divider::before, .nutbot-divider::after {
  content: ''; flex: 1;
  height: 1px; background: #e2e8f0;
}
.nutbot-divider::before { display: none; }

/* Footer input */
.nutbot-footer {
  border-top: 1px solid #f0f0f0;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: #fafafa;
}
.nutbot-input {
  flex: 1;
  padding: 9px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 22px;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
  color: #1a1a2e;
}
.nutbot-input:focus { border-color: #25d366; }
.nutbot-input::placeholder { color: #aaa; }
.nutbot-send-btn {
  width: 38px; height: 38px;
  background: #25d366;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: all 0.15s;
  flex-shrink: 0;
}
.nutbot-send-btn:hover { background: #0a7a3c; transform: scale(1.08); }

/* No results */
.nutbot-no-results {
  margin: 4px 0 4px 38px;
  background: #fff8f8;
  border: 1.5px solid #fecaca;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.82rem;
  color: #991b1b;
  animation: nutbot-msgIn 0.28s ease;
}

/* Restart button */
.nutbot-restart-btn {
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 38px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nutbot-restart-btn:hover {
  background: #e2e8f0;
  color: #1a1a2e;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .nutbot-window {
    right: 0; left: 0; bottom: 0;
    width: 100%;
    max-height: 90vh;
    border-radius: 22px 22px 0 0;
  }
  .nutbot-launcher {
    right: 16px;
    bottom: 16px;
  }
}
