.oxc-isearch-root {
  /* FAB label accent (explorer hover text); header uses host --primary/--card */
  --oxc-isearch-primary: #6863ff;
  /* Fallbacks align with @0xchain/theme when host tokens are absent */
  --oxc-isearch-card: #ffffff;
  --oxc-isearch-fg: #111827;
  --oxc-isearch-muted: #6b7280;
  --oxc-isearch-border: #e5e7eb;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.oxc-isearch-root[data-theme='dark'] {
  /* Match @0xchain/theme dark --card (#292c33), not generic gray-900 */
  --oxc-isearch-card: #292c33;
  --oxc-isearch-fg: #f9fafb;
  --oxc-isearch-muted: #9ca3af;
  --oxc-isearch-border: #374151;
}

/* Align with explorer AiChat FAB: gradient ring + card fill + hover gradient */
.oxc-isearch-fab {
  position: fixed;
  right: 24px;
  bottom: 44px;
  z-index: inherit;
  margin: 0;
  padding: 1px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background:
    linear-gradient(90deg, #88408a 0%, #2a6af6 50%, #5ae19c 100%),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.95) 50%,
      rgba(255, 255, 255, 0) 100%
    );
  background-size: 100% 100%, 250% 100%;
  background-position: 0 0, -250% 0;
  background-repeat: no-repeat;
  box-shadow: 0 0 4px rgba(52, 85, 203, 0.53);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.oxc-isearch-fab-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 11px;
  color: var(--oxc-isearch-primary);
  background: var(--oxc-isearch-card);
}

.oxc-isearch-fab-icon {
  position: relative;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.oxc-isearch-fab-icon img {
  position: absolute;
  inset: 0;
  width: 24px;
  height: 24px;
}

.oxc-isearch-fab-icon img.oxc-isearch-fab-icon-default {
  display: block;
}

.oxc-isearch-fab-icon img.oxc-isearch-fab-icon-hover {
  display: none;
}

.oxc-isearch-fab:hover .oxc-isearch-fab-inner {
  color: #fff;
  background: linear-gradient(90deg, #5ea2fe 0%, #b09af6 100%);
}

.oxc-isearch-fab:hover .oxc-isearch-fab-icon img.oxc-isearch-fab-icon-default {
  display: none;
}

.oxc-isearch-fab:hover .oxc-isearch-fab-icon img.oxc-isearch-fab-icon-hover {
  display: block;
}

.oxc-isearch-fab-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.oxc-isearch-panel {
  position: fixed;
  z-index: inherit;
  display: none;
  flex-direction: column;
  overflow: hidden;
  /* Prefer host design tokens (explorer Drawer used --card / --primary) */
  background: var(--card, var(--oxc-isearch-card));
  border: 1px solid var(--oxc-isearch-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.oxc-isearch-panel.oxc-isearch-open {
  display: flex;
}

.oxc-isearch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 48px;
  padding: 0 12px;
  /* Same as explorer AiChat Drawer header */
  border-bottom: none;
  background: color-mix(
    in srgb,
    var(--primary, #2a6af6) 5%,
    var(--card, var(--oxc-isearch-card))
  );
  color: var(--foreground, var(--oxc-isearch-fg));
  font-size: 16px;
  font-weight: 600;
}

.oxc-isearch-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Align with explorer Drawer header: maximize (md+) + close */
.oxc-isearch-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.oxc-isearch-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--oxc-isearch-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.oxc-isearch-icon-btn:hover {
  background: color-mix(in srgb, var(--oxc-isearch-fg) 8%, transparent);
  color: var(--oxc-isearch-fg);
}

.oxc-isearch-icon-btn:disabled {
  cursor: default;
  opacity: 1;
}

.oxc-isearch-icon-btn:disabled:hover {
  background: transparent;
  color: var(--oxc-isearch-muted);
}

.oxc-isearch-maximize {
  display: none;
}

.oxc-isearch-icon-btn svg {
  display: block;
  width: 14px;
  height: 14px;
}

.oxc-isearch-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: transparent;
}

@media (min-width: 768px) {
  .oxc-isearch-panel {
    top: 64px;
    right: 12px;
    bottom: 12px;
    width: 375px;
    border-radius: 12px;
  }

  .oxc-isearch-maximize {
    display: inline-flex;
  }
}

@media (max-width: 767px) {
  .oxc-isearch-fab {
    right: 12px;
    bottom: 12px;
  }

  .oxc-isearch-panel {
    left: 0;
    right: 0;
    bottom: 0;
    height: min(75vh, 640px);
    border-radius: 12px 12px 0 0;
  }
}
