// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

@chat-bg: #00000000;
@chat-input-bg: white;

#html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  overflow: hidden;
  background-color: #00000000;
}

.dark-mode {
  background-color: #1a1a2e;

  .action-container {
    background-color: #16162a;
  }

  .chat-container {
    background-color: #16162a;
    .scroll_enabled {
      background-color: #16162a;
    }
  }

  .replacement-container {
    background-color: #16162a;
  }

  .chat-input {
    background-color: #2a2a40;
    border: 1px solid #3a3a50;

    &:focus-within {
      border-color: #7c3aed;
      box-shadow: 0 1px 4px rgba(124, 58, 237, 0.2);
    }

    .user-textarea {
      color: #e8e8f0;
    }

    .chat-input-button {
      color: #e8e8f0;
    }

    label {
      color: #e8e8f0;
    }

    .autocomplete-container {
      background-color: #2a2a40f0;
      color: #e8e8f0;
      border-color: rgba(255, 255, 255, 0.08);
      box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.3),
        0 1px 4px rgba(0, 0, 0, 0.2);
    }

    .autocomplete-container .completions li:hover {
      background-color: rgba(167, 139, 250, 0.12);
    }

    .autocomplete-scrollbar {
      background-color: rgba(255, 255, 255, 0.06);
    }

    .autocomplete-scrollbar-indicator {
      background-color: rgba(167, 139, 250, 0.4);
    }
  }

  .inline-ghost {
    color: #6b7280;
  }

  .completion-toggle {
    color: #a78bfa;
  }

  .chat-message-agent {
    background-color: #2a2a40;
  }

  .chat-message-user {
    background-color: #3b2d63;
  }

  .chat-message-content {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }

  .chat-message-kind-info {
    color: #999;
  }

  .chat-message-agent.notification .chat-message-content {
    background-color: rgba(167, 139, 250, 0.07);
    border-left-color: #7c3aed;
    color: #c4b5fd;
  }

  details.reasoning-thinking {
    border-color: #3a3a50;
  }

  details.reasoning-thinking summary {
    color: #aaa;
  }

  details.reasoning-thinking pre {
    border-top-color: #3a3a50;
    background: rgba(255, 255, 255, 0.03);
    color: #ccc;
  }

  .chat-message-metrics-agent {
    background-color: #232338;
  }

  .chat-message-metrics-user {
    background-color: #322850;
  }

  .agent-icon {
    background-color: #2a2a40;
  }

  .user-icon {
    background: #4c1d95;
    color: #c4b5fd;
  }

  .chat-timestamp {
    color: #666;
  }

  .track-list {
    h3 {
      color: #ccc;
    }

    li {
      border-bottom-color: rgba(255, 255, 255, 0.06);
    }
  }

  .track-title {
    color: #e8e8f0;
  }

  .track-artist {
    color: #999;
  }

  .track-info div {
    color: #888;
  }

  .now-playing-title {
    color: #e8e8f0;
  }

  .now-playing-artist {
    color: #bbb;
  }

  .now-playing-album {
    color: #888;
  }

  .now-playing-times {
    color: #888;
  }

  .now-playing-bar {
    background: #3a3a50;
  }

  .now-playing-bar-fill {
    background: #a78bfa;
  }

  .now-playing-device {
    color: #666;
  }

  .chat-message-agent {
    background-color: #2a2a40;
  }

  .chat-message-user {
    background-color: #3b2d63;
  }

  .chat-message-content {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }

  .chat-message-metrics-agent {
    background-color: #232338;
  }

  .chat-message-metrics-user {
    background-color: #322850;
  }

  .agent-icon {
    background-color: #2a2a40;
  }

  .user-icon {
    background: #4c1d95;
    color: #c4b5fd;
  }

  .chat-timestamp {
    color: #666;
  }

  .track-list {
    h3 {
      color: #ccc;
    }

    li {
      border-bottom-color: rgba(255, 255, 255, 0.06);
    }
  }

  .track-title {
    color: #e8e8f0;
  }

  .track-artist {
    color: #999;
  }

  .track-info div {
    color: #888;
  }

  .now-playing-title {
    color: #e8e8f0;
  }

  .now-playing-artist {
    color: #bbb;
  }

  .now-playing-album {
    color: #888;
  }

  .now-playing-times {
    color: #888;
  }

  .now-playing-bar {
    background: #3a3a50;
  }

  .now-playing-bar-fill {
    background: #a78bfa;
  }

  .now-playing-device {
    color: #666;
  }

  .action-text {
    color: lightgray;
  }

  .chat-separator-line {
    background-color: #444;
  }

  .chat-separator-text {
    color: #666;
  }
}

.history {
  filter: grayscale(100%);
}

.chat-separator {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  text-align: center;
  font-size: 10px;
  margin: 20px 20px;
}

.chat-separator-line {
  flex-grow: 1;
  width: 40px;
  background-color: darkgray;
  height: 2px;
}

.chat-separator-text {
  margin: 0px 10px;
  color: darkgray;
  height: 20px;
}

.wrapper {
  height: 100%;
  width: 100%;
  position: absolute;
  background-color: #00000000;
}

.user-textarea {
  padding: 5px 8px;
  display: block;
  width: calc(100% - 48px);
  overflow: hidden;
  resize: none;
  outline: 0px solid transparent;
  min-height: 30px;
  line-height: 30px;
  font-family: inherit;
  font-size: inherit;
  align-self: flex-start;
}

.inline-ghost {
  color: #9ca3af;
  pointer-events: none;
  user-select: none;
}

.inline-completion-area {
  position: relative;
  display: inline-block;
  pointer-events: auto;
  user-select: none;
}

.replacement-textarea {
  padding: 10px 16px;
  display: block;
  width: 100%;
  overflow: hidden;
  resize: none;
  outline: 0px solid transparent;
  min-height: 40px;
  line-height: 20px;
  font-family: inherit;
  font-size: inherit;
  align-self: flex-start;
}

.action-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: white;
}

.choice-panel {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 40px;
  font-family: inherit;
  font-size: inherit;
}

.choice-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 100%;
}

.choice-button:hover {
  background-color: #c6e3ef;
}
.choice-button:focus {
  box-shadow:
    inset 0px 0.8px 0px -0.25px rgba(255, 255, 255, 0.2),
    0px 0.5px 1px rgba(0, 0, 0, 0.1),
    0px 0px 0px 3.5px rgba(58, 108, 217, 0.5);
  outline: 0;
}

.checkbox-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: auto;
  padding: 4px 0;
  gap: 2px;
}

.checkbox-choice {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.checkbox-choice:hover {
  background-color: #f0f0f0;
}

.checkbox-buttons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.action-text {
  padding: 10px 16px;
  align-self: center;
}

.preface-text {
  // bottom border
  border-bottom: 1px dotted #808080;
  padding-bottom: 5px;
  margin-bottom: 10px;
}

.replacement-title {
  display: flex;
  align-items: flex-start;
  height: 40px;
  color: green;
  background-color: white;
}

.replacement-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: white;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  bottom: 0px;
  position: absolute;
  background-color: @chat-bg;
  width: 100%;
}

.chat {
  /* use flexbox to align the messages vertically */
  display: flex;
  flex-direction: column-reverse;
  height: 100%;
  scroll-behavior: smooth;
  overflow-y: auto;
  font-family: inherit;
  font-size: inherit;
  background-color: @chat-bg;
  padding: 25px 10px 25px 10px;
}

.track-list {
  max-height: 350px;
  overflow-y: auto;
  border-radius: 8px;
  padding-right: 4px;

  h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: #333;
  }

  ol {
    margin: 0;
    padding-left: 24px;
    list-style-type: decimal;
  }

  li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);

    &:last-child {
      border-bottom: none;
    }
  }
}

.playlist-list {
  max-height: 350px;
  overflow-y: auto;
  border-radius: 8px;
  padding-right: 4px;
}

.playlist-title {
  color: #6b21a8;
  font-weight: 600;
}

.track-artist {
  color: #555;
  font-size: 0.9em;
}

.track-title {
  color: #1a1a1a;
  font-weight: 600;
}

.track-album-cover-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.track-info {
  flex: 1;
  min-width: 0;

  div {
    font-size: 0.85em;
    color: #666;
  }
}

.track-album-cover {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Now Playing status card */
.now-playing-card {
  padding: 4px 0;
}

.now-playing-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.now-playing-art {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.now-playing-info {
  flex: 1;
  min-width: 0;
}

.now-playing-title {
  font-weight: 600;
  font-size: 15px;
  color: #1a1a1a;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-artist {
  font-size: 13px;
  color: #555;
  margin-bottom: 1px;
}

.now-playing-album {
  font-size: 12px;
  color: #888;
}

.now-playing-progress {
  margin-top: 10px;
}

.now-playing-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.now-playing-bar {
  height: 4px;
  background: #e5e5e5;
  border-radius: 2px;
  overflow: hidden;
}

.now-playing-bar-fill {
  height: 100%;
  background: #7c3aed;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.now-playing-device {
  margin-top: 8px;
  font-size: 11px;
  color: #aaa;
}

.now-playing-empty {
  color: #888;
  font-style: italic;
}

.read-only .chat-input {
  display: none;
}

.write-only {
  .chat-input {
    max-height: 45px;
  }

  .chat {
    display: none;
  }
}

.chat-input.listening {
  background-color: aquamarine;
}

.chat-input {
  display: flex;
  padding: 6px 8px;
  background-color: @chat-input-bg;
  align-self: flex-end;
  margin: 8px 12px 12px 12px;
  width: calc(
    100% - 24px
  ); // Note: subtracted value should match horizontal margin total from line above
  border: solid 1px #e0e0e0;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: border-color 0.2s ease;

  &:focus-within {
    border-color: #a78bfa;
    box-shadow: 0 1px 4px rgba(167, 139, 250, 0.15);
  }

  .completion-toggle {
    position: absolute;
    top: 0;
    z-index: 50;
    min-width: 60px;
  }
}

.chat-input-drag {
  color: #cccccc;
  font-style: italic;
}

/* Container */
.chat-message-container {
  padding-left: 10px;
  padding-right: 10px;
  margin-bottom: 8px;
  margin-top: 8px;
  width: 55%;
  transform-origin: 0 100%;
  transform: scale(0);
  animation: message 0.15s ease-out 0s forwards;
}

.chat-message-container-agent {
  .chat-message-container;
  margin-left: 10px;
}

.chat-message-container-user {
  .chat-message-container;
  margin-right: 10px;
  align-self: flex-end;
}

/* Body */
.chat-message-body {
  border-radius: 12px;
  margin-bottom: 4px;
}

.chat-message-user {
  .chat-message-body;
  position: relative;
  background-color: #f0eef5;
  margin-right: 36px;
}

.chat-message-agent {
  margin-left: 36px;
  position: relative;
  background-color: #f3f4f6;
}

/* Content */
.chat-message-content {
  padding: 10px 16px;
  word-wrap: break-word;
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-message-kind-status {
  font-style: italic;
  color: grey;
}

.chat-message-kind-warning {
  font-style: italic;
  color: rgb(146, 146, 0);
}

.chat-message-kind-error {
  font-style: italic;
  color: red;
}

.chat-message-kind-success {
  font-style: italic;
  color: green;
}

.chat-message-kind-info {
  font-size: 0.85em;
  color: #666;
  padding: 2px 0;
}

/* Notification messages — agent-initiated toast/inline (via
 * SessionContext.beginAgentThread) and OS-forwarded notifications (via the
 * osNotifications agent). Rendered with a muted background and a left accent
 * stripe so they read as system/ephemeral rather than as a normal agent reply.
 * The class is applied to the message-container div by ChatView's
 * addNotificationMessage path. */
.chat-message-agent.notification {
  .chat-message-content {
    background-color: rgba(120, 144, 156, 0.08);
    border-left: 3px solid #78909c;
    box-shadow: none;
    font-size: 0.92em;
    padding: 6px 12px 6px 13px;
  }
}

/* Collapsible thinking block for reasoning engine */
details.reasoning-thinking {
  margin: 4px 0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0;
  font-size: 0.85em;
}

details.reasoning-thinking summary {
  cursor: pointer;
  padding: 4px 10px;
  font-weight: 600;
  color: #888;
  user-select: none;
  list-style: none;
}

details.reasoning-thinking summary::before {
  content: "\25B6";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
  font-size: 0.7em;
}

details.reasoning-thinking[open] summary::before {
  transform: rotate(90deg);
}

details.reasoning-thinking pre {
  margin: 0;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-top: 1px solid #e0e0e0;
  background: rgba(0, 0, 0, 0.02);
  max-height: 300px;
  overflow-y: auto;
}

.chat-message-agent-text {
  white-space: break-spaces;
}

.chat-message-user-text {
  white-space: break-spaces;
}

table.table-message {
  table-layout: fixed;
  text-overflow: ellipsis;
  text-wrap: pretty;
  width: 100%;
}

table.table-message th,
table.table-message td {
  border: solid 1px black;
  padding: 0px 10px 0px 10px;
}

.chat-message-metrics {
  margin: 0px;
  border-radius: 0px 0px 8px 8px;
  font-size: 10px;
  font-style: normal;
  z-index: 50;
  text-align: right;
}

.chat-message-metrics-agent {
  .chat-message-metrics;
  background-color: #e8e9eb;
}

.chat-message-metrics-user {
  .chat-message-metrics;
  background-color: #e2e0ec;
}

/* hidden metrics */
.chat-message-body-hide-metrics {
  .chat-message-body;
}
.chat-message-body-hide-metrics .chat-message-metrics {
  display: none;
}

.chat-message-body-hide-metrics .tts-metrics {
  display: none;
}

.chat-message-body-hide-metrics:hover {
  border-radius: 8px 8px 0px 0px;
}

.chat-message-body-hide-metrics:hover .chat-message-metrics {
  display: block;
  position: absolute;
  width: 100%;
  transform-origin: 0 0;
  transform: scaleY(0);
  animation: metrics 0.15s ease-out 0s forwards;
}

@keyframes metrics {
  0% {
  }
  100% {
    transform: scaleY(1);
    overflow: visible;
  }
}

.metrics-details {
  display: inline-flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 5px;
  margin-bottom: 5px;
}

.metrics-details > div {
  margin-left: 5px;
  margin-right: 5px;
}

.chat-message-hidden {
  display: none;
  visibility: hidden;
}

.chat-timestamp {
  font-size: 10px;
  font-style: normal;
  color: #aaa;
  position: relative;
  margin: 4px;
  letter-spacing: 0.2px;
}

.chat-timestamp-agent {
  .chat-timestamp;
  margin-left: 40px;
}

.chat-timestamp-user {
  .chat-timestamp;
  text-align: end;
  margin-right: 40px;
}

.agent-icon {
  width: 30px;
  height: 30px;
  border-radius: 15px;
  position: absolute;
  left: 0px;
  font-size: 18px;
  font-style: normal;
  text-align: center;
  line-height: 30px;
  background-color: #e8e9eb;
}

.user-icon {
  width: 30px;
  height: 30px;
  border-radius: 15px;
  position: absolute;
  right: 0px;
  font-size: 14px;
  font-style: normal;
  text-align: center;
  line-height: 30px;
  background: #e2dff0;
  color: #5b4a8a;
  font-family: inherit;
  font-weight: 600;
}

.agent-name {
  font-style: normal;
  font-weight: bold;
  margin-right: 8px;
}

.agent-name:hover .clickable {
  cursor: pointer;
  text-decoration: underline;
  font-weight: bolder;
}

.timeString {
  font-style: normal;
}

.chat-message-explained {
  position: relative;
}

.chat-message-explained-icon {
  align-self: flex-end;
  border: none;
  background-color: transparent;
  margin-right: 5px;
  position: absolute;
  top: 0;
  right: 0;
}

.chat-message-action-data {
  white-space: nowrap;
  font-size: 80%;
}

// Panel below an agent message that shows the action JSON when the
// user clicks the agent name. Mirrors the chat-ui details-row pattern
// so the JSON expands beneath the response instead of overlaying it.
.chat-action-data-panel {
  margin: 6px 0 0 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11.5px;
  line-height: 1.35;
  color: #333;
  white-space: pre;
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
}

.chat-message-explained[data-expl]:hover:after {
  content: attr(data-expl);
  position: absolute;
  text-align: right;
  top: 0px;
  right: 30px;
  white-space: nowrap;
  color: gray;
  background-color: lightyellow;
  border: 1px solid black;
  padding: 1px 5px 1px 5px;
  font-size: 70%;
}

.chat-input-button {
  align-self: flex-end;
  border: none;
  background-color: transparent;
  width: 24px;
  height: 24px;
  padding: 0px;
  margin: 6px 3.5px;
  cursor: pointer;
}

.chat-input-button:disabled svg {
  fill: lightslategray;
}

.chat-input-micSelector {
  border: 0px;
  margin-left: 25px;
  background-color: white;
  width: 100%;
  max-width: 85%;
}

.chat-input-dropImage {
  max-width: 96px;
  max-height: 96px;
  width: auto;
  height: auto;
}

.chat-input-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  overflow: auto;
}

.chat-smallImage img {
  max-width: 175px;
  max-height: 175px;
}

.chat-input-separator-container {
  width: 4px;
  margin-bottom: 7px;
}

.chat-input-separator {
  width: 0.5px;
  height: 24px;
  background-color: #bbbbbb;
  position: absolute;
  margin-bottom: 14px;
  vertical-align: bottom;
}

.chat-title {
  width: 100%;
  text-align: center;
  position: absolute;
  font-size: 8px;
  user-select: none;
  opacity: 0.5;
}

@keyframes message {
  0% {
  }
  100% {
    transform: scale(1);
    overflow: visible;
  }
}

@import "./searchMenuCommon.less";

span.ansi-black-fg {
  color: black;
}

span.ansi-red-fg {
  color: rgb(128, 0, 0);
}

span.ansi-green-fg {
  color: rgb(0, 128, 0);
}

span.ansi-yellow-fg {
  color: rgb(128, 128, 0);
}

span.ansi-blue-fg {
  color: rgb(0, 0, 128);
}

span.ansi-magenta-fg {
  color: rgb(128, 0, 128);
}

span.ansi-cyan-fg {
  color: rgb(0, 128, 128);
}

span.ansi-white-fg {
  color: rgb(192, 192, 192);
}

span.ansi-gray-fg span.ansi-bright-black-fg {
  color: rgb(128, 128, 128);
}

span.ansi-bright-red-fg {
  color: rgb(192, 0, 0);
}

span.ansi-bright-green-fg {
  color: rgb(0, 192, 0);
}

span.ansi-bright-yellow-fg {
  color: rgb(192, 192, 0);
}

span.ansi-bright-blue-fg {
  color: rgb(0, 0, 192);
}

span.ansi-bright-magenta-fg {
  color: rgb(192, 0, 192);
}

span.ansi-bright-cyan-fg {
  color: rgb(0, 192, 192);
}

span.ansi-bright-white-fg {
  color: rgb(255, 255, 255);
}

.scroll_enabled::-webkit-scrollbar {
  width: 10px;
}
.scroll_enabled::-webkit-scrollbar-corner {
  background: rgba(0, 0, 0, 0);
}
.scroll_enabled::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 10px;
}
.scroll_enabled::-webkit-scrollbar-thumb:hover {
  background: #555;
}
.scroll_enabled::-webkit-scrollbar-track {
  background-color: rgba(0, 0, 0, 0);
  margin-right: 4px;
}

.clickable {
  cursor: pointer;
}

.metrics {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  max-height: 90%;
  margin-left: 20px;
}

.metric-row {
  display: flex;
  margin-left: 10px;
  margin-bottom: 10px;
}

.metric-label {
  margin-right: 5px;
}

input[type="file"] {
  display: none;
}

.custom-file-upload {
  border: 0px solid #ccc;
  display: inline-block;
  padding: 6px 12px;
  cursor: pointer;
}

.notification-error {
  color: red;
}

.notification-warning {
  color: orange;
}

.notification-info {
  color: blue;
}

.notification-debug {
  color: pink;
}

.action-text table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  margin-bottom: 10px;
}

.action-text tr {
  border-top: 1px solid lightgray;
  border-bottom: 1px solid lightgray;
}
.action-text td {
  padding: 1px 10px 1px 10px;
  height: 22px;
}

.action-text .autocomplete-container {
  bottom: 25px;
}
.action-text td.name-cell {
  width: 30%;
}

.action-text td.value-cell {
  border-left: 1px solid lightgray;
  width: 62%;
}

.action-text td.button-cell {
  padding: 0px;
  text-align: center;
}

.action-text input,
.action-text select,
.action-text button {
  width: 100%;
  height: 100%;
}

.action-button {
  padding: 4px;
  border: lightgray;
  background-color: transparent;
  display: none;
  opacity: 0;
  width: 100%;
}
.action-text-editable .action-button {
  display: block;
  opacity: 0.25;
}

.action-text-editable tr:hover .action-button,
.action-text-editable tr.editing .action-button {
  display: block;
  opacity: 1;
}

.action-text-editable tr.missing .delete-button {
  display: none;
}

.action-text tr.error td.name-cell,
.action-text tr.error input {
  color: red;
  font-weight: bold;
}

.action-text tr.missing {
  display: none;
}

.action-text-editable tr.missing {
  display: table-row;
}

.action-text-editable tr.missing td.name-cell {
  font-style: italic;
  color: lightgray;
}

.references {
  font-size: small;
  font-weight: 400;

  a {
    font-size: small;
    font-weight: 200;
  }
}

.ai-video-container {
  width: auto;
  height: auto;
}

.ai-video {
  width: 100%;
  height: 100%;
}

// ─── Voice Mode Banner ────────────────────────────────────────────────────────

.voice-mode-banner {
  display: none;
  padding: 4px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid teal;
  border-radius: 6px;
  color: teal;
  text-align: center;
  margin: 4px 8px;
  letter-spacing: 0.05em;
}

.voice-mode-banner.claude-focus {
  border-color: #c87137;
  color: #c87137;
}

.chat-reconnect-banner {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  background-color: #fff4ce;
  color: #5c3c00;
  border-bottom: 1px solid #ffc83d;
  text-align: center;
  flex: 0 0 auto;
}

.user-textarea:empty[data-placeholder]::before {
  content: attr(data-placeholder);
  color: rgba(128, 128, 128, 0.6);
  font-style: italic;
  pointer-events: none;
}

// ─── Voice Mode Layout ────────────────────────────────────────────────────────

.voice-mode {
  // Show banner
  .voice-mode-banner {
    display: block;
  }

  // Hide all message history except the last result
  .chat-message-container:not(:last-child) {
    display: none;
  }

  // Make the last result a large, glanceable card
  .chat-message-container:last-child {
    width: 100%;
    margin: 0;
    padding: 0 8px;

    .chat-message-content {
      font-size: 1.4rem;
      line-height: 1.6;
      padding: 20px 24px;
      border-radius: 16px;
    }
  }

  // Larger chat input
  .chat-input {
    .user-textarea {
      font-size: 1.1rem;
      line-height: 1.6;
      min-height: 40px;
    }
  }
}

// =============================================================
// Session Selector
// =============================================================

.session-selector {
  position: relative;
  display: inline-block;
  padding: 4px 8px;
  z-index: 100;
}

.session-selector-button {
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;

  &:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }
}

.session-selector-dropdown {
  position: absolute;
  top: 100%;
  left: 8px;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 200;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;

  &:hover {
    background-color: #f0f0f0;
  }
}

.session-item-current {
  background-color: #e8f0fe;
  font-weight: 600;
}

.session-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item-meta {
  font-size: 11px;
  color: #888;
  margin-left: 8px;
  white-space: nowrap;
}

.session-separator {
  height: 1px;
  background: #ddd;
  margin: 4px 0;
}

.session-new {
  color: #1a73e8;
  font-weight: 500;
}

.session-loading,
.session-error {
  padding: 12px;
  text-align: center;
  color: #888;
  font-size: 13px;
}

.session-error {
  color: #d93025;
}

.dark-mode {
  .session-selector-button {
    border-color: #3a3a50;
    color: #e8e8f0;

    &:hover {
      background-color: rgba(255, 255, 255, 0.05);
    }
  }

  .session-selector-dropdown {
    background: #2a2a40;
    border-color: #3a3a50;
  }

  .session-item {
    &:hover {
      background-color: #3a3a50;
    }
  }

  .session-item-current {
    background-color: #3a3a60;
  }

  .session-item-meta {
    color: #aaa;
  }

  .session-separator {
    background: #3a3a50;
  }

  .session-loading,
  .session-error {
    color: #aaa;
  }
}

/* ----- Feedback widget --------------------------------------------------- */

@feedback-accent: #1f6feb;
@feedback-dim: #8a8a8a;

/* Bubble hidden via the trash icon. The whole MessageGroup is hidden in
   place — user message + status + every agent reply collapse to slim
   placeholders. The placeholder line fades and the container fully
   collapses 10 s after the class is applied (so the chat reflows and the
   trashed bubble doesn't permanently take up a line). `@shell trash
   restore` removes the class and the container snaps back to normal. */
.chat-message-container-agent.chat-message-trashed,
.chat-message-container-user.chat-message-trashed {
  // Real content snaps away as soon as the class is applied — no fade.
  & > .chat-timestamp-agent,
  & > .chat-timestamp-user,
  & > .agent-icon,
  & > .user-icon,
  & > .chat-message-body,
  & > .chat-message-body-hide-metrics,
  & > .chat-message-actions {
    display: none;
  }
  // .chat-message-container's base rule has `transform: scale(0)` plus
  // a 0.15s `message` enter-animation that fills forward to scale(1).
  // Setting `animation` below replaces that animation outright, so the
  // forwards-fill state is dropped and the container would snap back to
  // scale(0) — invisible — taking the placeholder ::after with it.
  // Pin scale(1) explicitly so the row stays visible while the
  // placeholder fades.
  transform: scale(1);
  // The container itself stays solid for the full 10 s window so the
  // row keeps its slot in the chat — only the placeholder text fades.
  // At t=10 s the container collapses to display:none in one snap.
  animation: chat-trashed-collapse 6s linear forwards;
}
.chat-message-container-agent.chat-message-trashed::after,
.chat-message-container-user.chat-message-trashed::after {
  content: "🗑  message hidden — `@shell trash restore` to recover";
  display: block;
  font-size: 11px;
  color: #888;
  font-style: italic;
  padding: 4px 0;
  // Placeholder is at full opacity for the first 4 s then fades 1 → 0
  // over the last 2 s (66.67% of a 6 s window). The container's
  // collapse keyframe handles vanishing the row after the fade.
  animation: chat-trashed-fade 6s linear forwards;
}
.chat-message-container-agent.chat-message-trashed::after {
  margin-left: 40px;
}
.chat-message-container-user.chat-message-trashed::after {
  text-align: right;
  margin-right: 40px;
}
@keyframes chat-trashed-fade {
  0%,
  66.67% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes chat-trashed-collapse {
  0%,
  99.99% {
    /* container stays in place while the placeholder fades */
  }
  100% {
    display: none;
  }
}

/* Trash button — anchored absolute top-right inside the bubble body
 * for both user and agent messages. Hidden until the user hovers the
 * container, brightens to red to telegraph the destructive intent. */
.chat-message-container-agent .chat-message-agent,
.chat-message-container-user .chat-message-user {
  position: relative;
}
.chat-message-trash {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  color: @feedback-dim;
  transition:
    opacity 0.15s ease,
    color 0.12s ease;
  &:hover {
    color: #c83e3e;
  }
}
.chat-message-container-agent:hover .chat-message-trash,
.chat-message-container-user:hover .chat-message-trash {
  opacity: 1;
  pointer-events: auto;
}

.chat-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: @feedback-dim;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    opacity 0.12s ease;

  i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }
  i svg {
    width: 16px;
    height: 16px;
  }

  &:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
  }
  &:focus-visible {
    outline: 2px solid @feedback-accent;
    outline-offset: 1px;
  }
  &.feedback-selected {
    color: @feedback-accent;
  }
  &[data-action="thumbs-down"].feedback-selected {
    color: #c83e3e;
  }
  &.feedback-copied {
    color: #2e8b57; // sea green — quick "copied!" confirmation
  }
}

.chat-message-actions {
  display: flex;
  gap: 2px;
  margin: 2px 0 6px 40px; // align under the bubble (left of agent icon area)
  align-items: center;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.chat-message-container-agent:hover .chat-message-actions,
.chat-message-container-agent.feedback-rated .chat-message-actions {
  opacity: 1;
}

/* Variant: footer-always — covered by the base .chat-message-actions rules. */

/* Dropdown menu (⋯ more / category menu) */
.chat-feedback-menu {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 4px;
  min-width: 220px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
}
.chat-feedback-menu-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  color: #222;
}
.chat-feedback-menu-item:hover {
  background: #f3f5f7;
}

/* Popover card (thumbs-down detail) */
.chat-feedback-popover {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  width: 340px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #222;
}
.chat-feedback-popover-heading {
  font-weight: 600;
  font-size: 14px;
}
.chat-feedback-popover-subtitle {
  color: #555;
  font-size: 11px;
  line-height: 1.4;
}
.chat-feedback-popover-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 500;
}
.chat-feedback-popover-textarea {
  width: 100%;
  resize: vertical;
  min-height: 60px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  padding: 6px 8px;
  font: inherit;
}
.chat-feedback-popover-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.chat-feedback-popover-fieldset legend {
  font-weight: 500;
  font-size: 12px;
  padding: 0 0 4px 0;
  color: #444;
}
.chat-feedback-popover-radio {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
  cursor: pointer;
}
.chat-feedback-popover-share {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 12px;
  color: #444;
  line-height: 1.4;
}
.chat-feedback-popover-share input {
  margin-top: 2px;
}
.chat-feedback-popover-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.chat-feedback-popover-button {
  border: 1px solid #d0d7de;
  background: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  color: #222;
}
.chat-feedback-popover-button:hover {
  background: #f3f5f7;
}
.chat-feedback-popover-button.submit {
  background: @feedback-accent;
  color: #fff;
  border-color: @feedback-accent;
}
.chat-feedback-popover-button.submit:hover {
  background: darken(@feedback-accent, 6%);
}
.chat-feedback-popover-button.clear {
  color: #a23737;
  border-color: transparent;
}

/* Dark mode */
body.dark-mode {
  .chat-action-button {
    color: #9aa0a6;
    &:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #d7dbe0;
    }
    &.feedback-selected {
      color: #6aa3ff;
    }
    &[data-action="thumbs-down"].feedback-selected {
      color: #e87a7a;
    }
  }
  .chat-feedback-menu,
  .chat-feedback-popover {
    background: #2a2a36;
    border-color: #4a4a5c;
    color: #e1e4ea;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  }
  .chat-feedback-menu-item {
    color: #e1e4ea;
  }
  .chat-feedback-menu-item:hover {
    background: #353648;
  }
  .chat-feedback-popover-subtitle,
  .chat-feedback-popover-fieldset legend,
  .chat-feedback-popover-share {
    color: #b4b9c2;
  }
  .chat-feedback-popover-textarea {
    background: #1f1f29;
    border-color: #4a4a5c;
    color: #e1e4ea;
  }
  .chat-feedback-popover-button {
    background: #353648;
    border-color: #4a4a5c;
    color: #e1e4ea;
  }
  .chat-feedback-popover-button:hover {
    background: #44455c;
  }
}
