/* ============================================================
   SatyaBot — Chatbot Styles
   Premium glassmorphism design with smooth animations
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --sb-primary: #007bff;
  --sb-primary-dark: #0056b3;
  --sb-gradient: #ffffff;
  --sb-toggle-btn: #007bff;
  --sb-glass-bg: #f8f9fa;
  --sb-glass-border: #dee2e6;
  --sb-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  --sb-radius: 12px;
  --sb-msg-bot-bg: #ffffff;
  --sb-msg-bot-border: #dee2e6;
  --sb-msg-user-bg: #28a745;
  --sb-msg-user-color: #fff;
  --sb-text: #212529;
  --sb-text-light: #6c757d;
  --sb-toggle-size: 56px;
}

/* ── Container ─────────────────────────────────────────────── */
#satyabot-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Toggle Button ─────────────────────────────────────────── */
.satyabot-toggle {
  width: var(--sb-toggle-size);
  height: var(--sb-toggle-size);
  border-radius: 50%;
  border: none;
  background: var(--sb-toggle-btn);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 3;
}

.satyabot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.65);
}

.satyabot-toggle:active {
  transform: scale(0.95);
}

.satyabot-toggle svg {
  width: 28px;
  height: 28px;
  transition: all 0.3s ease;
}

.satyabot-toggle .satyabot-icon-close {
  display: none;
}

.satyabot-toggle.active .satyabot-icon-open {
  display: none;
}

.satyabot-toggle.active .satyabot-icon-close {
  display: block;
}

/* Pulse animation */
.satyabot-toggle::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--sb-toggle-btn);
  z-index: -1;
  animation: satyabot-pulse 2s ease-in-out infinite;
}

.satyabot-toggle.active::before {
  animation: none;
}

@keyframes satyabot-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.25); opacity: 0; }
}

/* ── Tooltip ───────────────────────────────────────────────── */
.satyabot-tooltip {
  position: absolute;
  bottom: calc(var(--sb-toggle-size) + 12px);
  right: 0;
  background: #fff;
  color: var(--sb-text);
  padding: 10px 18px;
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 2;
}

.satyabot-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Chat Panel ────────────────────────────────────────────── */
.satyabot-panel {
  position: absolute;
  bottom: calc(var(--sb-toggle-size) + 16px);
  right: 0;
  width: 400px;
  max-height: 560px;
  background: var(--sb-glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--sb-glass-border);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 2;
}

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

/* ── Header ────────────────────────────────────────────────── */
.satyabot-header {
  background: var(--sb-gradient);
  color: var(--sb-text);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--sb-glass-border);
}

.satyabot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.satyabot-avatar {
  width: 48px;
  height: 48px;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid #e9ecef;
}

.satyabot-avatar svg {
  width: 24px;
  height: 24px;
  color: var(--sb-text);
}

.satyabot-header-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.satyabot-header-tagline {
  font-size: 13px;
  color: var(--sb-text-light);
  margin-top: 2px;
}

.satyabot-home-btn {
  background: transparent;
  border: 1px solid #dee2e6;
  color: var(--sb-text-light);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.satyabot-home-btn:hover {
  background: #e9ecef;
  color: var(--sb-text);
}

.satyabot-home-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Messages ──────────────────────────────────────────────── */
.satyabot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 250px;
  max-height: 340px;
  scroll-behavior: smooth;
}

.satyabot-messages::-webkit-scrollbar {
  width: 5px;
}

.satyabot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.satyabot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 10px;
}

/* ── Message Bubbles ───────────────────────────────────────── */
.satyabot-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--sb-text);
  animation: satyabot-fadeIn 0.3s ease;
  word-wrap: break-word;
}

.satyabot-msg a {
  color: var(--sb-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.satyabot-msg-bot {
  background: var(--sb-msg-bot-bg);
  border: 1px solid var(--sb-msg-bot-border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.satyabot-msg-user {
  background: var(--sb-msg-user-bg);
  color: var(--sb-msg-user-color);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.satyabot-msg-user a {
  color: #e2e8f0;
}

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

/* ── Typing Indicator ──────────────────────────────────────── */
.satyabot-typing {
  display: flex;
  gap: 5px;
  padding: 14px 20px;
}

.satyabot-typing .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a0aec0;
  animation: satyabot-bounce 1.4s ease-in-out infinite;
}

.satyabot-typing .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.satyabot-typing .dot:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* ── Quick Replies ─────────────────────────────────────────── */
.satyabot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
  animation: satyabot-fadeIn 0.3s ease;
}

.satyabot-qr-btn {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  color: var(--sb-primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.satyabot-qr-btn:hover {
  background: var(--sb-primary);
  color: #fff;
  border-color: var(--sb-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(93, 120, 255, 0.3);
}

/* ── Navigation Link ───────────────────────────────────────── */
.satyabot-nav-link {
  padding: 2px 0 4px;
  animation: satyabot-fadeIn 0.3s ease;
}

.satyabot-nav-link a {
  font-size: 12.5px;
  color: var(--sb-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.satyabot-nav-link a:hover {
  color: var(--sb-primary-dark);
  text-decoration: underline;
}

/* ── Input Area ────────────────────────────────────────────── */
.satyabot-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #edf2f7;
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

#satyabot-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--sb-text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}

#satyabot-input::placeholder {
  color: #a0aec0;
}

#satyabot-input:focus {
  border-color: var(--sb-primary);
  box-shadow: 0 0 0 3px rgba(93, 120, 255, 0.1);
}

#satyabot-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--sb-text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

#satyabot-send:hover {
  transform: scale(1.05);
  color: var(--sb-primary);
}

#satyabot-send svg {
  width: 20px;
  height: 20px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  #satyabot-container {
    bottom: 16px;
    right: 16px;
  }

  .satyabot-panel {
    width: calc(100vw - 32px);
    max-height: 70vh;
    right: 0;
    bottom: calc(var(--sb-toggle-size) + 12px);
  }

  .satyabot-messages {
    max-height: 45vh;
  }

  .satyabot-toggle {
    width: 54px;
    height: 54px;
  }

  .satyabot-toggle svg {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 360px) {
  .satyabot-panel {
    width: calc(100vw - 16px);
    right: -8px;
  }
}
