/* Recherche globale instantanée — palette ASVE (crème / prune / sarcelle).
   Composant partagé : overlay « command palette » (navbar, ⌘K) + rendu live de la
   page /search. Préfixe .cs- pour isoler de Bootstrap. */
.cs-scope {
  --cs-ink: #312F36;
  --cs-ink2: #44404D;
  --cs-mut: #7c7689;
  --cs-cream: #FFF6EF;
  --cs-surface: #fff;
  --cs-line: #efe4da;
  --cs-teal: #0396A6;
  --cs-tealk: #03707d;
  --cs-teal-soft: #e6f4f5;
}

/* ---------- Overlay ---------- */
.cs-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8vh 16px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease-out;
}
.cs-overlay.is-open { opacity: 1; pointer-events: auto; }
.cs-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(40, 36, 50, .42);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.cs-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--cs-surface);
  border: 1px solid var(--cs-line);
  border-radius: 16px;
  box-shadow: 0 24px 60px -12px rgba(40, 36, 50, .35), 0 4px 12px rgba(40, 36, 50, .12);
  display: flex;
  flex-direction: column;
  max-height: 78vh;
  overflow: hidden;
  transform: translateY(-8px) scale(.985);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1);
}
.cs-overlay.is-open .cs-panel { transform: none; }

.cs-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cs-line);
}
.cs-head-ic { color: var(--cs-tealk); font-size: 1.05rem; flex: 0 0 auto; }
.cs-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 1.1rem;
  color: var(--cs-ink);
  font-family: inherit;
  min-width: 0;
}
.cs-input::placeholder { color: var(--cs-mut); }
.cs-kbd {
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 600;
  color: var(--cs-mut);
  background: var(--cs-cream);
  border: 1px solid var(--cs-line);
  border-radius: 6px;
  padding: 2px 7px;
  cursor: pointer;
}
.cs-kbd:hover { color: var(--cs-ink2); }

.cs-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px; }

.cs-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--cs-line);
  background: var(--cs-cream);
  font-size: .8rem;
  color: var(--cs-mut);
}
.cs-foot kbd {
  font-family: inherit;
  background: var(--cs-surface);
  border: 1px solid var(--cs-line);
  border-radius: 5px;
  padding: 0 5px;
  font-size: .74rem;
  color: var(--cs-ink2);
}
.cs-all {
  color: var(--cs-tealk);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.cs-all:hover { color: var(--cs-teal); text-decoration: underline; }

/* ---------- Results (partagé overlay + page) ---------- */
.cs-results { color: var(--cs-ink); }
.cs-sec { padding: 6px 0; }
.cs-sec + .cs-sec { border-top: 1px solid var(--cs-line); }
.cs-sec-h {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--cs-mut);
  margin: 8px 10px 4px;
}
.cs-count {
  font-weight: 700;
  color: var(--cs-tealk);
  background: var(--cs-teal-soft);
  border-radius: 999px;
  padding: 0 7px;
  font-size: .72rem;
}
.cs-list { display: flex; flex-direction: column; }

.cs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--cs-ink);
  scroll-margin: 8px;
}
.cs-item:hover { background: #f7f0ea; text-decoration: none; color: var(--cs-ink); }
.cs-item.is-active { background: var(--cs-teal-soft); box-shadow: inset 0 0 0 1.5px rgba(3, 150, 166, .35); }
.cs-item--static { cursor: default; }
.cs-item--static:hover { background: transparent; }

.cs-ic {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--cs-teal-soft);
  color: var(--cs-tealk);
  font-size: .95rem;
}
.cs-ic--documents { background: #f1ecfb; color: #6b4fb0; }
.cs-ic--assignments { background: #fdeede; color: #b07a2f; }

.cs-txt { min-width: 0; display: flex; flex-direction: column; }
.cs-nm {
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-sub {
  color: var(--cs-mut);
  font-size: .82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-go { margin-left: auto; color: var(--cs-mut); font-size: 1.1rem; flex: 0 0 auto; }

/* States */
.cs-state {
  text-align: center;
  color: var(--cs-mut);
  padding: 34px 20px;
  line-height: 1.5;
}
.cs-state .fas { font-size: 1.6rem; color: var(--cs-teal-soft); display: block; margin-bottom: 10px; }
.cs-state .fas.cs-state-ink { color: #d8c9ba; }

/* Skeleton */
.cs-skel-row { display: flex; align-items: center; gap: 12px; padding: 10px; }
.cs-skel-ic, .cs-skel-line { background: linear-gradient(90deg, #f0e8df 25%, #f7f1ea 37%, #f0e8df 63%); background-size: 400% 100%; animation: cs-shimmer 1.2s ease-in-out infinite; border-radius: 8px; }
.cs-skel-ic { width: 36px; height: 36px; flex: 0 0 auto; }
.cs-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.cs-skel-line { height: 10px; }
.cs-skel-line.s { width: 45%; height: 8px; }
@keyframes cs-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- Page /search (rendu live in-place) ---------- */
.cs-page-results { max-width: 760px; margin: 0 auto; }
.cs-page-results .cs-item { padding: 12px 14px; }

@media (max-width: 575.98px) {
  .cs-overlay { padding: 0; }
  .cs-panel { max-width: none; height: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .cs-foot { padding-bottom: calc(9px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .cs-overlay, .cs-panel { transition: none; }
  .cs-skel-ic, .cs-skel-line { animation: none; }
}
