/* Responsive Search Bar Styles for VayVen WebApp */

.vv-search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}

/* Tablet and Desktop */
@media (min-width: 768px) {
  .vv-search-container {
    width: 400px;
  }
}

/* Mobile devices */
@media (max-width: 767px) {
  .vv-search-container {
    width: calc(100vw - 20px);
    max-width: 100%;
  }
}

/* Very small mobile devices */
@media (max-width: 360px) {
  .vv-search-container {
    width: calc(100vw - 16px);
  }
}

.vv-search-shell {
  position: relative;
  width: 100%;
  min-height: 44px; /* Touch-friendly minimum */
  background: white;
  box-sizing: border-box;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vv-search-shell:focus-within {
  border-color: #2563EB;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.2);
}

.vv-search-input {
  flex: 1;
  height: 100%;
  outline: none;
  border: none;
  background: transparent;
  font-size: 16px; /* Prevents iOS zoom on focus */
  padding: 12px 54px 12px 16px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
  box-sizing: border-box;
  min-height: 44px;
}

/* Tablet and Desktop */
@media (min-width: 768px) {
  .vv-search-input {
    font-size: 15px;
    padding: 10px 50px 10px 14px;
  }
  
  .vv-search-shell {
    min-height: 46px;
  }
}

.vv-search-input::placeholder {
  color: #999;
  opacity: 1;
}

.vv-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.vv-search-button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 44px; /* Touch-friendly */
  min-height: 44px;
  border: none;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background 0.2s ease;
  padding: 0;
}

/* Desktop */
@media (min-width: 768px) {
  .vv-search-button {
    min-width: 38px;
    min-height: 38px;
    font-size: 18px;
    right: 4px;
  }
}

.vv-search-button:hover {
  background: #e5e5e5;
}

.vv-search-button:active {
  background: #d5d5d5;
  transform: translateY(-50%) scale(0.95);
}

.vv-search-results {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: 100%;
  max-height: 60vh; /* Responsive height */
  overflow-y: auto;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  box-sizing: border-box;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Desktop - smaller max height */
@media (min-width: 768px) {
  .vv-search-results {
    max-height: 320px;
    top: calc(100% + 6px);
  }
}

/* Mobile landscape */
@media (max-height: 500px) {
  .vv-search-results {
    max-height: 40vh;
  }
}

.vv-search-result-item {
  padding: 14px 16px;
  cursor: pointer;
  color: #1a1a1a;
  font-size: 15px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s ease;
  min-height: 44px; /* Touch-friendly */
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

/* Desktop */
@media (min-width: 768px) {
  .vv-search-result-item {
    padding: 12px 14px;
    font-size: 14px;
    min-height: auto;
  }
}

.vv-search-result-item:last-child {
  border-bottom: none;
}

.vv-search-result-item:hover {
  background: #f5f5f5;
}

.vv-search-result-item:active {
  background: #e8e8e8;
}

.vv-search-result-item[data-active="true"] {
  background: #e3f2fd;
  color: #1976d2;
  font-weight: 500;
}

/* Smooth scrollbar for desktop */
@media (min-width: 768px) {
  .vv-search-results::-webkit-scrollbar {
    width: 8px;
  }

  .vv-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }

  .vv-search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
  }

  .vv-search-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .vv-search-shell {
    border-width: 3px;
  }
  
  .vv-search-result-item {
    border-bottom-width: 2px;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .vv-search-shell {
    background: #2a2a2a;
    border-color: #444;
  }
  
  .vv-search-input {
    color: #f0f0f0;
  }
  
  .vv-search-input::placeholder {
    color: #888;
  }
  
  .vv-search-button {
    background: #3a3a3a;
    color: #f0f0f0;
  }
  
  .vv-search-button:hover {
    background: #4a4a4a;
  }
  
  .vv-search-results {
    background: #2a2a2a;
    border-color: #444;
  }
  
  .vv-search-result-item {
    color: #f0f0f0;
    border-bottom-color: #3a3a3a;
  }
  
  .vv-search-result-item:hover {
    background: #3a3a3a;
  }
  
  .vv-search-result-item[data-active="true"] {
    background: #1e3a5f;
    color: #64b5f6;
  }
}

