/* ─── SwissInjection AI Chat Widget ──────────────────────────────────────── */

.si-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', -apple-system, sans-serif;
}

/* ─── Toggle Button ──────────────────────────────────────────────────────── */

.si-chat__toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #D31F26;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(211,31,38,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  position: relative;
  animation: si-pulse 2s infinite;
}

.si-chat__toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(211,31,38,.5);
  animation: none;
}

.si-chat__toggle:focus-visible {
  outline: 2px solid #D31F26;
  outline-offset: 3px;
}

@keyframes si-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(211,31,38,.4); }
  50%       { box-shadow: 0 4px 30px rgba(211,31,38,.65); }
}

.si-chat__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #1A1A1A;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Chat Window ────────────────────────────────────────────────────────── */

.si-chat__window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #E5E5E5;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.si-chat__header {
  background: #1A1A1A;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.si-chat__header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.si-chat__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #D31F26;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.si-chat__title {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}

.si-chat__subtitle {
  color: rgba(255,255,255,.6);
  font-size: 11px;
  margin-top: 2px;
}

.si-chat__header-actions {
  display: flex;
  gap: 6px;
}

.si-chat__btn-minimize,
.si-chat__btn-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background .15s, color .15s;
  line-height: 1;
}

.si-chat__btn-minimize:hover,
.si-chat__btn-close:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

/* ─── Messages ───────────────────────────────────────────────────────────── */

.si-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.si-chat__messages::-webkit-scrollbar { width: 4px; }
.si-chat__messages::-webkit-scrollbar-track { background: #F5F5F5; }
.si-chat__messages::-webkit-scrollbar-thumb {
  background: #D31F26;
  border-radius: 2px;
}

.si-chat__message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.si-chat__message--user {
  align-self: flex-end;
  align-items: flex-end;
}

.si-chat__message--assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.si-chat__bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.si-chat__message--user .si-chat__bubble {
  background: #D31F26;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.si-chat__message--assistant .si-chat__bubble {
  background: #F5F5F5;
  color: #1A1A1A;
  border-bottom-left-radius: 3px;
}

.si-chat__time {
  font-size: 10px;
  color: #808080;
  margin-top: 4px;
  padding: 0 3px;
}

/* ─── Typing indicator ───────────────────────────────────────────────────── */

.si-chat__typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 40px;
}

.si-chat__typing span {
  width: 6px;
  height: 6px;
  background: #808080;
  border-radius: 50%;
  animation: si-bounce 1.2s infinite;
}

.si-chat__typing span:nth-child(2) { animation-delay: .2s; }
.si-chat__typing span:nth-child(3) { animation-delay: .4s; }

@keyframes si-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* ─── Quick Replies ──────────────────────────────────────────────────────── */

.si-chat__quick-replies {
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.si-chat__quick-btn {
  padding: 6px 12px;
  border: 1px solid #D31F26;
  background: #fff;
  color: #D31F26;
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s, color .18s;
  white-space: nowrap;
}

.si-chat__quick-btn:hover {
  background: #D31F26;
  color: #fff;
}

/* ─── Input Area ─────────────────────────────────────────────────────────── */

.si-chat__input-area {
  padding: 12px 16px;
  border-top: 1px solid #E5E5E5;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: #fff;
}

.si-chat__input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #E5E5E5;
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .18s;
  min-width: 0;
  color: #1A1A1A;
  background: #fff;
}

.si-chat__input:focus {
  border-color: #D31F26;
}

.si-chat__send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #D31F26;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .18s;
}

.si-chat__send:hover { background: #B01A20; }

.si-chat__send:disabled {
  background: #D4D4D4;
  cursor: not-allowed;
}

/* ─── Contact CTA ────────────────────────────────────────────────────────── */

.si-chat__contact-cta {
  padding: 8px 16px 12px;
  flex-shrink: 0;
}

.si-chat__contact-btn {
  display: block;
  text-align: center;
  padding: 10px;
  background: #1A1A1A;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background .18s;
}

.si-chat__contact-btn:hover {
  background: #D31F26;
  color: #fff;
}

/* ─── Screen-reader only ─────────────────────────────────────────────────── */

.si-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .si-chat {
    bottom: 16px;
    right: 16px;
  }

  .si-chat__window {
    width: calc(100vw - 32px);
    height: 70vh;
    right: -8px;
    bottom: 72px;
  }
}
