/* TiTi Search Pro modal — scoped under #titiSearchProWrap. Uses the
   --titi-* semantic tokens introduced in R111 (workspace-shell-gateway.css),
   already theme-aware for light/dark via [data-theme]. */

#titiSearchProWrap {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(10vh, 90px);
}
#titiSearchProWrap.hidden { display: none; }
body.titi-sp-scroll-lock { overflow: hidden; }

.titi-sp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.6);
  backdrop-filter: blur(2px);
}

.titi-sp-modal {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  max-height: min(76vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--titi-surface, var(--bg-surface, #161f2b));
  border: 1px solid var(--titi-border, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  box-shadow: 0 24px 60px var(--titi-shadow, rgba(0, 0, 0, 0.45));
  overflow: hidden;
  animation: titiSpModalIn 0.16s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .titi-sp-modal { animation: none; }
}
@keyframes titiSpModalIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.titi-sp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--titi-border, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
}
.titi-sp-icon {
  display: inline-flex;
  color: var(--titi-text-secondary, rgba(255, 255, 255, 0.55));
  flex-shrink: 0;
}
.titi-sp-icon .titi-icon, .titi-sp-icon svg { width: 18px; height: 18px; }
.titi-sp-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 15px;
  padding: 4px 0;
}
.titi-sp-input:focus { outline: none; }
.titi-sp-clear {
  background: transparent;
  border: 0;
  color: var(--titi-text-secondary, rgba(255, 255, 255, 0.55));
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.titi-sp-clear.hidden { display: none; }
.titi-sp-clear:hover { background: var(--titi-surface-hover); color: var(--titi-text); }
.titi-sp-shortcut-hint {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--titi-text-secondary, rgba(255, 255, 255, 0.55));
  border: 1px solid var(--titi-border-strong, rgba(255, 255, 255, 0.18));
  border-radius: 6px;
  padding: 2px 6px;
}

.titi-sp-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--titi-border, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
  overflow-x: auto;
}
.titi-sp-tab {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--titi-text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.titi-sp-tab:hover { background: var(--titi-surface-hover); }
.titi-sp-tab.is-active {
  background: var(--titi-primary-soft);
  color: var(--titi-primary);
}
.titi-sp-tab:focus-visible,
.titi-sp-result:focus-visible,
.titi-sp-clear:focus-visible,
.titi-sp-recent-search-btn:focus-visible,
.titi-sp-recent-search-remove:focus-visible,
.titi-sp-clear-recent:focus-visible,
#titiSpInput:focus-visible {
  outline: 2px solid var(--titi-focus);
  outline-offset: 2px;
}

.titi-sp-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

.titi-sp-section { margin-bottom: 6px; }
.titi-sp-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--titi-text-secondary);
  padding: 8px 10px 4px;
}

.titi-sp-results-list, .titi-sp-recent-searches {
  list-style: none;
  margin: 0;
  padding: 0;
}

.titi-sp-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: inherit;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
}
.titi-sp-result:hover, .titi-sp-result.is-active { background: var(--titi-surface-hover); }
.titi-sp-result-icon-wrap {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--titi-surface-subtle);
  color: var(--titi-primary);
  margin-top: 1px;
}
.titi-sp-result-icon-wrap .titi-icon, .titi-sp-result-icon-wrap svg { width: 16px; height: 16px; }
.titi-sp-result-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.titi-sp-result-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--titi-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.titi-sp-result-title mark, .titi-sp-result-sub mark {
  background: var(--titi-primary-soft);
  color: var(--titi-primary);
  border-radius: 3px;
  padding: 0 1px;
}
.titi-sp-result-sub {
  font-size: 12px;
  color: var(--titi-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.titi-sp-result-meta {
  font-size: 11px;
  color: var(--titi-text-secondary);
}
.titi-sp-pin-badge {
  flex-shrink: 0;
  color: var(--titi-primary);
  margin-top: 3px;
}
.titi-sp-pin-badge .titi-icon, .titi-sp-pin-badge svg { width: 13px; height: 13px; }

.titi-sp-recent-search-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.titi-sp-recent-search-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--titi-text);
  font-size: 13px;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}
.titi-sp-recent-search-btn:hover { background: var(--titi-surface-hover); }
.titi-sp-recent-search-icon { flex-shrink: 0; color: var(--titi-text-secondary); }
.titi-sp-recent-search-icon .titi-icon, .titi-sp-recent-search-icon svg { width: 15px; height: 15px; }
.titi-sp-recent-search-remove {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  color: var(--titi-text-secondary);
  font-size: 15px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.titi-sp-recent-search-remove:hover { background: var(--titi-surface-hover); color: var(--titi-text); }
.titi-sp-clear-recent {
  background: transparent;
  border: 0;
  color: var(--titi-text-secondary);
  font-size: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.titi-sp-clear-recent:hover { color: var(--titi-text); text-decoration: underline; }

.titi-sp-empty-shell {
  padding: 28px 16px;
  text-align: center;
}
.titi-sp-empty-hint, .titi-sp-no-results-title {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--titi-text-secondary);
}
.titi-sp-no-results-title { color: var(--titi-text); font-weight: 600; }
.titi-sp-suggestions {
  margin: 0 auto;
  padding: 0;
  list-style: none;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font-size: 12.5px;
  color: var(--titi-text-secondary);
}
.titi-sp-suggestions li::before { content: "•  "; }

.titi-sp-skel-list { display: flex; flex-direction: column; gap: 2px; padding: 4px; }
.titi-sp-skel-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; }
.titi-sp-skel {
  display: inline-block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--titi-surface-subtle) 25%, var(--titi-surface-hover) 37%, var(--titi-surface-subtle) 63%);
  background-size: 400% 100%;
  animation: titiSpShimmer 1.4s ease infinite;
}
.titi-sp-skel-icon { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.titi-sp-skel-line { flex: 1; height: 14px; }
@keyframes titiSpShimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .titi-sp-skel { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 767px) {
  #titiSearchProWrap { padding-top: 0; }
  .titi-sp-modal {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .titi-sp-head { padding: 12px; }
  .titi-sp-shortcut-hint { display: none; }
}
