:root {
  --public-guide-width: 420px;
  --public-guide-space: 0px;
  --public-guide-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* FLOATING ACTION DOCK (TO TOP + CHAT) */
.musictouch-dock {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  transition: transform 0.32s var(--public-guide-ease);
}

.musictouch-dock > * {
  pointer-events: auto;
}

/* SCROLL TO TOP BUTTON IN DOCK */
#toTop.musictouch-dock-btn,
.musictouch-dock #toTop {
  position: relative !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  height: 38px !important;
  min-width: 96px !important;
  padding: 0 16px 0 14px !important;
  border-radius: 20px !important;
  background-color: rgba(30, 41, 59, 0.94) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  font: 700 11px/1 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  letter-spacing: 0.8px !important;
  text-transform: uppercase !important;
  text-decoration: none !important;
  cursor: pointer !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none; /* jQuery toggles this when scrolling */
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0.95 !important;
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease !important;
  user-select: none;
}

.musictouch-dock #toTop:not([style*="display: none"]) {
  display: inline-flex !important;
}

.musictouch-dock #toTop:before {
  display: none !important;
  content: none !important;
}

.musictouch-dock #toTop i {
  font-size: 13px !important;
  line-height: 1 !important;
  color: #ffffff !important;
  margin: 0 !important;
  padding: 0 !important;
  transition: transform 0.2s ease !important;
}

.musictouch-dock #toTop:hover {
  background-color: #2e7d6e !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(46, 125, 110, 0.45), 0 3px 6px rgba(0, 0, 0, 0.15) !important;
}

.musictouch-dock #toTop:hover i {
  transform: translateY(-2px);
}

/* CHAT LAUNCHER BUTTON IN DOCK */
.musictouch-dock .public-guide-launcher,
.public-guide-launcher {
  position: relative !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  height: 42px !important;
  min-height: 42px !important;
  min-width: 96px !important;
  padding: 0 18px 0 14px !important;
  border-radius: 21px !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  background: linear-gradient(135deg, #2e7d6e 0%, #205c50 100%) !important;
  color: #ffffff !important;
  font: 700 12px/1 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  letter-spacing: 0.6px !important;
  text-transform: uppercase !important;
  box-shadow: 0 8px 20px rgba(46, 125, 110, 0.38), 0 2px 6px rgba(0, 0, 0, 0.12) !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer !important;
  user-select: none;
  transition: transform 0.25s var(--public-guide-ease), box-shadow 0.25s, background 0.25s, opacity 0.25s !important;
}

.musictouch-dock .public-guide-launcher[hidden] {
  display: none !important;
}

.musictouch-dock .public-guide-launcher svg,
.public-guide-launcher svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.musictouch-dock .public-guide-launcher:hover,
.public-guide-launcher:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #348f7e 0%, #246558 100%) !important;
  box-shadow: 0 10px 26px rgba(46, 125, 110, 0.5), 0 4px 10px rgba(0, 0, 0, 0.15) !important;
  color: #ffffff !important;
}

.musictouch-dock .public-guide-launcher:hover svg {
  transform: scale(1.1);
}

@media (max-width: 480px) {
  .musictouch-dock {
    right: 14px;
    bottom: 14px;
    gap: 8px;
  }
  .musictouch-dock #toTop {
    height: 36px !important;
    min-width: 84px !important;
    font-size: 10px !important;
    padding: 0 12px 0 10px !important;
  }
  .musictouch-dock .public-guide-launcher {
    height: 38px !important;
    min-height: 38px !important;
    min-width: 84px !important;
    font-size: 11px !important;
    padding: 0 14px 0 12px !important;
  }
}

/* ASIDE DRAWER PANEL */
.public-guide {
  position: fixed;
  inset: 0 0 0 auto;
  width: var(--public-guide-width);
  max-width: 100vw;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #334155;
  border-left: 1px solid #e2e8f0;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.12);
  transform: translateX(105%);
  transition: transform 0.32s var(--public-guide-ease);
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html.public-guide-open .public-guide {
  transform: translateX(0);
}

/* PUSH PAGE CONTENT TO THE LEFT WHEN CHAT IS OPEN */
html.public-guide-open,
body.public-guide-open {
  overflow-x: hidden !important;
}

#wrapper {
  transition: transform 0.32s var(--public-guide-ease);
  will-change: transform;
}

.musictouch-dock {
  transition: transform 0.32s var(--public-guide-ease);
}

@media (min-width: 769px) {
  html.public-guide-open #wrapper {
    transform: translateX(calc(-1 * var(--public-guide-width)));
  }

  html.public-guide-open .musictouch-dock {
    transform: translateX(calc(-1 * var(--public-guide-width)));
  }

  html.public-guide-open .public-guide-launcher {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.85);
  }
}

.public-guide-resizing #wrapper,
.public-guide-resizing .musictouch-dock,
.public-guide-resizing .public-guide,
html.public-guide-resizing #wrapper,
html.public-guide-resizing .musictouch-dock,
html.public-guide-resizing .public-guide {
  transition: none !important;
}

/* RESIZE HANDLE */
.public-guide-resize {
  position: absolute;
  inset: 0 auto 0 -7px;
  width: 14px;
  z-index: 10;
  cursor: col-resize;
  touch-action: none;
  display: grid;
  place-items: center;
}

.public-guide-resize > span {
  display: block;
  width: 4px;
  height: 48px;
  border-radius: 4px;
  background: #cbd5e1;
  transition: height 0.18s, background 0.18s;
}

.public-guide-resize:hover > span,
.public-guide-resize:focus-visible > span {
  height: 70px;
  background: #2e7d6e;
}

.public-guide-resizing,
.public-guide-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* HEADER */
.public-guide-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
}

.public-guide-heading small {
  display: block;
  color: #2e7d6e;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.public-guide-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  font-family: 'Raleway', sans-serif;
  line-height: 1.2;
}

.public-guide-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.public-guide-actions button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.public-guide-actions button:hover {
  background: #2e7d6e;
  color: #ffffff;
  border-color: #2e7d6e;
}

.public-guide-actions button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* INTRO */
.public-guide-intro {
  margin: 0;
  padding: 11px 22px;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}

/* CONVERSATION AREA */
.public-guide-conversation {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
}

.public-guide-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.public-guide-messages::-webkit-scrollbar {
  width: 6px;
}
.public-guide-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* MESSAGES */
.public-guide-message {
  animation: guide-message-in 0.25s var(--public-guide-ease) forwards;
  max-width: 90%;
  word-break: break-word;
}

.public-guide-query {
  align-self: flex-end;
  background: linear-gradient(135deg, #2e7d6e 0%, #246558 100%);
  color: #ffffff;
  padding: 11px 16px;
  border-radius: 16px 16px 3px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(46, 125, 110, 0.25);
}

.public-guide-answer {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  padding: 14px 18px;
  border-radius: 16px 16px 16px 3px;
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.public-guide-answer-label {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #1b5e52;
  background: rgba(46, 125, 110, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.public-guide-answer-text p {
  margin: 0 0 10px;
}
.public-guide-answer-text p:last-child {
  margin-bottom: 0;
}
.public-guide-answer-text ul,
.public-guide-answer-text ol {
  margin: 6px 0 10px;
  padding-left: 20px;
}
.public-guide-answer-text li {
  margin-bottom: 4px;
}
.public-guide-answer-text strong {
  color: #0f172a;
  font-weight: 700;
}
.public-guide-answer-text a {
  color: #2e7d6e;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.public-guide-answer-text a:hover {
  color: #1b4e44;
}

/* STREAMING & PENDING STATE */
.public-guide-answer.is-pending .public-guide-answer-text::after {
  content: "Pensando...";
  color: #94a3b8;
  font-style: italic;
  font-size: 12px;
  animation: guide-breathe 1.5s infinite;
}

.public-guide-answer.is-streaming:not(.is-pending) .public-guide-answer-text::after {
  content: "▋";
  color: #2e7d6e;
  display: inline-block;
  vertical-align: baseline;
  animation: guide-breathe 0.8s infinite;
  margin-left: 2px;
}

/* FLOATING LATEST BUTTON */
.public-guide-latest {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #2e7d6e;
  border-radius: 20px;
  padding: 6px 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  font: 700 11px 'Lato', sans-serif;
  cursor: pointer;
  z-index: 5;
  transition: all 0.18s;
}
.public-guide-latest:hover {
  background: #2e7d6e;
  color: #ffffff;
  border-color: #2e7d6e;
}

/* SUGGESTION CHIPS */
.public-guide-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.public-guide-suggestions[hidden] {
  display: none !important;
}

.public-guide-suggestions button {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #2e7d6e;
  border-radius: 16px;
  padding: 6px 13px;
  font: 600 11.5px 'Lato', sans-serif;
  cursor: pointer;
  transition: all 0.18s ease;
}

.public-guide-suggestions button:hover {
  background: #2e7d6e;
  color: #ffffff;
  border-color: #2e7d6e;
}

/* STATUS */
.public-guide-status {
  flex-shrink: 0;
  min-height: 22px;
  padding: 2px 22px 6px;
  margin: 0;
  color: #64748b;
  background: #ffffff;
  font-size: 11px;
  line-height: 1.4;
}

/* FORM */
.public-guide-form {
  padding: 14px 20px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
}

.public-guide-form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
}

.public-guide-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.public-guide-form textarea {
  display: block;
  box-sizing: border-box;
  min-width: 0;
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  color: #1e293b;
  background: #f8fafc;
  font: 13.5px/1.45 'Lato', sans-serif;
  scrollbar-width: thin;
  outline: none;
  transition: border-color 0.18s, background-color 0.18s, box-shadow 0.18s;
}

.public-guide-form textarea:focus {
  background: #ffffff;
  border-color: #2e7d6e;
  box-shadow: 0 0 0 3px rgba(46, 125, 110, 0.15);
}

.public-guide-compose button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #2e7d6e;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 0 #1b4e44, 0 3px 8px rgba(46, 125, 110, 0.2);
  transition: background 0.18s, transform 0.1s;
}

.public-guide-compose button:hover {
  background: #246558;
}

.public-guide-compose button:active {
  box-shadow: 0 1px 0 #1b4e44;
  transform: translateY(1px);
}

.public-guide-compose button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.public-guide button:disabled {
  opacity: 0.45;
  cursor: default;
}

.public-guide-form > small {
  font-size: 10.5px;
  line-height: 1.5;
  color: #94a3b8;
  display: block;
  margin-top: 8px;
}

.public-guide-form > small a {
  color: #2e7d6e;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ERROR & RETRY */
.public-guide-error {
  color: #dc2626;
  font-size: 12px;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fecaca;
}

.public-guide-retry {
  display: inline-block;
  margin-top: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #2e7d6e;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.public-guide-retry:hover {
  background: #f1f5f9;
  border-color: #2e7d6e;
}

/* ANIMATIONS */
@keyframes guide-message-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes guide-breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* RESPONSIVE MOBILE */
@media (max-width: 760px) {
  html.public-guide-open {
    overflow: hidden;
  }
  .public-guide {
    width: 100% !important;
    border-left: 0;
  }
  .public-guide-resize {
    display: none;
  }
  .musictouch-dock {
    right: 16px;
    bottom: 16px;
  }
}
