/* ============================================================
   THALGO SEARCH WIDGET v2 — thalgo-search.css
   Typo : Optima (titres) + Montserrat (corps)
   Couleurs : Navy #1a2e3a + Or #a38c64
   Tous les sélecteurs préfixés .tsg- ou #tsg-
   ============================================================ */

/* ── Barre de recherche inline ── */
.tsg-bar {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #ddd8d0;
  border-radius: 2px;
  overflow: hidden;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 1px 6px rgba(26,46,58,0.07);
  font-family: 'Montserrat', system-ui, sans-serif;
}
.tsg-bar-icon {
  margin-left: 14px;
  flex-shrink: 0;
  color: #a38c64;
  pointer-events: none;
  width: 15px;
  height: 15px;
}
.tsg-bar-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 11px 10px;
  font-size: 13px;
  font-weight: 400;
  font-family: 'Montserrat', system-ui, sans-serif;
  color: #1a2e3a;
  letter-spacing: 0.01em;
  background: transparent;
}
.tsg-bar-input::placeholder { color: #b0bec5; }
.tsg-bar-clear {
  background: none;
  border: none;
  color: #b0bec5;
  cursor: pointer;
  font-size: 18px;
  padding: 0 10px;
  line-height: 1;
  display: none;
}
.tsg-bar-clear.vis { display: block; }
.tsg-bar-btn {
  background: #1a2e3a;
  border: none;
  color: #ffffff;
  padding: 11px 18px;
  cursor: pointer;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.tsg-bar-btn:hover { background: #2a4a5e; }

/* ── Backdrop ── */
#tsg-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,20,30,0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 999991;
  opacity: 0;
  transition: opacity 0.25s;
}
#tsg-backdrop.tsg-open  { display: block; }
#tsg-backdrop.tsg-vis   { opacity: 1; }

/* ── Panel ── */
#tsg-panel {
  position: fixed;
  top: 0; right: 0;
  width: min(520px, 100vw);
  height: 100vh;
  background: #ffffff;
  z-index: 999992;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -6px 0 40px rgba(10,20,30,0.14);
  overflow: hidden;
}
#tsg-panel.tsg-open { transform: translateX(0); }

/* ── Header ── */
.tsg-header {
  background: #1a2e3a;
  padding: 20px 20px 16px;
  flex-shrink: 0;
}
.tsg-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.tsg-logo {
  font-family: 'Optima', 'Trebuchet MS', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.tsg-logo span {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: #a38c64;
  margin-left: 6px;
}
.tsg-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  line-height: 1;
}
.tsg-close-btn:hover { color: #ffffff; }

/* ── Search input in panel ── */
.tsg-panel-input-wrap { position: relative; }
.tsg-panel-input-wrap .tsg-ico {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.35);
  pointer-events: none;
  width: 14px; height: 14px;
}
#tsg-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 2px;
  color: #ffffff;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 300;
  padding: 10px 36px 10px 36px;
  outline: none;
  letter-spacing: 0.02em;
  transition: border-color 0.15s;
}
#tsg-input::placeholder { color: rgba(255,255,255,0.28); }
#tsg-input:focus { border-color: rgba(163,140,100,0.6); }
.tsg-input-clear {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  display: none;
}
.tsg-input-clear.vis { display: block; }

/* ── Mode pills ── */
.tsg-modes {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.tsg-mode {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.42);
  cursor: pointer;
  background: none;
  transition: all 0.15s;
}
.tsg-mode.active {
  background: #a38c64;
  border-color: #a38c64;
  color: #ffffff;
  font-weight: 600;
}
.tsg-mode:hover:not(.active) {
  border-color: rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.7);
}

/* ── Status bar ── */
.tsg-status {
  padding: 8px 16px;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 11px;
  color: #a0b0bc;
  background: #f8f6f3;
  border-bottom: 1px solid #ede9e3;
  min-height: 34px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.tsg-status.ai { color: #a38c64; font-style: italic; }

/* ── Results scroll area ── */
#tsg-results {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd8d0 transparent;
}
#tsg-results::-webkit-scrollbar { width: 3px; }
#tsg-results::-webkit-scrollbar-thumb { background: #ddd8d0; border-radius: 2px; }

/* ── Empty state ── */
.tsg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 56px 40px;
  opacity: 0.42;
}
.tsg-empty-icon { font-size: 38px; margin-bottom: 14px; opacity: 0.5; }
.tsg-empty-title {
  font-family: 'Optima', 'Trebuchet MS', sans-serif;
  font-size: 19px;
  font-weight: 600;
  color: #1a2e3a;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.tsg-empty-hint {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 12px;
  color: #8a9aa8;
  line-height: 1.8;
}

/* ── Section labels ── */
.tsg-section {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #a38c64;
  padding: 12px 16px 6px;
  border-bottom: 1px solid #f0ede8;
  background: #f8f6f3;
}

/* ── Product card ── */
.tsg-card {
  display: flex;
  gap: 0;
  border: none;
  border-bottom: 1px solid #f0ede8;
  text-decoration: none !important;
  color: inherit !important;
  background: #ffffff;
  transition: background 0.12s;
  cursor: pointer;
}
.tsg-card:hover { background: #faf8f5; }

/* ── Product image ── */
.tsg-card-img-wrap {
  width: 82px;
  height: 82px;
  flex-shrink: 0;
  background: #f5f2ed;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tsg-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}
.tsg-card-img-ph {
  font-size: 26px;
  opacity: 0.28;
  font-family: serif;
}

/* ── Card body ── */
.tsg-card-body {
  flex: 1;
  min-width: 0;
  padding: 10px 14px 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tsg-card-cat {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a38c64;
  margin-bottom: 2px;
}
.tsg-card-name {
  font-family: 'Optima', 'Trebuchet MS', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #1a2e3a;
  line-height: 1.25;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tsg-card-accroche {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 11px;
  color: #8a9aa8;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}
.tsg-card-desc {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 11px;
  color: #5a6a74;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tsg-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.tsg-card-ref {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 9px;
  color: #b8c4cc;
  letter-spacing: 0.1em;
}
.tsg-card-price {
  font-family: 'Optima', 'Trebuchet MS', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #1a2e3a;
}

/* ── Highlight ── */
.tsg-hl {
  background: rgba(163,140,100,0.18);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── AI block ── */
.tsg-ai-block {
  margin: 12px 12px 0;
  padding: 14px 16px;
  background: #f8f6f3;
  border-left: 3px solid #a38c64;
  border-radius: 0 2px 2px 0;
}
.tsg-ai-label {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #a38c64;
  margin-bottom: 8px;
}
.tsg-ai-text {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 13px;
  color: #1a2e3a;
  line-height: 1.7;
}

/* ── Loading dots ── */
.tsg-dots {
  display: flex;
  gap: 5px;
  padding: 20px 16px;
  align-items: center;
}
.tsg-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #a38c64;
  animation: tsgBounce 1.2s infinite ease-in-out;
}
.tsg-dot:nth-child(2) { animation-delay: 0.2s; }
.tsg-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes tsgBounce {
  0%, 80%, 100% { transform: scale(0.65); opacity: 0.35; }
  40%           { transform: scale(1);    opacity: 1; }
}

/* ── No results ── */
.tsg-noresult {
  text-align: center;
  padding: 56px 32px;
}
.tsg-noresult-title {
  font-family: 'Optima', 'Trebuchet MS', sans-serif;
  font-size: 18px;
  color: #1a2e3a;
  margin-bottom: 8px;
}
.tsg-noresult-text {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 12px;
  color: #8a9aa8;
  line-height: 1.8;
}

/* ── Animations ── */
@keyframes tsgFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes tsgSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
