/**
 * Sid Bot - Premium Chatbot Widget Styles
 * Portfolio: CodewithSid
 */

.sidbot-widget {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 9999;
  font-family: "Syne", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidbot-trigger {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: linear-gradient(145deg, #202129 0%, #101116 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(170, 112, 224, 0.12);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.sidbot-trigger:hover {
  transform: translateY(-3px);
  border-color: rgba(170, 112, 224, 0.8);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.42), 0 0 0 7px rgba(170, 112, 224, 0.16);
}

.sidbot-trigger svg {
  width: 25px;
  height: 25px;
  fill: #f5f3ff;
}

.sidbot-trigger::after {
  content: "Ask Sid Bot";
  position: absolute;
  right: 72px;
  top: 50%;
  transform: translateY(-50%);
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(16, 17, 22, 0.92);
  color: #f5f3ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.sidbot-trigger.show-tooltip::after,
.sidbot-trigger:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(-2px);
}

.sidbot-window {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 390px;
  height: 560px;
  max-height: min(680px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: #101116;
  color: #f8fafc;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(170, 112, 224, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.24s ease, visibility 0.24s ease, transform 0.24s ease;
}

.sidbot-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.sidbot-header {
  min-height: 82px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(170, 112, 224, 0.18), rgba(112, 89, 226, 0.08)), #14151c;
}

.sidbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidbot-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: #1f2028;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.sidbot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidbot-avatar-fallback {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
}

.sidbot-header-text {
  min-width: 0;
}

.sidbot-header-text h4 {
  margin: 0;
  font-size: 17px;
  line-height: 1.1;
  font-weight: 800;
  color: #ffffff;
}

.sidbot-header-text p {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(248, 250, 252, 0.66);
}

.sidbot-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.sidbot-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.sidbot-close svg {
  width: 20px;
  height: 20px;
  stroke: #f8fafc;
  stroke-width: 2;
}

.sidbot-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: radial-gradient(circle at top left, rgba(170, 112, 224, 0.12), transparent 34%), #101116;
}

.sidbot-messages::-webkit-scrollbar {
  width: 6px;
}

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

.sidbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.sidbot-message {
  max-width: 88%;
  padding: 13px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: 0;
  word-break: break-word;
  animation: sidbot-message-in 0.22s ease both;
}

@keyframes sidbot-message-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidbot-message.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 6px;
}

.sidbot-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #aa70e0 0%, #7059e2 100%);
  color: #ffffff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 10px 22px rgba(112, 89, 226, 0.28);
}

.sidbot-message-time {
  display: block;
  margin-top: 7px;
  font-size: 10px;
  line-height: 1;
  color: rgba(248, 250, 252, 0.42);
}

.sidbot-message.user .sidbot-message-time {
  color: rgba(255, 255, 255, 0.64);
}

.sidbot-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px 16px 16px 6px;
  background: rgba(255, 255, 255, 0.08);
}

.sidbot-typing::before {
  content: "Sid Bot is typing";
  margin-right: 3px;
  color: rgba(248, 250, 252, 0.62);
  font-size: 12px;
  font-weight: 700;
}

.sidbot-typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #cec4ef;
  animation: sidbot-dot 1s infinite ease-in-out;
}

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

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

@keyframes sidbot-dot {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.sidbot-chips {
  display: flex;
  gap: 8px;
  padding: 0 18px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: #101116;
}

.sidbot-chips::-webkit-scrollbar {
  display: none;
}

.sidbot-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid rgba(206, 196, 239, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(248, 250, 252, 0.84);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sidbot-chip:hover {
  border-color: rgba(170, 112, 224, 0.8);
  background: rgba(170, 112, 224, 0.15);
  color: #ffffff;
}

.sidbot-input-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #14151c;
}

.sidbot-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.sidbot-input::placeholder {
  color: rgba(248, 250, 252, 0.42);
}

.sidbot-input:focus {
  border-color: rgba(170, 112, 224, 0.85);
  background: rgba(255, 255, 255, 0.09);
}

.sidbot-send {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #aa70e0 0%, #7059e2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(112, 89, 226, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sidbot-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(112, 89, 226, 0.36);
}

.sidbot-send:active {
  transform: translateY(0) scale(0.96);
}

.sidbot-send svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

.sidbot-cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 9px 14px;
  margin: 8px 0 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #aa70e0 0%, #7059e2 100%);
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(112, 89, 226, 0.28);
}

.sidbot-message a {
  color: #d8b4fe;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid rgba(216, 180, 254, 0.38);
}

.sidbot-message a:hover {
  color: #ffffff;
}

.sidbot-trigger:focus-visible,
.sidbot-close:focus-visible,
.sidbot-send:focus-visible,
.sidbot-chip:focus-visible,
.sidbot-input:focus-visible {
  outline: 2px solid rgba(170, 112, 224, 0.9);
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .sidbot-widget {
    right: 14px;
    bottom: 84px;
    left: 14px;
  }

  .sidbot-trigger {
    position: fixed;
    right: 16px;
    bottom: 132px;
  }

  .sidbot-trigger::after {
    display: none;
  }

  .sidbot-window {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 198px;
    width: auto;
    height: min(560px, calc(100vh - 220px));
    min-height: 420px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidbot-trigger,
  .sidbot-window,
  .sidbot-message,
  .sidbot-chip,
  .sidbot-send,
  .sidbot-typing-dot {
    animation: none;
    transition: none;
  }
}
