/* ==========================================================================
   Command Palette Search — search.css
   A VS Code / Linear-style command palette for APM search.
   Uses Bootstrap 5.3.2 + Material Design 3 design language.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Trigger button (topbar)
   -------------------------------------------------------------------------- */

.search-trigger {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  background: #f1f3f5;
  border: 1px solid #e0e4e8;
  border-radius: 24px;
  padding: 0.4rem 1rem 0.4rem 0.85rem;
  color: #6c757d;
  font-size: 0.875rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  transition: all 150ms ease;
  outline: none;
  white-space: nowrap;
}

.search-trigger:hover {
  background: #fff;
  border-color: #cdd3da;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  color: #495057;
}

.search-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(27, 100, 148, 0.2);
  border-color: #1b6494;
}

.search-trigger i {
  font-size: 0.85rem;
  color: #1b6494;
}

.search-trigger-text {
  color: #868e96;
  font-weight: 400;
}

.search-trigger-kbd {
  display: inline-block;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", monospace;
  font-size: 0.7rem;
  color: #6c757d;
  line-height: 1.4;
  margin-left: 0.25rem;
}

/* --------------------------------------------------------------------------
   Backdrop
   -------------------------------------------------------------------------- */

.search-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1070;
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease, visibility 150ms ease;
}

.search-palette-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Palette container
   -------------------------------------------------------------------------- */

.search-palette {
  position: fixed;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%) scale(0.98);
  z-index: 1080;
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.search-palette.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

.search-palette-container {
  width: 640px;
  max-height: 70vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Input wrapper
   -------------------------------------------------------------------------- */

.search-palette-input-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  gap: 0.5rem;
}

.search-palette-input-icon {
  color: #1b6494;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.search-palette-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.1rem;
  font-family: "Outfit", "Inter", sans-serif;
  color: #212529;
  min-width: 0;
}

.search-palette-input::placeholder {
  color: #adb5bd;
  font-weight: 300;
}

.search-palette-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  outline: none;
  line-height: 1;
}

.search-palette-close kbd {
  display: inline-block;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", monospace;
  font-size: 0.7rem;
  color: #6c757d;
  line-height: 1.4;
  transition: background 150ms ease;
}

.search-palette-close:hover kbd {
  background: #dee2e6;
  color: #495057;
}

/* --------------------------------------------------------------------------
   Filter badge
   -------------------------------------------------------------------------- */

.search-palette-filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #1b6494;
  color: #fff;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: "Inter", sans-serif;
  flex-shrink: 0;
  white-space: nowrap;
}

.search-palette-filter-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 2px;
  transition: color 150ms ease;
}

.search-palette-filter-remove:hover {
  color: #fff;
}

/* --------------------------------------------------------------------------
   Progress bar
   -------------------------------------------------------------------------- */

.search-palette-progress {
  height: 2px;
  width: 100%;
  overflow: hidden;
  position: relative;
  background: #e9ecef;
}

.search-palette-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  background: #1b6494;
  animation: searchProgress 1.2s ease-in-out infinite;
}

@keyframes searchProgress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

/* --------------------------------------------------------------------------
   Body (scrollable results area)
   -------------------------------------------------------------------------- */

.search-palette-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 0;
}

/* Thin scrollbar (MD3 style) */
.search-palette-body::-webkit-scrollbar {
  width: 4px;
}

.search-palette-body::-webkit-scrollbar-track {
  background: transparent;
}

.search-palette-body::-webkit-scrollbar-thumb {
  background: #dee2e6;
  border-radius: 2px;
}

.search-palette-body::-webkit-scrollbar-thumb:hover {
  background: #ced4da;
}

/* Firefox */
.search-palette-body {
  scrollbar-width: thin;
  scrollbar-color: #dee2e6 transparent;
}

/* --------------------------------------------------------------------------
   Section headers
   -------------------------------------------------------------------------- */

.search-palette-section-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6c757d;
  letter-spacing: 0.5px;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  font-family: "Inter", sans-serif;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Section animation
   -------------------------------------------------------------------------- */

.search-palette-section {
  animation: fadeSlideIn 200ms ease both;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Result item container
   -------------------------------------------------------------------------- */

.search-palette-item-container {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid #f8f9fa;
}

.search-palette-item-container:last-child {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Result items
   -------------------------------------------------------------------------- */

.search-palette-item {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: #495057;
  transition: background 150ms ease, border-left 150ms ease;
  flex: 1;
  min-width: 0;
  border-left: 3px solid transparent;
}

.search-palette-item:hover {
  background: #f8f9fa;
  color: #495057;
  text-decoration: none;
}

.search-palette-item.active {
  background: rgba(27, 100, 148, 0.06);
  border-left: 3px solid #1b6494;
  color: #495057;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Item icon
   -------------------------------------------------------------------------- */

.search-palette-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Item content
   -------------------------------------------------------------------------- */

.search-palette-item-content {
  flex: 1;
  min-width: 0;
}

.search-palette-item-title {
  font-weight: 600;
  font-size: 0.875rem;
  font-family: "DM Sans", "Inter", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #212529;
}

.search-palette-item-subtitle {
  font-size: 0.78rem;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* --------------------------------------------------------------------------
   Action button (Klantkaart, etc.)
   -------------------------------------------------------------------------- */

.search-palette-item-action {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  align-self: center;
  margin-right: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e0e4e8;
  border-radius: 8px;
  color: #1b6494;
  font-size: 0.8rem;
  font-family: "Inter", sans-serif;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
  white-space: nowrap;
}

.search-palette-item-action:hover {
  background: rgba(27, 100, 148, 0.06);
  border-color: #1b6494;
  color: #1b6494;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Highlight (mark)
   -------------------------------------------------------------------------- */

.search-palette-item mark {
  background: rgba(255, 193, 7, 0.25);
  padding: 0 2px;
  border-radius: 2px;
  color: inherit;
}

/* --------------------------------------------------------------------------
   Recent searches
   -------------------------------------------------------------------------- */

.search-palette-recent {
  padding: 1rem;
}

.search-palette-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #6c757d;
  font-weight: 600;
  letter-spacing: 0.3px;
  font-family: "Inter", sans-serif;
}

.search-palette-recent-clear {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  transition: color 150ms ease;
}

.search-palette-recent-clear:hover {
  color: #495057;
}

.search-palette-recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.search-palette-recent-pill {
  background: #f1f3f5;
  border: 1px solid #e0e4e8;
  border-radius: 16px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-family: "Inter", sans-serif;
  color: #495057;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.search-palette-recent-pill:hover {
  background: #e9ecef;
  border-color: #cdd3da;
}

/* --------------------------------------------------------------------------
   Hint (min chars)
   -------------------------------------------------------------------------- */

.search-palette-hint {
  padding: 2rem;
  text-align: center;
  color: #6c757d;
  font-size: 0.875rem;
  font-family: "Inter", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.search-palette-hint i {
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */

.search-palette-empty {
  padding: 3rem;
  text-align: center;
}

.search-palette-empty > i {
  font-size: 2rem;
  color: #dee2e6;
  display: block;
  margin-bottom: 0.75rem;
}

.search-palette-empty-title {
  font-weight: 600;
  color: #495057;
  font-size: 1rem;
  font-family: "DM Sans", "Inter", sans-serif;
}

.search-palette-empty-subtitle {
  color: #6c757d;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  font-family: "Inter", sans-serif;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.search-palette-footer {
  padding: 0.6rem 1rem;
  border-top: 1px solid #e9ecef;
  background: #fafbfc;
  border-radius: 0 0 16px 16px;
}

.search-palette-footer-hints {
  display: flex;
  gap: 1rem;
  justify-content: center;
  font-size: 0.75rem;
  color: #6c757d;
  font-family: "Inter", sans-serif;
}

.search-palette-footer-hints kbd {
  display: inline-block;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", monospace;
  font-size: 0.7rem;
  color: #6c757d;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Responsive — Tablet
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
  .search-palette-container {
    width: 90vw;
  }
}

/* --------------------------------------------------------------------------
   Responsive — Mobile (fullscreen takeover)
   -------------------------------------------------------------------------- */

@media (max-width: 767.98px) {
  .search-palette {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    display: flex;
    align-items: stretch;
  }

  .search-palette.show {
    transform: none;
  }

  .search-palette-container {
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .search-palette-body {
    flex: 1;
  }

  .search-palette-footer {
    border-radius: 0;
  }

  .search-palette-footer-hints {
    font-size: 0.65rem;
  }
}
