/* ============================================================
   TSGroup Header Search - Estilos dropdown
   Cargar en theme.html: <link rel="stylesheet" href="{wcmpath}/css/tsgroup-search.css">
   ============================================================ */

#ks-wrapper {
  position: relative;
  width: 100%;
}

#ks-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  z-index: 9999;
  overflow: hidden;
  animation: ksFadeIn 0.15s ease;
  min-width: 300px;
}

.ks-dropdown-body {
  max-height: 50vh;
  overflow-y: auto;
}

@keyframes ksFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

#ks-dropdown.ks-visible {
  display: block;
}

.ks-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f2f2f2;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
}

.ks-item:last-child {
  border-bottom: none;
}

.ks-item:hover,
.ks-item.ks-focused {
  background: #fff4ec;
}

.ks-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #ff66003d;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff6600;
  font-size: 14px;
  margin-top: 2px;
}

.ks-item-body {
  flex: 1;
  min-width: 0;
}

.ks-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.ks-item-title mark {
  background: transparent;
  color: #ff6600;
  font-weight: 700;
  padding: 0;
}

.ks-item-snippet {
  font-size: 12px;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.ks-item-snippet mark {
  background: transparent;
  color: #ff6600;
  font-weight: 600;
  padding: 0;
}

.ks-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
  font-size: 12.5px;
  font-weight: 600;
  color: #ff6600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
}

.ks-footer:hover {
  background: #ff66003d;
  color: #ff6600;
}

.ks-loading {
  padding: 16px 14px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

.ks-empty {
  padding: 16px 14px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

.ks-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #ffe0cc;
  border-top-color: #ff6600;
  border-radius: 50%;
  animation: ksSpin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes ksSpin {
  to { transform: rotate(360deg); }
}

/* ── Página de resultados ────────────────────────────────── */

#ks-results-wrapper {
  max-width: 80%;
  margin: 0 auto;
  padding: 24px 16px;
  font-family: inherit;
}

#ks-results-header {
  margin-bottom: 20px;
}

#ks-results-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

#ks-results-count {
  font-size: 13px;
  color: #888;
}

.ks-result-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ks-result-card:hover {
  border-color: #ff6600;
  box-shadow: 0 4px 16px rgba(255,102,0,0.1);
  color: inherit;
  text-decoration: none;
}

.ks-result-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #ff66003d;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff6600;
  font-size: 18px;
  margin-top: 2px;
}

.ks-result-body {
  flex: 1;
  min-width: 0;
}

.ks-result-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ks-result-title mark {
  background: transparent;
  color: #ff6600;
  font-weight: 700;
  padding: 0;
}

.ks-result-snippet {
  font-size: 15px;
  color: #555;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ks-result-snippet mark {
  background: #ff66003d;
  color: #ff6600;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 2px;
}

.ks-state-msg--lg {
  text-align: center;
  padding: 48px 0;
  color: #888;
  font-size: 15px;
}

.ks-state-msg--lg i {
  font-size: 40px;
  color: #ddd;
  display: block;
  margin-bottom: 12px;
}

.ks-state-msg--lg p {
  margin: 0;
}

#ks-clear-btn {
  --bs-btn-bg: #fff;
  --bs-btn-border-color: #ff6600;
  --bs-btn-hover-bg: #ff6600;
  --bs-btn-hover-border-color: #cc5200;
  --bs-btn-active-bg: #fff;
  --bs-btn-active-border-color: #cc5200;
  --bs-btn-disabled-bg: #fff;
  --bs-btn-disabled-border-color: #ff6600;
  color: #ff6600;
}

#ks-clear-btn:hover {
  color: #fff !important;
}

#ks-search-bar {
  width: 50%;
}

@media (max-width: 992px) {
  #ks-search-bar {
    width: 100%;
  }

  #ks-results-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 24px 8px;
    font-family: inherit;
  }
}

#ks-clear-btn:focus,
#ks-clear-btn:focus-visible {
  box-shadow: none;
  outline: none;
}

#ks-search-bar .form-control:focus {
  border-color: #ff6600 !important;
  box-shadow: 0 0 5px #ff66003d !important;
  outline: none !important;
}

#ks-search-bar input:-webkit-autofill {
  background-color: white !important;
  box-shadow: 0 0 0px 1000px white inset !important;
}

/********** pagination *****************/

.pagination {
  font-family: inherit;
}

li .page-link {
  color: #373a3c !important;
  text-decoration: none !important;
}

li .page-link:hover {
  color: #373a3c !important;
  background-color: #d4d4d4 !important;
}

li.disabled .page-link {
  color: #373a3c48 !important;
}

li.active .page-link {
  color: #373a3c;
  background-color: #d4d4d4 !important;
  border-color: #8c8c8c !important;
}

.page-link:focus {
  color: #373a3c !important;
  background-color: #d4d4d4 !important;
  outline: none !important;
  box-shadow: inset 0 3px 5px #00000020;
}
