/* JAS Design Studio — Live AI & Customer Concierge Widget Styles */

:root {
  --jas-bg-dark: #0a0d14;
  --jas-surface: #111827;
  --jas-surface-glass: rgba(17, 24, 39, 0.85);
  --jas-border: rgba(255, 255, 255, 0.1);
  --jas-border-highlight: rgba(0, 229, 255, 0.4);
  --jas-cyan: #00e5ff;
  --jas-cyan-glow: rgba(0, 229, 255, 0.25);
  --jas-cyan-dark: #0097a7;
  --jas-text: #f8fafc;
  --jas-text-muted: #94a3b8;
  --jas-visitor-bubble: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  --jas-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 229, 255, 0.12);
}

/* Chat Widget Container */
#jas-chat-widget {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  z-index: 9990;
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

/* Floating Launcher Button — Icon-only by default, reveals "Ask JAS" on hover or press */
.jas-chat-launcher {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--jas-surface);
  border: 1.5px solid var(--jas-border-highlight);
  color: var(--jas-text);
  padding: 14px;
  border-radius: 9999px;
  box-shadow: var(--jas-shadow);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.jas-chat-launcher:hover,
.jas-chat-launcher:active,
.jas-chat-launcher:focus-visible,
.jas-chat-launcher.jas-launcher-active {
  transform: translateY(-3px) scale(1.03);
  border-color: var(--jas-cyan);
  padding: 14px 20px;
  box-shadow: 0 15px 30px -5px rgba(0, 229, 255, 0.35);
}

.jas-launcher-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--jas-cyan);
  position: relative;
  flex-shrink: 0;
}

.jas-launcher-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.jas-launcher-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  margin-left: 0;
  transition: max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease,
              margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.jas-chat-launcher:hover .jas-launcher-label,
.jas-chat-launcher:active .jas-launcher-label,
.jas-chat-launcher:focus-visible .jas-launcher-label,
.jas-chat-launcher.jas-launcher-active .jas-launcher-label {
  max-width: 90px;
  opacity: 1;
  margin-left: 10px;
}

.jas-chat-launcher > .jas-status-dot {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--jas-surface);
}

.jas-chat-launcher:hover > .jas-status-dot,
.jas-chat-launcher:active > .jas-status-dot,
.jas-chat-launcher.jas-launcher-active > .jas-status-dot {
  position: static;
  margin-left: 8px;
  border: none;
}

.jas-status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: jas-pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes jas-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.jas-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
  display: none;
}

/* Chat Main Window */
.jas-chat-window {
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 100px);
  background: var(--jas-surface-glass);
  border: 1px solid var(--jas-border);
  border-radius: 20px;
  box-shadow: var(--jas-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin-bottom: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.jas-chat-window.jas-open {
  display: flex;
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.jas-chat-header {
  padding: 16px 20px;
  background: rgba(10, 13, 20, 0.85);
  border-bottom: 1px solid var(--jas-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.jas-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--jas-cyan);
  box-shadow: 0 0 12px var(--jas-cyan-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  position: relative;
  flex-shrink: 0;
}

.jas-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.jas-title-group h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--jas-text);
  line-height: 1.2;
}

.jas-subtitle {
  font-size: 12px;
  color: var(--jas-cyan);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.jas-header-actions {
  display: flex;
  gap: 8px;
}

.jas-icon-btn {
  background: transparent;
  border: none;
  color: var(--jas-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.jas-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--jas-text);
}

/* Messages Area */
.jas-messages-body {
  flex: 1;
  padding: 20px 16px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  min-height: 160px;
}

.jas-messages-body::-webkit-scrollbar {
  width: 5px;
}
.jas-messages-body::-webkit-scrollbar-track {
  background: transparent;
}
.jas-messages-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

/* Message Bubbles */
.jas-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: jas-fade-in 0.25s ease forwards;
}

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

.jas-msg-visitor {
  align-self: flex-end;
}

.jas-msg-ai, .jas-msg-representative {
  align-self: flex-start;
}

.jas-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.48;
  word-break: break-word;
}

.jas-msg-visitor .jas-bubble {
  background: var(--jas-visitor-bubble);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.jas-msg-ai .jas-bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--jas-border);
  color: var(--jas-text);
  border-bottom-left-radius: 4px;
}

.jas-msg-representative .jas-bubble {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid var(--jas-border-highlight);
  color: var(--jas-text);
  border-bottom-left-radius: 4px;
}

.jas-sender-tag {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.jas-msg-visitor .jas-sender-tag {
  color: var(--jas-text-muted);
  justify-content: flex-end;
}

.jas-msg-ai .jas-sender-tag {
  color: var(--jas-cyan);
}

.jas-msg-representative .jas-sender-tag {
  color: #38bdf8;
}

.jas-verified-badge {
  display: inline-block;
  background: #0284c7;
  color: #fff;
  border-radius: 50%;
  width: 13px;
  height: 13px;
  text-align: center;
  line-height: 13px;
  font-size: 9px;
}

.jas-msg-time {
  font-size: 10px;
  color: var(--jas-text-muted);
  margin-top: 4px;
  opacity: 0.8;
}

/* System Notice */
.jas-system-notice {
  align-self: center;
  text-align: center;
  font-size: 11.5px;
  color: var(--jas-cyan);
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.2);
  padding: 6px 14px;
  border-radius: 9999px;
  margin: 6px 0;
  max-width: 90%;
}

/* Quick Action Chips & Collapsible Container */
.jas-chips-container {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 13, 20, 0.85);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.jas-chips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--jas-text-muted);
  cursor: pointer;
  user-select: none;
}

.jas-chips-header:hover {
  color: var(--jas-cyan);
}

.jas-quick-chips {
  padding: 4px 14px 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  transition: all 0.3s ease;
}

.jas-chips-collapsed .jas-quick-chips {
  display: none;
}

.jas-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--jas-border);
  color: var(--jas-text);
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  line-height: 1.25;
  user-select: none;
}

.jas-chip:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--jas-cyan);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.15);
}

.jas-chip-full {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.12) 0%, rgba(0, 119, 182, 0.18) 100%);
  border: 1px solid var(--jas-cyan);
  color: var(--jas-cyan);
  font-weight: 700;
  padding: 10px 12px;
}

.jas-chip-full:hover {
  background: var(--jas-cyan);
  color: #0a0d14;
  box-shadow: 0 6px 16px rgba(0, 229, 255, 0.3);
}

/* Typing Indicator */
.jas-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--jas-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  display: none;
}

.jas-dot {
  width: 6px;
  height: 6px;
  background: var(--jas-cyan);
  border-radius: 50%;
  animation: jas-bounce 1.4s infinite ease-in-out both;
}

.jas-dot:nth-child(1) { animation-delay: -0.32s; }
.jas-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes jas-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Area */
.jas-chat-footer {
  padding: 12px 16px;
  background: rgba(10, 13, 20, 0.95);
  border-top: 1px solid var(--jas-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.jas-input-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--jas-border);
  color: var(--jas-text);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s;
}

.jas-input-box:focus {
  border-color: var(--jas-cyan);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 10px var(--jas-cyan-glow);
}

.jas-send-btn {
  background: var(--jas-cyan);
  border: none;
  color: #0a0d14;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.jas-send-btn:hover {
  background: #38bdf8;
  transform: scale(1.05);
}

.jas-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #jas-chat-widget {
    bottom: 16px;
    right: 16px;
  }
  .jas-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 110px);
    border-radius: 16px;
  }
}
