/* FILE: css/components/cmd.css */

.cmd-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 10000;
  /* FIX: Usar flex para centralizar melhor e dar margem segura */
  display: flex;
  align-items: flex-start; /* Start from top */
  justify-content: center;
  padding: 60px 20px; /* Safe margin from edges */
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.cmd-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.cmd-modal {
  width: 100%;
  max-width: 600px;
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  /* FIX: Force vertical flex layout with height limit */
  display: flex;
  flex-direction: column;
  max-height: 70vh; /* Never taller than 70% viewport height */
  overflow: hidden; /* Prevents overflow past rounded borders */
  transform: translateY(-20px);
  transition: 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cmd-overlay.open .cmd-modal {
  transform: translateY(0);
}

.cmd-input-wrapper {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0; /* Ensures input never shrinks */
}

.cmd-input-wrapper i {
  color: var(--text-muted);
  margin-right: 15px;
  font-size: 1.2rem;
}

.cmd-input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-tech);
  font-size: 1.1rem;
  width: 100%;
  outline: none;
}

.cmd-list {
  list-style: none;
  /* FIX: Uses flex to fill remaining space instead of fixed max-height */
  flex: 1;
  overflow-y: auto; /* Scroll apenas aqui dentro se necessário */
  padding: 10px;
  /* Extra padding at bottom so last item is not flush with edge */
  padding-bottom: 15px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  margin-bottom: 5px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: 0.1s;
  font-family: var(--font-tech);
  font-size: 0.9rem;
  border-left: 3px solid transparent; /* Prepares border for hover */
}

.cmd-item:hover,
.cmd-item.selected {
  background: rgba(157, 78, 221, 0.1);
  color: var(--text-main);
  border-left: 3px solid var(--accent-primary);
}

.cmd-item .shortcut {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Custom scrollbar for menu */
.cmd-list::-webkit-scrollbar {
  width: 4px;
}
.cmd-list::-webkit-scrollbar-track {
  background: transparent;
}
.cmd-list::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
}
