/* =========================================
   TWO GUYS PAINTING LLC — FLOATING AI CHATBOT
   ========================================= */

#tgp-chatbot-root,
#tgp-chatbot-root * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  cursor: auto !important;
}

#tgp-chatbot-root {
  position: fixed;
  /* Raised further to stay clear of floating CTA/social widgets */
  bottom: 168px;
  left: 24px;
  z-index: 9999;
  font-size: 14px;
  color: #0D1B2A;
}

/* =========================================
   LAUNCHER BUTTON
   ========================================= */
.tgp-launcher {
  position: relative;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #E8231A 0%, #CC0A00 50%, #FF3A30 100%);
  background-size: 200% 200%;
  animation: tgp-gradient-shift 5s ease infinite;
  box-shadow: 0 12px 36px rgba(232, 35, 26, 0.42), 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
}

.tgp-launcher:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 18px 48px rgba(232, 35, 26, 0.55), 0 6px 18px rgba(0, 0, 0, 0.22);
}

.tgp-launcher:active {
  transform: translateY(-1px) scale(0.98);
}

.tgp-launcher.tgp-open {
  background: #111111;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.tgp-launcher-icon {
  width: 30px;
  height: 30px;
  color: #FAFAF8;
  transition: transform 0.3s ease;
}

.tgp-launcher.tgp-open .tgp-launcher-icon {
  transform: rotate(180deg);
}

/* Pulse ring */
.tgp-launcher::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(232, 35, 26, 0.45);
  animation: tgp-pulse 2.2s ease-out infinite;
  pointer-events: none;
}

.tgp-launcher.tgp-open::before {
  display: none;
}

/* Badge */
.tgp-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #0D1B2A;
  color: #FAFAF8;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border: 2px solid #FAFAF8;
  animation: tgp-bounce 1.6s ease-in-out infinite;
}

.tgp-launcher.tgp-open .tgp-badge {
  display: none;
}

/* Tooltip greeting */
.tgp-greeting {
  position: absolute;
  bottom: 50%;
  left: calc(100% + 14px);
  transform: translateY(50%);
  background: #0D1B2A;
  color: #FAFAF8;
  padding: 10px 16px;
  border-radius: 14px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tgp-greeting::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #0D1B2A;
}

.tgp-launcher:not(.tgp-open) + .tgp-greeting.tgp-greeting-visible {
  opacity: 1;
  transform: translateY(50%) translateX(0);
}

/* =========================================
   CHAT PANEL
   ========================================= */
.tgp-panel {
  position: absolute;
  bottom: calc(100% + 20px);
  left: 0;
  width: min(484px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 250px));
  background: #FAFAF8;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24), 0 10px 28px rgba(0, 0, 0, 0.12);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom left;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(13, 27, 42, 0.08);
}

.tgp-panel.tgp-panel-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.tgp-header {
  position: relative;
  padding: 20px 22px;
  background: linear-gradient(135deg, #E8231A 0%, #CC0A00 60%, #FF3A30 100%);
  color: #FAFAF8;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.tgp-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.tgp-header-avatar svg {
  width: 22px;
  height: 22px;
  color: #FAFAF8;
}

.tgp-header-info {
  flex: 1;
  min-width: 0;
}

.tgp-header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.tgp-header-status {
  font-size: 11.5px;
  opacity: 0.92;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.tgp-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.8);
  animation: tgp-live 1.8s ease-in-out infinite;
}

.tgp-header-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #FAFAF8;
  cursor: pointer !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.tgp-header-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Quick actions (pinned at top — always visible) */
.tgp-quick-actions {
  display: none;
}

/* Messages */
.tgp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #FAFAF8;
  scroll-behavior: smooth;
}

.tgp-messages::-webkit-scrollbar { width: 4px; }
.tgp-messages::-webkit-scrollbar-thumb { background: rgba(13, 27, 42, 0.18); border-radius: 2px; }

.tgp-msg {
  max-width: 90%;
  padding: 16px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.62;
  word-wrap: break-word;
  overflow-wrap: break-word;
  animation: tgp-msg-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tgp-msg-bot {
  align-self: flex-start;
  background: #F0EDE8;
  color: #0D1B2A;
  border-bottom-left-radius: 5px;
}

.tgp-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #E8231A 0%, #CC0A00 100%);
  color: #FAFAF8;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 12px rgba(232, 35, 26, 0.22);
}

.tgp-msg-system {
  align-self: center;
  background: transparent;
  color: #6B7A8D;
  font-size: 12px;
  max-width: 100%;
  text-align: center;
  padding: 4px 10px;
}

.tgp-msg a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

/* Typing indicator */
.tgp-typing {
  align-self: flex-start;
  background: #F0EDE8;
  padding: 14px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 5px;
  display: flex;
  gap: 4px;
  animation: tgp-msg-in 0.25s ease both;
}

.tgp-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6B7A8D;
  animation: tgp-typing-bounce 1.4s ease-in-out infinite;
}

.tgp-typing span:nth-child(2) { animation-delay: 0.15s; }
.tgp-typing span:nth-child(3) { animation-delay: 0.3s; }

/* Option chips (for step prompts) */
.tgp-options {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  max-width: 100%;
}

.tgp-option-chip {
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1.5px solid #E8231A;
  background: #FAFAF8;
  color: #E8231A;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer !important;
  transition: all 0.18s ease;
}

.tgp-option-chip:hover {
  background: #E8231A;
  color: #FAFAF8;
}

/* =========================================
   SUGGESTIONS (context-aware chips above input)
   ========================================= */
.tgp-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 22px 18px;
  background: #FAFAF8;
  flex-shrink: 0;
  min-height: 0;
  align-items: flex-start;
}

.tgp-suggestions:empty {
  display: none;
}

.tgp-suggestions:not(:empty) {
  border-top: 1px solid rgba(13, 27, 42, 0.08);
}

.tgp-suggestion-chip {
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(232, 35, 26, 0.32);
  background: #FFFFFF;
  color: #E8231A;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer !important;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.1;
  max-width: 100%;
}
.tgp-suggestion-chip:hover {
  background: #E8231A;
  color: #FAFAF8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 35, 26, 0.28);
}

.tgp-suggestion-chip:active {
  transform: translateY(0);
}

/* =========================================
   INPUT AREA
   ========================================= */
.tgp-input-wrap {
  padding: 0 22px 22px;
  background: #FAFAF8;
  border-top: none;
  flex-shrink: 0;
}

.tgp-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #F0EDE8;
  border-radius: 18px;
  padding: 6px 6px 6px 14px;
  border: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tgp-input-row:focus-within {
  border-color: rgba(232, 35, 26, 0.45);
  box-shadow: 0 0 0 3px rgba(232, 35, 26, 0.08);
}

.tgp-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  line-height: 1.45;
  color: #0D1B2A;
  max-height: 90px;
  padding: 8px 0;
  font-family: inherit;
}

.tgp-input::placeholder {
  color: #6B7A8D;
}

.tgp-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #E8231A 0%, #CC0A00 100%);
  color: #FAFAF8;
  cursor: pointer !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
  box-shadow: 0 3px 10px rgba(232, 35, 26, 0.35);
}

.tgp-send:hover:not(:disabled) { transform: scale(1.08); }
.tgp-send:active:not(:disabled) { transform: scale(0.95); }
.tgp-send:disabled { opacity: 0.4; cursor: not-allowed !important; }

.tgp-send svg { width: 16px; height: 16px; }

.tgp-footer-note {
  text-align: center;
  font-size: 10.5px;
  color: #6B7A8D;
  margin-top: 10px;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.tgp-footer-note strong { color: #E8231A; font-weight: 700; }

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes tgp-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes tgp-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes tgp-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes tgp-live {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.8); }
  50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

@keyframes tgp-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tgp-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 520px) {
  #tgp-chatbot-root {
    bottom: 156px;
    left: 16px;
    right: 16px;
  }

  .tgp-panel {
    left: 0;
    right: 0;
    width: auto;
    height: min(560px, calc(100vh - 170px));
    max-height: min(560px, calc(100vh - 170px));
    min-width: 0;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  .tgp-greeting { display: none; }

  .tgp-header { padding: 18px 18px 16px 18px; }
  .tgp-messages { padding: 22px 20px 14px; }
  .tgp-msg { max-width: 92%; padding: 16px 18px; }
  .tgp-suggestions { padding: 14px 20px 16px; min-height: 0; }
  .tgp-input-wrap { padding: 0 20px 20px; }
}

/* Respect site's cursor hiding for touch-enabled but still give visible cursor inside widget */
@media (hover: hover) and (pointer: fine) {
  #tgp-chatbot-root,
  #tgp-chatbot-root * {
    cursor: auto !important;
  }
  #tgp-chatbot-root button,
  #tgp-chatbot-root .tgp-option-chip,
  #tgp-chatbot-root .tgp-quick-btn,
  #tgp-chatbot-root a {
    cursor: pointer !important;
  }
  #tgp-chatbot-root .tgp-input {
    cursor: text !important;
  }
}
