/* TendersInfo chatbot widget — design from tendersinfo_chatbot_widget.html */
#ti-chatbot-root {
  --ti-orange: #f08501;
  --ti-orange-dark: #c86e00;
  --ti-orange-light: #fff3e0;
  --ti-navy: #1a2b4a;
  --ti-navy-mid: #243659;
  --ti-navy-light: #eef1f7;
  --ti-text: #1a2b4a;
  --ti-muted: #6b7a99;
  --ti-border: rgba(26, 43, 74, 0.12);
  --ti-white: #ffffff;
  --ti-bubble-bot: #f4f6fb;
  --ti-bubble-user: #f08501;
  --ti-radius: 18px;
  --ti-radius-sm: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

#ti-chatbot-root * {
  box-sizing: border-box;
}

/* FAB launcher */
#ti-chatbot-root .ti-fab-wrap {
  position: fixed;
  right: 24px;
  bottom: 12%;
  z-index: 9999;
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ti-chatbot-root .ti-pulse-ring {
  position: absolute;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid var(--ti-orange);
  opacity: 0;
  animation: ti-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

#ti-chatbot-root .ti-pulse-ring:nth-child(2) {
  animation-delay: 0.8s;
}

@keyframes ti-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

#ti-chatbot-root #ti-chatbot-launcher {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--ti-orange);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(240, 133, 1, 0.45);
  color: #fff;
  padding: 0;
}

#ti-chatbot-root #ti-chatbot-launcher:hover {
  transform: scale(1.07);
}

#ti-chatbot-root #ti-chatbot-launcher svg {
  width: 28px;
  height: 28px;
  fill: white;
}

/* Panel */
#ti-chatbot-root #ti-chatbot-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 20px);
  height: 560px;
  max-height: calc(100vh - 110px);
  border-radius: var(--ti-radius);
  background: var(--ti-white);
  border: 0.5px solid var(--ti-border);
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(26, 43, 74, 0.18);
}

/* Header */
#ti-chatbot-root #ti-chatbot-header {
  background: var(--ti-navy);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background-image: none;
}

#ti-chatbot-root #ti-header-left {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

#ti-chatbot-root #ti-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ti-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  font-size: 0;
}

#ti-chatbot-root #ti-avatar svg {
  width: 22px;
  height: 22px;
  fill: white;
}

#ti-chatbot-root #ti-title {
  font-size: 14px;
  font-weight: 500;
  color: white;
  line-height: 1.2;
  margin: 0;
}

#ti-chatbot-root #ti-subtitle-wrap {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

#ti-chatbot-root .ti-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

#ti-chatbot-root #ti-subtitle {
  margin: 0;
  font-size: inherit;
  opacity: 1;
}

#ti-chatbot-root #ti-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

#ti-chatbot-root #ti-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0;
  padding: 0;
  transition: background 0.15s;
}

#ti-chatbot-root #ti-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

#ti-chatbot-root #ti-close svg {
  width: 15px;
  height: 15px;
  stroke: rgba(255, 255, 255, 0.8);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Messages */
#ti-chatbot-root #ti-chatbot-messages {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--ti-white);
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#ti-chatbot-root #ti-chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

#ti-chatbot-root #ti-chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--ti-border);
  border-radius: 2px;
}

#ti-chatbot-root .ti-message-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 0;
  animation: tiFade 0.2s ease-out;
}

#ti-chatbot-root .ti-message-row.bot {
  align-items: flex-start;
}

#ti-chatbot-root .ti-message-row.user {
  flex-direction: row-reverse;
}

#ti-chatbot-root .ti-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

#ti-chatbot-root .ti-msg-avatar.bot {
  background: var(--ti-orange-light);
  color: var(--ti-orange);
}

#ti-chatbot-root .ti-msg-avatar.user {
  background: var(--ti-navy-light);
  color: var(--ti-navy);
}

#ti-chatbot-root .ti-message-col {
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  text-align: left;
}

#ti-chatbot-root .ti-message-row.bot .ti-message-col {
  flex: 1;
  min-width: 0;
}

#ti-chatbot-root .ti-message-row.user .ti-message-col {
  max-width: 240px;
  align-items: flex-end;
  text-align: right;
  flex: 0 1 auto;
}

#ti-chatbot-root #ti-inline-form-row {
  align-items: stretch;
}

#ti-chatbot-root #ti-inline-form-row .ti-message-col,
#ti-chatbot-root #ti-inline-form-row .ti-form-col {
  max-width: 100%;
  width: 100%;
  flex: 1;
}

#ti-chatbot-root .ti-message-bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  text-align: left;
  position: relative;
  border: none;
  width: 100%;
  align-self: stretch;
}

#ti-chatbot-root .ti-message-row.bot .ti-message-bubble {
  background: var(--ti-bubble-bot);
  color: var(--ti-text);
  border-radius: 4px 16px 16px 16px;
}

#ti-chatbot-root .ti-bubble-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--ti-orange);
  color: white;
  font-weight: 500;
  margin-bottom: 8px;
  text-align: left;
  vertical-align: top;
}

#ti-chatbot-root .ti-message-bubble strong {
  font-weight: 600;
}

#ti-chatbot-root .ti-bubble-body {
  text-align: left;
  line-height: 1.55;
}

#ti-chatbot-root .ti-welcome-col {
  max-width: none;
  width: auto;
  flex: 1;
  min-width: 0;
  align-items: stretch;
}

#ti-chatbot-root .ti-welcome-col .ti-message-bubble {
  max-width: 100%;
  width: 100%;
  text-align: left;
}

#ti-chatbot-root .ti-welcome-col .ti-stats-row {
  margin-top: 10px;
  width: 100%;
  align-self: stretch;
}

#ti-chatbot-root .ti-welcome-col .ti-welcome-buttons {
  margin-top: 10px;
  align-self: stretch;
}

#ti-chatbot-root .ti-welcome-col .ti-flow-btn {
  text-align: center;
  width: 100%;
  display: block;
}

#ti-chatbot-root #ti-welcome-greeting-row .ti-msg-avatar {
  margin-top: 2px;
}

#ti-chatbot-root .ti-message-row.user .ti-message-bubble {
  background: var(--ti-orange);
  color: white;
  border-radius: 16px 4px 16px 16px;
  padding: 10px 13px;
  min-width: 0;
  text-align: left;
  width: auto;
  align-self: flex-end;
}

#ti-chatbot-root .ti-message-meta {
  font-size: 10px;
  color: var(--ti-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

#ti-chatbot-root .ti-message-row.user .ti-message-meta {
  position: static;
  color: var(--ti-muted);
  justify-content: flex-end;
}

#ti-chatbot-root .ti-ticks {
  font-size: 11px;
  letter-spacing: -2px;
  color: var(--ti-muted);
}

#ti-chatbot-root .ti-welcome-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
  max-width: 100%;
}

#ti-chatbot-root .ti-flow-btn {
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--ti-orange);
  background: white;
  color: var(--ti-orange);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}

#ti-chatbot-root .ti-flow-btn:hover {
  background: var(--ti-orange);
  color: white;
}

#ti-chatbot-root .ti-stats-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  max-width: 100%;
}

#ti-chatbot-root .ti-stat-chip {
  flex: 1;
  background: var(--ti-navy);
  border-radius: 8px;
  padding: 7px 6px;
  text-align: center;
  min-width: 0;
}

#ti-chatbot-root .ti-stat-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--ti-orange);
}

#ti-chatbot-root .ti-stat-lbl {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 1px;
}

/* Forms */
#ti-chatbot-root .ti-form-card {
  width: 100%;
  background: #fff;
  border: 1px solid var(--ti-border);
  border-radius: var(--ti-radius-sm);
  padding: 14px;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(26, 43, 74, 0.08);
}

#ti-chatbot-root .ti-form-card h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ti-navy);
  font-weight: 600;
}

#ti-chatbot-root .ti-form-summary {
  font-size: 12px;
  color: var(--ti-muted);
  background: var(--ti-navy-light);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  line-height: 1.4;
}

#ti-chatbot-root .ti-submitted-summary .ti-summary-row {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ti-border);
}

#ti-chatbot-root .ti-submitted-summary .ti-summary-row:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

#ti-chatbot-root .ti-summary-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ti-orange);
  margin-bottom: 2px;
}

#ti-chatbot-root .ti-summary-value {
  display: block;
  font-size: 13px;
  color: var(--ti-text);
  word-break: break-word;
}

#ti-chatbot-root .ti-submitted-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--ti-orange);
  margin: 8px 0 0;
}

#ti-chatbot-root .ti-form-field {
  margin-bottom: 10px;
}

#ti-chatbot-root .ti-form-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ti-navy);
  margin-bottom: 4px;
}

#ti-chatbot-root .ti-form-card input[type="text"],
#ti-chatbot-root .ti-form-card input[type="email"],
#ti-chatbot-root .ti-form-card input[type="tel"],
#ti-chatbot-root .ti-form-card select.ti-country-select,
#ti-chatbot-root .ti-dial-select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--ti-border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--ti-navy-light);
}

#ti-chatbot-root .ti-form-card input:focus,
#ti-chatbot-root .ti-form-card select:focus {
  outline: none;
  border-color: var(--ti-orange);
  background: white;
}

#ti-chatbot-root .ti-phone-wrap {
  display: flex;
  gap: 6px;
}

#ti-chatbot-root .ti-dial-select {
  width: auto;
  min-width: 88px;
  flex: 0 0 auto;
}

#ti-chatbot-root .ti-phone-input {
  flex: 1;
  min-width: 0;
}

#ti-chatbot-root .ti-form-hint {
  font-size: 11px;
  color: var(--ti-muted);
  margin-top: 2px;
}

#ti-chatbot-root .ti-form-error {
  color: #dc2626;
  font-size: 12px;
  margin: 4px 0 8px;
  display: none;
}

#ti-chatbot-root .ti-form-error.visible {
  display: block;
}

#ti-chatbot-root #ti-form-submit {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 11px;
  cursor: pointer;
  background: var(--ti-orange);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin-top: 4px;
}

#ti-chatbot-root #ti-form-submit:hover {
  background: var(--ti-orange-dark);
}

#ti-chatbot-root #ti-form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Input area */
#ti-chatbot-root #ti-chatbot-controls {
  border-top: 0.5px solid var(--ti-border);
  padding: 10px 12px 4px;
  background: white;
  flex-shrink: 0;
}

#ti-chatbot-root #ti-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#ti-chatbot-root #ti-chatbot-input {
  flex: 1;
  border: 1px solid var(--ti-border);
  border-radius: 22px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ti-text);
  background: var(--ti-navy-light);
  outline: none;
  min-height: 36px;
}

#ti-chatbot-root #ti-chatbot-input::placeholder {
  color: var(--ti-muted);
}

#ti-chatbot-root #ti-chatbot-input:focus {
  border-color: var(--ti-orange);
  background: white;
}

#ti-chatbot-root #ti-chatbot-input:disabled {
  background: #f3f4f6;
  color: var(--ti-muted);
}

#ti-chatbot-root #ti-chatbot-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ti-orange);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, background 0.15s, opacity 0.15s;
  color: transparent;
  font-size: 0;
  padding: 0;
}

#ti-chatbot-root #ti-chatbot-send svg {
  width: 16px;
  height: 16px;
  fill: white;
}

#ti-chatbot-root #ti-chatbot-send:hover:not(:disabled) {
  transform: scale(1.08);
  background: var(--ti-orange-dark);
}

#ti-chatbot-root #ti-chatbot-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

#ti-chatbot-root .ti-powered {
  padding: 6px 0 8px;
  text-align: center;
  font-size: 10px;
  color: var(--ti-muted);
  flex-shrink: 0;
  background: white;
}

#ti-chatbot-root .ti-powered span {
  color: var(--ti-orange);
  font-weight: 500;
}

#ti-chatbot-root .ti-typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 2px;
}

#ti-chatbot-root .ti-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--ti-muted);
  border-radius: 50%;
  animation: tiBounce 1.2s ease-in-out infinite;
}

#ti-chatbot-root .ti-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

#ti-chatbot-root .ti-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes tiFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tiBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-5px);
  }
}

@media (max-width: 768px) {
  #ti-chatbot-root #ti-chatbot-panel {
    right: 10px;
    left: 10px;
    width: auto;
    height: calc(100vh - 80px);
    bottom: 80px;
  }

  #ti-chatbot-root .ti-fab-wrap {
    right: 16px;
    bottom: 16px;
  }
}
