/**
 * @file
 * Styling for AI Context module.
 */

/* Add custom icon to toolbar menu item using mask-image */
.toolbar-button--icon--ai-context-overview::before {
  background-color: currentColor;
  mask-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpath fill="currentColor" fill-opacity=".15" d="M12.928 1.4861C12.3468 1.18165 11.6532 1.18165 11.072 1.4861L1.5 6.5L11.072 11.5139C11.6532 11.8183 12.3468 11.8183 12.928 11.5139L22.5 6.5L12.928 1.4861Z"/%3E%3Cpath d="M1.5 12L11.072 17.0139C11.6532 17.3183 12.3468 17.3183 12.928 17.0139L22.5 12"/%3E%3Cpath d="M1.5 17.5L11.072 22.5139C11.6532 22.8183 12.3468 22.8183 12.928 22.5139L22.5 17.5"/%3E%3C/g%3E%3C/svg%3E');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.action-link.action-link--icon-trash {
  padding-block: calc(var(--gin-spacing-xs) - var(--gin-spacing-xxxs)) !important;
}

/* Status markers - uses Gin's variables with fallbacks for non-Gin themes */
.view-ai-context-items .views-field .marker {
  display: inline-block;
  padding: 0.125em 0.75em;
  color: var(--gin-status-text, #626262);
  border-radius: var(--gin-border-l, 4px);
  background: var(--gin-status-bg, #eee);
  font-size: var(--gin-font-size-xxs, 0.75rem);
  font-weight: var(--gin-font-weight-semibold, 600);
}

.view-ai-context-items .views-field .marker--published {
  color: var(--gin-status-success-text, #1d6844);
  background-color: var(--gin-status-success-bg, rgb(38, 167, 105, 0.19));
}

.view-ai-context-items .views-field .marker--scheduled {
  color: var(--gin-status-warning-text, #826b1f) !important;
  background: var(--gin-status-warning-bg, rgb(226, 151, 0, 0.15)) !important;
}

/* Center the Global column */
.view-ai-context-items th.views-field-is-global,
.view-ai-context-items td.views-field-is-global {
  text-align: center;
}

/* Truncated description - indicate that hovering reveals full text */
.description-truncate {
  display: inline;
  cursor: help;
  border-bottom: 1px dotted var(--gin-color-text-light, #6c7985);
}

.description-truncate:hover {
  color: var(--gin-color-primary, #003ecc);
  border-bottom-style: solid;
}

.view-ai-context-items td.views-field-description__value .description-truncate {
  display: block;
  overflow: hidden;
  width: 100%;
  max-width: 300px;
  white-space: wrap;
  text-overflow: ellipsis;
}

/* Ensure any nested elements don't break truncation */
.view-ai-context-items td.views-field-description__value .description-truncate * {
  display: inline;
}

/* AI Context Usage view - compact exposed filters */
.view-ai-context-usage .views-exposed-form .form--inline {
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}

.view-ai-context-usage .views-exposed-form .form-item {
  margin-block: 0;
}

.view-ai-context-usage .views-exposed-form .form-item input[type="text"],
.view-ai-context-usage .views-exposed-form .form-item input[type="number"] {
  width: 20ch;
  min-width: 10ch;
}

.view-ai-context-usage .views-exposed-form .form-item-target-entity-id input {
  width: 6ch;
}

/* Preserve whitespace in target entity lists */
.ai-context-target {
  white-space: normal;
}

/* Tags display - each tag on its own line */
.ai-context-tag,
.ai-context-tags {
  display: block;
}

/* Scope display in agent form table - each scope type on its own line */
.ai-context-scope-cell {
  display: block;
}

.ai-context-scope-line {
  display: block;
}

/* Scope subscriptions summary */
.ai-context-scope-summary {
  margin-block-end: var(--gin-spacing-m, 1rem);
  padding: var(--gin-spacing-s, 0.75rem);
  border-radius: var(--gin-border-m, 4px);
  background-color: var(--gin-bg-layer2, #f7f9fa);
  font-size: var(--gin-font-size-s, 0.875rem);
  line-height: 1.5;
}

/**
 * Diff visual inline layout accessibility improvements.
 *
 * Scoped to diff comparison pages (which have .diff-header).
 * Darkens the background colors for better contrast with white text.
 */

/* Deleted content - dark red background */
.diff-header ~ del,
.diff-header ~ * del {
  color: #fff;
  background-color: #c43c3c;
}

/* Inserted content - dark green background */
.diff-header ~ ins,
.diff-header ~ * ins {
  color: #fff;
  background-color: #2e7d32;
}
