/**
 * Plugin Name: ServeLink Dynamic Search Block
 * Version: 1.4.0
 * Last updated: March 1, 2026
 * @copyright  (c) 2025 ServeLink
 *
 * @package    servelink_dynamic_search_block
 * @license    Proprietary
 */

/*  ── Container ──────────────────────────────────────  */

.servelink-search-form {
  position: relative;
}
.servelink-search-container {
  display: flex;
  position: relative;
  width: 100%;
  align-items: stretch;
}

.servelink-search-form .screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/*  ── Input Wrapper ──────────────────────────────────  */

.servelink-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: stretch;
}

/*  Gray magnifying glass inside the field  */
.servelink-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #7c8494;
  pointer-events: none;
  display: flex;
  align-items: center;
  line-height: 1;
}

/*  ── Search Field ───────────────────────────────────  */

#ectsearchwidgetform .servelink-search-field {
  width: 240px;
  padding: 8px 10px 8px 32px;
  border: 1.5px solid #7c8494;
  border-right: none;
  border-radius: 4px 0 0 4px;
  background-color: #ffffff;
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  font-size: 15px;
  color: #1e293b;
  transition: width 0.3s ease, border-color 0.2s ease,
              border-width 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

#ectsearchwidgetform .servelink-search-field::placeholder {
  color: #6b7280;
}

#ectsearchwidgetform .servelink-search-field:focus,
#ectsearchwidgetform .servelink-search-field.has-value {
  width: 320px;
  outline: none;
  border: 2px solid #2F3091;
  border-right: none;
  background-color: #ffffff;
}

#ectsearchwidgetform .servelink-search-icon {
  color: #7c8494;
}
/*  ── Submit Button ──────────────────────────────────  */

#ectsearchwidgetform .servelink-search-submit {
  padding: 0 16px;
  background-color: #2F3091;
  color: #e5e7eb;
  border: 1px solid #2F3091;
  border-radius: 0 4px 4px 0;
  font-family: 'Outfit', 'Source Sans 3', -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease;
}
#ectsearchwidgetform .servelink-search-submit:hover {
  color: #0e182a;
  background-color: #b56300;
  border-color: #b56300;
  box-shadow: 0 6px 24px rgba(212, 117, 0, 0.4);
}
#ectsearchwidgetform .servelink-btn-arrow {
  font-size: 15px;
}

/*  ── Results Dropdown ───────────────────────────────  */

#selectectsearchwidget {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  z-index: 100;
  background: #fff;
  border: 1px solid #0f172a;
  border-radius: 8px;
  box-shadow: 12px 12px 24px rgba(15, 23, 42, 0.3);
  max-height: 300px;
  overflow-y: auto;
  padding: 4px 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease,
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
#selectectsearchwidget.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/*  Result Items — consistent size on normal and hover  */
#selectectsearchwidget a,
#selectectsearchwidget div:not(.servelink-no-results) {
  display: block;
  padding: 7px 12px;
  color: #334155;
  text-decoration: none;
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  transition: background-color 0.12s ease;
}
#selectectsearchwidget a:hover,
#selectectsearchwidget a:focus,
#selectectsearchwidget a.active {
  background-color: #f1f5f9;
}

.servelink-no-results {
  padding: 10px 12px;
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
}

#selectectsearchwidget::-webkit-scrollbar {
  width: 5px;
}
#selectectsearchwidget::-webkit-scrollbar-track {
  background: transparent;
}
#selectectsearchwidget::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/*  ── Responsive ─────────────────────────────────────  */

@media (max-width: 767px) {
  .servelink-search-form {
    width: 100%;
  }
  .servelink-search-field,
  .servelink-search-field:focus,
  .servelink-search-field.has-value {
    width: 100%;
  }
}
