
:root {
  --pg-primary: #5c54f6;
  --pg-soft: rgba(92,84,246,0.12);
  --pg-bg: #f6f7fb;
  --pg-text: #1f1144;
  --pg-muted: #6b688f;
  --pg-border: #ecebff;
}

/* ================= TOGGLE ================= */
#chat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg,#5c54f6,#7b6cff);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(92,84,246,.35);
  z-index: 9999;
}

/* ================= PANEL (DESKTOP DEFAULT) ================= */
#chat-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  width: 380px;
  max-height: 72vh;
  background: #fff;
  border-radius: 18px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  font-family: Inter, system-ui, Arial, sans-serif;
  z-index: 9999;
}

/* ================= HEADER ================= */
.chat-header {
  background: linear-gradient(135deg,#5c54f6,#7b6cff);
  padding: 14px 16px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-logo {
  background: #fff;
  color: var(--pg-primary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-name {
  font-weight: 700;
  font-size: 15px;
}

.chat-sub {
  font-size: 12px;
  opacity: .9;
}

#chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* ================= BODY ================= */
.chat-body {
  padding: 14px;
  flex: 1;
  overflow-y: auto;
  background: var(--pg-bg);
}

.chat-empty {
  text-align: center;
  font-size: 13px;
  color: var(--pg-muted);
  margin-top: 20px;
}

/* ================= MESSAGES ================= */
.chat-message {
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 82%;
  font-size: 14px;
  line-height: 1.45;
  animation: fadeIn .2s ease-in;
}

.chat-message.user {
  margin-left: auto;
  background: var(--pg-soft);
  color: var(--pg-text);
  border-bottom-right-radius: 4px;
}

.chat-message.bot {
  margin-right: auto;
  background: #fff;
  border: 1px solid var(--pg-border);
  border-bottom-left-radius: 4px;
}

.chat-message.typing {
  font-style: italic;
  color: var(--pg-muted);
}

/* ================= INPUT ================= */
.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #eee;
  background: #fff;
}

.chat-input input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid #ddd;
  font-size: 14px;
}

.chat-input input:focus {
  outline: none;
  border-color: var(--pg-primary);
}

.chat-input button {
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  background: var(--pg-primary);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

/* ================= ANIMATION ================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===========================================================
   📱 MOBILE RESPONSIVE (IMPORTANT PART)
=========================================================== */
@media (max-width: 640px) {

  #chat-toggle {
    right: 16px;
    bottom: 16px;
    width: 56px;
    height: 56px;
  }

  #chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .chat-header {
    padding: 16px;
  }

  .chat-body {
    padding: 12px;
  }

  .chat-message {
    max-width: 90%;
    font-size: 15px;
  }

  .chat-input {
    padding: 10px;
  }

  .chat-input input {
    font-size: 16px; /* prevents iOS zoom */
  }
}
