.prompt-selection-dialog {
  min-width: min(500px, 90vw);
  max-width: 800px;
  overflow: hidden;
}

/* Header */
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.dialog-header h2 {
  margin: 0;
  flex: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.close-button {
  margin-left: 16px;
  flex-shrink: 0;
}

/* Content */
.dialog-content {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  margin-right: -8px;
  padding-right: 8px;
}

/* Search */
.search-container {
  margin-bottom: 16px;
}

.search-field {
  width: 100%;
}

.results-summary {
  margin-bottom: 16px;
  padding: 8px 12px;
  background-color: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}

.result-count {
  font-size: var(--md-sys-typescale-body-medium-font-size);
  color: rgba(0, 0, 0, 0.7);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: rgba(0, 0, 0, 0.6);
}

.empty-icon {
  font-size: var(--md-sys-typescale-display-large-font-size);
  height: 64px;
  width: 64px;
  margin-bottom: 16px;
  color: rgba(0, 0, 0, 0.4);
}

.empty-state p {
  margin: 8px 0;
  font-size: var(--md-sys-typescale-title-medium-font-size);
}

.empty-state small {
  display: block;
  margin-top: 8px;
  font-size: var(--md-sys-typescale-body-small-font-size);
  color: rgba(0, 0, 0, 0.4);
}

/* Prompts List */
.prompts-list {
  margin-bottom: 16px;
}

.server-panel {
  margin-bottom: 8px;
}

.server-panel mat-expansion-panel-header {
  padding: 8px 16px;
}

.server-name {
  margin-left: 8px;
  font-weight: 500;
}

.server-prompts {
  padding: 0;
}

/* ===== PROMPT ITEM STATE LAYERS ===== */
.prompt-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  border-radius: 4px;
  margin: 4px 0;
  min-height: 72px;
}

.prompt-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background-color: var(--md-sys-color-on-surface);
  opacity: 0;
  transition: opacity var(--md-sys-state-transition-duration) var(--md-sys-state-transition-easing);
  pointer-events: none;
  z-index: 1;
}

.prompt-item:hover::before {
  opacity: var(--md-sys-state-hover-opacity);
}

.prompt-item:focus-visible::before {
  opacity: var(--md-sys-state-focus-opacity);
}

.prompt-item:focus-visible {
  outline: var(--md-sys-state-focus-ring-width, 2px) solid var(--md-sys-color-outline);
  outline-offset: var(--md-sys-state-focus-ring-offset, 2px);
}

.prompt-item:active::before {
  opacity: var(--md-sys-state-pressed-opacity);
}

.prompt-title {
  font-weight: 500;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.prompt-description {
  color: rgba(0, 0, 0, 0.7);
  font-size: var(--md-sys-typescale-body-small-font-size);
  line-height: 1.4;
  margin-top: 4px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.argument-info {
  color: rgba(0, 0, 0, 0.5);
  font-size: var(--md-sys-typescale-body-small-font-size);
  font-style: italic;
  margin-left: 4px;
}

/* Argument Form View */
.argument-form-view {
  padding: 8px 0;
}

.selected-prompt-info {
  margin-bottom: 24px;
}

.selected-prompt-info mat-card {
  border-left: 4px solid var(--mat-sys-primary);
}

.arguments-form h3 {
  margin: 0 0 16px 0;
  font-size: var(--md-sys-typescale-title-medium-font-size);
  font-weight: var(--md-sys-typescale-title-medium-font-weight);
  color: var(--mat-sys-primary);
}

.argument-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.argument-field {
  width: 100%;
}

.full-width {
  width: 100%;
}

.required-indicator {
  color: #f44336;
  font-weight: bold;
}

.no-arguments {
  display: flex;
  align-items: center;
  padding: 24px;
  background-color: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  color: rgba(0, 0, 0, 0.6);
}

.no-arguments mat-icon {
  margin-right: 12px;
  color: var(--mat-sys-primary);
}

/* Actions */
.dialog-actions {
  padding: 16px 0 0 0;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  margin-top: 16px;
}

.selection-actions,
.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.form-actions button {
  margin-left: 8px;
}

.form-actions button:first-child {
  margin-left: 0;
}

/* Responsive */
@media (max-width: 600px) {
  .prompt-selection-dialog {
    min-width: 95vw;
  }

  .dialog-content {
    max-height: 60vh;
  }

  .empty-state {
    padding: 32px 16px;
  }

  .empty-icon {
    font-size: var(--md-sys-typescale-display-medium-font-size);
    height: 48px;
    width: 48px;
  }
}

/* Expansion panel customization */
::ng-deep .server-panel .mat-expansion-panel-header-description {
  justify-content: flex-end;
}

::ng-deep .server-panel .mat-expansion-panel-content .mat-expansion-panel-body {
  padding: 0;
}

/* Override dialog container styles to prevent horizontal scrolling */
::ng-deep .prompt-selection-dialog .mat-mdc-dialog-container {
  overflow-x: hidden !important;
}

::ng-deep .prompt-selection-dialog .mat-mdc-dialog-surface {
  overflow-x: hidden !important;
}
