.fc-widget-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.fc-widget-wrap.position-bottom-left {
  right: auto;
  left: 24px;
  align-items: flex-start;
}

.fc-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0077C8, #005fa3);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(0, 119, 200, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.fc-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(0, 119, 200, 0.5);
}

.fc-fab.active {
  background: linear-gradient(135deg, #64748b, #475569);
  box-shadow: 0 4px 16px rgba(71, 85, 105, 0.3);
}

.fc-fab svg {
  transition: all 0.25s ease;
}

.fc-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: fc-badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fc-badge-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.fc-panel {
  width: 400px;
  max-height: 580px;
  background: #f8f9fb;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  animation: fc-panel-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fc-panel.closing {
  animation: fc-panel-out 0.2s ease forwards;
}

@keyframes fc-panel-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fc-panel-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

.fc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, #0077C8, #005fa3);
  color: #fff;
}

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

.fc-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.fc-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.fc-header-title {
  font-weight: 700;
  font-size: 0.9375rem;
  display: block;
  line-height: 1.2;
}

.fc-header-status {
  font-size: 0.6875rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
}

.fc-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: fc-blink 1.5s ease-in-out infinite;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.6);
}

@keyframes fc-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.fc-header-actions {
  display: flex;
  gap: 4px;
}

.fc-header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.fc-header-btn:hover {
  background: rgba(255,255,255,0.25);
}

.fc-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  min-height: 300px;
  max-height: 400px;
}

.fc-body::-webkit-scrollbar {
  width: 4px;
}

.fc-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.fc-welcome {
  text-align: center;
  padding: 20px 12px;
}

.fc-welcome-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #e0f2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fc-welcome-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.fc-welcome h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 8px;
}

.fc-welcome p {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.6;
  margin: 0 0 18px;
}

.fc-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.fc-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  color: #4b5563;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.fc-quick-btn:hover {
  border-color: #0077C8;
  color: #0077C8;
  background: #e8f4fd;
}

.fc-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  animation: fc-msg-in 0.2s ease;
}

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

.fc-msg.user {
  flex-direction: row-reverse;
}

.fc-msg-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e0f2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  overflow: hidden;
}

.fc-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.fc-msg-avatar.agent-avatar {
  background: #fef9e7;
  border-color: #f5c518;
  color: #b8860b;
}

.fc-msg-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.8125rem;
  line-height: 1.55;
  position: relative;
  word-wrap: break-word;
}

.fc-msg.user .fc-msg-bubble {
  background: #0077C8;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.fc-msg.assistant .fc-msg-bubble {
  background: #fff;
  color: #1a1a2e;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

.fc-msg.agent .fc-msg-bubble {
  background: #fef9e7;
  color: #1a1a2e;
  border: 1px solid #f5c518;
  border-bottom-left-radius: 4px;
}

.fc-agent-name {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #b8860b;
  margin-bottom: 2px;
}

.fc-msg-bubble a {
  color: #0077C8;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(0, 119, 200, 0.3);
  transition: all 0.15s;
  word-break: break-all;
}

.fc-msg-bubble a:hover {
  color: #005fa3;
  border-bottom-color: #005fa3;
}

.fc-msg.user .fc-msg-bubble a {
  color: #e0f0ff;
  border-bottom-color: rgba(255,255,255,0.4);
}

.fc-msg.user .fc-msg-bubble a:hover {
  color: #fff;
  border-bottom-color: #fff;
}

.fc-msg-bubble strong {
  font-weight: 600;
}

.fc-msg-bubble code {
  background: rgba(0,0,0,0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.fc-msg.user .fc-msg-bubble code {
  background: rgba(255,255,255,0.2);
}

.fc-msg-time {
  display: block;
  font-size: 0.625rem;
  color: #9ca3af;
  margin-top: 4px;
  text-align: right;
}

.fc-msg.user .fc-msg-time {
  color: rgba(255,255,255,0.6);
}

.fc-msg-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.fc-att-image-link {
  display: block;
  max-width: 240px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.fc-att-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.fc-att-image:hover {
  opacity: 0.9;
}

.fc-att-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.03);
  color: #0077C8;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-att-file-btn:hover {
  background: #e8f4fd;
  border-color: #0077C8;
}

.fc-msg.user .fc-att-file-btn {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.fc-msg.user .fc-att-file-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.fc-agent-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: #e8f5e9;
  border: 1px solid #4caf50;
  border-radius: 10px;
  animation: fc-msg-in 0.2s ease;
}

.fc-agent-banner-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #4caf50;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fc-agent-banner-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #2e7d32;
}

.fc-agent-banner-sub {
  display: block;
  font-size: 0.6875rem;
  color: #388e3c;
}

.fc-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.fc-typing-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e0f2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.fc-typing-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.fc-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.fc-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: fc-bounce 1.4s infinite;
}

.fc-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.fc-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes fc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.fc-footer {
  padding: 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.fc-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fc-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  font-size: 0.8125rem;
  background: #f8f9fb;
  color: #1a1a2e;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.fc-input:focus {
  border-color: #0077C8;
  box-shadow: 0 0 0 3px rgba(0, 119, 200, 0.1);
}

.fc-input:disabled {
  opacity: 0.6;
}

.fc-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #0077C8;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.fc-send-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: scale(1.05);
}

.fc-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fc-contact-form {
  padding: 16px;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  margin-bottom: 12px;
  animation: fc-msg-in 0.2s ease;
}

.fc-contact-form h4 {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1e40af;
  margin: 0 0 10px;
}

.fc-contact-form input,
.fc-welcome-form input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.8125rem;
  margin-bottom: 8px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
  color: #1a1a2e;
  background: #fff;
}

.fc-contact-form input:focus,
.fc-welcome-form input:focus {
  border-color: #0077C8;
  box-shadow: 0 0 0 2px rgba(0, 119, 200, 0.1);
}

.fc-contact-form input::placeholder,
.fc-welcome-form input::placeholder {
  color: #9ca3af;
}

.fc-contact-form button,
.fc-welcome-form button {
  width: 100%;
  padding: 9px;
  background: #0077C8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.fc-contact-form button:hover,
.fc-welcome-form button:hover {
  background: #005fa3;
}

.fc-welcome-form {
  text-align: left;
  margin-top: 14px;
}

.fc-powered {
  text-align: center;
  padding: 6px;
  font-size: 0.625rem;
  color: #9ca3af;
  background: #fff;
  border-top: 1px solid #f3f4f6;
}

.fc-powered a {
  color: #6b7280;
  text-decoration: none;
  font-weight: 600;
}

.fc-powered a:hover {
  color: #0077C8;
}

.fc-hidden {
  display: none !important;
}

@media (max-width: 480px) {
  .fc-widget-wrap {
    bottom: 16px;
    right: 16px;
  }

  .fc-widget-wrap.position-bottom-left {
    left: 16px;
  }

  .fc-panel {
    width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
  }

  .fc-fab {
    width: 52px;
    height: 52px;
  }
}
