/* ========================================
   SEARCH STYLES - Desktop Bar & Mobile Button
   ======================================== */

/* ===== Desktop Search Bar (centered in header) ===== */
.search-bar-desktop {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 400px;
}

.search-bar-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: #555;
  pointer-events: none;
}

.search-bar-input {
  width: 100%;
  padding: 12px 16px 12px 46px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.search-bar-input:hover {
  border-color: #0061ff;
  box-shadow: 0 0 12px rgba(0, 97, 255, 0.3);
}

.search-bar-input:focus {
  outline: none;
  background: transparent;
  border-color: #0061ff;
  box-shadow: 0 0 12px rgba(0, 97, 255, 0.3);
}

.search-bar-input::placeholder {
  color: #666;
}

/* Hide desktop search on smaller screens - use icon instead */
@media (max-width: 1350px) {
  .search-bar-desktop {
    display: none !important;
  }
}

/* ===== Mobile Search Button ===== */
.search-container-mobile {
  position: relative;
  display: none;
}

/* Show mobile search icon on smaller screens */
@media (max-width: 1350px) {
  .search-container-mobile {
    display: block;
  }
}

/* Mobile dropdown - hidden by default */
.search-dropdown-mobile {
  display: none;
  position: fixed;
  top: 70px;
  right: 80px;
  left: auto;
  transform: none;
  width: 400px;
  max-width: calc(100vw - 100px);
  background: #16161e;
  border-radius: 16px;
  border: 1px solid #222230;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
}

/* Mobile dropdown full width on small screens */
@media (max-width: 768px) {
  .search-dropdown-mobile {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

.search-dropdown-mobile.active {
  display: block;
}

.search-input-wrapper-mobile {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #222230;
  gap: 10px;
}

.search-input-wrapper-mobile .search-input-icon {
  color: #555;
  font-size: 20px;
}

.search-input-mobile {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
}

.search-input-mobile::placeholder {
  color: #555;
}

.search-results-mobile {
  max-height: 350px;
  overflow-y: auto;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.search-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.search-btn .material-symbols-rounded {
  font-size: 22px;
}

/* ===== Search Dropdown (Style 07) ===== */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  width: 100%;
  min-width: 380px;
  background: #16161e;
  border-radius: 16px;
  border: 1px solid #222230;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.search-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Mobile dropdown positioning */
@media (max-width: 768px) {
  .search-dropdown {
    position: fixed;
    top: 70px;
    left: 12px;
    right: 12px;
    width: auto;
    min-width: auto;
  }
  
  /* Mobile dropdown needs search input inside */
  .search-dropdown .search-input-wrapper-mobile {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #222230;
    gap: 10px;
  }
  
  .search-dropdown .search-input-wrapper-mobile .search-input-icon {
    color: #555;
    font-size: 20px;
  }
  
  .search-dropdown .search-input-wrapper-mobile .search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
  }
}

/* Search Results Container */
.search-results {
  max-height: 420px;
  overflow-y: auto;
}

.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Empty/Loading States */
.search-empty,
.search-loading,
.search-no-results {
  padding: 32px 16px;
  text-align: center;
  color: #d5d5d5;
  font-size: 14px;
}

.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.search-loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Category Header ===== */
.search-category {
  padding: 12px 16px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  background: transparent;
}

.search-category.smart-money {
  color: #3b82f6;
}

.search-category.market-scan {
  color: #929292;
}

/* ===== Search Result Item (Style 07) ===== */
.search-result-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-result-item:hover {
  background: rgba(59, 130, 246, 0.08);
}

.search-result-item:focus {
  outline: none;
  background: rgba(59, 130, 246, 0.12);
}

.search-result-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  object-fit: contain;
  background: linear-gradient(135deg, #2a2a35 0%, #1a1a24 100%);
  padding: 6px;
}

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

.search-result-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.search-result-symbol {
  font-size: 12px;
  color: #666;
  font-weight: 400;
  max-width: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

/* Tag for Smart Money items */
.search-result-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}

.search-result-category {
  font-size: 12px;
  color: #666;
  margin-top: 3px;
}

.search-result-category.smart-money {
  color: #3b82f6;
}

.search-result-category.market-scan {
  color: #3b82f6;
}

/* Price Info */
.search-result-price {
  text-align: right;
}

.search-result-price-value {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.search-result-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}

.search-result-change.positive {
  color: #00ff5d;
}

.search-result-change.negative {
  color: #ff2a2a;
}

/* ===== Light Theme ===== */
:root[data-theme="light"] .search-bar-input {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1a1a1a;
}

:root[data-theme="light"] .search-bar-input:focus {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .search-bar-icon {
  color: #888;
}

:root[data-theme="light"] .search-dropdown {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .search-result-item:hover {
  background: rgba(59, 130, 246, 0.08);
}

:root[data-theme="light"] .search-result-name {
  color: #1a1a1a;
}

:root[data-theme="light"] .search-result-price-value {
  color: #1a1a1a;
}
