/* components/chat-widget/chat-widget.css — widget flotante estilo WhatsApp */

:root {
  --cw-green: #25d366;
  --cw-green-dk: #128c4e;
  --cw-header-bg: #075e54;
  --cw-bubble-in: #dcf8c6;
  --cw-bubble-out: #ffffff;
  --cw-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  --cw-radius: 16px;
}

#cw-fab {
  position: fixed;
  bottom: 85px;
  left: 20px;
  z-index: 10000;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--cw-green);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  outline: none;
}

#cw-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 26px rgba(37, 211, 102, 0.65);
}

#cw-fab:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.5);
  outline-offset: 3px;
}

#cw-fab svg {
  width: 30px;
  height: 30px;
}

#cw-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #e53935;
  color: #fff;
  border-radius: 10px;
  font: 700 11px/1 "Segoe UI", system-ui, sans-serif;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

#cw-window {
  position: fixed;
  bottom: 155px;
  left: 20px;
  z-index: 9999;
  width: 330px;
  max-width: calc(100vw - 40px);
  background: #ece5dd;
  border-radius: var(--cw-radius);
  box-shadow: var(--cw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom left;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  font-family: "Segoe UI", system-ui, sans-serif;
}

#cw-window.cw-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

#cw-header {
  background: var(--cw-header-bg);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#cw-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

#cw-header-info {
  flex: 1;
  min-width: 0;
}

#cw-header-name {
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
}

#cw-header-sub {
  color: rgba(255, 255, 255, 0.75);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

#cw-header-sub::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7fff7f;
  display: inline-block;
}

#cw-uses-left {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  white-space: nowrap;
}

#cw-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  padding: 2px;
  line-height: 1;
  font-size: 18px;
  flex-shrink: 0;
  border-radius: 6px;
}

#cw-close-btn:hover {
  color: #fff;
}

#cw-close-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

#cw-messages {
  min-height: 160px;
  max-height: 240px;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#cw-messages::-webkit-scrollbar {
  width: 4px;
}

#cw-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.cw-bubble {
  max-width: 82%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
  animation: cwBubbleIn 0.2s ease;
}

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

.cw-bubble.cw-in {
  background: var(--cw-bubble-out);
  border-bottom-left-radius: 2px;
  align-self: flex-start;
  color: #111;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.cw-bubble.cw-out {
  background: var(--cw-bubble-in);
  border-bottom-right-radius: 2px;
  align-self: flex-end;
  color: #111;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.cw-bubble .cw-time {
  font-size: 10px;
  color: rgba(0, 0, 0, 0.45);
  text-align: right;
  margin-top: 2px;
}

#cw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 10px 6px;
}

.cw-chip {
  background: #fff;
  border: 1.5px solid #25d366;
  color: #075e54;
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.cw-chip:hover {
  background: #d4f7e2;
}

.cw-chip:focus-visible {
  outline: 2px solid var(--cw-green);
  outline-offset: 2px;
}

#cw-footer {
  background: #f0f0f0;
  padding: 8px 10px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#cw-input {
  flex: 1;
  border: none;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 13.5px;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 90px;
  overflow-y: auto;
  line-height: 1.4;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#cw-input::placeholder {
  color: #aaa;
}

#cw-input:focus {
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.35);
}

#cw-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--cw-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
  outline: none;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.4);
}

#cw-send:hover {
  background: var(--cw-green-dk);
  transform: scale(1.08);
}

#cw-send:active {
  transform: scale(0.96);
}

#cw-send:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.45);
  outline-offset: 2px;
}

#cw-send svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

#cw-limit-notice {
  background: #fff8e1;
  border-top: 1px solid #ffe082;
  padding: 9px 14px;
  text-align: center;
  font-size: 12.5px;
  color: #6d4c00;
  display: none;
}

#cw-limit-notice a {
  color: var(--cw-green-dk);
  font-weight: 700;
  text-decoration: none;
}

#cw-limit-notice a:hover {
  text-decoration: underline;
}

@media (max-width: 400px) {
  #cw-window {
    width: calc(100vw - 32px);
    left: 16px;
  }

  #cw-fab {
    left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #cw-fab,
  #cw-window,
  .cw-bubble,
  #cw-send,
  .cw-chip {
    transition: none;
    animation: none;
  }

  #cw-window {
    transform: none;
  }

  #cw-window.cw-open {
    transform: none;
  }
}
