/**
 * Dextroverse Search Widget Styling
 * Card-based results at bottom of page
 */

#dxtv-search-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 420px;
  max-width: calc(100vw - 40px);
  max-height: 70vh;
  background: linear-gradient(135deg, rgba(5, 5, 16, 0.95), rgba(15, 15, 37, 0.95));
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 998;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
}

#dxtv-search-widget.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dxtv-search-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   SEARCH INPUT GROUP
   ═══════════════════════════════════════════════════════════════ */

.dxtv-search-input-group {
  position: relative;
  padding: 1.2rem;
  border-bottom: 1px solid rgba(0, 255, 255, 0.1);
  flex-shrink: 0;
}

.dxtv-search-input {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 6px;
  padding: 0.75rem 2.2rem 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

.dxtv-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.dxtv-search-input:focus {
  outline: none;
  border-color: rgba(0, 255, 255, 0.6);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
  background: rgba(0, 255, 255, 0.05);
}

.dxtv-search-icon {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.5;
  pointer-events: none;
}

.dxtv-search-close {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dxtv-search-close:hover {
  background: rgba(255, 0, 0, 0.2);
  border-color: rgba(255, 0, 0, 0.4);
  color: #ff4444;
}

/* ═══════════════════════════════════════════════════════════════
   RESULTS CONTAINER
   ═══════════════════════════════════════════════════════════════ */

.dxtv-search-results {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding: 1rem;
}

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

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

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

.dxtv-search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 255, 0.4);
}

/* ═══════════════════════════════════════════════════════════════
   RESULTS GRID
   ═══════════════════════════════════════════════════════════════ */

.dxtv-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.dxtv-result-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 255, 255, 0.05);
  border: 1px solid rgba(0, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dxtv-result-card:hover {
  background: rgba(0, 255, 255, 0.12);
  border-color: rgba(0, 255, 255, 0.35);
  transform: translateX(4px);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.15);
}

.dxtv-result-image-wrapper {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.dxtv-result-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dxtv-result-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(0, 255, 255, 0.1);
}

.dxtv-result-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dxtv-result-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.3;
  white-space: normal;
}

.dxtv-result-title mark {
  background: rgba(0, 255, 255, 0.3);
  color: #00ffff;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 2px;
}

.dxtv-result-excerpt {
  margin: 0.4rem 0 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dxtv-result-excerpt mark {
  background: rgba(0, 255, 255, 0.25);
  color: #00ffff;
  font-weight: 600;
}

.dxtv-result-type {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(0, 255, 255, 0.6);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY/LOADING/ERROR STATES
   ═══════════════════════════════════════════════════════════════ */

.dxtv-search-empty,
.dxtv-search-error,
.dxtv-search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  min-height: 200px;
}

.dxtv-search-empty p,
.dxtv-search-error p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.dxtv-search-error {
  color: #ff6666;
}

.dxtv-search-loading {
  color: rgba(0, 255, 255, 0.7);
}

.dxtv-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0, 255, 255, 0.2);
  border-top-color: #00ffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

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

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */

.dxtv-search-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(0, 255, 255, 0.1);
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  #dxtv-search-widget {
    width: calc(100vw - 40px);
    max-height: 60vh;
  }
  
  .dxtv-result-card {
    gap: 0.6rem;
  }
  
  .dxtv-result-image-wrapper {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  #dxtv-search-widget {
    width: calc(100vw - 20px);
    bottom: 10px;
    right: 10px;
    max-height: 50vh;
  }
  
  .dxtv-search-input-group {
    padding: 1rem;
  }
  
  .dxtv-search-results {
    padding: 0.75rem;
  }
  
  .dxtv-result-card {
    gap: 0.5rem;
    padding: 0.6rem;
  }
  
  .dxtv-result-title {
    font-size: 0.9rem;
  }
  
  .dxtv-result-excerpt {
    -webkit-line-clamp: 1;
  }
}
