/* web/app/ui/chatPanel.css */
/* ✅ FASE 1: Estilos para Panel de Chat Contextual */

.inversim-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: rgba(31, 41, 55, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
  animation: chat-panel-slide-in 0.3s ease;
}

@keyframes chat-panel-slide-in {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.inversim-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  flex-shrink: 0;
}

.inversim-chat-panel__header-content {
  flex: 1;
}

.inversim-chat-panel__title {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 4px 0;
}

.inversim-chat-panel__subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.inversim-chat-panel__close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inversim-chat-panel__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

.inversim-chat-panel__close:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
}

.inversim-chat-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.inversim-chat-panel__messages::-webkit-scrollbar {
  width: 6px;
}

.inversim-chat-panel__messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.inversim-chat-panel__messages::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 3px;
}

.inversim-chat-panel__messages::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

.inversim-chat-panel__welcome {
  text-align: center;
  padding: 32px 20px;
  color: rgba(255, 255, 255, 0.8);
}

.inversim-chat-panel__welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.inversim-chat-panel__welcome h4 {
  font-size: 18px;
  font-weight: 600;
  color: #f8fafc;
  margin: 0 0 12px 0;
}

.inversim-chat-panel__welcome p {
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.inversim-chat-panel__welcome ul {
  text-align: left;
  display: inline-block;
  margin: 12px 0;
  padding-left: 24px;
}

.inversim-chat-panel__welcome li {
  font-size: 13px;
  margin-bottom: 6px;
}

.inversim-chat-panel__message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 80%;
  animation: chat-message-fade-in 0.3s ease;
}

@keyframes chat-message-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.inversim-chat-panel__message--user {
  align-self: flex-end;
  align-items: flex-end;
}

.inversim-chat-panel__message--assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.inversim-chat-panel__message--loading {
  opacity: 0.7;
}

.inversim-chat-panel__message--follow-up {
  border-left: 3px solid rgba(59, 130, 246, 0.5);
  padding-left: 12px;
  margin-top: 8px;
}

.inversim-chat-panel__message-content {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.inversim-chat-panel__message--user .inversim-chat-panel__message-content {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.inversim-chat-panel__message--assistant .inversim-chat-panel__message-content {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-bottom-left-radius: 4px;
}

.inversim-chat-panel__message-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  padding: 0 4px;
}

.inversim-chat-panel__input-container {
  padding: 16px;
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.5);
}

.inversim-chat-panel__form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.inversim-chat-panel__input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  color: #f8fafc;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  transition: all 0.2s ease;
}

.inversim-chat-panel__input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.inversim-chat-panel__input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.inversim-chat-panel__input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.inversim-chat-panel__send {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inversim-chat-panel__send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.inversim-chat-panel__send:active:not(:disabled) {
  transform: translateY(0);
}

.inversim-chat-panel__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.inversim-chat-panel__send-icon {
  font-size: 18px;
  line-height: 1;
}

.inversim-chat-panel__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.inversim-chat-panel__suggestion {
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.inversim-chat-panel__suggestion:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: #f8fafc;
}

.inversim-chat-panel__suggestion:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .inversim-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .inversim-chat-panel__message {
    max-width: 85%;
  }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
  .inversim-chat-panel,
  .inversim-chat-panel__message {
    animation: none;
  }
}

/* ===== BOTÓN FLOTANTE PARA ABRIR CHAT ===== */
.inversim-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  animation: chat-toggle-pulse 2s ease-in-out infinite;
}

.inversim-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.inversim-chat-toggle:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
}

@keyframes chat-toggle-pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6);
  }
}

@media (max-width: 640px) {
  .inversim-chat-toggle {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inversim-chat-toggle {
    animation: none;
  }
}
