/* ===========================
   search.css
   Styles for the search results page.
   Import alongside style.css.
=========================== */

/* Ensure [hidden] always wins — needed because .result-card { display:flex }
   would otherwise override the browser default [hidden]{display:none} */
[hidden] { display: none !important; }

/* ===========================
   SEARCH HERO / INPUT AREA
=========================== */
.search-hero {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  padding: 4rem 1.5rem 3rem;
  color: white;
}

.search-hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.search-hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  font-weight: 900;
  color: white;
  margin-bottom: 0.5rem;
}

.search-hero-sub {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  margin-bottom: 2rem;
}

/* Main search input on results page */
.search-hero-form {
  display: flex;
  gap: 0;
  max-width: 680px;
  box-shadow: var(--shadow-md);
  border-radius: 999px;
  overflow: hidden;
}

.search-hero-input {
  flex: 1;
  padding: 1rem 1.5rem;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  background: white;
  border: none;
  outline: none;
  min-width: 0;
}

.search-hero-input::placeholder {
  color: #A0AFAE;
}

.search-hero-btn {
  padding: 1rem 1.75rem;
  background: var(--amber);
  color: var(--text);
  border: none;
  font-family: var(--font);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background var(--transition);
  white-space: nowrap;
}

.search-hero-btn:hover { background: var(--amber-dark); }

/* ===========================
   SEARCH META BAR
   (result count, query echo, sort)
=========================== */
.search-meta-bar {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 0.9rem 1.5rem;
  position: sticky;
  top: 72px;
  z-index: 50;
}

.search-meta-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.search-count strong {
  color: var(--text);
  font-weight: 900;
}

.search-query-echo {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.search-query-echo em {
  font-style: normal;
  color: var(--teal);
  font-weight: 900;
}

.search-sort {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
}

.search-sort select {
  padding: 0.4rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--bg);
  cursor: pointer;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.search-sort select:focus { border-color: var(--teal); }

/* ===========================
   SEARCH PAGE LAYOUT
=========================== */
.search-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  align-items: start;
}

/* ===========================
   FILTERS SIDEBAR (left)
=========================== */
.search-filters {
  position: sticky;
  top: 140px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.filter-widget {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.filter-widget-title {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--teal-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-clear-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal);
  cursor: pointer;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
  transition: color var(--transition);
}

.filter-clear-btn:hover { color: var(--teal-dark); text-decoration: underline; }

/* Filter list (checkboxes) */
.filter-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-list li label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.3rem 0;
  transition: color var(--transition);
  line-height: 1.4;
}

.filter-list li label:hover { color: var(--teal); }

.filter-list li input[type="checkbox"] {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}

.filter-list li input[type="checkbox"]:hover { border-color: var(--teal); }

.filter-list li input[type="checkbox"]:checked {
  background: var(--teal);
  border-color: var(--teal);
}

.filter-list li input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.filter-list li input[type="checkbox"]:focus { outline: 2px solid var(--amber); outline-offset: 2px; }

.filter-count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

/* Date range filter */
.filter-date-range {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.filter-date-range label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
}

.filter-date-range input[type="date"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color var(--transition);
  cursor: pointer;
}

.filter-date-range input[type="date"]:focus { border-color: var(--teal); }

/* Mobile filter toggle */
.filter-toggle-btn {
  display: none;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  transition: border-color var(--transition);
}

.filter-toggle-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ===========================
   RESULTS AREA (right)
=========================== */
.search-results { min-width: 0; }

/* ===========================
   ACTIVE FILTERS STRIP
=========================== */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.75rem;
}

.active-filters-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--teal);
  color: white;
  padding: 0.3rem 0.85rem 0.3rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.active-filter-remove {
  background: rgba(255,255,255,0.25);
  border: none;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background var(--transition);
}

.active-filter-remove:hover { background: rgba(255,255,255,0.4); }

.clear-all-filters {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--teal);
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  text-decoration: underline;
  transition: color var(--transition);
}

.clear-all-filters:hover { color: var(--teal-dark); }

/* ===========================
   RESULT ITEMS
=========================== */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Each result card */
.result-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.result-card:hover {
  border-left-color: var(--teal);
  box-shadow: var(--shadow-md);
  transform: translateX(3px);
}

.result-card-thumb {
  width: 100px;
  height: 72px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--teal-light);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  opacity: 0.4;
}

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

.result-card-type {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
  background: var(--teal-light);
  color: var(--teal);
}

.result-card-type.type-blog    { background: #E8F5F4; color: #1A7B74; }
.result-card-type.type-page    { background: #FEF6E8; color: #D4891A; }
.result-card-type.type-service { background: #EEF2FF; color: #4F46E5; }
.result-card-type.type-news    { background: #FDF2F8; color: #BE185D; }

.result-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.4rem;
  line-height: 1.35;
}

.result-card-title a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

.result-card-title a:hover { color: var(--teal); }

/* Highlight the search term in snippets */
.result-snippet {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
  font-weight: 600;
  margin-bottom: 0.6rem;

  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-highlight {
  background: #FFF3CD;
  color: var(--text);
  font-weight: 800;
  border-radius: 2px;
  padding: 0 2px;
}

.result-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.result-meta-dot { color: var(--amber); }

.result-url {
  font-size: 0.75rem;
  font-weight: 700;
  color: #27AE60;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

/* ===========================
   NO RESULTS STATE
=========================== */
.no-results {
  text-align: center;
  padding: 5rem 2rem;
}

.no-results-icon {
  width: 80px;
  height: 80px;
  background: var(--teal-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--teal);
  opacity: 0.6;
}

.no-results-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.no-results-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
  max-width: 420px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.no-results-suggestions {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  display: inline-block;
  text-align: left;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.no-results-suggestions p {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.no-results-suggestions ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.no-results-suggestions li {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.no-results-suggestions li::before {
  content: '→';
  color: var(--teal);
}

/* ===========================
   SEARCH PAGINATION
=========================== */
.search-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.search-page-btn {
  min-width: 42px;
  height: 42px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--white);
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  text-decoration: none;
}

.search-page-btn:hover { border-color: var(--teal); color: var(--teal); }
.search-page-btn.active { background: var(--teal); border-color: var(--teal); color: white; }
.search-page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.search-page-btn:disabled:hover { border-color: var(--border); color: var(--text); }

.search-page-ellipsis {
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 0.25rem;
  display: flex;
  align-items: center;
}

/* ===========================
   POPULAR / SUGGESTED SEARCHES
=========================== */
.popular-searches {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.popular-searches-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: rgba(255,255,255,0.65);
}

.popular-search-link {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.3);
  color: white;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--transition);
}

.popular-search-link:hover { background: rgba(255,255,255,0.25); color: white; }

/* ===========================
   LOADING SKELETON
=========================== */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.result-skeleton {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  animation: skeleton-pulse 1.6s ease infinite;
}

.skel {
  background: var(--border);
  border-radius: 4px;
}

.skel-thumb {
  width: 100px;
  height: 72px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.skel-body { flex: 1; display: flex; flex-direction: column; gap: 0.6rem; }
.skel-badge { width: 70px; height: 18px; border-radius: 999px; }
.skel-title { width: 75%; height: 22px; }
.skel-snippet-1 { width: 100%; height: 14px; }
.skel-snippet-2 { width: 60%; height: 14px; }
.skel-meta { width: 40%; height: 12px; }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 1024px) {
  .search-layout { grid-template-columns: 220px 1fr; gap: 2rem; }
}

@media (max-width: 768px) {
  .search-layout { grid-template-columns: 1fr; padding: 2rem 1.25rem; }

  .search-filters {
    display: none;
    position: static;
  }

  .search-filters.open { display: flex; }

  .filter-toggle-btn {
    display: flex;
    margin-bottom: 0;
  }

  .search-hero-form { border-radius: var(--radius-md); }
  .search-hero-btn { padding: 1rem 1.25rem; }

  .result-card { gap: 1rem; }
  .result-card-thumb { width: 72px; height: 54px; }

  .search-meta-inner { gap: 0.5rem; }
  .search-sort { font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .result-card { flex-direction: column; }
  .result-card-thumb { width: 100%; height: 120px; }
  .search-hero { padding: 3rem 1.25rem 2rem; }
}
