/* WIDGET CARMEN IA */

#carmen-widget {
  font-family: 'Inter', sans-serif;
  color: #1a1a2e;
}

#carmen-toggle {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0077b6, #00b4d8);
  box-shadow: 0 4px 16px rgba(0, 119, 182, 0.4);
  z-index: 9998;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: carmen-pulse 2s infinite;
  transition: transform 0.3s ease;
}

#carmen-toggle:hover {
  transform: scale(1.1);
}

#carmen-toggle img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

@keyframes carmen-pulse {
  0% { transform: scale(1); box-shadow: 0 4px 16px rgba(0, 119, 182, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 4px 20px rgba(0, 119, 182, 0.6); }
  100% { transform: scale(1); box-shadow: 0 4px 16px rgba(0, 119, 182, 0.4); }
}

#carmen-panel {
  position: fixed;
  bottom: 90px;
  left: 1.5rem;
  width: 360px;
  height: 500px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 1px solid #dee2e6;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(0);
  opacity: 1;
}

#carmen-panel.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

#carmen-header {
  height: 65px;
  background: linear-gradient(135deg, #0077b6, #0096c7);
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: white;
  position: relative;
}

.carmen-avatar-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
  border: 2px solid rgba(255,255,255,0.3);
}

.carmen-header-info {
  display: flex;
  flex-direction: column;
}

.carmen-name {
  font-weight: 700;
  font-size: 15px;
}

.carmen-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

.carmen-status-dot {
  width: 8px;
  height: 8px;
  background-color: #28a745;
  border-radius: 50%;
  margin-left: 8px;
  margin-top: -12px;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

#carmen-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  margin-left: auto;
  opacity: 0.8;
  transition: opacity 0.2s;
}

#carmen-close:hover {
  opacity: 1;
}

#carmen-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#carmen-messages::-webkit-scrollbar {
  width: 6px;
}
#carmen-messages::-webkit-scrollbar-thumb {
  background-color: rgba(0, 119, 182, 0.3);
  border-radius: 10px;
}

.carmen-message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  animation: fadeInUp 0.2s ease forwards;
  word-wrap: break-word;
}

.bot-message {
  align-self: flex-start;
  background: #f0f4f8;
  color: #1a1a2e;
  border-left: 3px solid #0077b6;
  border-bottom-left-radius: 4px;
}

.user-message {
  align-self: flex-end;
  background: linear-gradient(135deg, #0077b6, #0096c7);
  color: white;
  border-bottom-right-radius: 4px;
}

.carmen-message a {
  color: inherit;
  text-decoration: underline;
}

#carmen-input-area {
  background: white;
  border-top: 1px solid #dee2e6;
  padding: 12px;
  display: flex;
  gap: 10px;
}

#carmen-input {
  flex-grow: 1;
  border-radius: 20px;
  border: 1px solid #dee2e6;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  background: #f8f9fa;
  transition: all 0.2s ease;
}

#carmen-input:focus {
  border-color: #0077b6;
  box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.15);
  background: white;
}

#carmen-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0077b6;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s;
}

#carmen-send:hover {
  background: #005f99;
}

/* Typing indicator */
#carmen-typing {
  padding: 0 16px 12px 16px;
  display: flex;
  gap: 4px;
  background: #f8f9fa;
}

#carmen-typing.hidden {
  display: none;
}

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

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

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

/* Attention bubble */
#carmen-attention {
  position: fixed;
  bottom: 90px;
  left: 1.5rem;
  background: white;
  border: 1px solid #0077b6;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  color: #1a1a2e;
  box-shadow: 0 2px 12px rgba(0,119,182,0.2);
  z-index: 9998;
  animation: fadeIn 0.3s ease;
  pointer-events: none;
}

#carmen-attention::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 20px;
  width: 10px;
  height: 10px;
  background: white;
  border-left: 1px solid #0077b6;
  border-bottom: 1px solid #0077b6;
  transform: rotate(-45deg);
}

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

@media (max-width: 768px) {
  #carmen-toggle {
    width: 55px;
    height: 55px;
    left: 1rem;
    bottom: 1rem;
  }
  #carmen-toggle img {
    width: 51px;
    height: 51px;
  }
  #carmen-panel {
    width: 90%;
    left: 5%;
    bottom: 80px;
    height: 450px;
  }
}
