/* ============================================================
   Speedy Service chat widget — all selectors prefixed .ssc-
   Safe to include alongside any existing stylesheet.
   ============================================================ */

/* --- Floating toggle button --- */
.ssc-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ff5b6e;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px rgba(255, 91, 110, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  color: #0f0f14;
  font-family: inherit;
  outline: none;
}

.ssc-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(255, 91, 110, 0.55);
}

.ssc-btn:focus-visible {
  outline: 2px solid #ff5b6e;
  outline-offset: 3px;
}

.ssc-icon-close { display: none; }
.ssc-btn.open .ssc-icon-chat  { display: none; }
.ssc-btn.open .ssc-icon-close { display: block; }

/* Notification badge */
.ssc-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffcc33;
  border: 2px solid #0f0f14;
  display: none;
}

.ssc-badge.visible { display: block; }

/* --- Chat panel --- */
.ssc-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9999;
  width: 360px;
  height: 520px;
  background: #16161e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.ssc-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* --- Header --- */
.ssc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #0f0f14;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.ssc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: conic-gradient(from 220deg, #ff5b6e, #5b8cff, #ffcc33, #ff5b6e);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}

.ssc-avatar::after {
  content: "";
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: #0f0f14;
}

.ssc-avatar span {
  position: relative;
  z-index: 1;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: #f4f4f6;
}

.ssc-head-info { flex: 1; min-width: 0; }

.ssc-head-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #f4f4f6;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ssc-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #9494a0;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  outline: none;
  font-family: inherit;
}

.ssc-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f4f4f6;
}

.ssc-close-btn:focus-visible {
  outline: 2px solid #ff5b6e;
  outline-offset: 2px;
}

.ssc-head-status {
  font-size: 12px;
  color: #9494a0;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-family: 'Outfit', sans-serif;
}

.ssc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

/* --- Messages area --- */
.ssc-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.ssc-msgs::-webkit-scrollbar { width: 3px; }
.ssc-msgs::-webkit-scrollbar-track { background: transparent; }
.ssc-msgs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

/* --- Individual message --- */
.ssc-msg {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  animation: ssc-pop 0.18s ease;
}

@keyframes ssc-pop {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ssc-msg.bot  { align-self: flex-start; align-items: flex-start; }
.ssc-msg.user { align-self: flex-end;   align-items: flex-end; }

.ssc-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  font-family: 'Outfit', sans-serif;
  word-break: break-word;
  white-space: pre-wrap;
}

.ssc-msg.bot .ssc-bubble {
  background: #1c1c26;
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #f4f4f6;
  border-bottom-left-radius: 4px;
}

.ssc-msg.user .ssc-bubble {
  background: #ff5b6e;
  color: #0f0f14;
  border-bottom-right-radius: 4px;
}

/* --- Typing indicator --- */
.ssc-typing-wrap {
  display: flex;
  align-self: flex-start;
  animation: ssc-pop 0.18s ease;
}

.ssc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #1c1c26;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.ssc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9494a0;
  animation: ssc-bounce 1.1s infinite ease-in-out;
}

.ssc-typing span:nth-child(2) { animation-delay: 0.18s; }
.ssc-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes ssc-bounce {
  0%, 60%, 100% { transform: translateY(0); background: #9494a0; }
  30%           { transform: translateY(-6px); background: #ff5b6e; }
}

/* --- Input footer --- */
.ssc-foot {
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #0f0f14;
  flex-shrink: 0;
}

.ssc-input {
  flex: 1;
  background: #16161e !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px !important;
  padding: 9px 13px !important;
  color: #f4f4f6 !important;
  font-size: 14px !important;
  font-family: 'Outfit', sans-serif !important;
  outline: none !important;
  resize: none !important;
  min-height: 38px;
  max-height: 96px;
  line-height: 1.45;
  transition: border-color 0.2s;
  display: block;
  box-sizing: border-box;
  width: 100%;
  overflow-y: auto;
}

.ssc-input::placeholder { color: #9494a0 !important; }

.ssc-input:focus {
  border-color: rgba(255, 91, 110, 0.5) !important;
}

.ssc-input:disabled { opacity: 0.45 !important; }

.ssc-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ff5b6e;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #0f0f14;
  transition: transform 0.15s, opacity 0.15s;
  font-family: inherit;
  outline: none;
}

.ssc-send:hover:not(:disabled) { transform: scale(1.08); }
.ssc-send:focus-visible { outline: 2px solid #ff5b6e; outline-offset: 2px; }
.ssc-send:disabled { opacity: 0.38; cursor: not-allowed; }

/* --- Mobile --- */
@media (max-width: 480px) {
  .ssc-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .ssc-btn {
    right: 16px;
    bottom: 16px;
  }

  /* hide floating button when panel is open so it doesn't overlap the send button */
  .ssc-btn.open {
    display: none;
  }
}
