/* ==========================================================================
   Elevaan Network — Visual Image Search Styles
   ========================================================================== */

/* Visual Match Badge on Product Cards */
.visual-match-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: rgba(16, 185, 129, 0.94);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.2px;
  pointer-events: none;
}

.visual-match-badge svg {
  flex-shrink: 0;
  display: block;
}

.visual-match-badge.is-exact {
  background: linear-gradient(135deg, #ff6600 0%, #ff8533 100%);
  box-shadow: 0 3px 10px rgba(255, 102, 0, 0.35);
}

.visual-match-badge.is-medium {
  background: rgba(245, 158, 11, 0.94);
}

.visual-match-badge.is-low {
  background: rgba(100, 116, 139, 0.9);
}

/* Home Search Card Drag-Over State */
.home-search-card.is-drag-over {
  border: 2px dashed var(--color-orange-primary, #ff6600) !important;
  background: var(--color-orange-light, #fff5ef) !important;
  box-shadow: 0 0 0 4px rgba(255, 102, 0, 0.15) !important;
  position: relative;
}

.home-search-card.is-drag-over::after {
  content: "Drop image here to search";
  position: absolute;
  inset: 0;
  background: rgba(255, 245, 239, 0.92);
  backdrop-filter: blur(2px);
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-orange-primary, #ff6600);
  z-index: 10;
  pointer-events: none;
}

/* Scanning Overlay Modal */
.image-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.image-search-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 32px 28px;
  text-align: center;
  transform: scale(0.94) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.image-search-overlay.is-active .image-search-modal {
  transform: scale(1) translateY(0);
}

.image-search-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  z-index: 5;
}

.image-search-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Scanner viewport */
.image-scanner-box {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 24px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  background: #0f172a;
}

.image-scanner-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Laser scan line */
.image-scanner-laser {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ff6600, #ff9933, #ff6600, transparent);
  box-shadow: 0 0 16px #ff6600, 0 0 32px #ff9933;
  top: 0;
  animation: laserScan 1.6s ease-in-out infinite alternate;
  z-index: 3;
}

.image-scanner-laser::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  height: 28px;
  background: linear-gradient(180deg, rgba(255, 102, 0, 0.25) 0%, transparent 100%);
}

@keyframes laserScan {
  0% {
    top: 2%;
  }
  100% {
    top: 96%;
  }
}

/* Corner brackets on scanner */
.image-scanner-bracket {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid #ff6600;
  z-index: 4;
}

.image-scanner-bracket.tl {
  top: 8px;
  left: 8px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 6px;
}

.image-scanner-bracket.tr {
  top: 8px;
  right: 8px;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: 6px;
}

.image-scanner-bracket.bl {
  bottom: 8px;
  left: 8px;
  border-right: none;
  border-top: none;
  border-bottom-left-radius: 6px;
}

.image-scanner-bracket.br {
  bottom: 8px;
  right: 8px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 6px;
}

/* Spinner and Status */
.image-search-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.image-search-status {
  font-size: 13.5px;
  color: #64748b;
  margin: 0 0 18px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.image-search-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 102, 0, 0.25);
  border-top-color: #ff6600;
  border-radius: 50%;
  animation: imgSearchSpin 0.7s linear infinite;
  display: inline-block;
}

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

/* Visual Search Drop Dialog (Alternative when clicked) */
.image-drop-dialog {
  padding: 10px;
}

.image-drop-area {
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 36px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f8fafc;
}

.image-drop-area:hover,
.image-drop-area.is-drag-over {
  border-color: #ff6600;
  background: #fff5ef;
}

.image-drop-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ff6600;
  margin-bottom: 14px;
}

.image-drop-heading {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.image-drop-subtext {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 16px 0;
}

.image-drop-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ff6600;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.image-drop-btn:hover {
  background: #e65c00;
}

/* Visual Search Banner on Search Page */
.visual-search-banner {
  background: linear-gradient(135deg, #ffffff 0%, #fffbf8 100%);
  border: 1px solid rgba(255, 102, 0, 0.2);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(255, 102, 0, 0.06);
}

.visual-search-banner-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.visual-search-thumb-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  border: 2px solid #ffffff;
  flex-shrink: 0;
  background: #f1f5f9;
}

.visual-search-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.visual-search-badge-pill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.visual-search-meta {
  flex: 1;
  min-width: 220px;
}

.visual-search-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.visual-search-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

.visual-search-desc strong {
  color: #ff6600;
}

.visual-search-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.btn-visual-upload-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: #ff6600;
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.btn-visual-upload-new:hover {
  background: #e65c00;
  transform: translateY(-1px);
}

.btn-visual-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

@media (max-width: 640px) {
  .visual-search-banner-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .visual-search-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
}
