/* =====================================
   SEARCH SECTION STYLES
   ===================================== */

/* Mobile search toggle button */
.mobile-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: fixed;
  bottom: 4rem;
  right: 1rem;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mobile-search-toggle:hover {
  background-color: #e2e8f0;
  color: #475569;
}

@media (min-width: 768px) {
  .mobile-menu-toggle,
  .mobile-search-toggle {
    display: none;
  }
}

/* Search container - Latest definition from css/typoji.css takes precedence */
.search-container {
  padding: 1rem;
  margin-bottom: 1rem;
  width: 100%;
  position: relative;
}

/* Search input group - Latest definition from css/typoji.css */
.search-input-group {
  position: relative;
  margin-bottom: 0.5rem;
}

.search-input-group input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.search-input-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.search-input-group i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
  transition: color 0.2s;
}

.search-input-group input:focus + i {
  color: #3b82f6;
}

/* Search options - Latest definition from css/typoji.css */
.search-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}

.search-options-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Search input wrapper for reset button */
.search-input-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: stretch;
}

.search-input-wrapper input[type="text"] {
  flex: 1;
}

/* Reset button styling */
.reset-search-btn {
  padding: 0.5rem 1rem;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  color: #64748b;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.reset-search-btn:hover:not(:disabled) {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  color: #334155;
}

.reset-search-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.reset-search-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f8fafc;
  color: #94a3b8;
}

.reset-search-btn.active {
  background-color: #ef4444;
  color: white;
  border-color: #ef4444;
}

.reset-search-btn.active:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

/* Checkbox styling */
.checkbox-label {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 6px;
}

/* Category pills container - Latest definition from css/typoji.css */
.category-pills {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin-top: 0.75rem;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar in WebKit browsers */
.category-pills::-webkit-scrollbar,
.hand-emoji-row::-webkit-scrollbar {
  display: none;
}

.category-pills::-webkit-scrollbar {
  height: 4px;
}

.category-pills::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* Pill buttons - Latest definition from css/typoji.css */
.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 500;
  width: auto;
  height: 40px;
}

.pill:hover {
  background-color: #e2e8f0;
}

.pill.active {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.pill.emoji-only {
  font-size: 1.5rem;
  padding: 0;
  width: 36px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Make the All button appropriately sized */
.pill[data-category="all"] {
  min-width: 36px;
  padding: 0 10px;
}

/* Hand emoji buttons styling - Latest definition from styles.css */
.pill.emoji-only.hand-emoji {
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: all 0.2s ease, opacity 0.3s ease;
}

.pill.emoji-only.hand-emoji:hover {
  background-color: #e2e8f0;
}

.pill.emoji-only.hand-emoji.active {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

/* Text-based pill buttons (ADD and AND/OR) */
.pill.text-pill {
  min-width: 48px;
  height: 32px;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease, opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.pill.text-pill:hover {
  background-color: #e2e8f0;
}

.pill.text-pill.active {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.pill.text-pill.active:hover {
  background-color: #2563eb;
}

/* Container for both button rows */
.emoji-buttons-container {
  width: 100%;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hand emoji row */
.hand-emoji-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

/* Hide category text */
.category-text {
  display: none;
}

/* SVG specific styling in search results */
.emoji-image img[src$=".svg"] {
  width: auto;
  height: 40px;
  max-width: 100%;
  object-fit: contain;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .search-container {
    padding: 0.75rem;
  }
  
  .search-input-group input {
    padding: 0.875rem 1rem 0.875rem 2.5rem;
  }
  
  .pill.emoji-only.hand-emoji {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .search-input-wrapper {
    flex-direction: column;
  }
  
  .reset-search-btn {
    width: 100%;
    justify-content: center;
  }
  
  .pill {
    height: 36px;
  }
  
  .pill.emoji-only {
    font-size: 1.25rem;
  }
  
  .pill.emoji-only.hand-emoji {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.75rem;
  }
  
  .search-options-row {
    flex-wrap: wrap;
    gap: 5px;
  }
}

/* Style for the search options row with hand emojis */
.search-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* =====================================
   RESULTS & EMOJIS SECTION
   ===================================== */

/* Results container */
.results-container {
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .results-container {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* Sample emojis section */
.sample-emojis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Emoji Grid System - Latest definition from css/typoji.css takes precedence */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem;
}

/* Emoji cells - Latest definition from css/typoji.css */
.emoji-cell {
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f8fafc;
  border-radius: 0.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  cursor: pointer;
  max-width: none;
  position: relative;
}

.emoji-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 5;
  background-color: white;
}

.emoji-cell:active {
  transform: translateY(0);
}

/* Emoji symbols - Latest definition from css/typoji.css */
.emoji-symbol {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  font-size: 2rem;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  transform-origin: center;
  transition: transform 0.2s ease;
}

.emoji-cell:hover .emoji-symbol {
  transform: scale(1.1);
}

/* Emoji images */
.emoji-image {
  cursor: grab;
  transition: transform 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  position: relative;
  user-select: none;
}

.emoji-image img {
  vertical-align: middle;
  height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* SVG specific styling for emoji images */
.emoji-image img[src$=".svg"] {
  width: auto;
  height: 40px;
  max-width: 100%;
  object-fit: contain;
}

/* Ensure SVG images don't get clipped in cells */
.emoji-cell.emoji-image {
  overflow: visible;
}

/* Draggable characters */
.draggable-char {
  display: inline-flex;
  font-size: 2rem;
  padding: 0.375rem;
  cursor: grab;
  user-select: none;
  transition: transform 0.2s;
  border-radius: 0.25rem;
}

.draggable-char:hover {
  background-color: #f1f5f9;
  transform: scale(1.1);
}

/* Draggable images */
.draggable-image {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.375rem;
  cursor: grab;
  user-select: none;
  transition: transform 0.2s;
  border-radius: 0.25rem;
}

.draggable-image:hover {
  background-color: #f1f5f9;
  transform: scale(1.1);
}

/* Mobile responsiveness for emojis */
@media (max-width: 768px) {
  .emoji-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.375rem;
  }
  
  .emoji-symbol {
    font-size: 1.75rem;
  }
}

/* Dark mode support */
.dark-mode .emoji-cell {
  background-color: #e5e7eb;
}

.dark-mode .emoji-cell:hover {
  background-color: #f3f4f6;
}

/* For smaller screens */
@media (max-width: 480px) {
  .search-options-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}