/* Dynamic Search - Clean Dropdown Styles */

.brxe-dynamic-search {
  --card-bg: #ffffff;
  --card-border: 1px solid #e5e7eb;
  --card-padding: 1rem;
  --card-shadow: 0 1px 3px rgba(0,0,0,.1);
  --card-hover-bg: #f6f6f6;
  --card-border-color: #eee;
  --title-font-size: 1.125rem;
  --title-font-weight: 600;
  --title-line-height: 1.4;
  --title-color: inherit;
  --excerpt-font-size: 0.875rem;
  --excerpt-line-height: 1.6;
  --excerpt-color: #6b7280;
  --trigger-hover-bg: #fafafa;
  --trigger-hover-border: 1px solid #eee;
  --trigger-open-bg: #fff;
  --trigger-open-border: #bbb;
  --trigger-open-shadow: 0 1px 4px rgba(0,0,0,.05) inset;
  --panel-bg: #fff;
  --panel-border: 1px solid #ddd;
  --panel-shadow: 0 0 0 1px rgba(0,0,0,.08);
  --panel-radius: 6px;
  --panel-padding: 4px 0 0;
  --panel-max-height: 520px;
  --search-padding: .5rem .65rem;
  --search-border-color: #999;
  --pagination-border-color: #eee;
  direction: rtl;
  position: relative;
  width: 100%;
  max-width: 420px;
}

/* Trigger */
.search-dropdown-trigger {
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .75rem;
  height: 42px;
  padding: 0 16px;
  /* font-size removed - controlled by Bricks Typography */
  color: #2c3e51;
  user-select: none;
  transition: all .2s ease-in-out;
}
.search-dropdown-trigger:hover { 
  background:var(--trigger-hover-bg, #fafafa); 
  border:var(--trigger-hover-border, 1px solid #eee); 
}
.search-dropdown-trigger.open { 
  background-color:var(--trigger-open-bg, #fff)!important; 
  border:var(--trigger-open-border, 1px solid #bbb)!important; 
  box-shadow:var(--trigger-open-shadow, 0 1px 4px rgba(0,0,0,.05) inset); 
}
.search-dropdown-trigger.open .search-trigger-text {
  font-size: var(--trigger-open-font-size);
  font-weight: var(--trigger-open-font-weight);
  line-height: var(--trigger-open-line-height);
  letter-spacing: var(--trigger-open-letter-spacing);
  text-transform: var(--trigger-open-text-transform);
  font-style: var(--trigger-open-font-style);
  text-decoration: var(--trigger-open-text-decoration);
  color: var(--trigger-open-color);
}
.search-trigger-text { 
  flex:1; 
  white-space:nowrap; 
  overflow:hidden; 
  text-overflow:ellipsis; 
}
.search-trigger-arrow { width:0; height:0; border-left:4px solid transparent; border-right:4px solid transparent; border-top:4px solid #777; transition:transform .125s ease-in-out; }
.search-dropdown-trigger.open .search-trigger-arrow { transform:rotate(-180deg); }

/* Panel */
.search-dropdown-panel {
  background:var(--panel-bg, #fff);
  border:var(--panel-border, 1px solid #ddd);
  border-radius:var(--panel-radius, 6px);
  box-shadow:var(--panel-shadow, 0 0 0 1px rgba(0,0,0,.08));
  margin-top:6px;
  position:absolute; top:100%; left:0; right:0;
  z-index:1000;
  max-height:var(--panel-max-height, 520px);
  overflow-y:auto;
  padding:var(--panel-padding, 4px 0 0);
  opacity:0; transform:scale(.75); transform-origin:50% 0;
  pointer-events:none;
  transition:all .18s cubic-bezier(.25,0,.25,1.5), opacity .12s linear;
}
.search-dropdown-panel.open { opacity:1; transform:scale(1); pointer-events:auto; }

/* Search input inside panel */
.search-dropdown-search { display:flex; padding:var(--search-padding, .5rem .65rem); border-bottom:1px solid var(--search-border-color, #eee); }
.search-dropdown-search .search-input { width:100%; padding:var(--search-padding, .5rem .65rem); border:1px solid var(--search-border-color, #999); border-radius:4px; outline:none; background:#fff; }
.search-dropdown-search .search-input:focus { border-color:#3b82f6; }

/* Filters */
.taxonomy-filters { padding:.5rem .9rem .3rem; border-bottom:1px solid #eee; }
.filter-group { margin:0 0 .65rem; }
.filter-group:last-child { margin-bottom:.3rem; }
.filter-group label { font-size:13px; font-weight:500; margin:0 0 .25rem; color:#374151; display:block; }
.filter-select { width:100%; padding:.45rem .6rem; border:1px solid #d1d5db; border-radius:4px; background:#fff; font-size:13px; cursor:pointer; }
.filter-select:focus { outline:none; border-color:#3b82f6; }
.filter-radio-group, .filter-checkbox-group { display:flex; flex-direction:column; gap:.3rem; }
.filter-radio-group label, .filter-checkbox-group label { font-size:13px; display:flex; gap:.45rem; align-items:center; cursor:pointer; font-weight:400; }

/* Loading */
.search-loading { text-align:center; padding:1.5rem 1rem; font-size:14px; color:#6b7280; }
.search-loading::after { content:''; display:inline-block; width:1em; height:1em; margin-right:.5rem; border:2px solid #e5e7eb; border-top-color:#3b82f6; border-radius:50%; animation:spin .6s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* No results */
.no-results { text-align:center; padding:1.5rem 1rem; color:#6b7280; }

/* Results container */
.search-results { display:flex; flex-direction:column; margin:0; padding:0; }
.search-results.search-grid { display:grid; gap:1rem; }
.search-results.search-grid.cols-1 { grid-template-columns:1fr; }
.search-results.search-grid.cols-2 { grid-template-columns:repeat(2,1fr); }
.search-results.search-grid.cols-3 { grid-template-columns:repeat(3,1fr); }
.search-results.search-grid.cols-4 { grid-template-columns:repeat(4,1fr); }
.search-results.search-grid.cols-5 { grid-template-columns:repeat(5,1fr); }
.search-results.search-grid.cols-6 { grid-template-columns:repeat(6,1fr); }

/* Result card */
.search-result-card { background:var(--card-bg); border-bottom:1px solid var(--card-border-color, #eee); padding:var(--card-padding); cursor:pointer; transition:background .18s ease; box-shadow:var(--card-shadow); text-decoration:none; color:inherit; display:block; }
.search-result-card:hover { background:var(--card-hover-bg, #f6f6f6); }
.search-result-card:last-child { border-bottom:none; }
.result-thumbnail { margin-bottom:.5rem; border-radius:4px; overflow:hidden; }
.result-content { display:flex; flex-direction:column; gap:.35rem; }
.result-title { margin:0; font-size:var(--title-font-size); font-weight:var(--title-font-weight); line-height:var(--title-line-height); color:var(--title-color); transition:all .18s ease; }
.search-result-card:hover .result-title {
  font-size: var(--title-hover-font-size);
  font-weight: var(--title-hover-font-weight);
  line-height: var(--title-hover-line-height);
  letter-spacing: var(--title-hover-letter-spacing);
  text-transform: var(--title-hover-text-transform);
  font-style: var(--title-hover-font-style);
  text-decoration: var(--title-hover-text-decoration);
  color: var(--title-hover-color);
}
.result-excerpt { font-size:var(--excerpt-font-size); line-height:var(--excerpt-line-height); color:var(--excerpt-color); display:-webkit-box; -webkit-line-clamp:2; line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.result-taxonomies { display:flex; flex-wrap:wrap; gap:.25rem; margin-top:.25rem; }
.term-badge { background:#f3f4f6; color:#374151; padding:.15rem .5rem; border-radius:9999px; font-size:.7rem; font-weight:500; }

/* Pagination */
.search-pagination { display:flex; justify-content:center; padding:.6rem .5rem .7rem; border-top:1px solid var(--pagination-border-color, #eee); }
.pagination { display:flex; gap:.3rem; }
.pagination-btn { min-width:32px; background:#fff; border:1px solid var(--pagination-border-color, #d1d5db); padding:.3rem .55rem; font-size:12px; font-weight:500; border-radius:4px; cursor:pointer; transition:background .15s ease, border-color .15s ease; }
.pagination-btn:hover { background:#f9fafb; border-color:#9ca3af; }
.pagination-btn.active { background:#3b82f6; color:#fff; border-color:#3b82f6; }
.pagination-btn:disabled { opacity:.5; cursor:not-allowed; }

/* Responsive tweaks */
@media (max-width:1024px) {
  .search-results.search-grid.cols-4,
  .search-results.search-grid.cols-5,
  .search-results.search-grid.cols-6 { grid-template-columns:repeat(3,1fr); }
}
@media (max-width:768px) {
  .search-results.search-grid.cols-3,
  .search-results.search-grid.cols-4,
  .search-results.search-grid.cols-5,
  .search-results.search-grid.cols-6 { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:480px) {
  .brxe-dynamic-search { max-width:100%; }
  .search-dropdown-panel { max-height:440px; }
  .search-results.search-grid { grid-template-columns:1fr; }
}
