/* ============================================================
   SHIV Inter-Comercial – AI Chatbot Widget Styles
   ============================================================ */

/* ── Launcher Button ───────────────────────────────────────── */
.shiv-chat-launcher {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 9990;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0b2545, #4aa3c0);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 24px rgba(11, 37, 69, 0.35), 0 2px 8px rgba(74,163,192,.3);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
  outline: none;
}

.shiv-chat-launcher:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 32px rgba(11, 37, 69, 0.4), 0 4px 16px rgba(74,163,192,.4);
}

.shiv-chat-launcher.active {
  background: linear-gradient(135deg, #163a6b, #2e8ba6);
}

.shiv-chat-launcher-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s;
}

/* Notification dot */
.shiv-chat-notification-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.shiv-chat-notification-dot.visible {
  opacity: 1;
  transform: scale(1);
  animation: shiv-pulse 2s ease-in-out infinite;
}

@keyframes shiv-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ── Chat Window ───────────────────────────────────────────── */
.shiv-chat-window {
  position: fixed;
  bottom: 158px;
  right: 24px;
  z-index: 9989;
  width: 360px;
  max-height: 580px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(11,37,69,0.18), 0 4px 20px rgba(11,37,69,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.3s, visibility 0.3s, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.shiv-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ── Header ────────────────────────────────────────────────── */
.shiv-chat-header {
  background: linear-gradient(135deg, #0b2545 0%, #163a6b 60%, #1e4e7a 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.shiv-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shiv-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(74,163,192,0.15);
  border: 2px solid rgba(74,163,192,0.4);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shiv-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shiv-chat-avatar-fallback {
  color: #4aa3c0;
  font-weight: 800;
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
}

.shiv-chat-header-name {
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.3;
}

.shiv-chat-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.65);
  font-size: 0.73rem;
}

.shiv-online-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  animation: shiv-blink 2s ease-in-out infinite;
}

@keyframes shiv-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.shiv-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shiv-chat-icon-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.shiv-chat-icon-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ── Messages ──────────────────────────────────────────────── */
.shiv-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: #f8f9fa;
}

.shiv-chat-messages::-webkit-scrollbar {
  width: 4px;
}
.shiv-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.shiv-chat-messages::-webkit-scrollbar-thumb {
  background: #ced4da;
  border-radius: 4px;
}

/* Message rows */
.shiv-chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 100%;
}

.shiv-chat-msg.visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* Message avatars */
.shiv-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(11,37,69,0.08);
  border: 1.5px solid rgba(74,163,192,0.25);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}

.shiv-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shiv-msg-avatar-fallback {
  color: #4aa3c0;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Message body */
.shiv-msg-body {
  max-width: calc(100% - 46px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shiv-chat-msg--user .shiv-msg-body {
  align-items: flex-end;
}

/* Bubbles */
.shiv-msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.84rem;
  line-height: 1.6;
  word-break: break-word;
}

.shiv-chat-msg--bot .shiv-msg-bubble {
  background: #fff;
  color: #1a1a2e;
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 2px 8px rgba(11,37,69,0.07);
}

.shiv-chat-msg--user .shiv-msg-bubble {
  background: linear-gradient(135deg, #0b2545, #1e4e7a);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}

/* Links in bot messages */
.shiv-msg-bubble .chat-link {
  color: #4aa3c0;
  text-decoration: underline;
  font-weight: 500;
}

.shiv-msg-bubble strong {
  font-weight: 700;
}

/* Timestamps */
.shiv-msg-time {
  font-size: 0.68rem;
  color: #adb5bd;
  padding: 0 2px;
}

/* Inline action buttons */
.shiv-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: 4px;
  transition: all 0.2s;
  width: fit-content;
}

.shiv-inline-btn.catalog-btn {
  background: #e8f6fb;
  color: #0b2545;
  border: 1.5px solid #4aa3c0;
}

.shiv-inline-btn.catalog-btn:hover {
  background: #4aa3c0;
  color: #fff;
}

.shiv-inline-btn.whatsapp-inline-btn {
  background: #dcfce7;
  color: #166534;
  border: 1.5px solid #22c55e;
}

.shiv-inline-btn.whatsapp-inline-btn:hover {
  background: #22c55e;
  color: #fff;
}

/* ── Typing Indicator ──────────────────────────────────────── */
.shiv-typing-bubble {
  background: #fff !important;
  padding: 12px 16px !important;
  display: flex !important;
  align-items: center;
  gap: 4px;
  min-width: 54px;
}

.shiv-typing-dot {
  width: 8px;
  height: 8px;
  background: #4aa3c0;
  border-radius: 50%;
  animation: shiv-typing-bounce 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

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

@keyframes shiv-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick Replies ─────────────────────────────────────────── */
.shiv-chat-quick-replies {
  padding: 6px 12px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  flex-shrink: 0;
  min-height: 0;
}

.shiv-chat-quick-replies:empty {
  display: none;
}

.shiv-qr-btn {
  background: #fff;
  border: 1.5px solid #d0e8f0;
  color: #0b2545;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.shiv-qr-btn:hover {
  background: #4aa3c0;
  border-color: #4aa3c0;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(74,163,192,0.3);
}

/* ── Input Area ────────────────────────────────────────────── */
.shiv-chat-input-area {
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#shivChatInput {
  flex: 1;
  border: 1.5px solid #e9ecef;
  border-radius: 24px;
  padding: 9px 16px;
  font-size: 0.85rem;
  color: #1a1a2e;
  background: #f8f9fa;
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}

#shivChatInput:focus {
  border-color: #4aa3c0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(74,163,192,0.12);
}

#shivChatInput::placeholder {
  color: #adb5bd;
}

.shiv-chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0b2545, #4aa3c0);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 3px 10px rgba(74,163,192,0.35);
}

.shiv-chat-send-btn:hover {
  transform: scale(1.08) translateY(-1px);
  box-shadow: 0 5px 16px rgba(74,163,192,0.45);
}

.shiv-chat-send-btn:active {
  transform: scale(0.95);
}

/* ── Footer ────────────────────────────────────────────────── */
.shiv-chat-footer {
  text-align: center;
  padding: 6px 12px;
  font-size: 0.66rem;
  color: #adb5bd;
  background: #fff;
  border-top: 1px solid #f1f3f5;
  flex-shrink: 0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .shiv-chat-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 140px;
    max-height: 65vh;
    border-radius: 16px;
  }

  .shiv-chat-launcher {
    bottom: 80px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 360px) {
  .shiv-chat-window {
    width: calc(100vw - 16px);
    right: 8px;
  }
}

