/* ====================================
   WIDGET CHAT MVP - CloudAuditOps
   ==================================== */

/* Bouton flottant */
.chat-widget-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--aws-orange, #FF9900);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-widget-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-widget-button:active {
  transform: scale(0.95);
}

/* Fenêtre chat */
.chat-widget-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 550px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: none;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
}

.chat-widget-window.open {
  display: flex;
}

/* Header */
.chat-widget-header {
  background: var(--aws-orange, #FF9900);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-widget-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.chat-widget-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.chat-widget-close:hover {
  opacity: 1;
}

/* Messages */
.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f4f7fb;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.5;
  font-size: 14px;
  word-wrap: break-word;
}

.chat-message.bot {
  background: #ffffff;
  align-self: flex-start;
  border: 1px solid #e5e7eb;
}

.chat-message.user {
  background: var(--aws-orange, #FF9900);
  color: #ffffff;
  align-self: flex-end;
}

.chat-message.welcome {
  background: #ffffff;
  align-self: flex-start;
  border: 1px solid #e5e7eb;
  font-style: italic;
}

.chat-message.error {
  background: #fee;
  color: #c00;
  align-self: center;
  border: 1px solid #fcc;
  font-size: 13px;
}

.chat-message.error-rich {
  background: #ffffff;
  color: #374151;
  align-self: flex-start;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  max-width: 90%;
  line-height: 1.5;
}

.error-rich-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 6px;
}

.error-rich-link {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.2s;
}

.error-rich-link:hover {
  opacity: 0.85;
}

.error-rich-link:not(.error-rich-link--secondary) {
  background: var(--aws-orange, #FF9900);
  color: #ffffff;
}

.error-rich-link--secondary {
  background: transparent;
  color: var(--aws-orange, #FF9900);
  border: 1px solid rgba(255, 153, 0, 0.4);
}

.error-rich-note {
  display: block;
  color: #9ca3af;
  font-size: 12px;
  margin-top: 2px;
}

/* Loading */
.chat-loading {
  padding: 12px 16px;
  border-radius: 12px;
  background: #ffffff;
  align-self: flex-start;
  border: 1px solid #e5e7eb;
  color: #64748b;
  font-size: 20px;
  letter-spacing: 2px;
}

/* Input */
.chat-widget-input {
  padding: 16px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chat-widget-textarea {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-widget-textarea:focus {
  border-color: var(--aws-orange, #FF9900);
}

.chat-widget-textarea::placeholder {
  color: #9ca3af;
}

.chat-widget-send {
  background: var(--aws-orange, #FF9900);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.chat-widget-send:hover:not(:disabled) {
  opacity: 0.9;
}

.chat-widget-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .chat-widget-button {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    font-size: 24px;
  }

  .chat-widget-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 70vh;
    border-radius: 12px 12px 0 0;
  }

  .chat-widget-window.open {
    bottom: 0;
  }
}

/* Scrollbar styling */
.chat-widget-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-widget-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
