/**
 * KOAEE RESPONSIVE FIX
 * Corrections pour les problèmes d'affichage sur desktop scalé (150% Windows)
 * Date: 2026-02-24
 */

/* ============================================================================
   FIX 1: CHATBOT EN WIDGET SUR DESKTOP SCALÉ
   Viewport ~1280×800 (1920×1200 avec scaling 150%)
   ============================================================================ */

/* Override la media query tablette pour desktop scalé */
@media (min-width: 1024px) and (max-width: 1366px) {
  /* Forcer le chatbot en mode widget flottant, pas plein écran */
  #ubnbee_chatbox {
    width: 420px !important;
    height: 600px !important;
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(255, 107, 53, 0.2) !important;
    resize: both !important;
    overflow: auto !important;
  }

  #ubnbee_chatbox.visible {
    display: flex !important;
  }

  /* Réinitialiser les styles du header */
  .ubnbee_chat-header {
    cursor: move !important;
    padding: 10px 15px !important;
  }

  /* Réinitialiser les tailles de police */
  .ubnbee_message {
    font-size: 14px !important;
    max-width: 80% !important;
  }

  #ubnbee_welcome-message {
    font-size: 20px !important;
  }

  .ubnbee_chat-header span {
    font-size: 18px !important;
    font-weight: normal !important;
  }

  /* Input normal size */
  .ubnbee_chat-input {
    height: auto !important;
    padding: 10px 15px !important;
  }

  .ubnbee_chat-input input {
    height: 40px !important;
    font-size: 14px !important;
  }

  .ubnbee_chat-input button {
    height: 40px !important;
    font-size: 13px !important;
    min-width: 80px !important;
  }

  /* Micro button normal size */
  #ubnbee_micro-btn,
  .ubnbee_micro-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
  }

  #ubnbee_micro-btn svg,
  .ubnbee_micro-btn svg {
    width: 20px !important;
    height: 20px !important;
  }
}

/* ============================================================================
   FIX 2: SCROLL DE LA PAGE NON BLOQUÉ
   ============================================================================ */

/* Override le blocage du scroll pour desktop scalé */
@media (min-width: 1024px) {
  html, body {
    overflow: auto !important;
    overflow-x: hidden !important;
    position: static !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Assurer que le scroll fonctionne même avec le chat ouvert sur desktop */
@media (min-width: 768px) {
  html.chatbot-open,
  body.chatbot-open {
    overflow: auto !important;
    position: static !important;
  }
}

/* ============================================================================
   FIX 3: IMAGES CORRECTEMENT DIMENSIONNÉES
   ============================================================================ */

/* Avatar Koaee - taille cohérente sur tous les écrans */
.ubnbee_welcome-abeille {
  width: 140px !important;
  height: 140px !important;
  max-width: 140px !important;
  max-height: 140px !important;
  object-fit: contain !important;
  border: 2px solid var(--ubnbee_primary) !important;
  border-radius: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

/* Override pour desktop scalé spécifiquement */
@media (min-width: 1024px) and (max-width: 1366px) {
  .ubnbee_welcome-abeille {
    width: 140px !important;
    height: 140px !important;
    border-width: 2px !important;
  }

  .ubnbee_chat-header img.ubnbee_chat-abeille {
    width: 40px !important;
    height: 40px !important;
  }

  #ubnbee_slider-image {
    width: 50px !important;
    height: 50px !important;
  }

  .ubnbee_gpt-icon {
    width: 24px !important;
    height: 24px !important;
    left: -12px !important;
    top: -25px !important;
  }
}

/* ============================================================================
   FIX 4: DÉTECTION DEVICE TYPE AMÉLIORÉE
   Détecte mieux desktop avec écran tactile vs tablette réelle
   ============================================================================ */

/* Si l'écran est large ET haute résolution, traiter comme desktop */
@media (min-width: 1024px) and (min-device-width: 1920px) {
  /* Forcer le mode desktop même si touch est détecté */
  #ubnbee_chatbox {
    width: 400px !important;
    height: 550px !important;
  }

  html, body {
    overflow: auto !important;
  }
}

/* ============================================================================
   FIX 5: QUICK ACTIONS - TAILLE NORMALE SUR DESKTOP SCALÉ
   ============================================================================ */

@media (min-width: 1024px) and (max-width: 1366px) {
  #ubnbee_quick-actions {
    padding: 10px 15px !important;
  }

  .ubnbee_quick-action {
    font-size: 14px !important;
    padding: 8px 15px !important;
    min-height: auto !important;
  }
}

/* ============================================================================
   FIX 6: VIGNETTES - TAILLE CORRECTE
   ============================================================================ */

@media (min-width: 1024px) and (max-width: 1366px) {
  .ubnbee_link-thumbnail {
    max-width: 280px !important;
    width: auto !important;
    height: auto !important;
  }

  .ubnbee_thumbnail-title {
    font-size: 11px !important;
    max-width: 280px !important;
  }
}

/* ============================================================================
   SÉCURITÉ: S'assurer que mobile (<768px) reste intact
   ============================================================================ */

@media (max-width: 767px) {
  /* Ne rien changer pour mobile réel */
  #ubnbee_chatbox {
    width: 100vw !important;
    height: 95vh !important;
  }

  html, body {
    overflow-x: hidden !important;
  }
}

/* ============================================================================
   CUSTOM SCROLLBAR STYLING - MODERN & ELEGANT
   ============================================================================ */

/* Scrollbar styling pour webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f4f4f6;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  border-radius: 10px;
  border: 2px solid #f4f4f6;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #f7931e, #ff6b35);
}

/* Scrollbar pour le chatbox spécifiquement */
.ubnbee_chat-body::-webkit-scrollbar {
  width: 8px;
}

.ubnbee_chat-body::-webkit-scrollbar-track {
  background: rgba(255, 107, 53, 0.05);
  border-radius: 10px;
}

.ubnbee_chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 53, 0.3);
  border-radius: 10px;
}

.ubnbee_chat-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 53, 0.5);
}

/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: #ff6b35 #f4f4f6;
}

.ubnbee_chat-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 107, 53, 0.3) rgba(255, 107, 53, 0.05);
}

/* ============================================================================
   TRANSITIONS SMOOTH
   ============================================================================ */

#ubnbee_chatbox {
  transition: width 0.3s ease, height 0.3s ease, transform 0.3s ease;
}

.ubnbee_message,
.ubnbee_welcome-abeille,
.ubnbee_quick-action {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}