/* ══════════════════════════════════════════════════════════════
   SYSTEMSHIFT HQ — CUSTOM CHAT WIDGET STYLES
   Dark theme, turquoise accents, matches site design system
   ══════════════════════════════════════════════════════════════ */

/* ── Reset & Container ── */
#ss-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #E8E8E8;
  -webkit-font-smoothing: antialiased;
}

#ss-chat-widget * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Chat Bubble / Launcher ── */
#ss-chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #0FDFD8;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(15, 223, 216, 0.35);
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

#ss-chat-bubble:hover {
  background: #0BC8C2;
  box-shadow: 0 6px 32px rgba(15, 223, 216, 0.5);
  transform: scale(1.08);
}

#ss-chat-bubble.ss-active {
  background: #1A1A1A;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#ss-chat-bubble.ss-active:hover {
  background: #222;
}

#ss-chat-bubble svg {
  width: 28px;
  height: 28px;
  color: #0A0A0A;
  transition: transform 0.3s ease;
}

#ss-chat-bubble.ss-active svg {
  color: #E8E8E8;
}

/* ── Chat Window ── */
#ss-chat-window {
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  height: 520px;
  background: #0A0A0A;
  border: 1px solid #222;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#ss-chat-window.ss-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Header ── */
#ss-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #111;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

#ss-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

#ss-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0FDFD8, #0B6E6E);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

#ss-chat-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

#ss-chat-status {
  font-size: 12px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

#ss-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0FDFD8;
  display: inline-block;
  animation: ss-pulse 2s infinite;
}

@keyframes ss-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#ss-chat-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
}

#ss-chat-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

#ss-chat-close svg {
  width: 20px;
  height: 20px;
  color: #888;
  transition: color 0.2s;
}

#ss-chat-close:hover svg {
  color: #fff;
}

/* ── Messages Area ── */
#ss-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#ss-chat-messages::-webkit-scrollbar {
  width: 5px;
}

#ss-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#ss-chat-messages::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

#ss-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ── Message Bubbles ── */
.ss-msg {
  max-width: 85%;
  position: relative;
  animation: ss-fadeIn 0.3s ease;
}

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

.ss-msg p {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}

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

.ss-msg-bot p {
  background: #141414;
  border: 1px solid #222;
  border-radius: 12px 12px 12px 4px;
  color: #E8E8E8;
}

.ss-msg-user {
  align-self: flex-end;
}

.ss-msg-user p {
  background: rgba(15, 223, 216, 0.12);
  border: 1px solid rgba(15, 223, 216, 0.2);
  border-radius: 12px 12px 4px 12px;
  color: #E8E8E8;
}

.ss-msg a {
  color: #0FDFD8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ss-msg a:hover {
  color: #0BC8C2;
}

/* ── Timestamp ── */
.ss-msg-time {
  display: block;
  font-size: 11px;
  color: #555;
  margin-top: 4px;
  padding: 0 4px;
}

.ss-msg-user .ss-msg-time {
  text-align: right;
}

/* ── Pre-chat Form ── */
#ss-chat-prechat {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  background: #111;
  border-top: 1px solid #222;
  flex-shrink: 0;
}

#ss-prechat-label {
  font-size: 13px;
  color: #888;
  font-weight: 500;
}

#ss-chat-prechat input {
  width: 100%;
  padding: 10px 14px;
  background: #1A1A1A;
  border: 1px solid #333;
  border-radius: 10px;
  color: #E8E8E8;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#ss-chat-prechat input:focus {
  border-color: #0FDFD8;
  box-shadow: 0 0 0 2px rgba(15, 223, 216, 0.12);
}

#ss-chat-prechat input::placeholder {
  color: #666;
}

#ss-prechat-submit {
  width: 100%;
  padding: 11px 20px;
  background: #0FDFD8;
  border: none;
  border-radius: 10px;
  color: #0A0A0A;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

#ss-prechat-submit:hover {
  background: #0BC8C2;
  transform: translateY(-1px);
}

#ss-prechat-submit:active {
  transform: translateY(0);
}

/* ── Input Area ── */
#ss-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: #111;
  border-top: 1px solid #222;
  flex-shrink: 0;
}

#ss-chat-input {
  flex: 1;
  padding: 10px 14px;
  background: #1A1A1A;
  border: 1px solid #333;
  border-radius: 10px;
  color: #E8E8E8;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.2s;
}

#ss-chat-input:focus {
  border-color: #0FDFD8;
  box-shadow: 0 0 0 2px rgba(15, 223, 216, 0.12);
}

#ss-chat-input::placeholder {
  color: #666;
}

#ss-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #0FDFD8;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

#ss-chat-send:hover {
  background: #0BC8C2;
  transform: scale(1.06);
}

#ss-chat-send svg {
  width: 18px;
  height: 18px;
  color: #0A0A0A;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
  #ss-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  #ss-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
    bottom: 72px;
    right: 0;
    border-radius: 12px;
  }

  #ss-chat-bubble {
    width: 54px;
    height: 54px;
  }

  #ss-chat-bubble svg {
    width: 24px;
    height: 24px;
  }
}
