/* ============================================
   ULYSSE - ASSISTANT IA
   ============================================ */

#ulysse-widget {
  --ulysse-primary: #B48A3C;
  --ulysse-primary-dark: #8a6a2e;
  position: fixed;
  bottom: 120px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font-sans), system-ui, -apple-system, sans-serif;
}

/* Sur desktop, remettre en bas car pas de dock */
@media (min-width: 1024px) {
  #ulysse-widget {
    bottom: 24px;
  }
}

/* Dark Mode (default) */
.dark-mode #ulysse-widget,
#ulysse-widget {
  --ulysse-bg: #091A30;
  --ulysse-bg-secondary: #0d2240;
  --ulysse-text: #ffffff;
  --ulysse-text-muted: #94a3b8;
  --ulysse-border: rgba(255, 255, 255, 0.1);
  --ulysse-message-bg: rgba(255, 255, 255, 0.08);
}

/* Light Mode */
body:not(.dark-mode) #ulysse-widget {
  --ulysse-bg: #FCF9EF;
  --ulysse-bg-secondary: #f5f0e1;
  --ulysse-text: #091A30;
  --ulysse-text-muted: #64748b;
  --ulysse-border: rgba(9, 26, 48, 0.1);
  --ulysse-message-bg: rgba(9, 26, 48, 0.05);
}

/* Toggle Button */
.ulysse-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ulysse-primary) 0%, var(--ulysse-primary-dark) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 4px 20px rgba(180, 138, 60, 0.4),
    0 0 40px rgba(180, 138, 60, 0.2);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
  overflow: hidden;
}

.ulysse-toggle:hover {
  transform: scale(1.1);
  box-shadow: 
    0 6px 30px rgba(180, 138, 60, 0.5),
    0 0 60px rgba(180, 138, 60, 0.3);
}

.ulysse-toggle.active {
  transform: scale(0.95);
}

.ulysse-toggle-icon {
  position: relative;
  width: 28px;
  height: 28px;
  color: white;
}

.ulysse-toggle-icon svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: all 0.3s ease;
}

.ulysse-icon-chat {
  opacity: 1;
  transform: scale(1) rotate(0);
}

.ulysse-icon-close {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

.ulysse-toggle.active .ulysse-icon-chat {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

.ulysse-toggle.active .ulysse-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* Pulse Animation */
.ulysse-toggle-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ulysse-primary);
  animation: ulysse-pulse 2s infinite;
  z-index: -1;
}

@keyframes ulysse-pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

.ulysse-toggle.active .ulysse-toggle-pulse {
  animation: none;
  opacity: 0;
}

/* Chat Window */
.ulysse-chat {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: var(--ulysse-bg);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ulysse-border);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow: hidden;
}

/* Light mode shadow adjustment */
body:not(.dark-mode) .ulysse-chat {
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.15),
    0 4px 20px rgba(180, 138, 60, 0.1);
}

.ulysse-chat.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.ulysse-header {
  padding: 20px;
  background: linear-gradient(135deg, rgba(180, 138, 60, 0.15) 0%, transparent 100%);
  border-bottom: 1px solid var(--ulysse-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ulysse-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ulysse-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ulysse-primary) 0%, var(--ulysse-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  position: relative;
  box-shadow: 0 4px 12px rgba(180, 138, 60, 0.3);
}

.ulysse-robot-icon {
  width: 24px;
  height: 24px;
}

.ulysse-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--ulysse-bg);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.ulysse-header-text h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ulysse-text);
  margin: 0;
}

.ulysse-header-text p {
  font-size: 12px;
  color: var(--ulysse-text-muted);
  margin: 0;
}

.ulysse-minimize {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ulysse-message-bg);
  border: 1px solid var(--ulysse-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ulysse-text-muted);
  transition: all 0.2s ease;
}

.ulysse-minimize:hover {
  background: var(--ulysse-bg-secondary);
  color: var(--ulysse-text);
  border-color: var(--ulysse-primary);
}

.ulysse-minimize svg {
  width: 16px;
  height: 16px;
}

/* Messages */
.ulysse-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ulysse-messages::-webkit-scrollbar {
  width: 6px;
}

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

.ulysse-messages::-webkit-scrollbar-thumb {
  background: var(--ulysse-border);
  border-radius: 3px;
}

.ulysse-messages::-webkit-scrollbar-thumb:hover {
  background: var(--ulysse-primary);
}

/* Message */
.ulysse-message {
  display: flex;
  animation: ulysse-message-in 0.3s ease;
}

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

.ulysse-message-content {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

.ulysse-message-user {
  justify-content: flex-end;
}

.ulysse-message-user .ulysse-message-content {
  flex-direction: row-reverse;
}

.ulysse-message-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ulysse-primary) 0%, var(--ulysse-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 8px rgba(180, 138, 60, 0.25);
}

.ulysse-robot-small {
  width: 18px;
  height: 18px;
}

.ulysse-message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ulysse-message-bot .ulysse-message-bubble {
  background: #091A30 !important;
  border: 1px solid rgba(180, 138, 60, 0.3);
  border-top-left-radius: 4px;
}

.ulysse-message-user .ulysse-message-bubble {
  background: linear-gradient(135deg, var(--ulysse-primary) 0%, var(--ulysse-primary-dark) 100%);
  border-top-right-radius: 4px;
}

.ulysse-message-bubble p {
  font-size: 14px;
  line-height: 1.5;
  color: #ffffff !important;
  margin: 0;
  word-break: break-word;
}

.ulysse-message-user .ulysse-message-bubble p {
  color: #ffffff !important;
}

.ulysse-message-bubble a {
  color: var(--ulysse-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.ulysse-message-bubble a:hover {
  text-decoration-thickness: 2px;
}

.ulysse-message-user .ulysse-message-bubble a {
  color: white;
}

/* Light mode link adjustments */
body:not(.dark-mode) .ulysse-message-bubble a {
  color: var(--ulysse-primary-dark);
}

.ulysse-message-time {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 6px;
  text-align: right;
}

.ulysse-message-user .ulysse-message-time {
  color: rgba(255, 255, 255, 0.8);
}

/* Input */
.ulysse-input-container {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--ulysse-border);
  position: relative;
}

.ulysse-typing {
  position: absolute;
  top: -30px;
  left: 20px;
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--ulysse-message-bg);
  border-radius: 12px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.ulysse-typing.active {
  opacity: 1;
  visibility: visible;
}

.ulysse-typing span {
  width: 6px;
  height: 6px;
  background: var(--ulysse-primary);
  border-radius: 50%;
  animation: ulysse-typing-dot 1.4s infinite;
}

.ulysse-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ulysse-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ulysse-typing-dot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.ulysse-form {
  display: flex;
  gap: 10px;
}

.ulysse-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--ulysse-message-bg);
  border: 1px solid var(--ulysse-border);
  border-radius: 14px;
  color: var(--ulysse-text);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.ulysse-input::placeholder {
  color: var(--ulysse-text-muted);
}

.ulysse-input:focus {
  border-color: var(--ulysse-primary);
  background: var(--ulysse-bg-secondary);
}

.ulysse-send {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--ulysse-primary) 0%, var(--ulysse-primary-dark) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
}

.ulysse-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(180, 138, 60, 0.4);
}

.ulysse-send:active {
  transform: scale(0.95);
}

.ulysse-send svg {
  width: 20px;
  height: 20px;
}

/* Responsive */
@media (max-width: 480px) {
  #ulysse-widget {
    bottom: 110px;
    right: 16px;
  }

  .ulysse-toggle {
    width: 54px;
    height: 54px;
  }

  .ulysse-chat {
    bottom: 74px;
    width: calc(100vw - 32px);
    height: calc(100vh - 200px);
    max-height: 450px;
    border-radius: 20px;
  }

  .ulysse-header {
    padding: 16px;
  }

  .ulysse-messages {
    padding: 16px;
  }

  .ulysse-input-container {
    padding: 12px 16px 16px;
  }
}

