/* ==========================================
   SOPHIA CHATBOT — Tech Talent Global
   Brand-matched styles. Zero conflicts.
   ========================================== */

/* ---- Launcher Button ---- */
.sophia-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #1DB86A;
  border: none;
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(29, 184, 106, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}
.sophia-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(29, 184, 106, 0.5);
  background: #17A05C;
}
.sophia-launcher svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: transform 0.3s ease;
}
.sophia-launcher.sophia-open svg.sophia-icon-chat {
  display: none;
}
.sophia-launcher.sophia-open svg.sophia-icon-close {
  display: block;
}
.sophia-launcher svg.sophia-icon-close {
  display: none;
}

/* Pulse animation — first load only */
.sophia-launcher.sophia-pulse {
  animation: sophiaPulse 2s ease-in-out infinite;
}
@keyframes sophiaPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(29, 184, 106, 0.4); }
  50% { box-shadow: 0 4px 20px rgba(29, 184, 106, 0.4), 0 0 0 12px rgba(29, 184, 106, 0.15); }
}

/* Tooltip */
.sophia-tooltip {
  position: fixed;
  bottom: 96px;
  right: 28px;
  background: #fff;
  color: #2B2B2B;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  z-index: 10000;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.sophia-tooltip.sophia-visible {
  opacity: 1;
  transform: translateY(0);
}
.sophia-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

/* ---- Chat Window ---- */
.sophia-chat {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 240px);
  background: #fff;
  border-radius: 16px;
  border: 2px solid #1DB86A;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.sophia-chat.sophia-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---- Header ---- */
.sophia-header {
  background: #2B2B2B;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sophia-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0066CC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}
.sophia-header-info {
  flex: 1;
  min-width: 0;
}
.sophia-header-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
}
.sophia-header-status {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.sophia-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  flex-shrink: 0;
}
.sophia-header-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.sophia-header-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.sophia-header-close svg {
  width: 20px;
  height: 20px;
}

/* ---- Messages Area ---- */
.sophia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.sophia-messages::-webkit-scrollbar {
  width: 4px;
}
.sophia-messages::-webkit-scrollbar-track {
  background: transparent;
}
.sophia-messages::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 2px;
}

/* ---- Message Bubbles ---- */
.sophia-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: sophiaFadeIn 0.3s ease;
}
@keyframes sophiaFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.sophia-msg-bot {
  align-self: flex-start;
}
.sophia-msg-user {
  align-self: flex-end;
}
.sophia-bubble {
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #2B2B2B;
  word-wrap: break-word;
}
.sophia-msg-bot .sophia-bubble {
  background: #F5F5F5;
  border-bottom-left-radius: 4px;
  color: #2B2B2B;
}
.sophia-msg-user .sophia-bubble {
  background: #0066CC;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sophia-bubble a {
  color: #0066CC;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1.5px;
}
.sophia-msg-user .sophia-bubble a {
  color: #fff;
  text-decoration-color: rgba(255, 255, 255, 0.6);
}

/* ---- Quick Reply Buttons ---- */
.sophia-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-left: 0;
}
.sophia-btn {
  background: #fff;
  border: 1.5px solid #0066CC;
  color: #0066CC;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1.3;
}
.sophia-btn:hover {
  background: #0066CC;
  color: #fff;
}
.sophia-btn:active {
  transform: scale(0.96);
}
.sophia-btn-selected {
  background: #0066CC;
  color: #fff;
  pointer-events: none;
  opacity: 0.7;
}
.sophia-btn-disabled {
  pointer-events: none;
  opacity: 0.4;
}

/* ---- Typing Indicator ---- */
.sophia-typing {
  display: none;
  align-self: flex-start;
  padding: 12px 18px;
  background: #F5F5F5;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  gap: 4px;
  align-items: center;
}
.sophia-typing.sophia-visible {
  display: flex;
}
.sophia-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #999;
  animation: sophiaTyping 1.4s ease-in-out infinite;
}
.sophia-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.sophia-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes sophiaTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---- Input Area ---- */
.sophia-input-area {
  padding: 12px 16px;
  border-top: 1px solid #E0E0E0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: #fff;
}
.sophia-input {
  flex: 1;
  border: 1.5px solid #E0E0E0;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
  min-height: 40px;
  max-height: 80px;
  color: #2B2B2B;
  background: #FAFAFA;
}
.sophia-input:focus {
  border-color: #0066CC;
  background: #fff;
}
.sophia-input::placeholder {
  color: #999;
}
.sophia-send-btn {
  background: #0066CC;
  border: none;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.sophia-send-btn:hover {
  background: #0052A3;
}
.sophia-send-btn:active {
  transform: scale(0.92);
}
.sophia-send-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}
.sophia-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ---- GDPR Line ---- */
.sophia-gdpr {
  text-align: center;
  padding: 0 16px 10px;
  flex-shrink: 0;
  background: #fff;
}
.sophia-gdpr p {
  font-size: 0.7rem;
  color: #999;
  margin: 0;
  line-height: 1.4;
}
.sophia-gdpr a {
  color: #0066CC;
  text-decoration: underline;
}

/* ---- Contact Summary Form ---- */
.sophia-contact-form {
  margin-top: 10px;
}
.sophia-contact-form textarea {
  width: 100%;
  border: 1.5px solid #E0E0E0;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
  max-height: 120px;
  outline: none;
  color: #2B2B2B;
  background: #FAFAFA;
  transition: border-color 0.2s;
}
.sophia-contact-form textarea:focus {
  border-color: #0066CC;
  background: #fff;
}
.sophia-contact-submit {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px 20px;
  background: #0066CC;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.sophia-contact-submit:hover {
  background: #0052A3;
}
.sophia-contact-submit:active {
  transform: scale(0.97);
}
.sophia-contact-submit:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ---- Mobile Full-Screen ---- */
@media (max-width: 520px) {
  .sophia-chat {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .sophia-launcher {
    bottom: 20px;
    right: 20px;
    width: 54px;
    height: 54px;
  }
  .sophia-tooltip {
    display: none !important;
  }
  .sophia-header {
    padding: 14px 16px;
    border-radius: 0;
  }
}

/* ---- New Chat Button ---- */
.sophia-header-newchat {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
  order: -1;
}
.sophia-header-newchat:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.sophia-header-newchat svg {
  width: 20px;
  height: 20px;
}

/* ---- Print ---- */
@media print {
  .sophia-launcher,
  .sophia-chat,
  .sophia-tooltip {
    display: none !important;
  }
}
