/* Chat Widget Styles — Premium Modern Design */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

#csbot-chat-widget {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  --radius: 24px;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  position: fixed;
  z-index: 99999;
}

#csbot-chat-widget.position-bottom-right { bottom: 24px; right: 24px; }
#csbot-chat-widget.position-bottom-left { bottom: 24px; left: 24px; }

/* Bubble Button */
.csbot-bubble {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.csbot-bubble:hover {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.15), 0 15px 30px rgba(99, 102, 241, 0.4);
}

.csbot-bubble:active {
  transform: scale(0.95);
}

.csbot-bubble svg {
  width: 30px;
  height: 30px;
  fill: white;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.csbot-bubble .close-icon { display: none; position: absolute; }
.csbot-bubble.open .chat-icon { transform: scale(0) rotate(-90deg); opacity: 0; }
.csbot-bubble.open .close-icon { display: block; transform: scale(1) rotate(0); opacity: 1; }

/* Chat Window */
.csbot-window {
  display: none;
  position: absolute;
  bottom: 84px;
  width: 420px;
  height: 600px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  flex-direction: column;
  transform-origin: bottom right;
  animation: csbot-scaleUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.position-bottom-right .csbot-window { right: 0; transform-origin: bottom right; }
.position-bottom-left .csbot-window { left: 0; transform-origin: bottom left; }

.csbot-window.open {
  display: flex;
}

@keyframes csbot-scaleUp {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header */
.csbot-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.csbot-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.2);
}

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

.csbot-header-info h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csbot-header-info p {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csbot-header-info p::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}

.csbot-header-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.csbot-header-btn:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-2px);
}

.csbot-header-btn:active {
  transform: translateY(0);
}

/* Live Chat Active Banner */
.csbot-live-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f0fdf4;
  border-bottom: 1px solid #dcfce7;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
  animation: csbot-bannerSlide 0.25s ease-out;
}

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

.csbot-live-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #166534;
}

.csbot-live-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: csbot-pulse-green 1.8s infinite;
  flex-shrink: 0;
}

@keyframes csbot-pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.csbot-live-end-btn {
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}

.csbot-live-end-btn:hover {
  background: #dc2626;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.45);
}

.csbot-live-end-btn:active {
  transform: translateY(0);
}

/* Messages */
.csbot-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-secondary);
  scroll-behavior: smooth;
}

.csbot-messages::-webkit-scrollbar { width: 6px; }
.csbot-messages::-webkit-scrollbar-track { background: transparent; }
.csbot-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }
.csbot-messages::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

.csbot-msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.6;
  word-wrap: break-word;
  animation: csbot-msgPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-sm);
}

@keyframes csbot-msgPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.csbot-msg.bot {
  background: var(--bg);
  color: var(--text);
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.csbot-msg.user {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.csbot-msg.agent {
  background: #f0fdf4;
  color: #14532d;
  align-self: flex-start;
  border: 1px solid #bbf7d0;
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.csbot-msg.system {
  align-self: center;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 20px;
  text-align: center;
  border: 1px solid #bbf7d0;
  max-width: 90%;
  margin: 10px auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.csbot-msg.system::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.csbot-agent-header {
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #15803d;
  margin-bottom: 5px;
}

.csbot-msg a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  word-break: break-all;
}

.csbot-btn-link {
  display: inline-block;
  margin: 6px 2px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  word-break: normal !important;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  text-align: center;
}

.csbot-btn-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.csbot-btn-link:active {
  transform: translateY(1px);
}

.csbot-msg.user a { color: white; }
.csbot-msg strong { font-weight: 700; }
.csbot-msg em { font-style: italic; }

.csbot-chat-img { max-width: 100%; border-radius: 12px; margin-bottom: 8px; display: block; box-shadow: var(--shadow-sm); }

.csbot-image-preview {
  padding: 12px 24px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
#csbot-preview-img { height: 44px; border-radius: 8px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
#csbot-preview-remove {
  background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 50%;
  width: 22px; height: 22px; cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
#csbot-preview-remove:hover { background: rgba(0,0,0,0.8); }

/* Typing Indicator */
.csbot-typing {
  display: none;
  align-self: flex-start;
  padding: 14px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.csbot-typing.visible { display: flex; gap: 6px; align-items: center; }

.csbot-typing span {
  width: 8px;
  height: 8px;
  background: var(--primary-light);
  border-radius: 50%;
  animation: csbot-bounce 1.4s infinite cubic-bezier(0.455, 0.03, 0.515, 0.955);
}

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

@keyframes csbot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-8px); opacity: 1; }
}

/* Input */
.csbot-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  flex-shrink: 0;
}

.csbot-attach-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  color: var(--text-light); transition: all 0.2s; flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid transparent;
}
.csbot-attach-btn:hover {
  background: white;
  color: var(--primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.csbot-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 11px 16px;
  font-size: 14px;
  line-height: 22px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
  height: 46px;
  min-height: 46px;
  max-height: 100px;
  box-sizing: border-box;
  overflow-y: hidden;
  background: var(--bg-secondary);
}

.csbot-input::placeholder {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-light);
  opacity: 0.8;
}

.csbot-input:focus {
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.csbot-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.csbot-send:hover {
  opacity: 0.95;
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}
.csbot-send:active { transform: scale(0.95); }
.csbot-send:disabled { background: var(--border); cursor: not-allowed; transform: none; box-shadow: none; opacity: 0.6; }

.csbot-send svg {
  width: 20px;
  height: 20px;
  fill: white;
  margin-left: 2px; /* slight visual balance for send icon */
}

/* Powered By */
.csbot-powered {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.csbot-powered strong { color: var(--primary); }

/* Quick Action Buttons — Grid Layout */
.csbot-quick-actions {
  align-self: flex-start;
  width: 100%;
  padding: 8px 0;
  animation: csbot-msgPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.csbot-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.csbot-quick-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 16px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.csbot-quick-btn:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.1);
}

.csbot-quick-btn:active {
  transform: translateY(0);
}

.csbot-btn-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 8px;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.csbot-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: white;
}

.csbot-btn-icon svg {
  width: 100%;
  height: 100%;
}

.csbot-btn-text {
  flex: 1;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csbot-btn-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-light);
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
}
.csbot-btn-arrow svg {
  width: 100%;
  height: 100%;
}

.csbot-quick-btn:hover .csbot-btn-arrow {
  opacity: 1;
  transform: translateX(2px);
  color: var(--primary);
}

.csbot-quick-btn--paid { border-color: var(--border); }
.csbot-quick-btn--paid .csbot-btn-icon-wrapper { background: var(--success); box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3); }
.csbot-quick-btn--paid:hover {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.1);
}
.csbot-quick-btn--paid:hover .csbot-btn-arrow { color: var(--success); }

.csbot-quick-btn--cashapp { border-color: var(--border); }
.csbot-quick-btn--cashapp .csbot-btn-icon-wrapper { background: #00d632; box-shadow: 0 2px 6px rgba(0, 214, 50, 0.3); }
.csbot-quick-btn--cashapp:hover {
  border-color: rgba(0, 214, 50, 0.3);
  box-shadow: 0 6px 16px rgba(0, 214, 50, 0.1);
}
.csbot-quick-btn--cashapp:hover .csbot-btn-arrow { color: #00d632; }

.csbot-quick-btn--livechat { border-color: var(--border); }
.csbot-quick-btn--livechat .csbot-btn-icon-wrapper { background: linear-gradient(135deg, #0ea5e9, #0284c7); box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3); }
.csbot-quick-btn--livechat:hover {
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.12);
}
.csbot-quick-btn--livechat:hover .csbot-btn-arrow { color: #0284c7; }

/* Mobile Responsive */
@media (max-width: 600px) {
  #csbot-close-mobile { display: flex !important; }
  .csbot-window.open ~ .csbot-bubble { display: none !important; }

  .csbot-window {
    width: 100vw !important;
    height: 100vh !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    top: 0 !important;
    border-radius: 0 !important;
    position: fixed !important;
    max-width: none !important;
    max-height: none !important;
    animation: csbot-slideUpMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes csbot-slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .csbot-actions-grid {
    grid-template-columns: 1fr;
  }
}

