/* ================================================================
   KROW FEATURES — Estilos das Novas Features de E-commerce
   Módulo isolado — NÃO altera style.css
   ================================================================ */

/* ======================== RECOMENDAÇÕES INTELIGENTES ======================== */
.krow-recs {
  margin-top: 16px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  animation: krowSlideUp 0.4s ease;
}
.krow-recs__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.krow-recs__grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.krow-recs__grid::-webkit-scrollbar { display: none; }
.krow-recs__card {
  flex: 0 0 150px;
  scroll-snap-align: start;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.krow-recs__card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-color);
}
.krow-recs__card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}
.krow-recs__card-body {
  padding: 10px;
}
.krow-recs__card-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
  line-height: 1.3;
}
.krow-recs__card-price {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}
.krow-recs__card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 6px;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.krow-recs__card-btn:hover {
  opacity: 0.85;
}
.krow-recs__card-btn svg { width: 13px; height: 13px; }

/* ======================== GATILHOS DE URGÊNCIA E ENTREGA (UI CLEAN) ======================== */
/* Container para agrupar os metadados do card sem poluir */
.krow-meta-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  margin-bottom: 8px;
  border-left: 2px solid var(--border-color);
  padding-left: 8px;
}

.krow-urgency, .krow-express {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.2;
}

.krow-urgency { color: #d97706; }
.krow-urgency--stock { color: #dc2626; }
.krow-express { color: #16a34a; }

.krow-urgency__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: krowBlink 2s ease-in-out infinite;
}

.krow-express svg { 
  width: 12px; 
  height: 12px; 
  opacity: 0.8;
}

/* ======================== CHATBOT ======================== */
.krow-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 1500;
  transition: all var(--transition-normal);
  border: none;
  cursor: pointer;
}
.krow-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-xl);
}
.krow-chat-toggle svg { width: 24px; height: 24px; }
.krow-chat-toggle__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #ea580c;
  color: #fff;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.krow-chat {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: 70vh;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  z-index: 1501;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.krow-chat.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.krow-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.krow-chat__header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.krow-chat__avatar {
  width: 36px;
  height: 36px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: 'Museo Moderno', sans-serif;
}
.krow-chat__header-text h4 {
  font-size: 0.9rem;
  font-weight: 700;
}
.krow-chat__header-text span {
  font-size: 0.72rem;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 4px;
}
.krow-chat__header-text span::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #16a34a;
  border-radius: 50%;
}
.krow-chat__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-fast);
  color: var(--text-muted);
}
.krow-chat__close:hover { background: var(--bg-tertiary); }
.krow-chat__close svg { width: 18px; height: 18px; }

.krow-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.krow-chat__msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  animation: krowSlideUp 0.3s ease;
}
.krow-chat__msg--bot {
  align-self: flex-start;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.krow-chat__msg--user {
  align-self: flex-end;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-bottom-right-radius: 4px;
}
.krow-chat__msg--typing {
  align-self: flex-start;
  background: var(--bg-secondary);
  padding: 14px 18px;
  border-bottom-left-radius: 4px;
}
.krow-chat__typing-dots {
  display: flex;
  gap: 4px;
}
.krow-chat__typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: krowTypingBounce 1.4s ease-in-out infinite;
}
.krow-chat__typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.krow-chat__typing-dots span:nth-child(3) { animation-delay: 0.4s; }

.krow-chat__quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.krow-chat__quick-btn {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.krow-chat__quick-btn:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.krow-chat__input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
}
.krow-chat__input {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  font-size: 0.85rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}
.krow-chat__input:focus { border-color: var(--text-primary); }
.krow-chat__input::placeholder { color: var(--text-muted); }
.krow-chat__send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.krow-chat__send:hover { opacity: 0.8; }
.krow-chat__send svg { width: 16px; height: 16px; }

/* ======================== EXIT INTENT ======================== */
.krow-exit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}
.krow-exit-overlay.active {
  opacity: 1;
  visibility: visible;
}
.krow-exit-modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.krow-exit-overlay.active .krow-exit-modal {
  transform: scale(1) translateY(0);
}
.krow-exit-modal__glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(234, 88, 12, 0.06) 0%, transparent 60%);
  pointer-events: none;
}
.krow-exit-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  z-index: 1;
}
.krow-exit-modal__close:hover { background: var(--bg-tertiary); }
.krow-exit-modal__close svg { width: 18px; height: 18px; }
.krow-exit-modal__emoji {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}
.krow-exit-modal__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
  position: relative;
}
.krow-exit-modal__desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 24px;
  line-height: 1.5;
}
.krow-exit-modal__coupon {
  display: inline-block;
  padding: 10px 28px;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.krow-exit-modal__timer {
  font-size: 0.8rem;
  color: #ea580c;
  font-weight: 600;
  margin-bottom: 20px;
}
.krow-exit-modal__cta {
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: 12px;
}
.krow-exit-modal__cta:hover {
  background: transparent;
  color: var(--text-primary);
}
.krow-exit-modal__skip {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 6px;
  transition: color var(--transition-fast);
}
.krow-exit-modal__skip:hover { color: var(--text-primary); }

/* ======================== WHATSAPP RÁPIDO ======================== */
.krow-wa-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.krow-wa-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}
.krow-wa-btn svg { width: 17px; height: 17px; }

/* ======================== ENTREGA EXPRESSA BANNER (CARRINHO) ======================== */
.krow-express-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin: 12px 16px;
  font-size: 0.8rem;
  color: var(--text-primary);
  animation: krowSlideUp 0.3s ease;
}
.krow-express-banner__icon {
  width: 28px;
  height: 28px;
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}
.krow-express-banner__text strong { color: #16a34a; font-weight: 600; }

/* ======================== SIMULADOR DE FRETE ======================== */
.krow-frete {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}
.krow-frete__title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.krow-frete__row {
  display: flex;
  gap: 8px;
}
.krow-frete__input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}
.krow-frete__input:focus { border-color: var(--text-primary); }
.krow-frete__input::placeholder { color: var(--text-muted); }
.krow-frete__calc-btn {
  padding: 10px 18px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.krow-frete__calc-btn:hover { opacity: 0.85; }
.krow-frete__calc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.krow-frete__help {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: block;
}
.krow-frete__help a {
  color: var(--text-primary);
  text-decoration: underline;
  font-weight: 500;
}
.krow-frete__result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  animation: krowSlideUp 0.3s ease;
}
.krow-frete__result--success {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: var(--text-primary);
}
.krow-frete__result--info {
  background: rgba(234, 88, 12, 0.08);
  border: 1px solid rgba(234, 88, 12, 0.2);
  color: var(--text-primary);
}
.krow-frete__result-main {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.krow-frete__result-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ======================== ANIMAÇÕES ======================== */
@keyframes krowSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes krowPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
@keyframes krowBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes krowTypingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ======================== RESPONSIVO ======================== */
@media (max-width: 768px) {
  .krow-chat {
    right: 8px;
    bottom: 84px;
    width: calc(100vw - 16px);
    max-height: 65vh;
  }
  .krow-chat-toggle {
    bottom: 18px;
    right: 18px;
    width: 50px;
    height: 50px;
  }
  .krow-recs__card {
    flex: 0 0 130px;
  }
  .krow-recs__card img {
    height: 100px;
  }
  .krow-exit-modal {
    padding: 32px 24px;
  }
  .krow-exit-modal__coupon {
    font-size: 1.2rem;
    padding: 8px 20px;
  }
}
