/**
 * SquareLoops Inquiry Assistant - Modern Floating Widget Styles
 */

:root {
  --sl-primary: #2563eb;
  --sl-primary-hover: #1d4ed8;
  --sl-primary-light: #eff6ff;
  --sl-secondary: #0f172a;
  --sl-surface: #ffffff;
  --sl-surface-glass: rgba(255, 255, 255, 0.96);
  --sl-border: #e2e8f0;
  --sl-text: #0f172a;
  --sl-text-muted: #64748b;
  --sl-success: #10b981;
  --sl-radius: 16px;
  --sl-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.2), 0 0 1px 1px rgba(15, 23, 42, 0.05);
}

/* Floating Launcher Button */
.sl-widget-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  border: none;
  cursor: pointer;
  z-index: 999990;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  outline: none;
}

.sl-widget-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.45);
}

.sl-widget-launcher:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.5);
  outline-offset: 3px;
}

.sl-widget-launcher svg {
  width: 28px;
  height: 28px;
  transition: transform 0.25s ease;
}

.sl-widget-open .sl-widget-launcher svg.sl-icon-chat {
  display: none;
}

.sl-widget-open .sl-widget-launcher svg.sl-icon-close {
  display: block;
}

.sl-widget-closed .sl-widget-launcher svg.sl-icon-chat {
  display: block;
}

.sl-widget-closed .sl-widget-launcher svg.sl-icon-close {
  display: none;
}

/* Pulse Notification Ring */
.sl-launcher-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
}

/* Main Chat Modal Panel */
.sl-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--sl-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--sl-radius);
  box-shadow: var(--sl-shadow);
  border: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999991;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
}

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

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

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

.sl-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.sl-header-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.sl-header-subtitle {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.sl-status-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.sl-header-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.sl-header-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* Stepper Progress bar */
.sl-progress-bar {
  height: 3px;
  background: #334155;
  width: 100%;
  position: relative;
}

.sl-progress-indicator {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #2563eb);
  transition: width 0.3s ease;
  width: 25%;
}

/* Messages Scrollable Body */
.sl-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.sl-chat-body::-webkit-scrollbar {
  width: 5px;
}
.sl-chat-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Chat Message Bubbles */
.sl-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: slFadeSlide 0.25s ease-out;
}

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

.sl-msg-bot {
  align-self: flex-start;
}

.sl-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.sl-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.sl-msg-content {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.sl-msg-bot .sl-msg-content {
  background: #f1f5f9;
  color: var(--sl-text);
  border-bottom-left-radius: 4px;
}

.sl-msg-user .sl-msg-content {
  background: var(--sl-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Step 2: Contact Form Card inside Chat */
.sl-form-card {
  background: #ffffff;
  border: 1px solid var(--sl-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  width: 100%;
  margin-top: 4px;
}

.sl-field-group {
  margin-bottom: 12px;
}

.sl-field-group:last-child {
  margin-bottom: 0;
}

.sl-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sl-text-muted);
  margin-bottom: 4px;
}

.sl-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--sl-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--sl-text);
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sl-input:focus {
  outline: none;
  border-color: var(--sl-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.sl-input.sl-input-error {
  border-color: #ef4444;
  background: #fef2f2;
}

/* Step 3: Project Qualifier & Scoping Sections */
.sl-scoping-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px dashed rgba(226, 232, 240, 0.9);
}

.sl-scoping-section-last {
  border-bottom: none;
  margin-bottom: 8px;
  padding-bottom: 0;
}

.sl-scoping-section .sl-field-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: -0.1px;
}

.sl-field-icon {
  font-size: 15px;
  line-height: 1;
}

.sl-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 6px;
}

.sl-chip {
  padding: 9px 15px;
  background: #ffffff;
  border: 1.5px solid var(--sl-border);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sl-text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sl-chip:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(15, 23, 42, 0.06);
}

.sl-chip.sl-chip-active {
  background: #eff6ff;
  border-color: var(--sl-primary);
  color: var(--sl-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.16);
  transform: translateY(-1px);
}

.sl-chip.sl-chip-active::before {
  content: '✓';
  font-size: 11px;
  font-weight: 800;
  color: var(--sl-primary);
}

.sl-chip-single.sl-chip-active {
  background: #eff6ff;
  border-color: var(--sl-primary);
  color: var(--sl-primary);
}

/* Action Buttons */
.sl-btn-primary {
  width: 100%;
  background: var(--sl-primary);
  color: #ffffff;
  border: none;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sl-btn-primary:hover {
  background: var(--sl-primary-hover);
}

.sl-btn-primary:active {
  transform: scale(0.99);
}

.sl-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Footer Typing Input Area (For Step 1 initial requirement) */
.sl-chat-footer {
  padding: 14px 18px;
  background: #ffffff;
  border-top: 1px solid var(--sl-border);
}

.sl-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sl-chat-textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  padding: 10px 14px;
  border: 1px solid var(--sl-border);
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--sl-text);
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sl-chat-textarea:focus {
  outline: none;
  border-color: var(--sl-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.sl-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sl-primary);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.sl-send-btn:hover {
  background: var(--sl-primary-hover);
  transform: scale(1.05);
}

.sl-send-btn svg {
  width: 18px;
  height: 18px;
}

/* Success Card */
.sl-success-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  color: #166534;
}

.sl-success-icon {
  width: 48px;
  height: 48px;
  background: #22c55e;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  font-size: 24px;
}

.sl-success-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #14532d;
}

.sl-success-text {
  font-size: 13px;
  line-height: 1.5;
  color: #166534;
  margin-bottom: 16px;
}

/* Spinner */
.sl-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: slSpin 0.6s linear infinite;
}

@keyframes slSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .sl-chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .sl-widget-launcher {
    bottom: 16px;
    right: 16px;
  }
}
