/* ==========================================================================
   Search Block — Koko Mart
   Variation: km-rounded — white field, primary icon left, gray border
   Based on Figma node 18:472 — "SearchControl/Search"

   Target: core/search block with buttonPosition="button-inside"
   Class applied: .wp-block-search.is-style-km-rounded
   ========================================================================== */

/* Allow the search block to shrink in a flex row — real Chrome Android enforces
   each element's intrinsic min-width strictly, unlike DevTools emulation */
.wp-block-search.is-style-km-rounded {
  min-width: 0;
}

/* Hide label (icon-only header search per design) */
.wp-block-search.is-style-km-rounded .wp-block-search__label {
  display: none;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.wp-block-search.is-style-km-rounded .wp-block-search__inside-wrapper {
  background: var(--wp--preset--color--white);
  border: 1px solid var(--wp--preset--color--border);          /* #e2e2e2 */
  border-radius: var(--wp--preset--border-radius--lg);           /* 8px — Figma radius-l */
  padding: var(--wp--preset--spacing--sm);                  /* 8px all sides */
  display: flex;
  align-items: center;
  gap: var(--wp--preset--spacing--xs);                      /* 4px */
  overflow: hidden;
  transition: border-color 0.15s ease, outline 0.15s ease;
}

.wp-block-search.is-style-km-rounded .wp-block-search__inside-wrapper:focus-within {
  border-color: var(--wp--preset--color--primary);
}

/* ── Submit button — moved to the left via order ─────────────────────────── */
.wp-block-search.is-style-km-rounded .wp-block-search__button {
  order: -1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  color: var(--wp--preset--color--primary) !important;
  cursor: pointer;
  border-radius: 0;
  transition: color 0.15s ease;
  margin-left: 0;
}

.wp-block-search.is-style-km-rounded .wp-block-search__button:hover {
  background: transparent !important;
  color: var(--wp--preset--color--primary--600) !important;      /* #a42f26 */
}

.wp-block-search.is-style-km-rounded .wp-block-search__button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;   /* Gutenberg's search icon is fill-based */
}

/* ── Input field ─────────────────────────────────────────────────────────── */
.wp-block-search.is-style-km-rounded .wp-block-search__input {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  padding: 0 var(--wp--preset--spacing--xs) !important;      /* 4px horizontal */
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-family: var(--wp--preset--font--base);              /* Poppins */
  font-size: var(--wp--preset--fontSizes--md);                    /* 12px — Figma: 13px */
  font-weight: var(--wp--preset--font--regular);             /* 400 */
  line-height: 20px;
  color: var(--wp--preset--color--black);
}

/* Suppress browser default focus ring on the input itself */
.wp-block-search.is-style-km-rounded .wp-block-search__input:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* Native search cancel (×) button — recolor to primary */
.wp-block-search.is-style-km-rounded .wp-block-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  cursor: pointer;
  background-color: var(--wp--preset--color--primary);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.wp-block-search.is-style-km-rounded .wp-block-search__input::placeholder {
  color: var(--wp--preset--color--neutral-500);                      /* #737372 — Figma gray-700 #757575 */
}
