/* ============================================
   Matrix Spins Casino - Global Search Overlay
   ============================================ */

/* --- Overlay Backdrop --- */
.ms-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ms-search-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* --- Search Card --- */
.ms-search-card {
  width: 94%;
  max-width: 560px;
  background: rgba(18, 21, 30, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6),
              0 0 40px rgba(212, 175, 55, 0.08);
  overflow: hidden;
  transform: translateY(-20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ms-search-overlay.active .ms-search-card {
  transform: translateY(0) scale(1);
}

/* --- Input Wrapper --- */
.ms-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.ms-search-input-wrap svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #d4af37;
  opacity: 0.7;
}

.ms-search-input {
  flex: 1;
  height: 56px;
  padding: 0 14px;
  background: transparent;
  border: none;
  outline: none;
  color: #f0f0f5;
  font-size: 17px;
  font-family: inherit;
  caret-color: #d4af37;
}

.ms-search-input::placeholder {
  color: rgba(240, 240, 245, 0.35);
}

.ms-search-kbd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: rgba(240, 240, 245, 0.08);
  border: 1px solid rgba(240, 240, 245, 0.12);
  border-radius: 6px;
  color: rgba(240, 240, 245, 0.4);
  font-size: 12px;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* --- Results Area --- */
.ms-search-results {
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.25) transparent;
}

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

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

.ms-search-results::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.25);
  border-radius: 10px;
}

/* --- Result Item --- */
.ms-search-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.ms-search-item:hover,
.ms-search-item.focused {
  background: rgba(212, 175, 55, 0.08);
}

.ms-search-item-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
}

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

.ms-search-item-name {
  font-size: 15px;
  font-weight: 600;
  color: #f0f0f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ms-search-item-name mark {
  background: none;
  color: #d4af37;
  font-weight: 700;
}

.ms-search-item-studio {
  font-size: 12.5px;
  color: rgba(240, 240, 245, 0.45);
  margin-top: 2px;
}

.ms-search-item-rtp {
  flex-shrink: 0;
  padding: 3px 10px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #d4af37;
  white-space: nowrap;
}

/* --- Section Labels --- */
.ms-search-label {
  padding: 10px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(240, 240, 245, 0.3);
}

/* --- Empty State --- */
.ms-search-empty {
  padding: 36px 20px;
  text-align: center;
}

.ms-search-empty-icon {
  font-size: 32px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.ms-search-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #f0f0f5;
  margin-bottom: 4px;
}

.ms-search-empty-hint {
  font-size: 13px;
  color: rgba(240, 240, 245, 0.4);
}

/* --- Footer --- */
.ms-search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid rgba(212, 175, 55, 0.1);
  font-size: 12px;
  color: rgba(240, 240, 245, 0.25);
}

.ms-search-footer kbd {
  display: inline-block;
  padding: 1px 5px;
  background: rgba(240, 240, 245, 0.06);
  border: 1px solid rgba(240, 240, 245, 0.1);
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  margin: 0 2px;
}

/* --- Trigger Button --- */
.ms-search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  color: #d4af37;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ms-search-trigger:hover {
  background: rgba(212, 175, 55, 0.18);
  border-color: rgba(212, 175, 55, 0.35);
}

.ms-search-trigger svg {
  width: 18px;
  height: 18px;
}

/* --- Recent item remove --- */
.ms-search-item-remove {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: rgba(240, 240, 245, 0.25);
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}

.ms-search-item-remove:hover {
  color: #f0f0f5;
  background: rgba(240, 240, 245, 0.08);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .ms-search-overlay {
    padding-top: 0;
    align-items: flex-start;
  }

  .ms-search-card {
    width: 100%;
    max-width: 100%;
    border-radius: 0 0 16px 16px;
    border-top: none;
  }

  .ms-search-kbd {
    display: none;
  }

  .ms-search-results {
    max-height: 60vh;
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .ms-search-overlay,
  .ms-search-card,
  .ms-search-item {
    transition: none;
  }
}

/* --- Trigger button --- */
.ms-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(240, 240, 245, 0.75);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font: 500 13px/1 Inter, system-ui, sans-serif;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ms-search-trigger:hover {
  background: rgba(218, 165, 32, 0.1);
  border-color: rgba(218, 165, 32, 0.4);
  color: #DAA520;
}
.ms-search-trigger svg { width: 16px; height: 16px; }
.ms-search-trigger-label { display: inline-block; }
.ms-search-trigger-kbd {
  margin-left: 4px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  font: 600 10px/1 ui-monospace, monospace;
  color: rgba(240, 240, 245, 0.6);
}
@media (max-width: 600px) {
  .ms-search-trigger-label,
  .ms-search-trigger-kbd { display: none; }
  .ms-search-trigger { padding: 8px; }
}
.ms-search-trigger-floating {
  position: fixed;
  bottom: 76px;
  right: 16px;
  z-index: 9998;
  background: #DAA520;
  color: #0d0d0d;
  border-color: #DAA520;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.ms-search-trigger-floating:hover { background: #B8901C; color: #0d0d0d; }

/* --- Result thumbnail + theme tag --- */
.ms-search-item-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #1a1a1a;
  flex-shrink: 0;
}
.ms-search-cat {
  text-transform: capitalize;
  color: rgba(240, 240, 245, 0.55);
}

/* --- Popular search chips --- */
.ms-search-popular {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 4px;
}
.ms-search-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(240, 240, 245, 0.8);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font: 500 12px/1 Inter, system-ui, sans-serif;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ms-search-chip:hover {
  background: rgba(218, 165, 32, 0.12);
  border-color: rgba(218, 165, 32, 0.4);
  color: #DAA520;
}
