.puzzl-gear-img {
  filter: drop-shadow(0 0 4px #00d8ff);
  opacity: 0.5;
}
/* Spinning Gears Loader (for chat) */
.puzzl-gears-loading {
  display: flex;
  position: absolute;
  justify-content: center;
  align-items: center;
  gap: 0.7em;
  margin: 0.5em 0 0.1em 0;
  min-height: 2.2em;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  z-index: 0;
  pointer-events: none;
}
.puzzl-gear {
  display: inline-block;
  width: 500px;
  height: 500px;
  margin-top: -500px;
  animation: puzzl-spin 3s linear infinite;
}
.puzzl-gear-2 {
  animation: puzzl-spin-offset 3s linear infinite reverse;
  margin-left: -0.75em;
}
@keyframes puzzl-spin {
  100% { transform: rotate(360deg); }
}
@keyframes puzzl-spin-offset {
  from { transform: rotate(33deg); }
  to { transform: rotate(393deg); }
}
/* Related Topics Suggestions */
.puzzl-related-topics-container {
  margin-top: 0.5em;
  padding: 0.5em 1em 0.5em 1em;
  border-top: 1px solid #1a2a33;
  background: transparent;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em 1em;
  min-height: 2.2em;
}
.puzzl-related-topic-link {
  display: inline-block;
  padding: 0.25em 0.8em;
  border-radius: 1em;
  background: #16232e;
  color: #20C9D2;
  text-decoration: none;
  margin: 0.25em;
  font-size: 0.98em;
  transition: background 0.2s, color 0.2s;
}
.puzzl-related-topic-link:hover,
.puzzl-related-topic-link:focus {
  background: #20C9D2;
  color: #fff;
  outline: none;
  text-decoration: none;
}
#puzzl-chatbot-widget {
  position: fixed;
  bottom: 0;
  width: 100%;
  right: 0;
  z-index: 9999;
  font-family: inherit;
}
@media (min-width: 786px) {
  #puzzl-chatbot-widget {
    width: 400px;
  }
}
#puzzl-chatbot-toggle {
  background: #20C9D2;
  color: #fff;
  border: none;
  bottom: 0;
  border-radius: 1.5em 1.5em 0 0;
  width: 100%;
  right: 0;
  height: 56px;
  padding: 0 1.5em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.2s;
}
#puzzl-chatbot-toggle:hover, #puzzl-chatbot-toggle:focus {
  background: #0b1622;
}
.puzzl-chatbot-shortcut {
  display: none;
}
@media (min-width: 786px) {
  #puzzl-chatbot-toggle {
    right: 0;
    width: 400px
  }
  .puzzl-chatbot-shortcut {
    display: block;
    align-items: center;
    gap: 0.25em;
    margin-left: auto;
    font-size: 0.85em;
    padding: 0;
    background: none;
  }
  .puzzl-chatbot-shortcut kbd {
    display: inline-block;
    min-width: 1.7em;
    padding: 0.12em 0.38em;
    font-family: inherit;
    font-size: 1.2em;
    font-weight: 500;
    color: #fff;
    background: none;
    border: 1px solid #b2e6e6;
    border-radius: 0.3em;
    align-self: flex-end;
    box-shadow: none;
    margin: 0 0.07em;
    letter-spacing: 0.04em;
    user-select: none;
  }
}
/* Panel Slide Up Animation */
/* Metallic Teal Panel & Header */
#puzzl-chatbot-panel {
  display: none;
  flex-direction: column;
  height: 45vh;
  width: 100vw;
  max-height: 95vw;
  min-height: 0;
  color: #eafffa;
  background: #0b1622fa;
  bottom: 0;
  right: 0;
  border-radius: 1.5em 1.5em 0 0;
  box-shadow: 0 8px 32px 0 #00f2ff44, 0 2px 8px #20C9D288;
  overflow: hidden;
  position: fixed;
  opacity: 0;
  transform: translateY(100%);
  transition: height 0.4s cubic-bezier(.4,1.6,.6,1), width 0.4s cubic-bezier(.4,1.6,.6,1), max-width 0.4s cubic-bezier(.4,1.6,.6,1), max-height 0.4s cubic-bezier(.4,1.6,.6,1), opacity 0.25s, transform 0.4s cubic-bezier(.4,1.6,.6,1);
  z-index: 1;
  top: auto;
  will-change: height, width, max-width, max-height, opacity, transform;
}
#puzzl-chatbot-panel.open {
  display: flex;
  opacity: 1;
  transform: translateY(0);
  height: 45vh;
  width: 100vw;
  max-height: 600px;
}
#puzzl-chatbot-panel.open.expanded {
  height: 95vh;
  max-height: 95vh;
  height: 95dvh;
  max-height: 95dvh;
  width: 100vw;
  max-width: 100vw;
}
@media (min-width: 786px) {
  #puzzl-chatbot-panel {
    height: 50vh;
    max-height: 600px;
  }
  #puzzl-chatbot-panel.open {
    height: 50vh;
    max-height: 600px;
    width: 400px;
  }
  #puzzl-chatbot-panel.open.expanded {
    height: 100vh;
    max-height: 100vh;
    width: 100vw;
    max-width: 100vw;
    right: 0;
  }
}
#puzzl-chatbot-panel.open {
  display: flex;
  opacity: 1;
}
/* Header with logo and title */
#puzzl-chatbot-panel-header {
  color: #fff;
  padding: 1rem 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px #20C9D244;
  background-color: #0b1622;
  z-index: 1000;
}
.puzzl-chatbot-logo {
  width: 32px;
  height: 32px;
  margin-right: 0.5em;
}
.puzzl-chatbot-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  margin-right: auto;
}
#puzzl-chatbot-close, #puzzl-chatbot-open, #puzzl-chatbot-expand {
  background: none;
  border: none;
  color: #20C9D2;
  font-size: 1.7rem;
  font-weight: 900;
  cursor: pointer;
  margin-left: 1em;
  opacity: 0.7;
  transition: opacity 0.2s;
  border: 1px solid #20C9D2;
  height: 32px;
  padding: 0.5em 0.5em;
  padding-bottom: 0.1em;
  border-radius: 6px;
  line-height: 0;
}
#puzzl-chatbot-expand {
  padding-bottom: inherit;
  background: none;
}
#puzzl-chatbot-expand.expanded, #puzzl-chatbot-expand:hover,
#puzzl-chatbot-open:hover, #puzzl-chatbot-open:focus,
#puzzl-chatbot-close:hover, #puzzl-chatbot-close:focus {
  opacity: 1;
  background: #20C9D2;
  color: #fff;
}

/* Messages area */
#puzzl-chatbot-messages, .puzzl-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1.5rem;
  color: #f3f6fa;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Form area */
#puzzl-chatbot-form, .puzzl-chatbot-form {
  display: flex;
  align-items: flex-end;
  padding: 1rem 1.5rem 1.2rem 1.5rem;
  border-top: 1px solid #222a;
  background: transparent;
  gap: 0.5rem;
  position: relative;
  z-index: 2;
}
#puzzl-chatbot-input {
  flex: 1;
  min-height: 2.2em;
  max-height: 8em;
  border-radius: 8px;
  border: none;
  height: 51px;
  padding: 1em;
  font-size: 1rem;
  background: #232c3d44;
  color: #fff;
  transition: border 0.2s, box-shadow 0.2s;
  position: relative;
  overflow-y: auto;
  resize: none;
}
#puzzl-chatbot-input:focus {
  box-shadow: rgba(0, 120, 126, 0.1) 0px 1.74718px 8.50564px 0px;
}
.puzzl-agent-send {
    position: relative;
}

.puzzl-chatbot-message {
  margin: 0.18em 0 0.18em 0;
  padding: 0;
  line-height: 1.6;
  vertical-align: baseline;
  margin: 1em 0;
  padding: 1em;
  word-break: break-word;
  max-width: 80%;
  border-radius: 12px;
  font-size: 1rem;
  line-height: 1.35;
  color: #fff;
  position: relative;
  margin-bottom: 0.18em;
}
.puzzl-chatbot-message p {
  font-size: 1rem;
  margin: 0;
}
.puzzl-chatbot-message li {
  padding: 0;
  list-style-type: circle;
}
.puzzl-chatbot-message.user-message {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: auto;
  border: 1px solid #b2e6e633;
}
.puzzl-chatbot-message.user-message::before,
.puzzl-chatbot-message.assistant-message::before {
  font-weight: bold;
  align-self: flex-start;
  color: #b2e6e6;
  font-size: 0.8em;
  display: block;
  margin-bottom: 0.3em;
}
.puzzl-chatbot-message.user-message::before {
  content: "You:";
  color: #b2e6e6;
}
.puzzl-chatbot-message.assistant-message {
  position: relative;
  display: block;
  box-shadow: 0 2px 16px 0 #00d8ff33, 0 1px 4px #00d8ff33;
}
.puzzl-chatbot-message.assistant-message::before {
  content: "Copilot:";
  color: #00d8ff;
}

/* Timestamp and checkmark inside bubble, compact */
.puzzl-chatbot-timestamp {
  font-size: 0.6em;
  color: #b2e6e6;
  margin-bottom: 0.05em;
  margin-top: 0.6em;
  opacity: 0.7;
}
.puzzl-chatbot-timestamp.assistant-message {
  align-self: flex-start;
}
.puzzl-chatbot-timestamp.user-message {
  align-self: flex-end;
}
.puzzl-chatbot-loading {
  border: none;
  color: #20C9D2;
}
#puzzl-chatbot-input::placeholder {
  color: #20C9D2;
  opacity: 1;
}
#puzzl-chatbot-input::-webkit-input-placeholder {
  color: #20C9D2;
}
#puzzl-chatbot-input:-ms-input-placeholder {
  color: #20C9D2;
}
#puzzl-chatbot-input::-ms-input-placeholder {
  color: #20C9D2;
}
