/* Rootsy AI - Ultra-Premium "Executive Dark" Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --rootsy-primary: #5bc0eb;
  --rootsy-primary-glow: rgba(91, 192, 235, 0.4);
  --rootsy-bg-dark: #1a2930;
  --rootsy-bg-glass: rgba(15, 23, 27, 0.95);
  --rootsy-text: #ffffff;
  --rootsy-text-dim: #94a3b8;
  --rootsy-bot-bubble: rgba(255, 255, 255, 0.03);
  --rootsy-user-bubble: #5bc0eb;
  --rootsy-font: 'Outfit', sans-serif;
  --rootsy-border: rgba(255, 255, 255, 0.06);
  --rootsy-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#rootsy-widget-container {
  position: fixed;
  bottom: 0;
  right: 0; /* Align to absolute edge */
  z-index: 999999;
  font-family: var(--rootsy-font);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  max-width: 100%; /* Strict containment */
  overflow: visible;
}

#rootsy-widget-container * {
  pointer-events: auto;
  box-sizing: border-box;
}

/* --- THE LAUNCHER: Minimalist & Alive --- */
.rootsy-launcher {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 0;
  background: var(--rootsy-bg-dark);
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 2px solid var(--rootsy-primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 15px var(--rootsy-primary-glow);
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  margin-bottom: 30px;
  margin-right: 30px;
}

.rootsy-launcher-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.rootsy-launcher:hover {
  transform: scale(1.08) translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 25px var(--rootsy-primary-glow);
}

/* Online Indicator on Launcher */
.rootsy-launcher::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  /* Emeral Green */
  border: 2px solid var(--rootsy-bg-dark);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* --- THE WINDOW: Sophisticated Glass --- */
.rootsy-window {
  position: absolute;
  bottom: 110px;
  right: 30px;
  width: 400px;
  height: 650px;
  background: var(--rootsy-bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 28px;
  box-shadow: var(--rootsy-shadow);
  border: 1px solid var(--rootsy-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px) scale(0.96);
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1), visibility 0.5s;
  transform-origin: bottom right;
}

.rootsy-window.rootsy-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.rootsy-header {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.03), transparent);
  border-bottom: 1px solid var(--rootsy-border);
}

.rootsy-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rootsy-avatar-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid var(--rootsy-primary);
  padding: 2px;
  box-shadow: 0 0 15px var(--rootsy-primary-glow);
  animation: rootsy-avatar-glow 3s infinite ease-in-out;
}

@keyframes rootsy-avatar-glow {

  0%,
  100% {
    box-shadow: 0 0 15px var(--rootsy-primary-glow);
  }

  50% {
    box-shadow: 0 0 25px var(--rootsy-primary);
  }
}

.rootsy-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: -0.5px;
}

.rootsy-subtitle {
  font-size: 12px;
  color: #10b981;
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rootsy-subtitle::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: rootsy-blink 1.5s infinite;
}

@keyframes rootsy-blink {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }

  100% {
    opacity: 1;
  }
}

.rootsy-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

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

/* --- THE CONVERSATION --- */
.rootsy-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rootsy-message {
  max-width: 85%;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.5;
  border-radius: 18px;
  animation: rootsy-slide-up 0.4s ease-out forwards;
}

@keyframes rootsy-slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rootsy-message.rootsy-bot {
  align-self: flex-start;
  background: var(--rootsy-bot-bubble);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--rootsy-border);
}

.rootsy-message.rootsy-user {
  align-self: flex-end;
  background: var(--rootsy-user-bubble);
  color: #1a2930;
  border-bottom-right-radius: 4px;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(91, 192, 235, 0.2);
}

/* Typing Indicator */
.rootsy-typing {
  display: flex;
  gap: 4px;
  padding: 5px 0;
}

.rootsy-dot {
  width: 6px;
  height: 6px;
  background: var(--rootsy-text-dim);
  border-radius: 50%;
  animation: rootsy-typing-dot 1.4s infinite;
}

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

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

@keyframes rootsy-typing-dot {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-4px);
  }
}

/* --- SUGGESTIONS --- */
.rootsy-suggestions {
  padding: 0 24px 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rootsy-suggestion-btn {
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--rootsy-border);
  color: var(--rootsy-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.rootsy-suggestion-btn:hover {
  background: var(--rootsy-primary);
  color: #1a2930;
  border-color: var(--rootsy-primary);
}

/* --- INPUT --- */
.rootsy-input-area {
  padding: 20px 24px 30px;
  display: flex;
  gap: 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.2), transparent);
}

.rootsy-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--rootsy-border);
  border-radius: 14px;
  padding: 12px 16px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: all 0.3s;
}

.rootsy-input:focus {
  border-color: var(--rootsy-primary);
  background: rgba(255, 255, 255, 0.08);
}

.rootsy-send {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--rootsy-primary);
  border: none;
  color: #1a2930;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
}

.rootsy-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 5px 15px var(--rootsy-primary-glow);
}

.rootsy-send:disabled {
  opacity: 0.3;
  filter: grayscale(1);
}

/* Footer Branding */
.rootsy-footer {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--rootsy-text-dim);
  opacity: 0.7;
}

.rootsy-footer a {
  color: var(--rootsy-primary);
  text-decoration: none;
  font-weight: 600;
}

/* Scrollbar */
.rootsy-messages::-webkit-scrollbar {
  width: 4px;
}

.rootsy-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
  #rootsy-widget-container {
    bottom: 0;
    right: 0;
    width: auto;
    max-width: 100%;
  }

  .rootsy-launcher {
    width: 62px;
    height: 62px;
    margin-right: 15px;
    margin-bottom: 15px;
  }

  .rootsy-window {
    position: absolute;
    bottom: 92px;
    right: 15px;
    width: calc(100vw - 30px);
    height: 70vh;
    max-height: 550px;
    border-radius: 24px;
    margin-right: 0;
    margin-bottom: 0;
  }

  .rootsy-header {
    padding: 16px 20px;
  }

  .rootsy-messages {
    padding: 16px 20px;
  }

  .rootsy-input-area {
    padding: 15px 20px 25px;
  }

  /* Prevent horizontal movement on smaller screens */
  .rootsy-launcher:hover {
    transform: scale(1.05);
    /* Reduced scale on mobile to avoid overflow */
  }
}