/* JobWay Gemini AI Chatbot Widget Styles */

:root {
  --chat-primary: #14281D;
  --chat-primary-rgb: 20, 40, 29;
  --chat-accent: #00D084;
  --chat-accent-hover: #05b874;
  --chat-accent-soft: rgba(0, 208, 132, 0.12);
  --chat-bg: #FFFFFF;
  --chat-border: #E5E7EB;
  --chat-text: #1F2937;
  --chat-text-muted: #6B7280;
  --chat-bot-bubble: #F3F4F6;
  --chat-user-bubble: #14281D;
  --chat-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.2), 0 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* Minimalist Floating Robot Launcher */
.jobway-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, #14281D 0%, #064E3B 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px -4px rgba(20, 40, 29, 0.45), 0 0 0 1.5px rgba(0, 208, 132, 0.4);
  border: none;
  font-family: inherit;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  padding: 0;
}

.jobway-chat-launcher:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 14px 30px -4px rgba(0, 208, 132, 0.4), 0 0 0 2px var(--chat-accent);
}

.jobway-chat-launcher:active {
  transform: translateY(1px) scale(0.96);
}

.jobway-chat-launcher-robot {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}

.jobway-chat-launcher-pulse {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 11px;
  height: 11px;
  background: #00D084;
  border: 2px solid #14281D;
  border-radius: 50%;
  box-shadow: 0 0 8px #00D084;
}

/* Chat Container Window */
.jobway-chat-window {
  position: fixed;
  bottom: 86px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 110px);
  background: var(--chat-bg);
  border-radius: 20px;
  box-shadow: var(--chat-shadow);
  border: 1px solid var(--chat-border);
  display: none; /* strictly hidden by default - prevents FOUC/opening on refresh */
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  font-family: inherit;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.jobway-chat-window.open {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.jobway-chat-header {
  background: var(--chat-primary);
  color: #FFFFFF;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.jobway-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jobway-chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 208, 132, 0.22) 0%, rgba(6, 78, 59, 0.8) 100%);
  border: 1px solid rgba(0, 208, 132, 0.4);
  box-shadow: 0 4px 14px rgba(0, 208, 132, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  flex-shrink: 0;
}

.jobway-chat-header-title,
#jobway-chat-root .jobway-chat-header-title,
#jobway-chat-root h3.jobway-chat-header-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  color: #FFFFFF !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  line-height: 1.25 !important;
}

.jobway-chat-header-subtitle,
#jobway-chat-root .jobway-chat-header-subtitle {
  font-size: 11.5px !important;
  color: rgba(255, 255, 255, 0.85) !important;
  margin-top: 3px !important;
  margin-bottom: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  line-height: 1.2 !important;
}

.jobway-chat-header-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00D084;
  display: inline-block;
  box-shadow: 0 0 6px #00D084;
  flex-shrink: 0;
}

.jobway-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.jobway-chat-header-btn,
#jobway-chat-root .jobway-chat-header-btn {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #FFFFFF !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  padding: 0 !important;
  transition: all 0.2s ease !important;
}

.jobway-chat-header-btn:hover,
#jobway-chat-root .jobway-chat-header-btn:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #FFFFFF !important;
  transform: scale(1.05) !important;
}

/* Messages Body */
.jobway-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: #FAFAFA;
}

.jobway-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: fadeInMsg 0.2s ease;
}

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

.jobway-chat-msg.bot {
  align-self: flex-start;
}

.jobway-chat-msg.user {
  align-self: flex-end;
}

.jobway-chat-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.jobway-chat-msg.bot .jobway-chat-bubble {
  background: #FFFFFF;
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
  border: 1px solid #E5E7EB;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.jobway-chat-msg.user .jobway-chat-bubble {
  background: var(--chat-primary);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.jobway-chat-bubble a {
  color: #059669;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.jobway-chat-bubble a:hover {
  color: #047857;
}

.jobway-chat-msg.user .jobway-chat-bubble a {
  color: #A7F3D0;
}

.jobway-chat-bubble p {
  margin: 0 0 8px;
}

.jobway-chat-bubble p:last-child {
  margin-bottom: 0;
}

.jobway-chat-bubble ul, .jobway-chat-bubble ol {
  margin: 6px 0 8px 18px;
  padding: 0;
}

.jobway-chat-bubble li {
  margin-bottom: 4px;
}

.jobway-chat-msg-time {
  font-size: 10.5px;
  color: var(--chat-text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.jobway-chat-msg.user .jobway-chat-msg-time {
  text-align: right;
}

/* Quick Suggestion Pills */
.jobway-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.jobway-chat-pill {
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  color: var(--chat-text);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
  font-family: inherit;
}

.jobway-chat-pill:hover {
  border-color: var(--chat-accent);
  color: #065F46;
  background: var(--chat-accent-soft);
  transform: translateY(-1px);
}

/* Typing Indicator */
.jobway-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #FFFFFF;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  border: 1px solid #E5E7EB;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.jobway-chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9CA3AF;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.jobway-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.jobway-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background: #00D084; }
}

/* Input Area */
#jobway-chat-root .jobway-chat-footer {
  padding: 12px 14px 10px;
  background: #FFFFFF;
  border-top: 1px solid #EEF2F6;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#jobway-chat-root .jobway-chat-form {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: #F8FAFC !important;
  border: 1.5px solid #E2E8F0 !important;
  border-radius: 9999px !important;
  padding: 4px 5px 4px 14px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

#jobway-chat-root .jobway-chat-form:focus-within {
  background: #FFFFFF !important;
  border-color: #00D084 !important;
  box-shadow: 0 0 0 3px rgba(0, 208, 132, 0.18), 0 2px 8px rgba(0, 208, 132, 0.08) !important;
}

#jobway-chat-root input.jobway-chat-input,
#jobway-chat-root #jobway-chat-input,
#jobway-chat-root .jobway-chat-input {
  flex: 1 !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 13.5px !important;
  font-family: inherit !important;
  color: #0F172A !important;
  padding: 7px 4px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  height: auto !important;
  min-height: unset !important;
  line-height: 1.4 !important;
  width: auto !important;
}

#jobway-chat-root input.jobway-chat-input:focus,
#jobway-chat-root #jobway-chat-input:focus,
#jobway-chat-root .jobway-chat-input:focus {
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

#jobway-chat-root input.jobway-chat-input::placeholder,
#jobway-chat-root #jobway-chat-input::placeholder {
  color: #94A3B8 !important;
}

#jobway-chat-root .jobway-chat-send-btn {
  background: #14281D !important;
  color: #FFFFFF !important;
  border: none !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 6px rgba(20, 40, 29, 0.25) !important;
  padding: 0 !important;
}

#jobway-chat-root .jobway-chat-send-btn:hover:not(:disabled) {
  background: #00D084 !important;
  color: #14281D !important;
  transform: scale(1.08) !important;
  box-shadow: 0 4px 12px rgba(0, 208, 132, 0.35) !important;
}

#jobway-chat-root .jobway-chat-send-btn:active:not(:disabled) {
  transform: scale(0.95) !important;
}

#jobway-chat-root .jobway-chat-send-btn:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

#jobway-chat-root .jobway-chat-branding {
  font-size: 11px;
  color: #64748B;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.jobway-chat-branding span {
  color: #059669;
  font-weight: 600;
}

/* Mobile Responsiveness (Floating Card Modal instead of Fullscreen Cover) */
@media (max-width: 600px) {
  .jobway-chat-launcher {
    bottom: 16px !important;
    right: 16px !important;
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28), 0 0 0 1.5px rgba(0, 208, 132, 0.4) !important;
  }

  .jobway-chat-window {
    position: fixed !important;
    top: auto !important;
    bottom: 74px !important;
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
    max-width: 420px !important;
    margin: 0 auto !important;
    height: 520px !important;
    max-height: calc(100dvh - 90px) !important;
    border-radius: 18px !important;
    border: 1px solid rgba(20, 40, 29, 0.14) !important;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.28), 0 2px 10px rgba(0, 0, 0, 0.08) !important;
    z-index: 9999999 !important;
    overflow: hidden !important;
  }

  .jobway-chat-header {
    padding: 13px 15px !important;
  }

  .jobway-chat-messages {
    padding: 14px !important;
  }

  #jobway-chat-root .jobway-chat-footer {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-height: 540px) {
  .jobway-chat-window {
    height: calc(100dvh - 30px) !important;
    bottom: 10px !important;
  }
}
