/*
  Copilot Plugin Css
  This file is generated by Copilot plugin.
*/
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

/*

This CSS file will be included with your plugin, and
available in the app when your plugin is enabled.

If your plugin does not need CSS, delete this file.

*/

/* Popover needs to render on top of the workspace-leaf-resize-handle */
[data-radix-popper-content-wrapper] {
  z-index: 9999 !important;
}

.button-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 25px;
}

.button-container .mod-cta {
  flex: 1; /* Make buttons take equal width */
  margin: 25px 0;
}

/* button mobile style */
@media screen and (max-width: 768px) {
  .button-container {
    gap: 0.5rem;
    padding: 0 12px;
  }

  .button-container .mod-cta {
    margin: 12px 0;
    font-size: 0.9rem;
    padding: 6px 12px;
  }
}

.warning-message {
  background-color: black;
  color: orange;
  padding: 10px;
  margin: 10px 0;
  border-radius: 5px;
  border: 1px solid orange;
  font-weight: bolder;
  text-align: center;
}

.copilot-setting-item-name {
  font-weight: bold;
  display: block;
  color: var(--inline-title-color);
  margin-top: 20px;
  margin-bottom: 10px;
}

.copilot-setting-item-description {
  display: block;
  margin-top: 10px;
  margin-bottom: 10px;
}

.copilot-setting-item-control {
  width: 50%; /* Adjust the width as needed */
  max-width: 100%; /* Ensures it doesn't exceed the parent width */
}

.copilot-setting-item-control::placeholder {
  color: gray;
  opacity: 0.5;
}

.copilot-setting-item-control[type="range"] {
  width: 70%;
}

/* Vim navigation: hide default outline, show for keyboard navigation */
.copilot-messages-focusable:focus {
  outline: none;
}

.copilot-messages-focusable:focus-visible {
  outline: 2px solid var(--interactive-accent);
  outline-offset: -2px;
  border-radius: var(--radius-s);
}

.chat-context-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-bottom: none;
  flex: 1; /* Take up available space */
}

.note-badge {
  font-size: 10px;
  padding: 0 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.remove-note {
  padding: 0 4px;
  cursor: pointer;
  opacity: 0.5;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.remove-note:hover {
  opacity: 1;
}

.context-note .note-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.context-note.url .note-badge {
  background-color: var(--interactive-accent);
}

.context-note.url .note-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-note .note-badge.pdf {
  background-color: var(--background-modifier-error);
}

.chat-icons-right {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  margin-left: auto; /* Push to the right */
}

.icon-scaler {
  transform: scale(0.7);
}

.tooltip-text {
  max-width: 400px;
  background-color: var(--background-secondary);
  color: var(--text-normal);
  text-align: center;
  border-radius: 5px;
  padding: 5px;
  font-size: var(--font-ui-smaller);
  white-space: nowrap;
}

.select-wrapper {
  position: relative;
  display: inline-block;
}

.chat-icon-button.clickable-icon,
.chat-icon-selection,
.model-select-button,
.submit-button,
.chain-select-button {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.chat-icon-button.clickable-icon:hover,
.chat-icon-selection:hover,
.model-select-button:hover,
.submit-button:hover,
.chain-select-button:hover {
  background: none !important;
  color: var(--text-normal);
  opacity: 1;
}

@keyframes flash {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.submit-button.cancel {
  opacity: 0.5;
  padding: 4px;
  border-radius: 4px;
  animation: flash 2s infinite;
}

.submit-button.cancel:hover {
  opacity: 1;
}

.selected-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background: var(--background-secondary);
  border-radius: 4px;
  margin-bottom: 8px;
}

.image-preview-container {
  position: relative;
  width: 80px;
  height: 80px;
}

.selected-image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--background-modifier-border);
}

.remove-image-button {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--background-modifier-error);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}

.remove-image-button:hover {
  background: var(--background-modifier-error-hover);
}

.button-content {
  display: flex;
  align-items: center;
}

.button-content span {
  font-size: 10px;
}

/* Make sure the icon scales consistently */
.button-content .icon-scaler {
  width: 18px;
  height: 18px;
}

.model-select-content {
  min-width: 120px;
  background: var(--background-secondary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 4px;
  padding: 4px;
  font-size: 10px;
  z-index: 1000;
}

.model-select-content [role="menuitem"] {
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 2px;
  font-size: 10px;
  color: var(--text-normal);
  margin: 2px 0;
}

.model-select-content [role="menuitem"]:hover {
  background: var(--background-modifier-hover);
}

.submit-button svg,
.model-select-button svg,
.chain-select-button svg {
  width: 10px;
  height: 10px;
}

.chain-select-button:hover {
  opacity: 1;
  background: var(--background-modifier-hover);
}

.chain-select-content {
  min-width: 120px;
  background: var(--background-secondary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 4px;
  padding: 4px;
  font-size: 10px;
  z-index: 1000;
}

.chain-select-content [role="menuitem"] {
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 2px;
  font-size: 10px;
  color: var(--text-normal);
  margin: 2px 0;
}

.chain-select-content [role="menuitem"]:hover {
  background: var(--background-modifier-hover);
}

/* Make the chevron icon smaller */
.chain-select-button svg {
  width: 12px;
  height: 12px;
}

.chain-select-button span {
  opacity: 1;
}

/* Button and Tooltip Container */
.chat-icon-button {
  position: relative;
}

.submit-button svg,
.model-select-button svg,
.chain-select-button svg {
  width: 12px;
  height: 12px;
}

.message {
  display: flex;
  padding: 0;
  border-radius: 4px;
  position: relative;
  margin-bottom: 0;
}

.message-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.6 !important;
}

.message-content p {
  margin-top: 0;
  margin-bottom: 0;
}

.message-content table {
  border-collapse: collapse;
  margin-top: 15px;
  margin-bottom: 15px;
}

.message-content th,
.message-content td {
  padding: var(--size-2-2) var(--size-4-2);
  border: var(--table-border-width) solid var(--table-border-color);
}

.message-content th {
  font-weight: var(--table-header-weight);
  background-color: var(--table-header-background);
}

/* Style for inline code */
.message-content code {
  background-color: var(--code-background);
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--code-normal);
}

/* Style for code blocks */
.message-content pre {
  background-color: var(--background-primary-alt);
  border-radius: 4px;
  padding: 10px;
  border: 1px solid var(--background-modifier-border);
}

.message-content pre code {
  background-color: transparent;
  padding: 0;
  color: var(--code-normal);
  line-height: 1.5 !important;
  display: block;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Style for the copy button in code blocks */
.message-content pre {
  position: relative;
}

.message-content pre .copy-code-button {
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 8px;
  color: var(--text-muted);
  background-color: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 0 4px 0 4px;
  font-size: 0.8em;
  transition: all 0.1s ease;
  opacity: 0;
}

.message-content pre:hover .copy-code-button {
  opacity: 1;
}

.message-content pre .copy-code-button:hover {
  background-color: var(--background-modifier-hover);
  color: var(--text-normal);
}

.message-content ul,
.message-content ol {
  padding-left: 20px;
  margin: 10px;
}

.tool-call-container {
  margin: 0.75rem 0;
}

.message-image-content {
  width: 100%;
  max-width: 400px;
  padding: 8px 0;
}

.chat-message-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--background-modifier-border);
}

.copilot-command-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Custom animations */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.copilot-command-input-container {
  width: 90%;
  margin: auto;
}

.copilot-command-input-container input,
.copilot-command-input-container textarea {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.copilot-command-input-container textarea {
  height: 150px;
  resize: vertical;
}

.copilot-command-save-btn-container {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.copilot-command-save-btn {
  margin-top: 15px;
}

.model-settings-table {
  border-collapse: collapse;
  width: 100%;
}

.model-settings-table th,
.model-settings-table td {
  text-align: center;
  vertical-align: middle;
  padding: 0.5em;
  border: none !important;
  height: 2.5em;
}

.model-settings-table th {
  font-weight: bold;
}

.model-settings-table th:nth-child(1) {
  width: 10%;
}

.model-settings-table th:nth-child(2) {
  width: 50%;
}

.model-settings-table th:nth-child(3) {
  width: 16%;
}

.model-settings-table th:nth-child(4),
.model-settings-table th:nth-child(5),
.model-settings-table th:nth-child(6) {
  width: 8%;
}

/* Add specific styles for toggle cells */
.model-settings-table td .copilot-setting-item {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  margin: 0;
}

.model-settings-table .switch {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  margin: 0;
}

.add-custom-model {
  margin-top: 20px;
}

.switch.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch.disabled input:checked + .slider {
  background-color: #ccc;
}

.switch.disabled input:focus + .slider {
  box-shadow: 0 0 1px #ccc;
}

.switch.disabled input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

.model-select {
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-wrapper::after {
  content: "\25BC";
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  pointer-events: none;
}

.add-model-button {
  margin-top: 15px;
}

.edit-textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  overflow-y: hidden;
}

.edit-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.copilot-notice-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.copilot-notice-message {
  margin-bottom: 16px;
}

.copilot-notice-container button {
  align-self: flex-end;
  margin-top: 16px;
  margin-left: auto;
}

.similar-notes-modal-container {
  width: 80vw;
  height: 80vh;
}

.similar-notes-modal {
  max-width: 100%;
  max-height: 100%;
}

.similar-notes-container {
  max-height: calc(80vh - 100px);
  overflow-y: auto;
  padding: 10px;
}

.similar-note-item {
  margin-bottom: 10px;
}

.similar-note-title {
  cursor: pointer;
  color: var(--text-accent);
}

.similar-note-item details > summary {
  list-style: none;
}

.similar-note-item details > summary::before {
  content: "▶";
  display: inline-block;
  width: 20px;
  transition: transform 0.3s;
}

.similar-note-item details[open] > summary::before {
  transform: rotate(90deg);
}

.similar-note-item details > p {
  margin-left: 20px;
  margin-top: 5px;
}

/* control pc and mobile view */
.desktop-only {
  display: table;
}

.mobile-only {
  display: none;
}

@media screen and (max-width: 768px) {
  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }

  .model-cards-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px;
  }

  .model-card {
    background: var(--background-primary-alt);
    border-radius: 8px;
    padding: 0 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .model-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--background-modifier-border);
  }

  .model-card-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-normal);
  }

  .model-provider {
    font-size: 0.9em;
    color: var(--text-muted);
    padding: 2px 0px;
    background: var(--background-secondary);
    border-radius: 4px;
    width: fit-content;
    align-self: flex-start;
  }

  .model-card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .model-card-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
  }

  .model-card-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .model-card-item span {
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: nowrap;
  }

  .model-card-item .switch {
    margin: 0;
  }

  .model-select-content,
  .chain-select-content {
    background: var(--background-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .model-select-content [role="menuitem"],
  .chain-select-content [role="menuitem"] {
    background: var(--background-primary);
    color: var(--text-normal);
    padding: 8px 12px;
    font-size: 14px;
  }

  .model-select-content [role="menuitem"]:hover,
  .chain-select-content [role="menuitem"]:hover {
    background: var(--background-modifier-hover);
  }

  /* Tool call banner responsive styles */
  .tool-call-container {
    margin: 0.5rem 0;
  }

  /* Agent Reasoning Block responsive styles */
  .agent-reasoning-block {
    margin: 2px 0 6px;
  }

  .agent-reasoning-steps {
    margin: 6px 0 0 16px;
    gap: 4px;
  }
}

.model-card {
  background: var(--background-primary-alt);
  border-radius: 8px;
  padding: 0 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  border-left: 4px solid transparent;
  /*transition: border-color 0.2s ease;*/
}

.model-card.selected {
  border-left-color: var(--interactive-accent);
}

.model-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 8px;
  cursor: pointer;
}

.model-card-header-content {
  display: flex;
  align-items: baseline;
  flex: 1;
  margin-right: 12px;
}

.model-provider-wrapper {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 10px;
  width: 100%;
}

.model-provider {
  font-size: 0.85em;
  color: var(--text-muted);
  padding: 2px 0px;
  background: var(--background-secondary);
  border-radius: 4px;
  width: fit-content;
  align-self: flex-start;
}

/* delete icon*/
.model-delete-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.6;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  padding: 0;
}

.model-delete-icon:hover {
  color: var(--text-error);
  opacity: 1;
}

/* Maybe ob's error removed the hierarchy, so add hierarchy to the modal box on mobile for now */
.is-phone .modal .modal-close-button {
  z-index: var(--layer-modal);
}

/* use 'important' to prevent ob default css style from being third-party theme overridden */
/* --copilot-status-bar-clearance is set dynamically by ChatViewLayout */

.workspace-leaf-content[data-type="copilot-chat-view"] .view-content {
  padding-bottom: calc(
    var(--safe-area-inset-bottom, 0px) + var(--copilot-status-bar-clearance, 0px) + var(--size-4-1)
  ) !important;
}

/* Editor mode for mobile - legacy (no bottom navbar): minimal padding */
body.is-mobile
  .workspace-tab-container
  .workspace-leaf-content[data-type="copilot-chat-view"]
  .view-content {
  padding-bottom: var(--size-4-1) !important;
}

/* Editor mode for mobile - new version (with bottom navbar visible): reserve navbar space */
@supports selector(body:has(*)) {
  body.is-mobile:has(.mobile-navbar):not(.is-hidden-nav)
    .workspace-tab-container
    .workspace-leaf-content[data-type="copilot-chat-view"]
    .view-content {
    padding-bottom: calc(
      var(--navbar-height, 50px) + max(var(--safe-area-inset-bottom, 0px), var(--size-4-3)) +
        var(--size-4-1)
    ) !important;
  }
}

/* ApplyView for mobile - new version (with bottom navbar visible): reserve navbar space */
@supports selector(body:has(*)) {
  body.is-mobile:has(.mobile-navbar):not(.is-hidden-nav)
    .workspace-tab-container
    .workspace-leaf-content[data-type="obsidian-copilot-apply-view"]
    .view-content {
    padding-bottom: calc(
      var(--navbar-height, 50px) + max(var(--safe-area-inset-bottom, 0px), var(--size-4-3)) +
        var(--size-4-1) + var(--size-4-4)
    ) !important;
  }

  /* Lift the fixed Accept/Reject button bar above the navbar */
  body.is-mobile:has(.mobile-navbar):not(.is-hidden-nav)
    .workspace-tab-container
    .workspace-leaf-content[data-type="obsidian-copilot-apply-view"]
    .tw-fixed.tw-bottom-4 {
    bottom: calc(
      var(--navbar-height, 50px) + max(var(--safe-area-inset-bottom, 0px), var(--size-4-3)) +
        var(--size-4-1)
    ) !important;
  }
}

/* Hide drawer header and tab-options when keyboard is open in Copilot's drawer */
body.is-mobile .workspace-drawer.copilot-keyboard-open .workspace-drawer-header,
body.is-mobile .workspace-drawer.copilot-keyboard-open .workspace-drawer-tab-options {
  display: none !important;
}

/* Collapsible sources styling */
.copilot-sources {
  margin-top: var(--size-4-1);
  padding: calc(var(--size-4-2) / 2) var(--size-4-2);
  border-radius: var(--radius-s);
  border: 1px solid color-mix(in srgb, var(--background-modifier-border) 70%, transparent);
  background-color: color-mix(
    in srgb,
    var(--background-primary) 94%,
    var(--background-modifier-border) 6%
  );
  width: min(100%, 32rem);
}

.copilot-sources__summary {
  font-size: var(--font-ui-smaller);
  color: color-mix(in srgb, var(--text-muted) 90%, transparent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--size-4-2);
  padding: calc(var(--size-4-2) / 4) 0;
  padding-left: var(--size-4-2);
  padding-right: var(--size-4-2);
  margin: 0;
}

.copilot-sources__summary::-webkit-details-marker {
  color: color-mix(in srgb, var(--text-muted) 80%, transparent);
}

.copilot-sources__summary::after {
  content: ">";
  font-size: var(--font-ui-smaller);
  color: color-mix(in srgb, var(--text-muted) 70%, transparent);
  transition: transform 0.15s ease;
}

.copilot-sources[open] .copilot-sources__summary {
  margin-bottom: calc(var(--size-4-2) / 2);
}

.copilot-sources[open] .copilot-sources__summary::after {
  transform: rotate(90deg);
}

.copilot-sources__list {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-left: var(--size-4-2);
  padding-right: var(--size-4-2);
  display: flex;
  flex-direction: column;
  gap: calc(var(--size-4-2) / 2);
  font-size: var(--font-ui-smaller);
  color: color-mix(in srgb, var(--text-muted) 85%, transparent);
}

.copilot-sources__item {
  display: flex;
  gap: var(--size-4-2);
  align-items: baseline;
}

.copilot-sources__index {
  color: color-mix(in srgb, var(--text-muted) 65%, transparent);
  font-weight: var(--font-medium);
  min-width: var(--size-4-3);
  text-align: right;
  white-space: nowrap;
}

.copilot-sources__text {
  color: color-mix(in srgb, var(--text-muted) 90%, transparent);
  line-height: 1.4;
}

.copilot-sources__text a {
  color: var(--text-accent);
}

/* Inline citation links */
.copilot-citation-ref {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.7em;
  vertical-align: super;
  background: var(--background-modifier-hover);
  border-radius: var(--radius-s);
  padding: 0 4px;
  line-height: 1.4;
  cursor: default;
}
.copilot-citation-group {
  display: inline-block;
  font-size: 0.7em;
  vertical-align: super;
  background: var(--background-modifier-hover);
  border-radius: var(--radius-s);
  padding: 0 4px;
  line-height: 1.4;
}
.copilot-citation-link {
  color: var(--text-accent);
  cursor: pointer;
  text-decoration: none;
}
.copilot-citation-link:hover {
  text-decoration: underline;
}

/* fix the width of the popover on mobile */
body.is-mobile div[data-radix-popper-content-wrapper] {
  min-width: fit-content !important;
}

/* Agent Reasoning Block */
.agent-reasoning-block {
  margin: 4px 0 8px;
  padding: 0;
  font-size: var(--font-ui-small);
  width: 100%;
}

.agent-reasoning-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font-size: var(--font-ui-smaller);
}

.agent-reasoning-header:hover:not(:disabled) {
  color: var(--text-muted);
}

.agent-reasoning-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.agent-reasoning-title {
  font-weight: var(--font-medium);
}

.agent-reasoning-timer {
  color: var(--text-faint);
}

.agent-reasoning-steps {
  margin: 8px 0 0 20px;
  padding: 0;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-reasoning-step {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.4;
  font-size: var(--font-ui-smaller);
}

/* Copilot Cross Spinner Animation
 * 5 dots in cross pattern with 2 dim intervals
 * Sequence: center(4) → right(5) → top(1) → left(3) → bottom(7) → dim → dim → repeat
 * 7 total phases (5 dots + 2 dim intervals), 1s cycle
 */
.copilot-spinner {
  display: block;
}

.copilot-spinner-dot {
  fill: var(--text-faint);
}

/* Animation for each dot (7 dots, 1.4s cycle for smooth motion)
 * Staggered delays create the snake trail effect
 */
.copilot-spinner-dot-0 {
  animation: copilot-dot-chase 1.4s ease-in-out infinite;
  animation-delay: 0ms;
}
.copilot-spinner-dot-1 {
  animation: copilot-dot-chase 1.4s ease-in-out infinite;
  animation-delay: 155ms;
}
.copilot-spinner-dot-2 {
  animation: copilot-dot-chase 1.4s ease-in-out infinite;
  animation-delay: 310ms;
}
.copilot-spinner-dot-3 {
  animation: copilot-dot-chase 1.4s ease-in-out infinite;
  animation-delay: 465ms;
}
.copilot-spinner-dot-4 {
  animation: copilot-dot-chase 1.4s ease-in-out infinite;
  animation-delay: 620ms;
}
.copilot-spinner-dot-5 {
  animation: copilot-dot-chase 1.4s ease-in-out infinite;
  animation-delay: 775ms;
}
.copilot-spinner-dot-6 {
  animation: copilot-dot-chase 1.4s ease-in-out infinite;
  animation-delay: 930ms;
}

/* Smooth chase animation - gradual fade through brightness levels
 * Uses smooth transitions between states instead of abrupt steps
 */
@keyframes copilot-dot-chase {
  0% {
    fill: var(--text-normal);
    opacity: 1;
  }
  11% {
    fill: var(--text-normal);
    opacity: 1;
  }
  22% {
    fill: var(--text-normal);
    opacity: 0.85;
  }
  33% {
    fill: var(--text-muted);
    opacity: 0.6;
  }
  44% {
    fill: var(--text-faint);
    opacity: 0.35;
  }
  55%,
  100% {
    fill: var(--text-faint);
    opacity: 0.2;
  }
}

/* Legacy spinner animation (deprecated) */
.agent-reasoning-spinner .spinner-dots {
  display: inline-block;
  animation: reasoning-pulse 1s ease-in-out infinite;
}

@keyframes reasoning-pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* Quick Ask Overlay Styles */
.copilot-quick-ask-overlay-host {
  position: relative;
}

/* Override Obsidian's default contenteditable border */
.copilot-quick-ask-overlay [contenteditable] {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Reason: The overlay is mounted inside CM6 editor DOM, which has its own
   selection handling that prevents normal text selection in child elements.
   Only target message text containers (marked with data-quick-ask-selectable)
   to avoid overriding user-select on buttons and other interactive controls. */
.copilot-quick-ask-overlay [data-quick-ask-selectable],
.copilot-quick-ask-overlay [data-quick-ask-selectable] * {
  user-select: text !important;
  -webkit-user-select: text !important;
}

.copilot-quick-ask-overlay-root {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--layer-popover);
}

.copilot-quick-ask-overlay {
  position: absolute;
  pointer-events: auto;
  z-index: var(--layer-popover);
  animation: copilot-quick-ask-fade-in 0.2s ease-out;
}

.copilot-quick-ask-overlay.closing {
  animation: copilot-quick-ask-fade-out 0.2s ease-in forwards;
}

@keyframes copilot-quick-ask-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes copilot-quick-ask-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* Quick Ask Resize Indicators */
.quick-ask-resize-indicator-right::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-right: 2px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.quick-ask-resize-indicator-left::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: -1px;
  width: 8px;
  height: 8px;
  border-left: 2px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.tw-group:hover .quick-ask-resize-indicator-right::after,
.tw-group:hover .quick-ask-resize-indicator-left::after {
  opacity: 1;
}

/* Touch devices: always show badge close button (no hover available) */
@media (hover: none) {
  .tw-group\/badge .context-badge-close {
    visibility: visible;
  }
  .tw-group\/badge .context-badge-icon-removable {
    visibility: hidden;
  }
}

/* Gradient fade mask for truncated content */
.copilot-fade-mask-bottom {
  background: linear-gradient(to top, var(--background-primary), transparent);
}
