/* Styles pour le widget chat Mia */

/* Bouton flottant */
.mia-chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9998;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mia-chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.mia-chat-button svg {
  width: 30px;
  height: 30px;
  fill: white;
}

/* Fenêtre de chat */
.mia-chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.mia-chat-window.open {
  display: flex;
  animation: slideIn 0.3s ease;
}

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

/* Header */
.mia-chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mia-chat-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.mia-chat-quota {
  font-size: 14px;
  opacity: 0.9;
}

.mia-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.mia-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Messages */
.mia-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f5f5;
}

.mia-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.mia-message.user {
  align-items: flex-end;
}

.mia-message.bot {
  align-items: flex-start;
}

.mia-message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
}

.mia-message.user .mia-message-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.mia-message.bot .mia-message-bubble {
  background: white;
  color: #333;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mia-message-sources {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
  font-style: italic;
}

/* Zone de saisie */
.mia-chat-input-area {
  padding: 12px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

.mia-chat-input-wrapper {
  display: flex;
  gap: 8px;
}

.mia-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.mia-chat-footer {
  padding: 12px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

.mia-chat-input-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.mia-chat-input:focus {
  border-color: #667eea;
}

.mia-send-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.mia-send-btn:hover {
  opacity: 0.9;
}

.mia-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bouton pub */
.mia-ad-button {
  margin-top: 8px;
  width: 100%;
  padding: 10px;
  background: #ff6b6b;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}

.mia-ad-button:hover {
  background: #ff5252;
}

/* Loading */
.mia-loading {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  animation: bounce 1.4s infinite ease-in-out both;
}

.mia-loading:nth-child(1) {
  animation-delay: -0.32s;
}

.mia-loading:nth-child(2) {
  animation-delay: -0.16s;
}

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

/* Responsive */
@media (max-width: 480px) {
  .mia-chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    right: 10px;
    bottom: 80px;
  }
  
  .mia-chat-button {
    bottom: 15px;
    right: 15px;
  }
}

/* Modal publicité */
#mia-ad-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mia-ad-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.mia-ad-content {
  position: relative;
  background: white;
  padding: 30px;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mia-ad-content h3 {
  margin: 0 0 15px 0;
  font-size: 24px;
  color: #333;
}

.mia-ad-content p {
  margin: 10px 0;
  color: #666;
  font-size: 16px;
}

.mia-ad-timer {
  position: relative;
  margin: 25px 0;
  height: 40px;
  background: #f0f0f0;
  border-radius: 20px;
  overflow: hidden;
}

.mia-ad-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.5s linear;
}

#mia-ad-countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: bold;
  color: #333;
  z-index: 1;
}

.mia-ad-note {
  font-size: 14px;
  color: #999;
  font-style: italic;
  margin-top: 15px;
}

/* Section pub dans le chat */
#mia-ad-section {
  padding: 12px 16px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  border-top: 1px solid #eee;
  display: block; /* Toujours visible pour regarder des pubs */
}

#mia-watch-ad-btn {
  width: 100%;
  padding: 12px;
  background: white;
  color: #ff6b6b;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#mia-watch-ad-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#mia-watch-ad-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}


