@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

#a2z-assistant-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: "Space Grotesk", "Roboto", sans-serif;
  color: #0f1a1f;
  --a2z-blue: var(--a2z-brand-blue, #00A9E0);
  --a2z-teal: #3fe1d5;
  --a2z-deep: #0b1b24;
  --a2z-surface: #f7fbff;
  --a2z-border: rgba(8, 25, 35, 0.12);
}

#a2z-assistant-root * {
  box-sizing: border-box;
}

.a2z-assistant {
  position: relative;
}

.a2z-assistant-fab {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: radial-gradient(circle at 30% 30%, #2fd3ff, var(--a2z-blue) 60%, #0b7db0 100%);
  color: #ffffff;
  box-shadow: 0 12px 32px rgba(0, 169, 224, 0.35), 0 0 0 3px rgba(255, 255, 255, 0.9) inset;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.a2z-assistant-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 18px 40px rgba(0, 169, 224, 0.45), 0 0 0 3px rgba(255, 255, 255, 0.95) inset;
}

.a2z-assistant-fab:focus-visible {
  outline: 3px solid #0f1a1f;
  outline-offset: 3px;
}

.a2z-assistant-fab-icon {
  width: 28px;
  height: 28px;
}

.a2z-assistant-fab-sparkle {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.a2z-assistant-tip {
  position: absolute;
  right: 74px;
  bottom: 8px;
  background: #ffffff;
  border: 1px solid var(--a2z-border);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #16303a;
  box-shadow: 0 10px 22px rgba(8, 25, 35, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
}

.a2z-assistant-tip::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-right: 1px solid var(--a2z-border);
  border-bottom: 1px solid var(--a2z-border);
  transform: translateY(-50%) rotate(-45deg);
}

.a2z-assistant-tip.hidden {
  display: none;
}

.a2z-assistant-tip-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: #5d6b72;
}

.a2z-assistant-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 13, 18, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.a2z-assistant-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: clamp(380px, 34vw, 420px);
  max-width: calc(100vw - 24px);
  height: min(70vh, 640px);
  max-height: calc(100vh - 120px);
  background: var(--a2z-surface);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(6, 12, 18, 0.35);
  border: 1px solid rgba(8, 25, 35, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.a2z-assistant-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(0, 194, 255, 0.18), transparent 55%);
  pointer-events: none;
}

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

.a2z-assistant.open .a2z-assistant-overlay {
  opacity: 1;
  pointer-events: auto;
}

.a2z-assistant-header {
  padding: 16px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-bottom: 1px solid rgba(8, 25, 35, 0.08);
  position: sticky;
  top: 0;
  z-index: 3;
}

.a2z-assistant-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.a2z-assistant-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.a2z-assistant-title-icon {
  width: 20px;
  height: 20px;
  color: var(--a2z-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.a2z-assistant-title-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.a2z-assistant-title span {
  font-size: 16px;
  letter-spacing: 0.2px;
}

.a2z-assistant-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #3d5c63;
}

.a2z-assistant-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ad67b;
  box-shadow: 0 0 0 2px rgba(42, 214, 123, 0.2);
}

.a2z-assistant-actions {
  display: flex;
  gap: 6px;
}

.a2z-assistant-action {
  border: none;
  background: #f1f6f8;
  color: #1d2c33;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.a2z-assistant-priorities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.a2z-assistant-priorities button {
  border: 1px solid var(--a2z-border);
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
}

.a2z-assistant-priorities button.active {
  background: rgba(0, 169, 224, 0.2);
  border-color: rgba(0, 169, 224, 0.5);
}

.a2z-assistant-body {
  padding: 14px 18px 8px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.a2z-assistant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.a2z-assistant-chip {
  border: 1px solid var(--a2z-border);
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border 0.2s ease;
}

.a2z-assistant-chip:hover {
  background: rgba(0, 169, 224, 0.12);
  border-color: rgba(0, 169, 224, 0.4);
}

.a2z-assistant-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.a2z-assistant-message {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.a2z-assistant-message.assistant .a2z-assistant-bubble {
  background: #ffffff;
  border: 1px solid rgba(8, 25, 35, 0.08);
  align-self: flex-start;
}

.a2z-assistant-message.user .a2z-assistant-bubble {
  background: var(--a2z-blue);
  color: #ffffff;
  align-self: flex-end;
}

.a2z-assistant-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 85%;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: visible;
  max-height: none;
}

.a2z-assistant-bubble a {
  color: #0b1b24;
  text-decoration: underline;
}

.a2z-assistant-message.user .a2z-assistant-bubble a {
  color: #ffffff;
}

/* Gentle spacing tuning for markdown content inside assistant bubbles */
.a2z-assistant-bubble p {
  margin: 8px 0;
}

.a2z-assistant-bubble ul,
.a2z-assistant-bubble ol {
  margin: 6px 0;
  padding-left: 18px;
}

.a2z-assistant-bubble li {
  margin: 3px 0;
}

.a2z-assistant-bubble h1,
.a2z-assistant-bubble h2,
.a2z-assistant-bubble h3,
.a2z-assistant-bubble h4 {
  margin: 10px 0 6px;
  line-height: 1.25;
}

.a2z-assistant-meta {
  font-size: 11px;
  color: #5b6b70;
}

.a2z-assistant-typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4a5c61;
}

.a2z-assistant-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4a5c61;
  animation: a2z-dot 1s infinite ease-in-out;
}

.a2z-assistant-typing span:nth-child(2) { animation-delay: 0.2s; }
.a2z-assistant-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes a2z-dot {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

.a2z-assistant-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.a2z-assistant-cards {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.a2z-assistant-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--a2z-border);
  box-shadow: 0 8px 18px rgba(8, 25, 35, 0.08);
}

.a2z-assistant-card-image {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #e8f3f7;
}

.a2z-assistant-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.a2z-assistant-card-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 169, 224, 0.2), rgba(0, 169, 224, 0.05));
}

.a2z-assistant-card-body {
  display: grid;
  gap: 6px;
}

.a2z-assistant-card-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.a2z-assistant-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #0b1b24;
  background: rgba(0, 169, 224, 0.18);
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 6px;
}

.a2z-assistant-card-subtitle {
  font-size: 12px;
  color: #4b5f66;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.a2z-assistant-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.a2z-assistant-card-badges span {
  background: rgba(0, 169, 224, 0.12);
  color: #0b1b24;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
}

.a2z-assistant-card-highlights {
  margin: 0;
  padding-left: 16px;
  font-size: 11px;
  color: #52666d;
}

.a2z-assistant-card-cta {
  justify-self: end;
  margin-top: 2px;
  font-size: 12px;
  text-decoration: none;
  color: #0b1b24;
  background: #e8f5f9;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--a2z-border);
}

.a2z-assistant-link {
  border: 1px solid rgba(8, 25, 35, 0.12);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  text-decoration: none;
  color: #0f1a1f;
  background: #f1f6f8;
}

.a2z-assistant-preferences {
  padding: 0 18px 10px;
  display: none;
  flex: 0 0 auto;
}

.a2z-assistant-preferences.open {
  display: block;
}

.a2z-assistant-preferences form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.a2z-assistant-preferences label {
  font-size: 12px;
  color: #375059;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.a2z-assistant-preferences input,
.a2z-assistant-preferences select {
  border: 1px solid rgba(8, 25, 35, 0.2);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  background: #ffffff;
}

.a2z-assistant-composer {
  display: flex;
  gap: 8px;
  padding: 10px 18px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(8, 25, 35, 0.08);
  background: #ffffff;
  align-items: center;
  flex: 0 0 auto;
}

.a2z-assistant-input {
  flex: 1;
  border: 1px solid rgba(8, 25, 35, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  resize: none;
  min-height: 42px;
  font-family: "Space Grotesk", "Roboto", sans-serif;
}

.a2z-assistant-input:focus-visible,
.a2z-assistant-input:focus {
  outline: none;
  border-color: var(--a2z-blue);
  box-shadow: 0 0 0 3px rgba(0, 169, 224, 0.2);
}

.a2z-assistant-send {
  border: none;
  background: var(--a2z-blue);
  color: #ffffff;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.a2z-assistant-send:hover {
  background: #079bd0;
  box-shadow: 0 8px 18px rgba(0, 169, 224, 0.25);
  transform: translateY(-1px);
}

.a2z-assistant-send:active {
  background: #078fc1;
  transform: translateY(0);
}

.a2z-assistant-menu-wrap {
  position: relative;
}

.a2z-assistant-menu-btn {
  border: 1px solid var(--a2z-border);
  background: #f1f6f8;
  color: #0f1a1f;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
}

.a2z-assistant-menu {
  position: absolute;
  right: 0;
  bottom: 44px;
  background: #ffffff;
  border: 1px solid var(--a2z-border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(8, 25, 35, 0.12);
  padding: 6px;
  display: none;
  min-width: 150px;
  z-index: 5;
}

.a2z-assistant-menu.open {
  display: grid;
}

.a2z-assistant-menu button {
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.a2z-assistant-menu button:hover {
  background: rgba(0, 169, 224, 0.12);
}

.a2z-assistant-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.a2z-assistant-pref-toggle {
  border: none;
  background: #e8f5f8;
  color: #0f1a1f;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.a2z-assistant-footer {
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  font-size: 11px;
  color: #567078;
  background: #ffffff;
  border-top: 1px solid rgba(8, 25, 35, 0.08);
  flex: 0 0 auto;
  text-align: center;
}

@media (max-width: 720px) {
  #a2z-assistant-root {
    right: 12px;
    bottom: 12px;
  }

  .a2z-assistant-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 420px);
    max-width: 92vw;
    height: min(72vh, 640px);
    max-height: calc(100vh - 24px);
    margin: 0 auto;
    border-radius: 18px 18px 0 0;
  }

  .a2z-assistant-body {
    max-height: none;
  }

  .a2z-assistant-tip {
    right: 64px;
    bottom: 0;
    max-width: 220px;
  }

  .a2z-assistant-card {
    grid-template-columns: 64px 1fr;
  }

  .a2z-assistant-card-cta {
    justify-self: start;
  }

  .a2z-assistant-preferences form {
    grid-template-columns: 1fr;
  }
}
