/* ==========================================================================
   GOFTINO-STYLE CUSTOMER FLOATING LIVE CHAT WIDGET
   ========================================================================== */

/* Floating Button (Bottom-Left) */
.tyiam-chat-widget-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff7900 0%, #e66d00 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 24px rgba(255, 121, 0, 0.4);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.tyiam-chat-widget-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 121, 0, 0.5);
}

.tyiam-chat-widget-btn .unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
}

/* Chat Popup Window */
.tyiam-chat-box {
  position: fixed;
  bottom: 96px;
  left: 24px;
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Vazirmatn', sans-serif;
  direction: rtl;
}

.tyiam-chat-box.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.tyiam-chat-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.tyiam-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff7900, #e66d00);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.tyiam-chat-title h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: white;
}

.tyiam-chat-title span {
  font-size: 11px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tyiam-chat-context-bar {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 14px;
  font-size: 11px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.tyiam-chat-context-bar i {
  color: #ff7900;
  font-size: 13px;
}

.tyiam-chat-context-bar span {
  color: #0f172a;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tyiam-chat-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s;
}

.tyiam-chat-close-btn:hover {
  color: white;
}

/* Body / Messages Area */
.tyiam-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Message Bubbles */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: chatMsgIn 0.25s ease-out;
}

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

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

.chat-msg.user .msg-bubble {
  background: #ff7900;
  color: white;
  border-radius: 16px 16px 16px 4px;
}

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

.chat-msg.admin .msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.msg-bubble {
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.msg-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  align-self: flex-end;
}

/* Footer / Input Area */
.tyiam-chat-footer {
  padding: 12px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tyiam-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.tyiam-chat-input:focus {
  border-color: #ff7900;
}

.tyiam-chat-send-btn {
  background: linear-gradient(135deg, #ff7900, #e66d00);
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.tyiam-chat-file-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #64748b;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.tyiam-chat-file-btn:hover {
  background: #ff7900;
  color: white;
  border-color: #ff7900;
}

.tyiam-chat-send-btn:hover {
  background: #e66d00;
}

/* Guest Info Modal Inside Chat */
.tyiam-chat-intro {
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tyiam-chat-intro h3 {
  margin: 0;
  font-size: 16px;
  color: #1e293b;
}

.tyiam-chat-intro p {
  font-size: 12px;
  color: #64748b;
  margin: 0;
}

/* Responsive adjustment for mobile bottom navigation */
@media (max-width: 768px) {
  .tyiam-chat-widget-btn {
    bottom: 84px;
  }
  .tyiam-chat-box {
    bottom: 156px;
  }
}

