﻿/* SCALUX Chatbot CSS */
#scalux-chatbot {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 99999 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.chatbot-toggle {
  width: 60px !important;
  height: 60px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d4a 100%) !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 4px 20px rgba(26, 26, 46, 0.4) !important;
  transition: all 0.3s ease !important;
  position: relative !important;
}

.chatbot-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(26, 26, 46, 0.5);
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.chatbot-toggle.active .icon-chat { display: none; }
.chatbot-toggle .icon-close { display: none; }
.chatbot-toggle.active .icon-close { display: block; }

.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: #c9a227;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #1a1a2e;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.chatbot-toggle.active .chatbot-badge { display: none; }

.chatbot-window {
  position: absolute !important;
  bottom: 75px !important;
  right: 0 !important;
  width: 380px !important;
  height: 520px !important;
  background: #ffffff !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important;
  flex-direction: column;
  overflow: hidden;
  /* Tranziție lentă pentru retragere */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease;
}

.chatbot-window.open {
  display: flex !important;
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chatbot-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d4a 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 45px;
  height: 45px;
  background: #c9a227;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #1a1a2e;
}

.chatbot-header-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.chatbot-header-info p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.8;
}

.chatbot-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  margin-right: 5px;
}

.chatbot-close {
  margin-left: auto;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  opacity: 0.7;
  font-size: 24px;
  line-height: 1;
}

.chatbot-close:hover { opacity: 1; }

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafafa;
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.chat-message.bot {
  background: #ffffff;
  color: #333333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-message.user {
  background: #1a1a2e;
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-message a {
  color: #c9a227;
  text-decoration: underline;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
}

.quick-reply-btn {
  background: white;
  border: 1px solid #e0e0e0;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: #1a1a2e;
}

.quick-reply-btn:hover {
  background: #1a1a2e;
  color: white;
  border-color: #1a1a2e;
}

.chatbot-input-area {
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.chatbot-input:focus { border-color: #1a1a2e; }

.chatbot-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1a1a2e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-send:hover { background: #2d2d4a; }

.chatbot-send svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* ========== MOBIL - CHATBOT COMPACT ========== */
@media (max-width: 768px) {
  /* Container principal - colt dreapta jos */
  #scalux-chatbot {
    bottom: 10px !important;
    right: 10px !important;
  }

  /* Buton toggle - marit cu 25%, ROTUND */
  .chatbot-toggle {
    width: 62px !important;
    height: 62px !important;
    min-width: 62px !important;
    min-height: 62px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .chatbot-toggle.active {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }
  /* Avatar - perfect rotund, marit cu 25% */
  .chatbot-avatar-img {
    width: 62px !important;
    height: 62px !important;
    min-width: 62px !important;
    min-height: 62px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
  }

  /* Fereastra chat - mai mica, nu ocupa tot ecranul */
  .chatbot-window {
    width: 300px !important;
    height: 400px !important;
    max-height: 60vh !important;
    bottom: 60px !important;
    right: 0 !important;
    border-radius: 12px !important;
  }

  /* Header mai compact */
  .chatbot-header {
    padding: 10px 12px !important;
  }
  .chatbot-header-avatar {
    width: 32px !important;
    height: 32px !important;
  }
  .chatbot-header-info h4 {
    font-size: 13px !important;
  }
  .chatbot-header-info p {
    font-size: 10px !important;
  }

  /* Mesaje mai compacte */
  .chatbot-messages {
    padding: 12px !important;
    gap: 8px !important;
  }
  .chat-message {
    padding: 8px 12px !important;
    font-size: 13px !important;
    border-radius: 12px !important;
  }

  /* Input mai compact */
  .chatbot-input-area {
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  .chatbot-input {
    padding: 8px 12px !important;
    font-size: 14px !important;
  }
  .chatbot-send {
    width: 36px !important;
    height: 36px !important;
  }
  .chatbot-send svg {
    width: 16px !important;
    height: 16px !important;
  }

  /* Quick replies */
  .quick-replies {
    padding: 6px 10px !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
  }
  .quick-reply-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  /* Popup bun venit - mai mic */
  .chatbot-welcome-popup {
    max-width: 220px !important;
    right: 10px !important;
    bottom: 70px !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
  }
  .welcome-avatar {
    width: 35px !important;
    height: 35px !important;
  }
  .welcome-text strong {
    font-size: 12px !important;
  }
  .welcome-text p {
    font-size: 11px !important;
  }
  .welcome-popup-content {
    gap: 8px !important;
  }
}

/* Ecrane foarte mici */
@media (max-width: 380px) {
  .chatbot-window {
    width: calc(100vw - 20px) !important;
    height: 350px !important;
    max-height: 55vh !important;
  }
  .chatbot-toggle {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
  }
  .chatbot-avatar-img {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
  }
}

/* ========== FAVICON IN BUTON ========== */
.chatbot-favicon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.chatbot-toggle.active .chatbot-favicon {
  display: none;
}

.chatbot-toggle .icon-chat {
  display: none;
}

/* ========== AVATAR HEADER ========== */
.chatbot-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
}

.chatbot-avatar {
  display: none;
}

/* ========== POPUP BUN VENIT ========== */
.chatbot-welcome-popup {
  position: fixed;
  bottom: 100px;
  right: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 5px 40px rgba(0,0,0,0.2);
  padding: 15px 20px;
  max-width: 300px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.9);
  transition: all 0.3s ease;
  z-index: 9998;
  cursor: pointer;
}

.chatbot-welcome-popup.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ========== SESSION DIVIDER (timestamp) ========== */
.chat-session-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  position: relative;
}

.chat-session-divider::before,
.chat-session-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(0,0,0,0.1);
}

.chat-session-divider span {
  font-size: 11px;
  color: #999;
  background: #fff;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid rgba(0,0,0,0.08);
  white-space: nowrap;
  margin: 0 8px;
}

.chatbot-welcome-popup::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 30px;
  width: 16px;
  height: 16px;
  background: white;
  transform: rotate(45deg);
  box-shadow: 3px 3px 5px rgba(0,0,0,0.1);
}

.welcome-popup-close {
  position: absolute;
  top: 5px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.welcome-popup-close:hover {
  color: #333;
}

.welcome-popup-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.welcome-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.welcome-text {
  flex: 1;
}

.welcome-text strong {
  display: block;
  color: #1a1a2e;
  font-size: 14px;
  margin-bottom: 4px;
}

.welcome-text p {
  margin: 0;
  color: #666;
  font-size: 13px;
  line-height: 1.4;
}

/* ========== ANIMATIE POPUP ========== */
@keyframes welcomePulse {
  0%, 100% { box-shadow: 0 5px 40px rgba(0,0,0,0.2); }
  50% { box-shadow: 0 5px 40px rgba(201, 169, 98, 0.4); }
}

.chatbot-welcome-popup.show {
  animation: welcomePulse 2s ease-in-out infinite;
}

/* ========== CORECTII CULORI CHATBOT ========== */

/* Numele chatbot-ului in header - alb vizibil */
.chatbot-header-info h4 {
  color: #ffffff !important;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* Status online - vizibil */
.chatbot-header-info p,
.chatbot-header-info .chatbot-status {
  color: rgba(255, 255, 255, 0.85) !important;
  margin: 2px 0 0;
  font-size: 12px;
}

/* Numele in popup bun venit */
.welcome-text strong {
  color: #1a1a2e !important;
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

/* Mesaj in popup */
.welcome-text p {
  color: #333333 !important;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}


/* ========== AVATAR E-COSTICA - DESKTOP ========== */
@media (min-width: 769px) {
  .chatbot-toggle {
    width: 75px !important;
    height: 75px !important;
    border-radius: 50% !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    position: relative !important;
  }

  .chatbot-toggle:hover {
    transform: scale(1.1);
  }

  .chatbot-avatar-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    transition: all 0.3s ease !important;
  }

  .chatbot-toggle:hover .chatbot-avatar-img {
    box-shadow: 0 6px 20px rgba(0,0,0,0.4) !important;
  }

  /* Cand chat-ul e deschis - ascunde avatarul, arata X mic */
  .chatbot-toggle.active {
    width: 50px !important;
    height: 50px !important;
    background: #1a1a2e !important;
  }
}

/* Stiluri comune pentru toggle activ */
.chatbot-toggle.active .chatbot-avatar-img {
  display: none !important;
}

.chatbot-toggle.active::after {
  content: '✕';
  font-size: 18px;
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.chatbot-toggle.active {
  background: #1a1a2e !important;
  border-radius: 50% !important;
}



/* ---------- Informare GDPR in fereastra de chat ---------- */
.chatbot-privacy {
  margin: 0;
  padding: 8px 14px 11px;
  font-size: 10.5px;
  line-height: 1.45;
  color: #8b93a1;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #fafbfc;
}

.chatbot-privacy a {
  color: #c9a962;
  text-decoration: underline;
}
