/* Prospely — app/search-history-sidebar.css
   Sidebar historique de recherches (inspirée de Claude.ai). */

#search-history-sidebar {
  position: fixed;
  top: 60px;                          /* below app-nav (height: 60px) */
  left: 0;
  width: 280px;
  height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  background: #f9fafb;              /* gray-50 */
  border-right: 1px solid #e5e7eb;  /* gray-200 */
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  z-index: 40;
}

/* Header sticky */
.shs-header {
  position: sticky;
  top: 0;
  background: #ffffff;
  padding: 16px 12px;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  z-index: 2;
}
.shs-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;                    /* gray-900 */
  margin-bottom: 10px;
}
.shs-new-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #2563eb;               /* blue-600 */
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}
.shs-new-btn:hover { background: #1d4ed8; }

/* Scroll area */
.shs-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.shs-scroll::-webkit-scrollbar { width: 6px; }
.shs-scroll::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* Groups */
.shs-group { margin-bottom: 6px; }
.shs-group-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;                    /* gray-400 */
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 12px 4px;
}
.shs-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Item */
.shs-item {
  position: relative;
  display: flex;
  align-items: stretch;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.shs-item:hover { background: #f3f4f6; }         /* gray-100 */
.shs-item:hover .shs-item-menu-btn { opacity: 1; }

.shs-item-active {
  background: #eff6ff;                            /* blue-50 */
  border-left-color: #2563eb;                     /* blue-600 */
}
.shs-item-active:hover { background: #dbeafe; }

.shs-item-main {
  flex: 1;
  min-width: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shs-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.shs-item-icon {
  flex-shrink: 0;
  color: #6b7280;                    /* gray-500 */
}
.shs-item-prompt {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shs-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #6b7280;
  padding-left: 22px;                /* align under prompt text */
}
.shs-item-badge {
  background: #e5e7eb;
  color: #374151;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
}

/* Menu button */
.shs-item-menu-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: #6b7280;
  padding: 4px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: opacity 0.12s ease, background 0.12s ease;
}
.shs-item-menu-btn:hover { background: #e5e7eb; color: #111827; }
.shs-item-active .shs-item-menu-btn { opacity: 1; }

/* Dropdown menu */
.shs-item-menu {
  position: absolute;
  right: 8px;
  top: 38px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 10;
  min-width: 120px;
  padding: 4px;
}
.shs-item-menu button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 6px 10px;
  font-size: 12px;
  color: #dc2626;
  cursor: pointer;
  border-radius: 4px;
}
.shs-item-menu button:hover { background: #fef2f2; }

/* States */
.shs-state {
  padding: 16px 12px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}
.shs-state-error { color: #dc2626; }

/* Force navbar to stay fixed at top (above sidebar + content) */
#app .app-nav {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
}

/* ─────────────────────────────────────────────────────────────
   Coloration par mode de recherche
   ───────────────────────────────────────────────────────────── */

/* Sans site web → bleu clair */
.shs-item.shs-mode-no-website {
  background: #eff6ff;           /* blue-50 */
  border-left-color: #60a5fa;    /* blue-400 */
}
.shs-item.shs-mode-no-website:hover { background: #dbeafe; } /* blue-100 */
.shs-item.shs-mode-no-website.shs-item-active {
  background: #dbeafe;
  border-left-color: #2563eb;    /* blue-600 */
}

/* Recrutement / growth → marron clair */
.shs-item.shs-mode-growth {
  background: #faf0e0;           /* linen / tan */
  border-left-color: #b45309;    /* amber-700 */
}
.shs-item.shs-mode-growth:hover { background: #f3e4ca; }
.shs-item.shs-mode-growth.shs-item-active {
  background: #f3e4ca;
  border-left-color: #92400e;    /* amber-800 */
}

/* Service client défaillant / slow_response → rouge très clair */
.shs-item.shs-mode-slow-response {
  background: #fef2f2;           /* red-50 */
  border-left-color: #f87171;    /* red-400 */
}
.shs-item.shs-mode-slow-response:hover { background: #fee2e2; } /* red-100 */
.shs-item.shs-mode-slow-response.shs-item-active {
  background: #fee2e2;
  border-left-color: #dc2626;    /* red-600 */
}

#app { padding-top: 60px; }  /* reserve space for fixed navbar */

/* Push #app content to the right when sidebar is active (desktop only).
   The top navbar stays full-width — only content below is pushed. */
@media (min-width: 1024px) {
  body.has-history-sidebar #app .app-main,
  body.has-history-sidebar #app .welcome-banner {
    margin-left: 280px;
  }
}
@media (max-width: 1023px) {
  #search-history-sidebar { display: none !important; }
}
