/* ============================================================
   TELEDO AI CHAT WIDGET
   ============================================================ */

/* --- Floating button --- */
.tedi-fab {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066FF 0%, #0044CC 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: tedi-pulse 3s ease-in-out infinite;
}

.tedi-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0, 102, 255, 0.55);
}

.tedi-fab svg {
  width: 26px;
  height: 26px;
  fill: white;
  transition: transform 0.3s ease;
}

.tedi-fab.active svg {
  transform: rotate(90deg);
}

@keyframes tedi-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4); }
  50% { box-shadow: 0 4px 28px rgba(0, 102, 255, 0.65); }
}

/* --- Notification badge --- */
.tedi-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: #FF3B30;
  border-radius: 50%;
  border: 2px solid #0A0A0F;
  display: block;
}

.tedi-fab.active .tedi-badge {
  display: none;
}

/* --- Chat window --- */
.tedi-chat {
  position: fixed;
  bottom: 160px;
  right: 20px;
  width: 370px;
  max-height: 520px;
  border-radius: 16px;
  overflow: hidden;
  z-index: 9999;
  display: none;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  font-family: 'Inter', -apple-system, sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s ease;
  background: #12121A;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tedi-chat.open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --- Header --- */
.tedi-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #0066FF 0%, #0044CC 100%);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.tedi-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.tedi-header-info {
  flex: 1;
}

.tedi-header-name {
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
}

.tedi-header-status {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.75rem;
}

.tedi-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 4px;
  font-size: 20px;
  line-height: 1;
  transition: color 0.2s;
}

.tedi-close:hover {
  color: white;
}

/* --- Messages area --- */
.tedi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  max-height: 340px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.tedi-messages::-webkit-scrollbar {
  width: 4px;
}

.tedi-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* --- Message bubbles --- */
.tedi-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-wrap: break-word;
  animation: tedi-fadeIn 0.25s ease;
}

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

.tedi-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  color: #E5E7EB;
  border-bottom-left-radius: 4px;
}

.tedi-msg.user {
  align-self: flex-end;
  background: #0066FF;
  color: white;
  border-bottom-right-radius: 4px;
}

/* --- Typing indicator --- */
.tedi-typing {
  align-self: flex-start;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  display: none;
  gap: 4px;
  align-items: center;
}

.tedi-typing.show {
  display: flex;
}

.tedi-typing span {
  width: 7px;
  height: 7px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  animation: tedi-bounce 1.2s ease-in-out infinite;
}

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

@keyframes tedi-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* --- Quick replies --- */
.tedi-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.tedi-quick button {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0, 102, 255, 0.3);
  background: rgba(0, 102, 255, 0.08);
  color: #5599FF;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.tedi-quick button:hover {
  background: rgba(0, 102, 255, 0.2);
  border-color: rgba(0, 102, 255, 0.5);
}

/* --- Input area --- */
.tedi-input-area {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.tedi-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #E5E7EB;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.tedi-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.tedi-input:focus {
  border-color: rgba(0, 102, 255, 0.4);
}

.tedi-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #0066FF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.tedi-send:hover {
  background: #0055DD;
}

.tedi-send:active {
  transform: scale(0.92);
}

.tedi-send:disabled {
  background: rgba(0, 102, 255, 0.3);
  cursor: not-allowed;
}

.tedi-send svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* --- Light theme --- */
[data-theme="light"] .tedi-chat {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .tedi-msg.bot {
  background: #F1F5F9;
  color: #334155;
}

[data-theme="light"] .tedi-typing {
  background: #F1F5F9;
}

[data-theme="light"] .tedi-typing span {
  background: rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .tedi-input-area {
  border-color: #E2E8F0;
  background: #F8FAFC;
}

[data-theme="light"] .tedi-input {
  background: #FFFFFF;
  border-color: #E2E8F0;
  color: #1E293B;
}

[data-theme="light"] .tedi-input::placeholder {
  color: #94A3B8;
}

[data-theme="light"] .tedi-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .tedi-badge {
  border-color: #FFFFFF;
}

[data-theme="light"] .tedi-quick button {
  background: rgba(0, 102, 255, 0.05);
  border-color: rgba(0, 102, 255, 0.2);
  color: #0066FF;
}

/* --- Mobile responsive --- */
@media (max-width: 640px) {
  .tedi-chat {
    right: 8px;
    left: 8px;
    bottom: 80px;
    width: auto;
    max-height: 70vh;
  }

  .tedi-fab {
    bottom: 140px;
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .tedi-fab svg {
    width: 22px;
    height: 22px;
  }
}
