/* Basic reset for modal */
body.cls-no-scroll { overflow: hidden; }

.cls-wrap { display: inline-block; }

.cls-open {
  display: block;
  margin-top:10px;
  text-decoration: none;
}
.cls-open:hover { text-decoration: underline;}


/* Modal shell */
.cls-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  grid-template-rows: 1fr;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.cls-modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}
.cls-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,15,20,.55);
  backdrop-filter: blur(2px);
}
.cls-modal__dialog {
  position: relative;
  margin: auto;
  width: min(720px, 92vw);
  max-height: 86vh;
  overflow: hidden;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 1rem 1rem 0 1rem;
  display: flex;
  flex-direction: column;
}

/* Close button */
.cls-modal__close {
  position: absolute;
  top: .4rem;
  right: .6rem;
  border: 0;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: #444;
}
.cls-modal__close:hover { color: #111; }

/* Title */
.cls-modal__title {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  margin: .25rem 0 1rem;
  padding: 0 .4rem;
}

/* Search area */
.cls-search {
  display: grid;
  gap: .8rem;
  padding: 0 .4rem 1rem .4rem;
}
.cls-search__input {
  width: 100%;
  font-size: 1rem;
  padding: .85rem 1rem;
  border: 1px solid #dcdcdc;
  border-radius: .6rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cls-search__input:focus {
  border-color: #9ec5ff;
  box-shadow: 0 0 0 4px rgba(100, 150, 255, .15);
}

/* Results */
.cls-results {
  display: grid;
  gap: .5rem;
  max-height: 58vh;
  overflow: auto;
  padding-bottom: 1rem;
}
.cls-results__item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: .75rem;
  align-items: center;
  text-decoration: none;
  padding: .6rem .7rem;
  border: 1px solid #ececec;
  border-radius: .6rem;
  background: #fff;
  transition: box-shadow .15s ease, transform .05s ease, border-color .15s ease;
}
.cls-results__item:hover {
  border-color: #d7e3ff;
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
.cls-results__thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: .4rem;
  background: #f2f2f2;
}
.cls-results__title {
  color: #111;
  font-weight: 600;
  font-size: .98rem;
  line-height: 1.25;
}
.cls-results__empty {
  padding: .6rem .2rem;
  color: #666;
}

/* Spinner */
.cls-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #e7e7e7;
  border-top-color: #999;
  animation: cls-spin 0.7s linear infinite;
  margin: .5rem auto;
}
@keyframes cls-spin { to { transform: rotate(360deg); } }

/* Hint */
.cls-hint {
  font-size: .85rem;
  color: #777;
  padding: 0 1.1rem 1.1rem;
}

/* Accessibility utility */
.screen-reader-text {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Mobile tweaks */
@media (max-width: 480px) {
  .cls-results__item {
    grid-template-columns: 40px 1fr;
  }
  .cls-results__thumb { width: 40px; height: 40px; }
}
