/* ============================================
   CHATBOX PREMIUM - DARK & MINIMALIST
   Design luxueux blanc/noir/doré
   Mobile First & SEO Friendly
   ============================================ */

/* Variables */
:root {
  --chatbox-dark: rgba(250, 250, 250, 0.95);
  --chatbox-dark-elevated: rgba(255, 255, 255, 0.98);
  --chatbox-accent: #d4af37;
  --chatbox-accent-hover: #c9a227;
  --chatbox-text-primary: #0a0a0a;
  --chatbox-text-secondary: rgba(0, 0, 0, 0.65);
  --chatbox-border: rgba(212, 175, 55, 0.25);
}

/* ============================================
   BOUTON FLOTTANT
   ============================================ */

.chatbox-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--chatbox-border);
  border-radius: 50%;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(212, 175, 55, 0.15);
  cursor: pointer;
  user-select: none;
  z-index: 999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbox-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.05));
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chatbox-toggle:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 8px 30px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(212, 175, 55, 0.3);
  border-color: var(--chatbox-accent);
}

.chatbox-toggle:hover::before {
  opacity: 1;
}

/* Icône SVG */
.chatbox-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--chatbox-accent);
  position: relative;
  z-index: 1;
}

.chatbox-toggle.active {
  display: none;
}

/* Badge de notification */
.chatbox-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  background: var(--chatbox-accent);
  border: 2px solid var(--chatbox-dark);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--chatbox-dark);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ============================================
   CONTENEUR CHATBOX
   ============================================ */

.chatbox-container {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  max-height: 600px;
  display: none;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--chatbox-border);
  border-radius: 16px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(212, 175, 55, 0.1);
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  animation: chatboxSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.chatbox-container.active {
  display: flex;
}

@keyframes chatboxSlideIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   HEADER
   ============================================ */

.chatbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 16px 16px 0 0;
  height: 100%;
  width: 100%;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  background: linear-gradient(90deg, var(--sd-accent), #e8c968);
  backdrop-filter: blur(20px);
}

.chatbox-header h3 {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--chatbox-text-primary);
  letter-spacing: 0.02em;
}

.chatbox-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chatbox-close svg {
  width: 16px;
  height: 16px;
  color: var(--chatbox-text-secondary);
}

.chatbox-close:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--chatbox-accent);
}

.chatbox-close:hover svg {
  color: var(--chatbox-accent);
}

/* ============================================
   MESSAGES
   ============================================ */

.chatbox-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(250, 250, 250, 0.5);
  backdrop-filter: blur(10px);
  overflow-y: auto;
}

/* Messages du bot */
.message.bot .bubble {
  max-width: 85%;
  padding: 0.875rem 1.125rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px 12px 12px 4px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--chatbox-text-primary);
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Scrollbar sombre */
.chatbox-messages::-webkit-scrollbar {
  width: 6px;
}

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

.chatbox-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.chatbox-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.3);
}

.message {
  display: flex;
  animation: messageSlideIn 0.3s ease;
}

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

/* Messages du bot */
.message.bot {
  justify-content: flex-start;
}

.message.bot .bubble {
  max-width: 85%;
  padding: 0.875rem 1.125rem;
  background: var(--chatbox-dark-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px 12px 12px 4px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--chatbox-text-primary);
  line-height: 1.6;
}

/* Messages de l'utilisateur */
.message.user {
  justify-content: flex-end;
}

.message.user .bubble {
  max-width: 85%;
  padding: 0.875rem 1.125rem;
  background: linear-gradient(135deg, var(--chatbox-accent), #c9a227);
  border-radius: 12px 12px 4px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--chatbox-dark);
  line-height: 1.6;
}

/* ============================================
   FOOTER - ACTIONS
   ============================================ */

.chatbox-footer {
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-top: 2px solid rgba(212, 175, 55, 0.2);
  border-radius: 0 0 16px 16px;
}

.chatbox-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chatbox-btn {
  padding: 0.875rem 1.125rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--chatbox-text-primary);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.chatbox-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.05));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.chatbox-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--chatbox-accent);
  color: var(--chatbox-accent);
  transform: translateX(4px);
}

.chatbox-btn:hover::before {
  opacity: 1;
}

.chatbox-btn:active {
  transform: translateX(2px);
}

/* Bouton sélectionné */
.chatbox-btn.active {
  background: linear-gradient(135deg, var(--chatbox-accent), #c9a227);
  border-color: transparent;
  color: var(--chatbox-dark);
}

/* Liens directs (téléphone, email) */

/* ============================================
   RESPONSIVE - MOBILE FIRST
   ============================================ */

@media (max-width: 480px) {
  .chatbox-toggle {
    bottom: 20px;
    right: 20px;
    width: 52px;
    height: 52px;
  }

  .chatbox-toggle svg {
    width: 22px;
    height: 22px;
  }

  .chatbox-badge {
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }

  .chatbox-container {
    width: calc(100vw - 30px);
    max-width: 100%;
    bottom: 85px;
    right: 15px;
    max-height: calc(100vh - 150px);
    border-radius: 16px 16px 0 0;
  }

  .chatbox-header {
    padding: 1rem 1.25rem;
  }

  .chatbox-header h3 {
    font-size: 1.125rem;
  }

  .chatbox-messages {
    padding: 1.25rem;
  }

  .chatbox-footer {
    padding: 1rem 1.25rem;
  }

  .chatbox-btn {
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
  }
}

/* Très petits écrans */
@media (max-width: 360px) {
  .chatbox-container {
    width: calc(100vw - 20px);
    right: 10px;
  }

  .message.bot .bubble,
  .message.user .bubble {
    max-width: 90%;
    font-size: 0.8rem;
  }
}