/**
 * Tenbit Addon - Search Box Widget Styles
 * Author: Team Tenbit Solution
 * Website: tenbitsol.com
 */

:root {
  --tenbit-brand-red: #c91818;
  --tenbit-brand-red-hover: #a81212;
  --tenbit-brand-red-light: #ffeded;
  --tenbit-brand-gold: #e5a93c;
  --tenbit-brand-dark: #0f1013;
  --tenbit-text-main: #1d1e20;
  --tenbit-text-muted: #67696e;
  --tenbit-radius-sm: 4px;
  --tenbit-radius-md: 8px;
  --tenbit-radius-lg: 14px;
  --tenbit-radius-full: 9999px;
  --tenbit-transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tenbit-search-widget-wrapper {
  position: relative;
  box-sizing: border-box;
  font-family: inherit;
}

.tenbit-search-widget-wrapper * {
  box-sizing: border-box;
}

/* ==========================================================================
   TRIGGER ICON BUTTON (POPOVER & MODAL)
   ========================================================================== */
.tenbit-search-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tenbit-action-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--tenbit-radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  transition: var(--tenbit-transition);
  position: relative;
  padding: 0;
  outline: none;
}

.tenbit-action-icon-btn:hover {
  background: var(--tenbit-brand-red);
  border-color: var(--tenbit-brand-red);
  color: #ffffff;
  transform: translateY(-1px);
}

.tenbit-action-icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  pointer-events: none;
}

/* ==========================================================================
   HEADER SEARCH POPOVER (POPOVER LAYOUT)
   ========================================================================== */
.tenbit-header-search-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 420px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: var(--tenbit-radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 1.25rem;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.tenbit-header-search-popover.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ==========================================================================
   INLINE SEARCH LAYOUT
   ========================================================================== */
.tenbit-search-inline-wrap {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.tenbit-inline-results-box {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: var(--tenbit-radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  padding: 1rem 1.25rem;
  z-index: 9999;
  display: none;
}

.tenbit-inline-results-box.open {
  display: block;
}

/* ==========================================================================
   FORM & INPUT WRAPPERS
   ========================================================================== */
.tenbit-header-search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  margin: 0;
}

.tenbit-search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.tenbit-search-lens-icon {
  position: absolute;
  left: 12px;
  pointer-events: none;
  stroke: #9ca3af;
  display: flex;
  align-items: center;
}

.tenbit-header-search-input {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 38px;
  border: 2px solid #e5e7eb;
  border-radius: var(--tenbit-radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  color: #111827;
  outline: none;
  background: #f9fafb;
  transition: var(--tenbit-transition);
}

.tenbit-header-search-input:focus {
  border-color: var(--tenbit-brand-red);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(201, 24, 24, 0.1);
}

.tenbit-search-clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tenbit-search-clear-btn:hover {
  color: #111827;
}

.tenbit-search-submit-btn {
  height: 44px;
  padding: 0 1.25rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--tenbit-radius-sm);
  white-space: nowrap;
  background: var(--tenbit-brand-red);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: var(--tenbit-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.tenbit-search-submit-btn:hover {
  background: var(--tenbit-brand-red-hover);
  color: #ffffff;
}

/* ==========================================================================
   POPULAR TAGS / QUICK PILLS
   ========================================================================== */
.tenbit-search-results-box {
  margin-top: 1rem;
  border-top: 1px solid #f3f4f6;
  padding-top: 0.85rem;
}

.tenbit-search-suggestions-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 0.5rem;
}

.tenbit-search-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tenbit-search-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  background: #f3f4f6;
  color: #374151;
  border-radius: var(--tenbit-radius-full);
  text-decoration: none;
  transition: var(--tenbit-transition);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.tenbit-search-pill:hover {
  background: #fee2e2;
  color: var(--tenbit-brand-red);
}

/* ==========================================================================
   LIVE SEARCH RESULTS LIST & CARDS
   ========================================================================== */
.tenbit-live-results-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  scrollbar-width: thin;
}

.tenbit-live-results-list::-webkit-scrollbar {
  width: 5px;
}

.tenbit-live-results-list::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 4px;
}

.tenbit-live-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--tenbit-radius-sm);
  text-decoration: none;
  color: #111827;
  transition: var(--tenbit-transition);
  border: 1px solid transparent;
  background: #ffffff;
}

.tenbit-live-result-item:hover,
.tenbit-live-result-item.active {
  background: #fff1f1;
  border-color: #fecaca;
}

.tenbit-live-result-img {
  width: 44px;
  height: 44px;
  border-radius: var(--tenbit-radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.tenbit-live-result-info {
  flex: 1;
  min-width: 0;
}

.tenbit-live-result-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tenbit-live-result-desc {
  font-size: 0.74rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.tenbit-live-result-price {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--tenbit-brand-red);
  white-space: nowrap;
  flex-shrink: 0;
}

.tenbit-no-results {
  padding: 0.85rem 0.5rem;
  font-size: 0.84rem;
  color: #6b7280;
  text-align: center;
}

.tenbit-no-results a {
  color: var(--tenbit-brand-red);
  font-weight: 700;
  text-decoration: underline;
  margin-left: 4px;
}

/* Spinner */
.tenbit-search-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--tenbit-brand-red);
  border-radius: 50%;
  animation: tenbit-spin 0.6s linear infinite;
  margin: 1rem auto;
}

@keyframes tenbit-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   FULLSCREEN / MODAL DIALOG MODE
   ========================================================================== */
.tenbit-search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}

.tenbit-search-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.tenbit-search-modal-dialog {
  background: #ffffff;
  width: 90%;
  max-width: 620px;
  border-radius: var(--tenbit-radius-lg);
  padding: 1.75rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(-20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tenbit-search-modal-backdrop.open .tenbit-search-modal-dialog {
  transform: translateY(0);
}

.tenbit-search-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.tenbit-search-modal-label {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tenbit-brand-red);
}

.tenbit-search-modal-close {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.tenbit-search-modal-close:hover {
  color: #111827;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 480px) {
  .tenbit-header-search-popover {
    position: fixed;
    top: 80px;
    left: 1rem;
    right: 1rem;
    width: auto;
  }
  
  .tenbit-search-modal-backdrop {
    padding-top: 40px;
  }
}
