/* Overlay Styles (Phase 11.1)
 *
 * Styles for floating UI elements: completion menus, command-line,
 * hover info, signature help.
 */

/* Base overlay styles */
.overlay {
  position: absolute;
  background: var(--theme-popup-bg);
  border: 1px solid var(--theme-border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-family: var(--font-mono, monospace);
  font-size: var(--font-size, 14px);
  max-width: 80%;
  max-height: 60%;
  overflow: hidden;
  z-index: 100;
}

.overlay[aria-hidden="true"] {
  display: none;
}

/* ============ Completion Menu ============ */

.overlay-completion {
  min-width: 200px;
  max-width: 400px;
  max-height: 300px;
}

.completion-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  max-height: 280px;
}

.completion-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.completion-item:hover {
  background: var(--theme-statusline-bg);
}

.completion-item.selected {
  background: var(--theme-menu-selected-bg);
  color: var(--theme-popup-fg);
}

.completion-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.completion-kind {
  font-size: 0.75em;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--theme-border);
  color: var(--theme-fg);
  text-transform: lowercase;
}

/* Kind-specific colors */
.completion-kind-function { background: #89b4fa; color: #1e1e2e; }
.completion-kind-variable { background: #f5c2e7; color: #1e1e2e; }
.completion-kind-class { background: #f9e2af; color: #1e1e2e; }
.completion-kind-keyword { background: #cba6f7; color: #1e1e2e; }
.completion-kind-snippet { background: #94e2d5; color: #1e1e2e; }
.completion-kind-field { background: #fab387; color: #1e1e2e; }
.completion-kind-method { background: #89b4fa; color: #1e1e2e; }

.completion-detail {
  font-size: 0.85em;
  color: var(--theme-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

.completion-source {
  font-size: 0.75em;
  color: var(--theme-text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

.completion-empty {
  padding: 12px;
  text-align: center;
  color: var(--theme-text-muted);
  font-style: italic;
}

/* ============ Command Line ============ */

.overlay-cmdline {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  max-width: 100%;
  padding: 8px 12px;
  z-index: 200;
}

.cmdline-container {
  display: flex;
  align-items: center;
  gap: 0;
}

.cmdline-prefix {
  color: var(--theme-text-accent);
  font-weight: bold;
  user-select: none;
}

.cmdline-content {
  flex: 1;
  white-space: pre;
}

.cmdline-cursor {
  background: var(--theme-cursor-bg);
  color: var(--theme-cursor-fg);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ============ Hover Info ============ */

.overlay-hover {
  max-width: 500px;
  padding: 8px 12px;
}

.hover-content {
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ============ Signature Help ============ */

.overlay-signature {
  max-width: 600px;
  padding: 8px 12px;
}

.signature-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.signature-label {
  font-family: var(--font-mono, monospace);
  white-space: pre-wrap;
}

.signature-documentation {
  font-size: 0.9em;
  color: var(--theme-text-muted);
  border-top: 1px solid var(--theme-border);
  padding-top: 4px;
  margin-top: 4px;
}

/* ============ Which-Key Hints ============ */

.whichkey-popup {
  /* Overridable color properties (default to theme vars) */
  --whichkey-border-color: var(--theme-border);
  --whichkey-title-color: var(--theme-text-accent);
  --whichkey-key-color: var(--theme-accent);
  --whichkey-desc-color: var(--theme-text-muted);
  --whichkey-category-color: var(--theme-text-muted);

  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  min-width: 300px;
  max-width: 60%;
  max-height: 40%;
  overflow-y: auto;
  z-index: 150;
  border-color: var(--whichkey-border-color);
}

.whichkey-header {
  padding: 6px 12px;
  font-weight: bold;
  color: var(--whichkey-title-color);
  border-bottom: 1px solid var(--whichkey-border-color);
}

.whichkey-hints {
  padding: 4px 0;
}

.whichkey-hint {
  display: flex;
  padding: 3px 12px;
  gap: 12px;
}

.whichkey-key {
  min-width: 5em;
  font-weight: bold;
  color: var(--whichkey-key-color);
}

.whichkey-command {
  color: var(--whichkey-desc-color);
  font-size: 0.9em;
}

.whichkey-group-header {
  padding: 4px 12px 2px;
  font-size: 0.85em;
  color: var(--whichkey-category-color);
  text-transform: capitalize;
}

/* ============ Cmdline Completions ============ */

.cmdline-completions {
  padding: 4px 0;
  border-top: 1px solid var(--theme-border);
}

.cmdline-completion {
  padding: 2px 12px;
  cursor: default;
}

.cmdline-completion.selected {
  background: var(--theme-menu-selected-bg);
  color: var(--theme-popup-fg);
}

/* ============ Microscope Fuzzy Finder ============ */

.microscope-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 100%;
  max-height: 50%;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.microscope-query-row {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid var(--theme-border);
  gap: 4px;
}

.microscope-prompt {
  color: var(--theme-text-accent);
  font-weight: bold;
  user-select: none;
}

.microscope-query {
  flex: 1;
  white-space: pre;
}

.microscope-counter {
  color: var(--theme-text-muted);
  font-size: 0.85em;
  white-space: nowrap;
}

.microscope-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.microscope-results {
  flex: 0 0 40%;
  overflow-y: auto;
  border-right: 1px solid var(--theme-border);
}

.microscope-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.microscope-item:hover {
  background: var(--theme-statusline-bg);
}

.microscope-item.selected {
  background: var(--theme-menu-selected-bg);
  color: var(--theme-popup-fg);
}

.microscope-item-icon {
  width: 1.5em;
  text-align: center;
  flex-shrink: 0;
}

.microscope-item-display {
  overflow: hidden;
  text-overflow: ellipsis;
}

.microscope-item-detail {
  color: var(--theme-text-muted);
  font-size: 0.85em;
  margin-left: auto;
  flex-shrink: 0;
}

.microscope-preview {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.microscope-preview-path {
  padding: 4px 12px;
  font-size: 0.85em;
  color: var(--theme-text-muted);
  border-bottom: 1px solid var(--theme-border);
}

.microscope-preview-lines {
  padding: 4px 0;
}

.microscope-preview-line {
  display: flex;
  padding: 0 12px;
  line-height: 1.4;
}

.microscope-preview-line.highlighted {
  background: var(--theme-menu-selected-bg);
}

.microscope-line-number {
  min-width: 3em;
  text-align: right;
  padding-right: 12px;
  color: var(--theme-text-muted);
  user-select: none;
  flex-shrink: 0;
}

.microscope-line-text {
  white-space: pre;
}

/* ============ Explorer Sidebar ============ */

.explorer-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--theme-popup-bg);
  border-right: 1px solid var(--theme-border);
  font-family: var(--font-mono, monospace);
  font-size: var(--font-size, 14px);
  display: flex;
  flex-direction: column;
  z-index: 150;
  overflow: hidden;
}

.explorer-header {
  padding: 6px 12px;
  font-weight: bold;
  color: var(--theme-fg);
  border-bottom: 1px solid var(--theme-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.explorer-tree {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}

.explorer-node {
  display: flex;
  align-items: center;
  padding: 1px 8px;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.4;
}

.explorer-node:hover {
  background: var(--theme-statusline-bg);
}

.explorer-node.cursor {
  background: var(--theme-menu-selected-bg);
  color: var(--theme-popup-fg);
}

.explorer-node.dir .explorer-name {
  color: #89b4fa;
  font-weight: bold;
}

.explorer-node.symlink .explorer-name {
  color: #94e2d5;
}

.explorer-node.hidden-file {
  opacity: 0.5;
}

.explorer-prefix {
  color: var(--theme-text-muted);
  white-space: pre;
}

.explorer-icon {
  white-space: pre;
  flex-shrink: 0;
}

.explorer-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.explorer-input {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-top: 1px solid var(--theme-border);
  flex-shrink: 0;
}

.explorer-input-label {
  color: var(--theme-text-accent);
  font-weight: bold;
  white-space: nowrap;
}

.explorer-input-buffer {
  white-space: pre;
}

.explorer-input-cursor {
  color: var(--theme-cursor-bg);
  animation: blink 1s step-end infinite;
}

.explorer-message {
  padding: 4px 8px;
  color: var(--theme-text-muted);
  font-size: 0.85em;
  border-top: 1px solid var(--theme-border);
  flex-shrink: 0;
}

/* ============ Fallback ============ */

.overlay-fallback {
  padding: 8px;
  margin: 0;
  font-size: 0.85em;
  overflow: auto;
  max-height: 200px;
}

/* Theme variables are now managed by ThemeManager.
 * The 'light' theme can be activated via:
 *   themeManager.setTheme('light');
 * See main.css for fallback variable definitions.
 */
