/* styles/cmdk.css */

/* Overlay plein écran */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
}

/* Conteneur */
.cmdk-container {
  width: 100%;
  max-width: 680px;
  margin-top: 10vh;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  box-shadow: 0 20px 50px rgba(0,0,0,.2), 0 0 0 1px rgba(0,0,0,.05), 0 0 20px rgba(0,0,0,.06) inset;
  background-image: radial-gradient(ellipse at center, rgba(0,0,0,.04) 0%, transparent 70%);
  background-clip: padding-box;
  border: 1px solid #e7eaf3;
  overflow: hidden;
}

/* Racine */
.cmdk-root {
  width: 100%;
  display: grid;
  /* Auto rows so the list shrinks to content instead of forcing empty space */
  grid-template-rows: auto auto auto;
}

/* Barre de recherche */
.cmdk-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #e7eaf3;
  background: #fff;
  justify-content: space-between;
  position: relative;
}

.cmdk-input-wrapper kbd {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
}

.cmdk-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  padding: 0;
  margin: 0;
  outline: none;
  color: #000;
  font-family: inherit;
}

.cmdk-input::placeholder {
  color: #9ca3af;
}

/* Liste des résultats */
.cmdk-list {
  /* Let the list height fit content up to a maximum */
  height: auto;
  max-height: 60vh;
  overflow: auto;
  overscroll-behavior: contain;
  position: relative;
  background: #fff;
}

.cmdk-list-sizer {
  position: absolute;
  top: 0;
  width: 100%;
  transition: height .12s ease;
  overflow: hidden;
}

/* Groupes */
.cmdk-group {
  overflow: hidden;
}

.cmdk-group-heading {
  padding: 8px 14px;
  font-size: 12px;
  color: #6b7280;
  user-select: none;
  background: #f9fafb;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Items */
.cmdk-item {
  content-visibility: auto;
  cursor: pointer;
  height: 48px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: #374151;
  user-select: none;
  will-change: background, color;
  transition: all 150ms ease;
  transition-property: none;
  position: relative;
}

.cmdk-item[data-selected="true"] {
  background: #f3f4f6;
  color: #111827;
}

.cmdk-item[data-disabled="true"] {
  color: #9ca3af;
  cursor: not-allowed;
}

.cmdk-item[data-disabled="true"][data-selected="true"] {
  background: #f9fafb;
  color: #9ca3af;
}

.cmdk-item + .cmdk-item {
  margin-top: 4px;
}

.cmdk-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Layout helpers for custom item structure */
.cmdk-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.cmdk-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cmdk-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cmdk-item-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.cmdk-item-subtitle,
.cmdk-item-meta {
  font-size: 12px;
  color: #6b7280;
}

/* Message vide */
.cmdk-empty {
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  white-space: pre-wrap;
  color: #6b7280;
}

/* Séparateur */
.cmdk-separator {
  height: 1px;
  width: 100%;
  background: #e5e7eb;
  margin: 4px 0;
}

/* Loading */
.cmdk-loading {
  padding: 8px 14px;
  font-size: 14px;
  color: #6b7280;
}

/* Loading icon */
.cmdk-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: cmdk-spin 1s linear infinite;
}

@keyframes cmdk-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 640px) {
  .cmdk-container {
    max-width: 95vw;
    margin-top: 5vh;
  }
  
  .cmdk-list {
    height: 300px;
    max-height: 300px;
  }
}