/* JG Assist — Floating AI Assistant Widget for Jobman Global */

.jg-assist-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1a2530;
}

/* Launcher Button */
.jg-assist-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 6px;
  background: linear-gradient(135deg, #052d4c 0%, #073e66 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  box-shadow: 0 12px 36px rgba(5, 45, 76, 0.35);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.jg-assist-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(5, 45, 76, 0.45);
  background: linear-gradient(135deg, #073e66 0%, #0a4f82 100%);
}

.jg-assist-launcher::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid rgba(255, 87, 34, 0.45);
  animation: jg-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes jg-pulse {
  0% { transform: scale(0.96); opacity: 0.9; }
  60% { transform: scale(1.08); opacity: 0; }
  100% { transform: scale(1.08); opacity: 0; }
}

.jg-assist-launcher-face,
.jg-assist-face {
  width: 44px !important;
  height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  background: #ffffff !important;
  border: 2px solid #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}

.jg-assist-launcher-face video,
.jg-assist-face video {
  width: 44px !important;
  height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  display: block !important;
}

.jg-assist-launcher-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.jg-assist-launcher-text strong {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.jg-assist-launcher-text span {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.75);
}

/* CRITICAL: Hide launcher completely when chat panel is open so it NEVER overlaps the send button */
.jg-assist-root.open .jg-assist-launcher,
.jg-assist-panel.active ~ .jg-assist-launcher,
.jg-assist-launcher.jg-hidden,
#jg-assist-launcher.jg-hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Chat Panel */
.jg-assist-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: min(410px, calc(100vw - 32px));
  height: min(630px, calc(100vh - 48px));
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(5, 45, 76, 0.36);
  border: 1px solid rgba(5, 45, 76, 0.16);
  overflow: hidden;
  z-index: 10000;
  animation: jg-slide-up 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.jg-assist-panel.active {
  display: flex;
}

@keyframes jg-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel Header */
.jg-assist-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #052d4c;
  color: #ffffff;
  flex-shrink: 0;
}

.jg-assist-face-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

.jg-assist-face-small video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.jg-assist-title-wrap {
  flex: 1;
}

.jg-assist-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.jg-assist-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 1px;
}

.jg-assist-status::before {
  content: "";
  width: 7px;
  height: 7px;
  background: #00e676;
  border-radius: 50%;
}

.jg-assist-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s;
}

.jg-assist-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Quick Bar */
.jg-assist-bar {
  background: #f4f7fa;
  padding: 9px 12px;
  border-bottom: 1px solid #e1e8ef;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  flex-shrink: 0;
}
.jg-assist-bar::-webkit-scrollbar { display: none; }

.jg-chip {
  background: #ffffff;
  border: 1px solid #cfdce8;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: #073e66;
  cursor: pointer;
  transition: all 0.15s;
}

.jg-chip:hover {
  background: #ff5722;
  color: #ffffff;
  border-color: #ff5722;
}

/* Messages area */
.jg-assist-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
}

.jg-msg {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.jg-msg.assistant {
  align-self: flex-start;
  background: #edf3f8;
  color: #0b1d2e;
  border-bottom-left-radius: 4px;
}

.jg-msg.user {
  align-self: flex-end;
  background: #073e66;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.jg-msg a {
  color: #ff5722;
  text-decoration: underline;
  font-weight: 600;
}
.jg-msg.user a { color: #80d8ff; }

/* Input area */
.jg-assist-input-area {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e5ecf2;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.jg-assist-form {
  padding: 10px 14px 14px !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  border-radius: 0 0 16px 16px !important;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4f7fa;
  border: 1.5px solid #cfdce8;
  border-radius: 999px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.jg-assist-form:focus-within {
  border-color: #ff5722;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.12);
}

.jg-assist-form input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: #0b1d2e;
  outline: none;
  min-width: 0;
  padding: 6px 0;
}

.jg-assist-form input::placeholder {
  color: #78909c;
}

.jg-assist-send-btn {
  background: #ff5722;
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.jg-assist-send-btn:hover {
  background: #e64a19;
  transform: scale(1.05);
}

.jg-assist-send-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* Quick Lead Modal / Form inside Assistant */
.jg-lead-mode {
  padding: 14px;
  background: #fbfcfe;
  border-top: 1px solid #e1e8ef;
  flex-shrink: 0;
}
.jg-lead-mode h4 {
  margin: 0 0 4px;
  font-size: 13.5px;
  color: #073e66;
}
.jg-lead-mode p {
  margin: 0 0 10px;
  font-size: 11.5px;
  color: #607d8b;
}
.jg-lead-row {
  display: grid;
  gap: 7px;
  margin-bottom: 8px;
}
.jg-lead-row input {
  padding: 8px 10px;
  border: 1px solid #cfdce8;
  border-radius: 6px;
  font-size: 12.5px;
}
.jg-lead-actions {
  display: flex;
  gap: 8px;
}
.jg-lead-actions button {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.jg-btn-primary { background: #ff5722; color: #fff; }
.jg-btn-secondary { background: #e0e7ee; color: #073e66; }

@media (max-width: 480px) {
  .jg-assist-root { bottom: 16px; right: 16px; }
  .jg-assist-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    position: fixed;
  }
}


.jg-assist-root.open .jg-assist-launcher,
.jg-assist-panel.active ~ .jg-assist-launcher,
.jg-assist-panel.open ~ .jg-assist-launcher,
.jg-assist-launcher.jg-hidden,
#jg-assist-launcher.jg-hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}


.jg-assist-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 14px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  border-radius: 0 0 16px 16px;
  box-sizing: border-box;
}

.jg-assist-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 0.9rem;
  outline: none;
  background: #f8fafc;
  color: #0f172a;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.jg-assist-input:focus {
  border-color: #0369a1;
  background: #ffffff;
}

/* Strict concealment of launcher button when chat panel is open */
.jg-assist-root.open .jg-assist-launcher,
.jg-assist-open .jg-assist-launcher {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}


/* Explicit JG Assist Form & Input Alignment */
#jg-assist-form,
form.jg-assist-input,
.jg-assist-form {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 16px 18px 16px !important;
  background: #ffffff !important;
  border-top: 1px solid #e5ecf2 !important;
  border-radius: 0 0 20px 20px !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
  width: 100% !important;
}

#jg-assist-form input,
form.jg-assist-input input,
.jg-assist-form input {
  flex: 1 !important;
  background: #f4f7fa !important;
  border: 1.5px solid #cfdce8 !important;
  border-radius: 999px !important;
  padding: 10px 16px !important;
  font-size: 13.5px !important;
  color: #0b1d2e !important;
  outline: none !important;
  min-width: 0 !important;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s !important;
}

#jg-assist-form input:focus,
form.jg-assist-input input:focus,
.jg-assist-form input:focus {
  border-color: #0369a1 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.15) !important;
}

#jg-assist-form button,
form.jg-assist-input button,
.jg-assist-form button,
.jg-assist-send-btn {
  background: #ff5722 !important;
  border: none !important;
  color: #ffffff !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.2s, transform 0.15s !important;
  flex-shrink: 0 !important;
}

#jg-assist-form button:hover,
form.jg-assist-input button:hover,
.jg-assist-form button:hover,
.jg-assist-send-btn:hover {
  background: #e64a19 !important;
  transform: scale(1.05) !important;
}

/* Strict concealment of launcher button when chat panel is open */
.jg-assist-panel.active ~ .jg-assist-launcher,
.jg-assist-panel.active + .jg-assist-launcher,
.jg-assist-launcher.jg-hidden,
#jg-assist-launcher.jg-hidden,
.jg-assist-open .jg-assist-launcher,
.jg-assist-root.open .jg-assist-launcher {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
