/* chat-widget.css — Socratii Concierge floating chat widget */

.sc-chat-fab {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 9998;
  transition: transform var(--transition-interactive), background var(--transition-interactive);
}

.sc-chat-fab:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
}

.sc-chat-fab svg {
  width: 24px;
  height: 24px;
}

.sc-chat-fab .sc-chat-fab-icon-close {
  display: none;
}

.sc-chat-fab[aria-expanded='true'] .sc-chat-fab-icon-open {
  display: none;
}

.sc-chat-fab[aria-expanded='true'] .sc-chat-fab-icon-close {
  display: block;
}

.sc-chat-fab-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-gold);
  border: 2px solid var(--color-bg);
}

.sc-chat-panel {
  position: fixed;
  right: var(--space-6);
  bottom: calc(var(--space-6) + 68px);
  width: 380px;
  max-width: calc(100vw - 2 * var(--space-4));
  height: 540px;
  max-height: calc(100vh - 140px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 200ms var(--ease-out-expo), transform 200ms var(--ease-out-expo);
}

.sc-chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sc-chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  flex-shrink: 0;
}

.sc-chat-header-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sc-chat-header-mark img {
  width: 18px;
  height: 18px;
  display: block;
}

.sc-chat-header-text {
  flex: 1;
  min-width: 0;
}

.sc-chat-header-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  line-height: 1.2;
}

.sc-chat-header-tagline {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-top: 2px;
}

.sc-chat-close {
  background: none;
  border: none;
  color: var(--color-text-inverse);
  opacity: 0.8;
  cursor: pointer;
  padding: var(--space-1);
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.sc-chat-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.sc-chat-close svg {
  width: 18px;
  height: 18px;
}

.sc-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--color-bg);
}

.sc-chat-welcome {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  padding-bottom: var(--space-1);
}

.sc-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
}

.sc-chat-chip {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition-interactive), background var(--transition-interactive);
}

.sc-chat-chip:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.sc-chat-msg {
  max-width: 88%;
  font-size: var(--text-xs);
  line-height: 1.55;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}

.sc-chat-msg.is-user {
  align-self: flex-end;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-bottom-right-radius: var(--radius-sm);
}

.sc-chat-msg.is-assistant {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-bottom-left-radius: var(--radius-sm);
}

.sc-chat-msg.is-error {
  background: var(--color-error-highlight);
  border-color: var(--color-error);
  color: var(--color-error);
}

.sc-chat-sources {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 88%;
  margin-top: calc(-1 * var(--space-2));
}

.sc-chat-source-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-highlight);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
  transition: background var(--transition-interactive);
}

.sc-chat-source-link:hover {
  background: var(--color-gold-highlight);
  color: var(--color-text);
}

.sc-chat-source-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.sc-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
}

.sc-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-text-faint);
  animation: sc-chat-bounce 1.2s infinite ease-in-out;
}

.sc-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.sc-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

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

.sc-chat-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--color-border);
  padding: var(--space-3);
  background: var(--color-surface);
}

.sc-chat-disclaimer {
  font-size: 10px;
  color: var(--color-text-faint);
  line-height: 1.4;
  margin-bottom: var(--space-2);
}

.sc-chat-form {
  display: flex;
  gap: var(--space-2);
}

.sc-chat-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-4);
}

.sc-chat-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.sc-chat-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-interactive);
}

.sc-chat-send:hover {
  background: var(--color-primary-hover);
}

.sc-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sc-chat-send svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .sc-chat-panel {
    right: var(--space-3);
    left: var(--space-3);
    width: auto;
    bottom: calc(var(--space-6) + 68px);
  }

  .sc-chat-fab {
    right: var(--space-4);
    bottom: var(--space-4);
  }
}
