/* ============================================================
   SHRI SOLAR - Website AI chatbot ("Solar Mitra")
   Sits beside the existing .floating-actions stack (bottom-right).
   ============================================================ */

.ss-chat-fab {
  position: fixed;
  bottom: max(25px, env(safe-area-inset-bottom));
  right: max(87px, calc(env(safe-area-inset-right) + 87px));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #16a34a;
  background: #ffffff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s;
  z-index: 2100;
  overflow: visible;
}

.ss-chat-fab:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.55);
}

.ss-chat-fab.ss-open {
  transform: scale(0.92);
}

.ss-chat-fab-avatar {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  border-radius: 50%;
}

.ss-chat-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #f5a623;
  color: #0a1628;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.ss-chat-panel {
  position: fixed;
  bottom: max(97px, calc(env(safe-area-inset-bottom) + 97px));
  right: max(25px, env(safe-area-inset-right));
  width: 380px;
  max-width: calc(100vw - 30px);
  height: 560px;
  max-height: calc(100vh - 130px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(10, 22, 40, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 2100;
}

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

/* ---------- header ---------- */
.ss-chat-header {
  background: linear-gradient(135deg, #0a1628, #1a3055);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ss-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  overflow: hidden;
}

.ss-chat-avatar img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.ss-chat-header-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}

.ss-chat-header-text strong {
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
}

.ss-chat-header-text span {
  font-size: 0.75rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ss-chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: ss-chat-pulse 2s infinite;
}

@keyframes ss-chat-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.ss-chat-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: background 0.2s;
}

.ss-chat-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ---------- messages ---------- */
.ss-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8f9fc;
  scroll-behavior: smooth;
}

.ss-chat-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: normal;
  font-family: 'Outfit', sans-serif;
}

.ss-chat-msg.ss-bot {
  align-self: flex-start;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(10, 22, 40, 0.06);
}

.ss-chat-msg.ss-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #16a34a, #10b981);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.ss-chat-msg a {
  color: #16a34a;
  text-decoration: underline;
}

.ss-chat-msg.ss-user a {
  color: #fff;
}

.ss-chat-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.ss-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: ss-chat-bounce 1.2s infinite ease-in-out;
}

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

@keyframes ss-chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- suggestion chips ---------- */
.ss-chat-suggestions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  flex-shrink: 0;
  background: #f8f9fc;
  border-top: 1px solid #eef2f7;
}

.ss-chat-suggestions::-webkit-scrollbar { height: 0; }

.ss-chat-chip {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #16a34a;
  color: #166534;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: all 0.2s;
  white-space: nowrap;
}

.ss-chat-chip:hover {
  background: #f0fdf4;
  transform: translateY(-1px);
}

/* ---------- input ---------- */
.ss-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.ss-chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  background: #f8f9fc;
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 0.875rem;
  font-family: 'Outfit', sans-serif;
  color: #1e293b;
  resize: none;
  max-height: 96px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.4;
}

.ss-chat-input:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
  background: #fff;
}

.ss-chat-input::placeholder {
  color: #94a3b8;
}

.ss-chat-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #16a34a, #10b981);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}

.ss-chat-send:hover:not(:disabled) {
  transform: scale(1.05);
}

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

.ss-chat-powered {
  flex-shrink: 0;
  padding: 6px 12px 8px;
  font-size: 0.68rem;
  color: #94a3b8;
  text-align: center;
  background: #fff;
  line-height: 1.4;
}

.ss-chat-powered a {
  color: #16a34a;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- mobile ---------- */
@media (max-width: 600px) {
  .ss-chat-fab {
    bottom: max(20px, env(safe-area-inset-bottom));
    right: max(70px, calc(env(safe-area-inset-right) + 70px));
    width: 54px;
    height: 54px;
  }

  .ss-chat-fab-avatar {
    width: 46px;
    height: 46px;
  }

  .ss-chat-panel {
    bottom: max(80px, calc(env(safe-area-inset-bottom) + 80px));
    right: 12px;
    left: 12px;
    width: auto;
    height: 70vh;
    max-height: 70vh;
    border-radius: 14px;
  }
}
