/* ════════════════════════════════════
   BOX-SIZING RESET (scoped to widget)
   FIX #7: prevents padding from causing overflow inside the panel
   ════════════════════════════════════ */
#ta-panel,
#ta-panel * {
  box-sizing: border-box;
}

/* ════════════════════════════════════
   FLOATING TRIGGER BUTTON
   ════════════════════════════════════ */
#ta-trigger {
  position: fixed;
  bottom: 150px; right: 23px;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2e7d32, #66bb6a);
  border: none; cursor: pointer;
  box-shadow: 0 4px 20px rgba(46,125,50,0.55);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 10000;
}
#ta-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(46,125,50,0.7);
}
#ta-trigger svg { width: 30px; height: 30px; fill: #fff; }

/* Pulse ring */
#ta-trigger::after {
  content: '';
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(102,187,106,0.5);
  animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring {
  0%            { transform: scale(0.88); opacity: 1; }
  80%, 100%     { transform: scale(1.25); opacity: 0; }
}

/* Notification badge */
#ta-badge {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ff5722; color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

/* ════════════════════════════════════
   CHAT PANEL
   ════════════════════════════════════ */
#ta-panel {
  position: fixed;
  bottom: 108px; right: 28px;
  width: 380px; max-width: calc(100vw - 40px);
  height: 560px; max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.28);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s;
  z-index: 10000;
}
#ta-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto; /* FIX #3: was 'all' which is non-standard */
}

/* ════════════════════════════════════
   HEADER
   ════════════════════════════════════ */
.ta-header {
  background: linear-gradient(135deg, #1b5e20, #388e3c);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.ta-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ta-avatar svg { width: 24px; height: 24px; fill: #fff; }
.ta-header-text { flex: 1; }
.ta-header-text h3 {
  color: #fff; font-size: 15px; font-weight: 700; line-height: 1.2;
}
.ta-header-text p {
  color: rgba(255,255,255,0.75); font-size: 12px; margin-top: 2px;
}
.ta-status { display: flex; align-items: center; gap: 5px; }
.ta-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #a5d6a7;
  animation: blink 1.8s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.ta-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.8); font-size: 22px; line-height: 1;
  padding: 4px; transition: color 0.15s;
}
.ta-close:hover { color: #fff; }

/* ════════════════════════════════════
   QUICK-ACTION CHIPS
   ════════════════════════════════════ */
.ta-chips {
  padding: 10px 14px 4px;
  display: flex; gap: 8px; flex-wrap: wrap;
  flex-shrink: 0;
  border-bottom: 1px solid #f0f0f0;
}
.ta-chip {
  background: #e8f5e9; color: #2e7d32;
  border: 1px solid #c8e6c9;
  border-radius: 16px; padding: 5px 12px;
  font-size: 12px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ta-chip:hover { background: #c8e6c9; border-color: #a5d6a7; }

/* ════════════════════════════════════
   MESSAGES AREA
   ════════════════════════════════════ */
#ta-messages {
  flex: 1; overflow-y: auto;
  padding: 16px 14px 8px;
  scroll-behavior: smooth;
}
#ta-messages::-webkit-scrollbar { width: 4px; }
#ta-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* ════════════════════════════════════
   MESSAGE BUBBLES
   ════════════════════════════════════ */
.ta-msg {
  display: flex; gap: 8px;
  margin-bottom: 14px; align-items: flex-end;
}
.ta-msg.user { flex-direction: row-reverse; }

.ta-msg-icon {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #1b5e20, #388e3c);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ta-msg-icon svg { width: 16px; height: 16px; fill: #fff; }

.ta-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px; line-height: 1.5;
}
.ta-msg.bot .ta-bubble {
  background: #f4f4f4; color: #222;
  border-bottom-left-radius: 4px;
}
.ta-msg.user .ta-bubble {
  background: linear-gradient(135deg, #2e7d32, #4caf50);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ════════════════════════════════════
   BOOKING CARDS
   ════════════════════════════════════ */
.ta-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12.5px;
}
.ta-card-title {
  font-weight: 700; color: #1b5e20; margin-bottom: 4px;
}
.ta-card-row {
  display: flex; justify-content: space-between;
  color: #555; margin: 2px 0;
}
.ta-card-row span:last-child { font-weight: 600; color: #333; }

/* FIX #2: .ta-card-note was missing — was previously an inline style */
.ta-card-note {
  font-size: 12px;
  color: #666;
  margin: 8px 0 12px;
  line-height: 1.4;
  font-style: italic;
  text-align: left;
}

.ta-card-btn {
  display: inline-block; margin-top: 8px;
  background: #2e7d32; color: #fff;
  border: none; border-radius: 8px;
  padding: 6px 14px; font-size: 12px; cursor: pointer;
  text-decoration: none; transition: background 0.15s;
}
.ta-card-btn:hover { background: #1b5e20; }

/* ════════════════════════════════════
   TYPING INDICATOR
   FIX #1: was .ta-typing / .ta-typing span — didn't match
            id="ta-typing" with class="dot" children in HTML/JS
   ════════════════════════════════════ */
#ta-typing {
  display: flex;       /* JS overrides to 'none' when hidden */
  gap: 4px;
  padding: 4px 8px;
  align-items: center;
}
#ta-typing .dot {
  width: 7px; height: 7px;
  background: #aaa; border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
#ta-typing .dot:nth-child(2) { animation-delay: 0.18s; }
#ta-typing .dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-7px); }
}

/* ════════════════════════════════════
   INPUT AREA
   ════════════════════════════════════ */
.ta-input-area {
  padding: 10px 14px 14px;
  border-top: 1px solid #f0f0f0;
  display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;
  background: #fff;
}
#ta-input {
  flex: 1;
  border: 1.5px solid #ddd;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 13.5px; resize: none; outline: none;
  max-height: 100px; overflow-y: auto;
  font-family: inherit; line-height: 1.4;
  transition: border-color 0.2s;
}
#ta-input:focus { border-color: #4caf50; }

#ta-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #2e7d32, #4caf50);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform 0.15s, background 0.15s;
}
#ta-send:hover { transform: scale(1.08); }

/* FIX #4: :disabled style was defined but JS never set disabled — now it's
           ready for when you add sendBtn.disabled = true/false in widget.js */
#ta-send:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}
#ta-send svg { width: 18px; height: 18px; fill: #fff; }

/* ════════════════════════════════════
   FOOTER
   ════════════════════════════════════ */
.ta-footer-note {
  text-align: center; font-size: 11px; color: #bbb;
  padding: 0 14px 10px; flex-shrink: 0;
}

/* ════════════════════════════════════
   MOBILE RESPONSIVE
   FIX #5: panel had no breakpoint — clipped on narrow screens
   FIX #6: chips wrapped to two rows on mobile — now horizontally scrollable
   ════════════════════════════════════ */
@media (max-width: 480px) {
  #ta-panel {
    right: 8px;
    left: 8px;
    width: auto;      /* left + right edges control width */
    bottom: 90px;
    height: 70vh;
    max-height: calc(100vh - 110px);
    border-radius: 16px;
  }

  #ta-trigger {
    bottom: 16px;
    right: 16px;
    width: 56px; height: 56px;
  }

  .ta-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;       /* Firefox */
    padding-bottom: 8px;
  }
  .ta-chips::-webkit-scrollbar { display: none; } /* Chrome/Safari */
}