.koco-cat-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-bottom: 0.4rem;
}
.koco-cat-search__toggle {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}
.koco-cat-search__icon {
  display: block;
  width: 22px;
  height: 22px;
}
.koco-cat-search__toggle {
  color: #000;
}
.koco-cat-search__toggle .koco-cat-search__icon circle,
.koco-cat-search__toggle .koco-cat-search__icon path {
  stroke: #000;
}
.koco-cat-search__toggle:hover .koco-cat-search__icon {
  opacity: 0.85;
}

/* Make the clickable area square and centered on mobile */
@media (max-width: 782px) {
  .koco-cat-search__toggle {
    width: 40px;
    height: 40px;
  }
  .koco-cat-search__icon {
    width: 20px;
    height: 20px;
  }

  .koco-cat-search {
    padding-bottom: 0rem;
    padding-top: 1.2rem;
  }

  .reverse-mobile {
    flex-direction: row-reverse;
  }
}

.koco-cat-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
}
.koco-cat-modal[hidden] {
  display: none !important;
}
.koco-cat-modal__dialog {
  width: min(900px, 92vw);
  max-height: 84vh;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
}
.koco-cat-modal__header {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.koco-cat-modal__header--with-input {
  gap: 10px;
}
.koco-cat-modal__close {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  margin-right: 1rem;
}
.koco-cat-modal__body {
  padding: 8px 12px 12px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
}

.koco-cat-modal .koco-cat-search__input {
  width: 100%;
  padding: 10px 6px;
  font-size: 20px;
  border: none !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-appearance: none;
  appearance: none;
}
.koco-cat-modal .koco-cat-search__input:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}
.koco-cat-search__input::placeholder {
  color: rgba(0, 0, 0, 0.45);
}
/* Hide built-in clear button on WebKit browsers */
.koco-cat-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 0;
  width: 0;
  margin: 0;
}

.koco-cat-results {
  position: relative;
  overflow: auto;
}
/* loader-line is defined globally in assets; show it inline when loading */
.koco-cat-results[data-state="loading"] .loader-line {
  display: block !important;
}
.koco-cat-results[data-state="loading"] .koco-cat-results__empty {
  display: none;
}
/* Center loader within results and add vertical spacing */
.koco-cat-results .loader-line {
  display: block;
  margin: 2rem auto;
}
@keyframes koco-spin {
  to {
    transform: rotate(360deg);
  }
}

.koco-cat-results__empty,
.koco-cat-results__error {
  color: #666;
  padding: 16px;
}
.koco-cat-results__list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0 4px 8px;
}
.koco-cat-results__item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.koco-cat-results__rowlink,
.koco-cat-results__item {
  display: flex;
  gap: 12px;
  padding: 10px 8px;
  align-items: center;
  transition: background 0.12s ease;
  text-decoration: none;
  color: inherit;
  width: 100%;
}
.koco-cat-results__rowlink:hover {
  background: rgba(255, 255, 255, 0.85);
}
.koco-cat-results__item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 0;
  background: #fafafa;
}
.koco-cat-results__title {
  font-weight: 600;
  font-size: 16px;
}
.koco-cat-results__subtitle {
  color: #666;
  font-size: 13px;
  margin-top: 2px;
  overflow: hidden;
  line-height: 1.4;
  max-height: calc(1.4em * 4);
  position: relative;
}
.koco-cat-results__subtitle ul,
.koco-cat-results__subtitle ol {
  margin: 0;
  padding-left: 1.2em;
}
.koco-cat-results__subtitle li {
  margin: 0;
  padding: 0;
}
.koco-cat-results__meta {
  color: #888;
  font-size: 12px;
  margin-top: 4px;
}
.koco-cat-results__actions {
  display: none;
}
.koco-cat-results__no-link {
  color: #999;
}

body.koco-cat-modal-open {
  overflow: hidden;
}

/* Subtle entry animations */
.koco-cat-modal.koco-open {
  animation: koco-fade-in 0.18s ease-out;
}
.koco-cat-modal.koco-open .koco-cat-modal__dialog {
  animation: koco-pop-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes koco-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes koco-pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Tabs */
.koco-cat-tabs {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 6px;
}
.koco-cat-tab {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}
.koco-cat-tab.is-active {
  color: #000;
  border-bottom: 2px solid #000;
}

/* Badges */
.koco-cat-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1;
  text-transform: none;
  border: 1px solid rgba(0, 0, 0, 0.25);
  color: #222;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 9999px;
}
.koco-cat-badge--family {
}
.koco-cat-badge--article {
}
.block-editor-page .koco-cat-modal {
  display: none !important;
}
.editor-styles-wrapper .koco-cat-modal {
  display: none !important;
}
