/* 420c Agente Virtual — widget.css v1.0.0 */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --c420-navy:   #1a3a5c;
  --c420-teal:   #2a9d8f;
  --c420-cream:  #faf8f5;
  --c420-sand:   #f0ece4;
  --c420-white:  #ffffff;
  --c420-text:   #2c2c2c;
  --c420-muted:  #7a7a7a;
  --c420-radius: 20px;
  --c420-shadow: 0 20px 60px rgba(26,58,92,.18), 0 4px 16px rgba(26,58,92,.08);
  --c420-font:   'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset for plugin scope ── */
#c420-av-root * { box-sizing: border-box; margin: 0; padding: 0; font-family: var(--c420-font); }

/* ── Tooltip ── */
.c420-tooltip {
  position: fixed;
  bottom: 100px;
  right: 100px;
  background: var(--c420-white);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
  font-size: 13px;
  color: var(--c420-navy);
  font-weight: 500;
  max-width: 200px;
  line-height: 1.4;
  z-index: 99997;
  opacity: 0;
  transform: translateY(10px) scale(.9);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.c420-tooltip--visible { opacity: 1; transform: translateY(0) scale(1); }
.c420-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  border: 8px solid transparent;
  border-top-color: var(--c420-white);
  border-bottom: none;
}

/* ── Bubble ── */
.c420-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  background: linear-gradient(135deg, var(--c420-navy), #234e7a);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(26,58,92,.35);
  z-index: 99998;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
  outline: none;
}
.c420-bubble:hover { transform: scale(1.08); box-shadow: 0 12px 36px rgba(26,58,92,.45); }
.c420-bubble--open { transform: scale(.9) rotate(10deg); }

.c420-bubble svg { position: absolute; transition: opacity .2s, transform .2s; }
.c420-icon-close { opacity: 0; transform: rotate(-30deg); }
.c420-bubble--open .c420-icon-chat  { opacity: 0; transform: rotate(30deg); }
.c420-bubble--open .c420-icon-close { opacity: 1; transform: rotate(0); }

.c420-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 18px; height: 18px;
  background: #e63946;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 10px; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: c420-pulse 2s ease infinite;
}
@keyframes c420-pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }

/* ── Window ── */
.c420-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 370px;
  height: 560px;
  background: var(--c420-white);
  border-radius: var(--c420-radius);
  box-shadow: var(--c420-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  transform: scale(.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.4,.64,1), opacity .25s;
}
.c420-window--open { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }

/* ── Header ── */
.c420-header {
  background: linear-gradient(135deg, var(--c420-navy) 0%, #234e7a 100%);
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.c420-header::before {
  content: '';
  position: absolute;
  bottom: -30px; right: 30px;
  width: 80px; height: 80px;
  background: rgba(42,157,143,.15);
  border-radius: 50%;
}
.c420-agent-row { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.c420-avatar {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--c420-teal), #3dbfb0);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.c420-agent-info { flex: 1; }
.c420-agent-name { font-weight: 600; color: #fff; font-size: 15px; letter-spacing: -.2px; }
.c420-agent-status { font-size: 11px; color: rgba(255,255,255,.65); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.c420-dot {
  width: 7px; height: 7px;
  background: #4ade80; border-radius: 50%;
  animation: c420-blink 2.5s ease infinite;
}
@keyframes c420-blink { 0%,100%{opacity:1} 50%{opacity:.4} }
.c420-close-btn {
  background: rgba(255,255,255,.1); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.c420-close-btn:hover { background: rgba(255,255,255,.2); }
.c420-tagline { font-size: 11px; color: rgba(255,255,255,.45); margin-top: 10px; font-style: italic; position: relative; z-index:1; }

/* ── Messages ── */
.c420-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--c420-cream);
  scrollbar-width: thin; scrollbar-color: #ddd transparent;
}
.c420-msg { display: flex; gap: 8px; animation: c420-fadeup .3s ease forwards; opacity: 0; }
.c420-msg--user { flex-direction: row-reverse; }
@keyframes c420-fadeup { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.c420-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c420-teal), #3dbfb0);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0; margin-top: 2px;
}
.c420-msg--user .c420-msg-avatar { background: linear-gradient(135deg,#94a3b8,#64748b); }
.c420-msg-inner { max-width: 78%; }
.c420-msg-bubble {
  padding: 10px 14px; border-radius: 16px;
  font-size: 13.5px; line-height: 1.5; color: var(--c420-text);
}
.c420-msg--bot .c420-msg-bubble {
  background: var(--c420-white);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.c420-msg--user .c420-msg-bubble {
  background: var(--c420-navy); color: #fff;
  border-bottom-right-radius: 4px;
}
.c420-msg-time { font-size: 10px; color: var(--c420-muted); margin-top: 4px; }
.c420-msg--user .c420-msg-time { text-align: right; }

/* ── Typing ── */
.c420-typing-bubble {
  background: var(--c420-white);
  border-radius: 16px; border-bottom-left-radius: 4px;
  padding: 12px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  display: flex; gap: 4px; align-items: center;
}
.c420-dot-anim {
  width: 7px; height: 7px;
  background: var(--c420-teal); border-radius: 50%;
  animation: c420-bounce 1.2s ease infinite;
  display: inline-block;
}
.c420-dot-anim:nth-child(2) { animation-delay: .15s; }
.c420-dot-anim:nth-child(3) { animation-delay: .3s; }
@keyframes c420-bounce { 0%,60%,100%{transform:none} 30%{transform:translateY(-5px)} }

/* ── Product cards ── */
.c420-product-card {
  background: var(--c420-white); border-radius: 10px;
  padding: 10px 12px; margin-top: 8px;
  border: 1.5px solid rgba(42,157,143,.2);
  display: flex; gap: 10px; align-items: center;
  cursor: pointer; transition: border-color .2s, transform .15s;
}
.c420-product-card:hover { border-color: var(--c420-teal); transform: translateY(-1px); }
.c420-product-img {
  width: 40px; height: 40px; flex-shrink: 0;
  background: linear-gradient(135deg,#e0f2f0,#c8eae7);
  border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.c420-product-img img { width: 100%; height: 100%; object-fit: cover; }
.c420-product-info { flex: 1; min-width: 0; }
.c420-product-name { font-size: 12px; font-weight: 600; color: var(--c420-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c420-product-price { font-size: 12px; color: var(--c420-teal); font-weight: 700; margin-top: 2px; }
.c420-out-of-stock { font-size: 10px; color: #e63946; }
.c420-product-arrow { color: var(--c420-teal); font-size: 16px; font-weight: 700; flex-shrink: 0; }

.c420-cat-link {
  display: block; margin-top: 10px;
  font-size: 12px; color: var(--c420-teal); text-decoration: none; font-weight: 600;
  border-top: 1px solid rgba(42,157,143,.15); padding-top: 8px;
}
.c420-cat-link:hover { text-decoration: underline; }

/* ── Suggestions ── */
.c420-suggestions {
  padding: 10px 14px 6px;
  display: flex; flex-wrap: wrap; gap: 6px;
  background: var(--c420-cream);
  border-top: 1px solid rgba(0,0,0,.05);
  flex-shrink: 0;
}
.c420-chip {
  background: var(--c420-white);
  border: 1.5px solid rgba(26,58,92,.15);
  color: var(--c420-navy);
  font-size: 11.5px; font-weight: 500;
  padding: 5px 11px; border-radius: 20px;
  cursor: pointer; transition: all .18s;
  font-family: var(--c420-font);
}
.c420-chip:hover { background: var(--c420-navy); color: #fff; border-color: var(--c420-navy); transform: translateY(-1px); }

/* ── Input ── */
.c420-input-area { padding: 10px 14px 14px; background: var(--c420-white); border-top: 1px solid rgba(0,0,0,.06); flex-shrink: 0; }
.c420-input-row {
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--c420-cream); border-radius: 14px;
  padding: 8px 8px 8px 14px;
  border: 1.5px solid transparent; transition: border-color .2s;
}
.c420-input-row:focus-within { border-color: var(--c420-teal); }
.c420-input {
  flex: 1; border: none; background: transparent;
  font-family: var(--c420-font); font-size: 13.5px; color: var(--c420-text);
  resize: none; outline: none; max-height: 80px; line-height: 1.4;
}
.c420-input::placeholder { color: #b0aaa0; }
.c420-send-btn {
  width: 34px; height: 34px;
  background: var(--c420-navy); border: none; border-radius: 10px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .2s, transform .15s;
}
.c420-send-btn:hover { background: var(--c420-teal); transform: scale(1.05); }
.c420-send-btn:active { transform: scale(.95); }
.c420-send-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }
.c420-hint { font-size: 10px; color: var(--c420-muted); text-align: center; margin-top: 6px; }

/* ── Left position override ── */
.c420-bubble--left  { right: auto !important; left: 24px; }
.c420-window--left  { right: auto !important; left: 24px; transform-origin: bottom left; }
.c420-tooltip--left { right: auto !important; left: 100px; }
.c420-tooltip--left::after { right: auto; left: 20px; }

/* ── Mobile ── */
@media (max-width: 480px) {
  .c420-window {
    width: calc(100vw - 20px);
    right: 10px; left: 10px;
    bottom: 90px;
    height: calc(100vh - 110px);
    max-height: 580px;
    border-radius: 16px;
  }
  .c420-bubble { bottom: 16px; right: 16px; }
}

/* ── v1.2.0: Blog source styles ── */
.c420-source-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
  letter-spacing: .3px;
}
.c420-source-blog { background: #fef3c7; color: #92400e; }
.c420-source-kb   { background: #d1fae5; color: #065f46; }

.c420-resp-text { font-size: 13.5px; line-height: 1.55; }
.c420-resp-text a {
  color: var(--c420-teal);
  text-decoration: none;
  font-weight: 600;
}
.c420-resp-text a:hover { text-decoration: underline; }

.c420-prod-title {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin: 10px 0 6px;
}

.c420-more-articles-title {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin: 10px 0 5px;
}

.c420-article-link {
  display: block;
  font-size: 12px;
  color: var(--c420-teal) !important;
  text-decoration: none !important;
  font-weight: 500 !important;
  padding: 3px 0;
  transition: opacity .15s;
}
.c420-article-link:hover { opacity: .75; }
