/* ==========================================================================
   COPELITO IA CHAT WIDGET - COPELT TECH BRAND STANDARD
   ========================================================================== */

/* ── Floating Action Button (FAB) Trigger ── */
#copelito-fab-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 10px 30px rgba(10, 27, 57, 0.25), 0 0 20px rgba(99, 102, 241, 0.3);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  outline: none;
}

#copelito-fab-btn:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow: 0 15px 35px rgba(10, 27, 57, 0.35), 0 0 25px rgba(99, 102, 241, 0.5);
  border-color: #6366f1;
}

#copelito-fab-btn:active {
  transform: scale(0.95);
}

#copelito-fab-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: contain;
  transition: transform 0.2s ease;
  pointer-events: none;
}

#copelito-fab-btn:hover #copelito-fab-avatar {
  transform: scale(1.05);
}

.copelito-online-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: copelitoPulse 2s infinite ease-in-out;
}

@keyframes copelitoPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Chat Modal Window ── */
#copelito-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(85vh - 30px);
  background: rgba(7, 21, 43, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 35px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  animation: copelitoSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes copelitoSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Header ── */
.copelito-header {
  background: linear-gradient(135deg, #050d1a 0%, #0a1b39 100%);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.copelito-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.copelito-avatar-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.copelito-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  padding: 1px;
  border: 1.5px solid #38bdf8;
  object-fit: contain;
}

.copelito-title-group {
  min-width: 0;
}

.copelito-title-group h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 900;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.2;
}

.copelito-badge-360 {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.copelito-status-text {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copelito-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.copelito-btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.copelito-btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.copelito-btn-icon.close-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* ── Quick Chips Carousel ── */
.copelito-chips-bar {
  background: rgba(5, 13, 26, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem 0.75rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.copelito-chips-bar::-webkit-scrollbar {
  display: none;
}

.copelito-chip {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copelito-chip:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
}

/* ── Messages Stream ── */
.copelito-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.3) rgba(15, 23, 42, 0.5);
}

.copelito-messages-container::-webkit-scrollbar {
  width: 5px;
}

.copelito-messages-container::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}

.copelito-messages-container::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

.copelito-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  line-height: 1.5;
  font-size: 0.82rem;
  word-break: break-word;
}

.copelito-msg.user {
  align-self: flex-end;
}

.copelito-msg.assistant {
  align-self: flex-start;
}

.copelito-msg-bubble {
  padding: 0.75rem 0.95rem;
  border-radius: 18px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.copelito-msg.user .copelito-msg-bubble {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.copelito-msg.assistant .copelito-msg-bubble {
  background: rgba(15, 33, 64, 0.9);
  color: #e2e8f0;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-bottom-left-radius: 4px;
}

.copelito-msg.assistant .copelito-msg-bubble strong {
  color: #ffffff;
}

.copelito-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.65rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: all 0.2s ease;
  text-decoration: none;
}

.copelito-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
  filter: brightness(1.08);
}

.copelito-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 33, 64, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 0.5rem 0.85rem;
  border-radius: 16px;
  font-size: 0.75rem;
  color: #94a3b8;
  width: fit-content;
}

.copelito-typing-dot {
  width: 6px;
  height: 6px;
  background: #38bdf8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

/* ── Footer Input ── */
.copelito-footer {
  background: #050d1a;
  border-top: 1px solid rgba(56, 189, 248, 0.2);
  padding: 0.75rem;
  flex-shrink: 0;
}

.copelito-input-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  transition: border-color 0.2s ease;
}

.copelito-input-form:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.copelito-input-field {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.82rem;
  outline: none;
  font-family: inherit;
  padding: 0.3rem 0;
}

.copelito-input-field::placeholder {
  color: #64748b;
}

.copelito-char-counter {
  font-size: 0.68rem;
  color: #64748b;
  font-family: monospace;
  margin-right: 0.25rem;
}

.copelito-send-btn {
  background: #0284c7;
  color: #ffffff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.copelito-send-btn:hover:not(:disabled) {
  background: #38bdf8;
  color: #07152b;
  transform: scale(1.05);
}

.copelito-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #copelito-chat-window {
    bottom: 90px;
    right: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    height: 520px;
  }
}
