/**
 * Gameosophy Global Search Bar Styles
 * Clean, Modern, Premium UI
 */

/* ==========================================================================
   Desktop Global Search Bar Container
   ========================================================================== */
.gm-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 440px;
  min-width: 320px;
  margin: 0 20px;
  z-index: 1050;
  display: flex;
  align-items: center;
}

.gm-search-form {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.gm-search-input-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  height: 46px;
  padding: 0 14px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.gm-search-input-box:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.gm-search-input-box.is-focused {
  border-color: #634490;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(99, 68, 144, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.gm-search-icon-left {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 16px;
  margin-right: 10px;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.gm-search-input-box.is-focused .gm-search-icon-left {
  color: #634490;
}

.gm-search-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  font-weight: 500;
  color: #1e293b;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0;
}

.gm-search-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
  font-size: 13px;
}

.gm-search-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  flex-shrink: 0;
}

.gm-search-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 11px;
  transition: all 0.15s ease;
}

.gm-search-clear-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.gm-search-clear-btn.is-visible {
  display: flex;
}

.gm-search-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid #e2e8f0;
  border-top-color: #634490;
  border-radius: 50%;
  animation: gmSpin 0.7s linear infinite;
}

.gm-search-spinner.is-active {
  display: block;
}

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

.gm-search-shortcut-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.5px;
  user-select: none;
  pointer-events: none;
}

/* ==========================================================================
   Live Autocomplete Dropdown
   ========================================================================== */
.gm-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 440px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.18), 0 8px 16px -6px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  display: none;
  z-index: 99999;
  animation: gmDropdownSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top center;
}

@keyframes gmDropdownSlide {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gm-autocomplete-dropdown.is-open {
  display: block;
}

.gm-dropdown-inner {
  max-height: 480px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.gm-dropdown-inner::-webkit-scrollbar {
  width: 6px;
}

.gm-dropdown-inner::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 10px;
}

/* Group Headers */
.gm-search-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.gm-search-group-count {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  padding: 1px 7px;
  border-radius: 10px;
}

/* Suggestion Item */
.gm-suggestion-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f8fafc;
  text-decoration: none !important;
  color: inherit !important;
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
}

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

.gm-suggestion-item:hover,
.gm-suggestion-item.is-active {
  background: #f8fafc;
}

.gm-suggestion-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  flex-shrink: 0;
  margin-right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #f1f5f9;
}

.gm-suggestion-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.gm-suggestion-item:hover .gm-suggestion-thumb img {
  transform: scale(1.05);
}

.gm-suggestion-thumb-icon {
  color: #a855f7;
  font-size: 20px;
}

.gm-suggestion-details {
  flex: 1;
  min-width: 0;
}

.gm-suggestion-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  margin-bottom: 3px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-suggestion-badge.badge-service {
  background: #eff6ff;
  color: #2563eb;
}

.gm-suggestion-badge.badge-category {
  background: #fef3c7;
  color: #d97706;
}

.gm-suggestion-badge.badge-blog {
  background: #ecfdf5;
  color: #059669;
}

.gm-suggestion-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-suggestion-title mark {
  background: rgba(168, 85, 247, 0.15);
  color: #7e22ce;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 3px;
}

.gm-suggestion-subtitle {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-suggestion-rating {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  display: inline-flex;
  align-items: center;
}

.gm-suggestion-price-col {
  margin-left: 14px;
  text-align: right;
  flex-shrink: 0;
}

.gm-suggestion-price {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.gm-suggestion-price.is-free {
  color: #059669;
}

.gm-suggestion-price.is-sale {
  color: #e11d48;
}

.gm-suggestion-price-old {
  font-size: 11.5px;
  color: #94a3b8;
  text-decoration: line-through;
  display: block;
}

/* Category & Blog Mini Items */
.gm-category-suggestion-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #334155 !important;
  text-decoration: none !important;
  transition: background 0.15s ease;
}

.gm-category-suggestion-item:hover,
.gm-category-suggestion-item.is-active {
  background: #f1f5f9;
  color: #634490 !important;
}

.gm-category-suggestion-item i {
  margin-right: 10px;
  color: #94a3b8;
  font-size: 14px;
}

/* Dropdown Footer */
.gm-dropdown-footer {
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.gm-view-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 9px 16px;
  background: linear-gradient(135deg, #634490 0%, #432874 100%);
  color: #ffffff !important;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(99, 68, 144, 0.2);
}

.gm-view-all-btn:hover {
  background: linear-gradient(135deg, #744fa8 0%, #4f308a 100%);
  box-shadow: 0 6px 14px rgba(99, 68, 144, 0.3);
  transform: translateY(-1px);
}

.gm-view-all-btn i {
  margin-left: 6px;
  transition: transform 0.2s ease;
}

.gm-view-all-btn:hover i {
  transform: translateX(3px);
}

/* Empty State in Dropdown */
.gm-search-empty-state {
  padding: 30px 20px;
  text-align: center;
}

.gm-search-empty-icon {
  width: 48px;
  height: 48px;
  line-height: 48px;
  background: #f1f5f9;
  border-radius: 50%;
  color: #94a3b8;
  font-size: 20px;
  margin: 0 auto 12px;
}

.gm-search-empty-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.gm-search-empty-subtext {
  font-size: 12.5px;
  color: #64748b;
  margin-bottom: 16px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.gm-search-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.gm-search-tag-chip {
  display: inline-block;
  padding: 4px 10px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none !important;
  transition: all 0.15s ease;
  border: 1px solid #e2e8f0;
}

.gm-search-tag-chip:hover {
  background: #634490;
  color: #ffffff;
  border-color: #634490;
}

/* ==========================================================================
   Mobile Search Trigger & Drawer Overlay
   ========================================================================== */
.gm-mobile-search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  font-size: 15px;
  cursor: pointer;
  margin-left: auto;
  margin-right: 10px;
  transition: all 0.2s ease;
}

.gm-mobile-search-toggle:hover {
  background: #634490;
  color: #ffffff;
  border-color: #634490;
}

/* Mobile Search Modal / Drawer */
.gm-mobile-search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999999;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gm-mobile-search-modal.is-active {
  display: block;
  opacity: 1;
}

.gm-mobile-search-panel {
  background: #ffffff;
  width: 100%;
  max-height: 90vh;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.gm-mobile-search-modal.is-active .gm-mobile-search-panel {
  transform: translateY(0);
}

.gm-mobile-search-header {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
  gap: 12px;
}

.gm-mobile-search-input-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  height: 48px;
  padding: 0 14px;
}

.gm-mobile-search-close-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f1f5f9;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gm-mobile-results-container {
  flex: 1;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
  padding-bottom: 16px;
}

/* Responsive Rules */
@media (max-width: 991px) {
  .gm-search-wrapper {
    display: none !important;
  }
  .gm-mobile-search-toggle {
    display: flex !important;
  }
}

@media (min-width: 992px) {
  .gm-mobile-search-modal {
    display: none !important;
  }
}
