/* C:\IA\chatbot\chatbot.css */
/* Styles complets pour le Chatbot Mathématique Albert • Style Google Gemini */

:root {
  --morant-orange: #ff5e36;
  --morant-purple: #7928ca;
  --morant-gradient: linear-gradient(135deg, #ff5e36 0%, #a820c7 50%, #7928ca 100%);
  --gemini-bg: #ffffff;
  --gemini-border: rgba(121, 40, 202, 0.22);
  --gemini-shadow: 0 6px 24px rgba(121, 40, 202, 0.12), 0 2px 6px rgba(0, 0, 0, 0.05);
  --gemini-shadow-hover: 0 10px 32px rgba(121, 40, 202, 0.22), 0 4px 10px rgba(0, 0, 0, 0.08);
  --text-main: #1f2937;
  --text-muted: #64748b;
  --bot-bubble-bg: #ffffff;
  --bot-bubble-border: #e2e8f0;
  --user-bubble-bg: #f5f3ff;
  --user-bubble-border: #ddd6fe;
  --user-bubble-text: #1e1b4b;
}

[data-morant-theme="dark"] {
  --gemini-bg: #131b2e;
  --gemini-border: rgba(168, 85, 247, 0.35);
  --gemini-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  --gemini-shadow-hover: 0 12px 36px rgba(0, 0, 0, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --bot-bubble-bg: #131b2e;
  --bot-bubble-border: #1e293b;
  --user-bubble-bg: #1e1b4b;
  --user-bubble-border: #4338ca;
  --user-bubble-text: #e0e7ff;
}

/* ============================================================
   CONTENEUR PRINCIPAL PLEIN ÉCRAN
   ============================================================ */
.morant-gemini-app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  width: 100% !important;
  position: relative !important;
  overflow: hidden !important;
  background: #fbfcfe !important;
  color: var(--text-main) !important;
  box-sizing: border-box !important;
}

[data-morant-theme="dark"] .morant-gemini-app {
  background: #0b0f19 !important;
}

.morant-gemini-app * {
  box-sizing: border-box !important;
}

/* ============================================================
   EN-TÊTE SUPÉRIEUR (STYLE GEMINI APP)
   ============================================================ */
.morant-gemini-top-header {
  flex: 0 0 54px !important;
  height: 54px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 20px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid #edf0f5 !important;
  z-index: 20 !important;
}

[data-morant-theme="dark"] .morant-gemini-top-header {
  background: rgba(11, 15, 25, 0.92) !important;
  border-bottom-color: #1e293b !important;
}

.morant-top-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.morant-gemini-avatar {
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  background: var(--morant-gradient) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(121, 40, 202, 0.25) !important;
  flex-shrink: 0 !important;
}

.morant-gemini-header-text {
  display: flex !important;
  flex-direction: column !important;
  line-height: 1.2 !important;
}

.morant-gemini-title {
  margin: 0 !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

[data-morant-theme="dark"] .morant-gemini-title {
  color: #f8fafc !important;
}

.morant-badge-subtle {
  display: inline-flex !important;
  align-items: center !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  padding: 2px 9px !important;
  background: rgba(99, 102, 241, 0.12) !important;
  color: #4f46e5 !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.2s ease !important;
}

.morant-badge-subtle:hover {
  background: rgba(99, 102, 241, 0.22) !important;
  transform: translateY(-1px) !important;
}

[data-morant-theme="dark"] .morant-badge-subtle {
  background: rgba(99, 102, 241, 0.24) !important;
  color: #a5b4fc !important;
  border-color: rgba(99, 102, 241, 0.45) !important;
}

.morant-badge-subtle.is-ansu {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #047857 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

.morant-badge-subtle.is-ansu:hover {
  background: rgba(16, 185, 129, 0.25) !important;
}

[data-morant-theme="dark"] .morant-badge-subtle.is-ansu {
  background: rgba(16, 185, 129, 0.24) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
}

.morant-gemini-subtitle {
  margin: 2px 0 0 0 !important;
  font-size: 0.75rem !important;
  color: #059669 !important;
  font-weight: 600 !important;
}

[data-morant-theme="dark"] .morant-gemini-subtitle {
  color: #34d399 !important;
}

/* ============================================================
   SWITCH DE MODE PÉDAGOGIQUE (OBSOLÈTE / MASQUÉ CAR DOUBLON)
   ============================================================ */
.morant-mode-switch {
  display: none !important;
}

.morant-top-header-right {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.morant-btn-new-chat {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.morant-btn-new-chat:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-morant-theme="dark"] .morant-btn-new-chat {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

[data-morant-theme="dark"] .morant-btn-new-chat:hover {
  background: #334155 !important;
  color: #f8fafc !important;
}

/* ============================================================
   ZONE DE DÉFILEMENT DE LA CONVERSATION
   ============================================================ */
.morant-chat-scroll-area {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  position: relative !important;
  scroll-behavior: smooth !important;
}

.morant-chat-content-wrap {
  max-width: 860px !important;
  margin: 0 auto !important;
  padding: 24px 20px 150px 20px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 18px !important;
  min-height: 100% !important;
}

/* ============================================================
   ÉCRAN D'ACCUEIL GEMINI (INITIAL)
   ============================================================ */
.morant-gemini-hero-welcome {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  padding: 42px 20px 28px 20px !important;
  border-radius: 24px !important;
  transition: background 0.3s ease, border-color 0.3s ease !important;
  animation: morantFadeIn 0.35s ease-out !important;
}

.morant-gemini-hero-welcome.is-tutor {
  background: radial-gradient(circle at 50% 18%, rgba(99, 102, 241, 0.08) 0%, rgba(255, 255, 255, 0) 70%) !important;
}

[data-morant-theme="dark"] .morant-gemini-hero-welcome.is-tutor {
  background: radial-gradient(circle at 50% 18%, rgba(99, 102, 241, 0.12) 0%, rgba(11, 15, 25, 0) 70%) !important;
}

.morant-gemini-hero-welcome.is-ansu {
  background: radial-gradient(circle at 50% 18%, rgba(16, 185, 129, 0.10) 0%, rgba(255, 255, 255, 0) 70%) !important;
}

[data-morant-theme="dark"] .morant-gemini-hero-welcome.is-ansu {
  background: radial-gradient(circle at 50% 18%, rgba(16, 185, 129, 0.14) 0%, rgba(11, 15, 25, 0) 70%) !important;
}

.morant-hero-sparkle {
  font-size: 42px !important;
  margin-bottom: 14px !important;
  filter: drop-shadow(0 2px 8px rgba(255, 94, 54, 0.35)) !important;
  transition: transform 0.25s ease !important;
}

.morant-hero-greeting {
  font-family: 'Outfit', sans-serif !important;
  font-size: 2.1rem !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  background: var(--morant-gradient) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  margin: 0 0 12px 0 !important;
  letter-spacing: -0.5px !important;
  transition: all 0.3s ease !important;
}

.morant-gemini-hero-welcome.is-ansu .morant-hero-greeting {
  background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.morant-hero-intro {
  font-size: 1.05rem !important;
  color: #4b5563 !important;
  max-width: 620px !important;
  line-height: 1.55 !important;
  margin: 0 0 28px 0 !important;
  transition: color 0.3s ease !important;
}

[data-morant-theme="dark"] .morant-hero-intro {
  color: #94a3b8 !important;
}

/* ============================================================
   CARTES DE CHOIX DE MODE SUR L'ACCUEIL
   ============================================================ */
.morant-hero-mode-cards {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 14px !important;
  width: 100% !important;
  max-width: 660px !important;
  margin: 0 auto 22px auto !important;
}

.morant-hero-mode-card {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  padding: 16px 18px !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  border: 2px solid #e2e8f0 !important;
  text-align: left !important;
  cursor: pointer !important;
  transition: all 0.22s ease !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

[data-morant-theme="dark"] .morant-hero-mode-card {
  background: #131b2e !important;
  border-color: #1e293b !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
}

.morant-hero-mode-card:hover {
  transform: translateY(-2px) !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08) !important;
}

[data-morant-theme="dark"] .morant-hero-mode-card:hover {
  border-color: #334155 !important;
}

.morant-hero-mode-card.is-active[data-mode="tutor"] {
  border-color: #6366f1 !important;
  background: #eef2ff !important;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.22) !important;
}

[data-morant-theme="dark"] .morant-hero-mode-card.is-active[data-mode="tutor"] {
  background: #1e1b4b !important;
  border-color: #818cf8 !important;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35) !important;
}

.morant-hero-mode-card.is-active[data-mode="ansu"] {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.22) !important;
}

[data-morant-theme="dark"] .morant-hero-mode-card.is-active[data-mode="ansu"] {
  background: #064e3b !important;
  border-color: #34d399 !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35) !important;
}

.morant-hero-mode-icon {
  font-size: 24px !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  margin-top: 2px !important;
}

.morant-hero-mode-text {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
}

.morant-hero-mode-text strong {
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
}

[data-morant-theme="dark"] .morant-hero-mode-text strong {
  color: #f8fafc !important;
}

.morant-hero-mode-text p {
  margin: 0 !important;
  font-size: 0.78rem !important;
  color: #64748b !important;
  line-height: 1.35 !important;
}

[data-morant-theme="dark"] .morant-hero-mode-text p {
  color: #94a3b8 !important;
}

@media (max-width: 640px) {
  .morant-hero-mode-cards {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

.morant-hero-level-pills {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 12px !important;
  background: rgba(255, 255, 255, 0.75) !important;
  border: 1.5px dashed rgba(168, 85, 247, 0.45) !important;
  padding: 18px 24px !important;
  border-radius: 20px !important;
  backdrop-filter: blur(8px) !important;
  box-shadow: 0 4px 16px rgba(121, 40, 202, 0.06) !important;
}

[data-morant-theme="dark"] .morant-hero-level-pills {
  background: rgba(30, 41, 59, 0.6) !important;
  border-color: rgba(168, 85, 247, 0.3) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

.morant-hero-pills-title {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  color: #6b21a8 !important;
}

[data-morant-theme="dark"] .morant-hero-pills-title {
  color: #c084fc !important;
}

.morant-hero-pills-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  justify-content: center !important;
}

.morant-hero-pill {
  background: #ffffff !important;
  border: 1.5px solid #d8b4fe !important;
  color: #6b21a8 !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  padding: 9px 18px !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 6px rgba(121, 40, 202, 0.08) !important;
}

.morant-hero-pill:hover {
  background: #7928ca !important;
  color: #ffffff !important;
  border-color: #7928ca !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(121, 40, 202, 0.25) !important;
}

.morant-hero-pill.is-selected {
  background: var(--morant-gradient) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 14px rgba(121, 40, 202, 0.3) !important;
}

[data-morant-theme="dark"] .morant-hero-pill {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #e2e8f0 !important;
}

[data-morant-theme="dark"] .morant-hero-pill:hover {
  background: #9333ea !important;
  border-color: #9333ea !important;
  color: #ffffff !important;
}

/* ============================================================
   FLUX DES MESSAGES
   ============================================================ */
.morant-chat-messages {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  width: 100% !important;
}

.morant-msg {
  display: flex !important;
  flex-direction: column !important;
  max-width: 90% !important;
  animation: morantFadeIn 0.2s ease-out !important;
}

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

.morant-msg.user {
  align-self: flex-end !important;
}

.morant-msg.assistant {
  align-self: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
}

.morant-msg-bubble {
  padding: 16px 22px !important;
  border-radius: 18px !important;
  font-size: 0.98rem !important;
  line-height: 1.65 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

.morant-msg.user .morant-msg-bubble {
  background: var(--user-bubble-bg) !important;
  border: 1px solid var(--user-bubble-border) !important;
  color: var(--user-bubble-text) !important;
  border-bottom-right-radius: 4px !important;
}

.morant-msg.assistant .morant-msg-bubble {
  background: var(--bot-bubble-bg) !important;
  border: 1px solid var(--bot-bubble-border) !important;
  color: var(--text-main) !important;
  border-bottom-left-radius: 4px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

[data-morant-theme="dark"] .morant-msg.assistant .morant-msg-bubble {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

/* Formatage Typographique dans les bulles */
.morant-msg-bubble h1,
.morant-msg-bubble h2,
.morant-msg-bubble h3,
.morant-msg-bubble h4 {
  color: #1e1b4b !important;
  margin: 14px 0 8px 0 !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

[data-morant-theme="dark"] .morant-msg-bubble h1,
[data-morant-theme="dark"] .morant-msg-bubble h2,
[data-morant-theme="dark"] .morant-msg-bubble h3,
[data-morant-theme="dark"] .morant-msg-bubble h4 {
  color: #f8fafc !important;
}

.morant-msg-bubble p {
  margin: 0 0 10px 0 !important;
}

.morant-msg-bubble p:last-child {
  margin-bottom: 0 !important;
}

.morant-msg-bubble ul,
.morant-msg-bubble ol {
  margin: 8px 0 12px 0 !important;
  padding-left: 24px !important;
}

.morant-msg-bubble li {
  margin-bottom: 6px !important;
}

.morant-msg-bubble strong,
.morant-msg-bubble b {
  font-weight: 700 !important;
  color: #0f172a !important;
}

[data-morant-theme="dark"] .morant-msg-bubble strong,
[data-morant-theme="dark"] .morant-msg-bubble b {
  color: #f8fafc !important;
}

.morant-msg-bubble blockquote {
  border-left: 4px solid var(--morant-purple) !important;
  margin: 12px 0 !important;
  padding: 8px 16px !important;
  background: #faf5ff !important;
  border-radius: 0 8px 8px 0 !important;
  color: #4b5563 !important;
}

[data-morant-theme="dark"] .morant-msg-bubble blockquote {
  background: #1e1b4b !important;
  color: #cbd5e1 !important;
  border-left-color: #a855f7 !important;
}

/* ============================================================
   TABLEAUX DANS LES BULLES DE DISCUSSION (GFM MARKDOWN)
   ============================================================ */
.morant-table-responsive {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  margin: 14px 0 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04) !important;
  background: #ffffff !important;
}

[data-morant-theme="dark"] .morant-table-responsive {
  border-color: #334155 !important;
  background: #0f172a !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

.elementor .morant-msg-bubble table,
.morant-msg-bubble table {
  width: 100% !important;
  min-width: 100% !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  margin: 0 !important;
  font-size: 0.88rem !important;
  line-height: 1.45 !important;
  text-align: left !important;
  border: none !important;
}

.elementor .morant-msg-bubble thead,
.morant-msg-bubble thead {
  background: #f5f3ff !important;
}

.elementor .morant-msg-bubble th,
.morant-msg-bubble th {
  background: #f3e8ff !important;
  color: #581c87 !important;
  font-weight: 700 !important;
  padding: 10px 14px !important;
  border-bottom: 2px solid #ddd6fe !important;
  border-right: 1px solid #e2e8f0 !important;
  white-space: nowrap !important;
  text-align: left !important;
}

.elementor .morant-msg-bubble th:last-child,
.morant-msg-bubble th:last-child {
  border-right: none !important;
}

.elementor .morant-msg-bubble td,
.morant-msg-bubble td {
  padding: 9px 13px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-right: 1px solid #e2e8f0 !important;
  color: var(--text-main) !important;
  vertical-align: middle !important;
}

.elementor .morant-msg-bubble td:last-child,
.morant-msg-bubble td:last-child {
  border-right: none !important;
}

.elementor .morant-msg-bubble tbody tr:last-child td,
.morant-msg-bubble tbody tr:last-child td {
  border-bottom: none !important;
}

.elementor .morant-msg-bubble tbody tr:nth-child(even),
.morant-msg-bubble tbody tr:nth-child(even) {
  background: #faf5ff !important;
}

.elementor .morant-msg-bubble tbody tr:hover,
.morant-msg-bubble tbody tr:hover {
  background: rgba(121, 40, 202, 0.04) !important;
}

/* Mode sombre pour les tableaux */
[data-morant-theme="dark"] .elementor .morant-msg-bubble thead,
[data-morant-theme="dark"] .morant-msg-bubble thead {
  background: #1e1b4b !important;
}

[data-morant-theme="dark"] .elementor .morant-msg-bubble th,
[data-morant-theme="dark"] .morant-msg-bubble th {
  background: #2e1065 !important;
  color: #e9d5ff !important;
  border-bottom-color: #4338ca !important;
  border-right-color: #334155 !important;
}

[data-morant-theme="dark"] .elementor .morant-msg-bubble td,
[data-morant-theme="dark"] .morant-msg-bubble td {
  border-bottom-color: #334155 !important;
  border-right-color: #334155 !important;
  color: var(--text-main) !important;
}

[data-morant-theme="dark"] .elementor .morant-msg-bubble tbody tr:nth-child(even),
[data-morant-theme="dark"] .morant-msg-bubble tbody tr:nth-child(even) {
  background: #1e293b !important;
}

[data-morant-theme="dark"] .elementor .morant-msg-bubble tbody tr:hover,
[data-morant-theme="dark"] .morant-msg-bubble tbody tr:hover {
  background: rgba(168, 85, 247, 0.12) !important;
}

/* KaTeX et Formules Mathématiques */
.morant-msg-bubble .katex-display {
  margin: 14px 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 8px 0 !important;
}

.morant-msg-bubble .katex-inline {
  padding: 0 3px !important;
}

[data-morant-theme="dark"] .morant-msg-bubble .katex {
  color: #f1f5f9 !important;
}

/* Rétablissement strict des SVG KaTeX (chapeaux d'angles, racines, flèches) */
.elementor .morant-msg-bubble .katex svg,
.elementor .morant-msg-bubble .katex-html svg,
.morant-msg-bubble .katex svg,
.morant-msg-bubble .katex-html svg {
  display: inline-block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  max-width: none !important;
  box-sizing: content-box !important;
}

/* Images & Figures Géométriques dans les bulles */
.elementor .morant-msg-bubble img,
.morant-msg-bubble img {
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
  margin: 14px auto !important;
  border-radius: 12px !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
  background: #ffffff !important;
}

[data-morant-theme="dark"] .morant-msg-bubble img {
  border-color: #334155 !important;
}

/* Dessins SVG géométriques dynamiques (hors KaTeX) */
.elementor .morant-msg-bubble svg:not(.katex svg):not(.katex-html svg),
.morant-msg-bubble svg:not(.katex svg):not(.katex-html svg) {
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
  margin: 14px auto !important;
  border-radius: 12px !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
  background: #ffffff !important;
  padding: 8px !important;
}

[data-morant-theme="dark"] .morant-msg-bubble svg:not(.katex svg):not(.katex-html svg) {
  border-color: #334155 !important;
  background: #0f172a !important;
}

/* Image utilisateur jointe */
.morant-msg.user .morant-msg-image {
  margin-bottom: 8px !important;
}

.morant-msg.user .morant-msg-image img {
  max-width: 240px !important;
  max-height: 200px !important;
  border-radius: 10px !important;
  border: 2px solid rgba(255, 255, 255, 0.4) !important;
  display: block !important;
  cursor: zoom-in !important;
  object-fit: contain !important;
  background: rgba(0, 0, 0, 0.15) !important;
}

/* ============================================================
   BOUTONS D'ACTION RAPIDE SOUS LES BULLES DE L'ASSISTANT
   ============================================================ */
.morant-quick-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  margin-top: 10px !important;
}

.morant-quick-action-btn {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  padding: 5px 11px !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  transition: all 0.18s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.morant-quick-action-btn:hover {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  transform: translateY(-1px) !important;
}

[data-morant-theme="dark"] .morant-quick-action-btn {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

[data-morant-theme="dark"] .morant-quick-action-btn:hover {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
}

.morant-quick-action-btn.morant-ansu-action-btn {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #047857 !important;
}

.morant-quick-action-btn.morant-ansu-action-btn:hover {
  background: #d1fae5 !important;
  border-color: #34d399 !important;
  color: #065f46 !important;
}

[data-morant-theme="dark"] .morant-quick-action-btn.morant-ansu-action-btn {
  background: #064e3b !important;
  border-color: #059669 !important;
  color: #6ee7b7 !important;
}

[data-morant-theme="dark"] .morant-quick-action-btn.morant-ansu-action-btn:hover {
  background: #047857 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}

/* ============================================================
   SUGGESTIONS RAPIDES / CHIPS
   ============================================================ */
.morant-gemini-chips {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-top: 8px !important;
  justify-content: flex-start !important;
}

.morant-gemini-chip {
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 9999px !important;
  padding: 7px 15px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  color: #475569 !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.2s ease !important;
}

.morant-gemini-chip:hover {
  background: #faf5ff !important;
  border-color: #d8b4fe !important;
  color: var(--morant-purple) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 8px rgba(121, 40, 202, 0.12) !important;
}

.morant-gemini-chip.is-ansu {
  border-color: #a7f3d0 !important;
  color: #047857 !important;
}

.morant-gemini-chip.is-ansu:hover {
  background: #ecfdf5 !important;
  border-color: #6ee7b7 !important;
  color: #065f46 !important;
}

[data-morant-theme="dark"] .morant-gemini-chip {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
}

[data-morant-theme="dark"] .morant-gemini-chip:hover {
  background: #334155 !important;
  border-color: #9333ea !important;
  color: #c084fc !important;
}

/* ============================================================
   BARRE DE SAISIE FLOTTANTE UNIQUE EN BAS (STYLE GOOGLE GEMINI)
   ============================================================ */
.morant-gemini-bottom-bar-wrap {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  pointer-events: none !important;
  z-index: 30 !important;
  background: linear-gradient(180deg, rgba(251, 252, 254, 0) 0%, rgba(251, 252, 254, 0.92) 28%, #fbfcfe 100%) !important;
  padding: 24px 0 12px 0 !important;
}

[data-morant-theme="dark"] .morant-gemini-bottom-bar-wrap {
  background: linear-gradient(180deg, rgba(11, 15, 25, 0) 0%, rgba(11, 15, 25, 0.94) 28%, #0b0f19 100%) !important;
}

.morant-bottom-inner {
  max-width: 860px !important;
  margin: 0 auto !important;
  padding: 0 16px !important;
  pointer-events: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
}

/* La Pill Bar unique */
.morant-gemini-pill-bar {
  display: flex !important;
  align-items: flex-end !important;
  background: #ffffff !important;
  border: 1.5px solid rgba(121, 40, 202, 0.25) !important;
  border-radius: 24px !important;
  padding: 5px 8px 5px 12px !important;
  box-shadow: var(--gemini-shadow) !important;
  gap: 8px !important;
  width: 100% !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-morant-theme="dark"] .morant-gemini-pill-bar {
  background: #131b2e !important;
  border-color: rgba(168, 85, 247, 0.35) !important;
}

.morant-gemini-pill-bar:hover,
.morant-gemini-pill-bar:focus-within {
  border-color: #9333ea !important;
  box-shadow: var(--gemini-shadow-hover) !important;
  transform: translateY(-1px) !important;
}

[data-morant-theme="dark"] .morant-gemini-pill-bar:hover,
[data-morant-theme="dark"] .morant-gemini-pill-bar:focus-within {
  border-color: #c084fc !important;
}

/* Bouton Caméra / Photo */
.morant-btn-photo {
  background: transparent !important;
  border: none !important;
  padding: 6px !important;
  margin: 0 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  color: #64748b !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  width: 36px !important;
  height: 36px !important;
}

.morant-btn-photo:hover {
  background: #f1f5f9 !important;
  color: #7928ca !important;
  transform: scale(1.08) !important;
}

[data-morant-theme="dark"] .morant-btn-photo {
  color: #94a3b8 !important;
}

[data-morant-theme="dark"] .morant-btn-photo:hover {
  background: #1e293b !important;
  color: #c084fc !important;
}

/* Champ de texte de saisie */
.elementor .morant-gemini-input,
.morant-gemini-input {
  flex: 1 1 auto !important;
  border: none !important;
  border-width: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  background-color: transparent !important;
  padding: 8px 10px !important;
  margin: 0 !important;
  font-size: 1rem !important;
  color: #0f172a !important;
  min-width: 0 !important;
  line-height: 1.45 !important;
  resize: none !important;
  min-height: 24px !important;
  max-height: 160px !important;
  overflow-y: hidden !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  font-family: inherit !important;
  field-sizing: content !important;
}

[data-morant-theme="dark"] .elementor .morant-gemini-input,
[data-morant-theme="dark"] .morant-gemini-input {
  color: #f8fafc !important;
}

.morant-gemini-input::placeholder {
  color: #94a3b8 !important;
  font-size: 0.95rem !important;
  font-weight: 400 !important;
}

[data-morant-theme="dark"] .morant-gemini-input::placeholder {
  color: #64748b !important;
}

/* Sélecteur de niveau dans la pill bar */
.morant-level-wrapper {
  position: relative !important;
  flex-shrink: 0 !important;
}

.morant-gemini-level-select {
  border: 1.5px solid #e2e8f0 !important;
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  border-radius: 9999px !important;
  padding: 6px 12px !important;
  outline: none !important;
  cursor: pointer !important;
  transition: all 0.22s ease !important;
}

[data-morant-theme="dark"] .morant-gemini-level-select {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

.morant-gemini-level-select.morant-level-unselected {
  border: 1.5px dashed #a855f7 !important;
  background: #faf5ff !important;
  color: #7e22ce !important;
}

[data-morant-theme="dark"] .morant-gemini-level-select.morant-level-unselected {
  background: #2e1065 !important;
  border-color: #c084fc !important;
  color: #e9d5ff !important;
}

.morant-gemini-level-select.morant-level-selected {
  border-color: #7928ca !important;
  background: #f3e8ff !important;
  color: #6b21a8 !important;
}

[data-morant-theme="dark"] .morant-gemini-level-select.morant-level-selected {
  background: #3b0764 !important;
  border-color: #a855f7 !important;
  color: #f3e8ff !important;
}

/* Animation d'alerte pour choisir la classe */
@keyframes morantPulseAlert {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.6); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(168, 85, 247, 0); }
}

.morant-pulse-level {
  animation: morantPulseAlert 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2 !important;
}

/* Bouton d'envoi circulaire */
.morant-gemini-send-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  border-radius: 50% !important;
  border: none !important;
  background: var(--morant-gradient) !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 3px 12px rgba(121, 40, 202, 0.3) !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease !important;
  padding: 0 !important;
  color: #ffffff !important;
}

.morant-gemini-send-btn:hover {
  transform: scale(1.06) !important;
  box-shadow: 0 4px 16px rgba(121, 40, 202, 0.45) !important;
}

.morant-gemini-send-btn:active {
  transform: scale(0.95) !important;
}

.morant-gemini-send-btn.is-ansu {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.35) !important;
}

.morant-gemini-send-btn.is-ansu:hover {
  transform: scale(1.06) !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5) !important;
}

.morant-gemini-send-btn svg {
  width: 18px !important;
  height: 18px !important;
  fill: #ffffff !important;
  color: #ffffff !important;
  display: block !important;
  pointer-events: none !important;
}

/* Boîte d'aperçu de photo attachée */
.morant-img-preview-box {
  display: none !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 8px 14px !important;
  background: #ffffff !important;
  border: 1.5px solid #d8b4fe !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 14px rgba(121, 40, 202, 0.1) !important;
  width: 100% !important;
  animation: morantFadeIn 0.2s ease-out !important;
}

[data-morant-theme="dark"] .morant-img-preview-box {
  background: #1e293b !important;
  border-color: #6b21a8 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
}

.morant-img-preview-box.is-active {
  display: flex !important;
}

.morant-img-preview-wrap {
  position: relative !important;
  display: inline-block !important;
}

.morant-img-preview-thumb {
  width: 46px !important;
  height: 46px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 1.5px solid #cbd5e1 !important;
  display: block !important;
}

.morant-img-preview-remove {
  position: absolute !important;
  top: -6px !important;
  right: -6px !important;
  background: #ef4444 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 50% !important;
  width: 18px !important;
  height: 18px !important;
  font-size: 11px !important;
  font-weight: bold !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.morant-img-preview-meta {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

.morant-img-preview-title {
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  color: #1e1b4b !important;
}

[data-morant-theme="dark"] .morant-img-preview-title {
  color: #f8fafc !important;
}

.morant-img-preview-subtitle {
  font-size: 0.74rem !important;
  color: #64748b !important;
}

[data-morant-theme="dark"] .morant-img-preview-subtitle {
  color: #94a3b8 !important;
}

/* Disclaimer en dessous de la pill bar */
.morant-bottom-disclaimer {
  font-size: 0.72rem !important;
  color: #64748b !important;
  text-align: center !important;
  line-height: 1.3 !important;
}

[data-morant-theme="dark"] .morant-bottom-disclaimer {
  color: #94a3b8 !important;
}

.morant-bottom-disclaimer strong {
  color: #475569 !important;
}

[data-morant-theme="dark"] .morant-bottom-disclaimer strong {
  color: #cbd5e1 !important;
}

/* Mode AnSu toggle button */
.morant-header-mode-btn {
  background: #eff6ff !important;
  border: 1.5px solid #bfdbfe !important;
  color: #1d4ed8 !important;
  font-weight: 700 !important;
  font-size: 0.8rem !important;
  padding: 5px 11px !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}

.morant-header-mode-btn:hover {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
}

.morant-header-mode-btn.is-ansu {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #047857 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

.morant-header-mode-btn.is-ansu:hover {
  background: #d1fae5 !important;
  border-color: #6ee7b7 !important;
}

[data-morant-theme="dark"] .morant-header-mode-btn {
  background: #172554 !important;
  border-color: #1e3a8a !important;
  color: #93c5fd !important;
}

[data-morant-theme="dark"] .morant-header-mode-btn.is-ansu {
  background: #064e3b !important;
  border-color: #047857 !important;
  color: #a7f3d0 !important;
}

/* Loading Dots */
.morant-loading-dots {
  display: inline-flex !important;
  gap: 4px !important;
  padding: 6px 10px !important;
}

.morant-loading-dots span {
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: var(--morant-purple) !important;
  animation: morantBlink 1.4s infinite both !important;
}

.morant-loading-dots span:nth-child(2) { animation-delay: 0.2s !important; }
.morant-loading-dots span:nth-child(3) { animation-delay: 0.4s !important; }

@keyframes morantBlink {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Message d'invitation discret */
.morant-level-prompt-hint {
  text-align: center !important;
  font-size: 0.85rem !important;
  color: #7e22ce !important;
  background: #faf5ff !important;
  border: 1px dashed #c084fc !important;
  border-radius: 12px !important;
  padding: 8px 16px !important;
  margin: 0 auto !important;
  max-width: 90% !important;
}

[data-morant-theme="dark"] .morant-level-prompt-hint {
  background: #2e1065 !important;
  border-color: #a855f7 !important;
  color: #e9d5ff !important;
}

/* ============================================================
   RESPONSIVE (SMARTPHONES & TABLETTES)
   ============================================================ */
@media (max-width: 640px) {
  .morant-gemini-top-header {
    padding: 0 10px !important;
    height: 52px !important;
  }
  .morant-gemini-brand {
    gap: 8px !important;
  }
  .morant-gemini-avatar {
    width: 30px !important;
    height: 30px !important;
    font-size: 15px !important;
  }
  .morant-gemini-title {
    font-size: 0.95rem !important;
  }
  .morant-gemini-subtitle {
    display: none !important;
  }
  .morant-top-header-right {
    gap: 6px !important;
  }
  .morant-mode-switch {
    padding: 2px !important;
    gap: 2px !important;
  }
  .morant-mode-btn {
    padding: 5px 8px !important;
    font-size: 0.76rem !important;
    gap: 4px !important;
  }
  .morant-gemini-btn-icon {
    width: 34px !important;
    height: 34px !important;
    padding: 6px !important;
  }
  .morant-btn-new-chat-label {
    display: none !important;
  }
  .morant-gemini-hero-welcome {
    padding: 20px 8px 40px !important;
    gap: 12px !important;
  }
  .morant-hero-sparkle {
    font-size: 32px !important;
  }
  .morant-hero-greeting {
    font-size: 1.35rem !important;
    line-height: 1.25 !important;
    margin: 4px 0 8px !important;
  }
  .morant-hero-intro {
    font-size: 0.88rem !important;
    line-height: 1.45 !important;
    max-width: 100% !important;
  }
  .morant-hero-mode-cards {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin: 10px 0 0 !important;
    width: 100% !important;
  }
  .morant-hero-mode-card {
    padding: 12px 14px !important;
    border-radius: 14px !important;
  }
  .morant-hero-mode-icon {
    font-size: 20px !important;
  }
  .morant-hero-mode-text strong {
    font-size: 0.88rem !important;
  }
  .morant-hero-mode-text p {
    font-size: 0.75rem !important;
  }
  .morant-chat-scroll-area {
    -webkit-overflow-scrolling: touch !important;
  }
  .morant-chat-content-wrap {
    padding: 12px 10px calc(115px + env(safe-area-inset-bottom, 0px)) 10px !important;
  }
  .morant-msg {
    max-width: 95% !important;
  }
  .morant-msg-bubble {
    padding: 12px 15px !important;
    font-size: 0.92rem !important;
    line-height: 1.55 !important;
    border-radius: 16px !important;
  }
  .morant-table-responsive {
    margin: 10px 0 !important;
    border-radius: 8px !important;
  }
  .elementor .morant-msg-bubble table,
  .morant-msg-bubble table {
    font-size: 0.82rem !important;
  }
  .elementor .morant-msg-bubble th,
  .morant-msg-bubble th,
  .elementor .morant-msg-bubble td,
  .morant-msg-bubble td {
    padding: 7px 9px !important;
  }
  .morant-gemini-bottom-bar-wrap {
    padding: 14px 0 max(8px, env(safe-area-inset-bottom, 8px)) 0 !important;
  }
  .morant-bottom-inner {
    padding: 0 10px !important;
    gap: 6px !important;
  }
  .morant-gemini-pill-bar {
    padding: 4px 6px 4px 8px !important;
    gap: 6px !important;
  }
  .morant-btn-photo {
    width: 34px !important;
    height: 34px !important;
    padding: 4px !important;
  }
  .morant-btn-photo svg {
    width: 20px !important;
    height: 20px !important;
  }
  .elementor .morant-gemini-input,
  .morant-gemini-input {
    font-size: 16px !important;
    padding: 6px 6px !important;
  }
  .morant-gemini-level-select {
    padding: 5px 8px !important;
    font-size: 0.8rem !important;
    max-width: 92px !important;
  }
  .morant-gemini-send-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
  }
  .morant-bottom-disclaimer {
    font-size: 0.68rem !important;
    padding: 0 4px !important;
  }
}

@media (max-width: 380px) {
  .morant-mode-label-short {
    display: none !important;
  }
  .morant-mode-btn {
    padding: 5px 6px !important;
  }
  .morant-gemini-title {
    font-size: 0.88rem !important;
  }
  .morant-gemini-level-select {
    max-width: 80px !important;
    font-size: 0.76rem !important;
    padding: 5px 6px !important;
  }
}

/* ============================================================
   LIGHTBOX MODAL DIALOG
   ============================================================ */
.morant-lightbox-dialog {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: auto !important;
  max-width: 95vw !important;
  max-height: 95vh !important;
  outline: none !important;
  overflow: visible !important;
}

.morant-lightbox-dialog::backdrop {
  background: rgba(11, 15, 25, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  animation: morantFadeIn 0.2s ease-out !important;
}

.morant-lightbox-wrap {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

.morant-lightbox-close {
  position: absolute !important;
  top: -14px !important;
  right: -14px !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #e2e8f0 !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
  z-index: 10 !important;
  transition: transform 0.18s ease !important;
}

.morant-lightbox-close:hover {
  transform: scale(1.1) !important;
}

.morant-lightbox-media {
  background: #ffffff !important;
  padding: 10px !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
  max-width: 90vw !important;
  max-height: 85vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.morant-lightbox-img {
  max-width: 100% !important;
  max-height: 80vh !important;
  object-fit: contain !important;
  border-radius: 10px !important;
  display: block !important;
}

.morant-lightbox-caption {
  color: #f8fafc !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  margin-top: 10px !important;
  text-align: center !important;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6) !important;
}

