/* ###########################################################
   ###   2418521        Antony O'Neill                     ###
   ###   TEMPUS PRIVÉ - SEARCH MODAL STYLING MODULE        ###
   ###   Last Updated: 02-07-2025                          ###
   ########################################################### */

/*
===============================================
Full-text search modal with luxury aesthetic
Accessible, performant, and responsive design
===============================================
*/

/* ###########################################################
   ###   1. SEARCH BACKDROP                                ###
   ########################################################### */

/* ===== SEARCH BACKDROP ===== */
.search-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 27, 42, 0.95);
  backdrop-filter: blur(20px);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-backdrop.active {
  display: block;
  opacity: 1;
}

/* ###########################################################
 ###   2. SEARCH MODAL CONTAINER                           ###
 ########################################################### */

/* ===== SEARCH MODAL ===== */
#search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
}

#search-modal.active {
  display: flex;
}

/* ###########################################################
 ###   3. MODAL CONTENT                                   ###
 ########################################################### */

/* ===== MODAL CONTENT ===== */
.search-modal-content {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  transform: translateY(-20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 5vh;
}

#search-modal.active .search-modal-content {
  transform: translateY(0);
  opacity: 1;
}

/* ###########################################################
 ###   4. SEARCH HEADER                                    ###
 ########################################################### */

/* ===== SEARCH HEADER ===== */
.search-header {
  padding: 2rem;
  border-bottom: 1px solid var(--light-gray);
  position: relative;
}

.search-input-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--medium-gray);
  pointer-events: none;
}

.search-icon svg {
  width: 24px;
  height: 24px;
}

/* ###########################################################
 ###   5. SEARCH INPUT                                     ###
 ########################################################### */

/* ===== SEARCH INPUT ===== */
#search-input {
  width: 100%;
  padding: 1.25rem 4rem 1.25rem 4rem;
  font-size: 1.25rem;
  border: 2px solid var(--light-gray);
  border-radius: 12px;
  background: var(--off-white);
  transition: all 0.3s ease;
  font-family: var(--font-sans);
}

#search-input:focus {
  outline: none;
  border-color: var(--imperial-gold);
  background: white;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

#search-input::placeholder {
  color: var(--medium-gray);
  font-style: italic;
}

/* ###########################################################
 ###   6. SEARCH CLOSE BUTTON                              ###
 ########################################################### */

/* ===== SEARCH CLOSE ===== */
.search-close {
  position: absolute;
  right: 2rem;
  top: 2rem;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  color: var(--medium-gray);
}

.search-close:hover {
  background: var(--light-gray);
  color: var(--crown-navy);
  transform: rotate(90deg);
}

/* ###########################################################
 ###   7. SEARCH INFO BAR                                  ###
] ########################################################### */

/* ===== SEARCH INFO BAR ===== */
.search-info {
  padding: 1rem 2rem;
  background: var(--off-white);
  border-bottom: 1px solid var(--light-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--medium-gray);
}

.search-count {
  font-weight: 600;
  color: var(--crown-navy);
}

.search-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.key-hint {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  background: white;
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--crown-navy);
}

/* ###########################################################
 ###   8. SEARCH RESULTS CONTAINER                         ###
 ########################################################### */

/* ===== SEARCH RESULTS ===== */
#search-results {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.search-results-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ###########################################################
 ###   9. SEARCH RESULT ITEM                               ###
 ########################################################### */

/* ===== SEARCH RESULT ITEM ===== */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.search-result-item:hover,
.search-result-item.active {
  border-color: var(--imperial-gold);
  background: var(--off-white);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.1);
}

.search-result-item.active {
  border-width: 2px;
}

/* ###########################################################
 ###   10. RESULT MEDIA                                    ###
 ########################################################### */

/* ===== RESULT IMAGE ===== */
.result-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: var(--off-white);
  border-radius: 8px;
  padding: 0.5rem;
  flex-shrink: 0;
}

/* ###########################################################
 ###   11. RESULT CONTENT                                  ###
 ########################################################### */

/* ===== RESULT CONTENT ===== */
.result-content {
  flex: 1;
  min-width: 0;
}

.result-brand {
  font-size: 0.85rem;
  color: var(--imperial-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.result-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--crown-navy);
  margin-bottom: 0.5rem;
  font-weight: 400;
  line-height: 1.2;
}

.result-details {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--medium-gray);
}

.result-detail {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.result-price {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--crown-navy);
  text-align: right;
  flex-shrink: 0;
}

/* ###########################################################
 ###   12. MATCH HIGHLIGHTING                              ###
 ########################################################### */

/* ===== MATCH HIGHLIGHT ===== */
.match {
  background: linear-gradient(to bottom, transparent 40%, var(--imperial-gold) 40%, var(--imperial-gold) 60%, transparent 60%);
  font-weight: 600;
  color: var(--crown-navy);
}

/* ###########################################################
 ###   13. EMPTY STATE                                     ###
 ########################################################### */

/* ===== EMPTY STATE ===== */
.search-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--medium-gray);
}

.empty-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 2rem;
  background: var(--off-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--light-gray);
}

.empty-icon svg {
  width: 50px;
  height: 50px;
}

.empty-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--crown-navy);
  margin-bottom: 1rem;
  font-weight: 400;
}

.empty-message {
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

.empty-suggestions {
  font-size: 0.9rem;
}

.suggestion-list {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.suggestion-chip {
  padding: 0.5rem 1rem;
  background: var(--off-white);
  border: 1px solid var(--light-gray);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-chip:hover {
  border-color: var(--imperial-gold);
  background: white;
  transform: translateY(-2px);
}

/* ###########################################################
 ###   14. LOADING STATE                                   ###
 ########################################################### */

/* ===== LOADING STATE ===== */
.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.search-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--light-gray);
  border-top-color: var(--imperial-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ###########################################################
 ###   15. RESPONSIVE DESIGN                               ###
 ########################################################### */

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #search-modal {
      padding: 1rem;
  }

  .search-modal-content {
      margin-top: 2vh;
      max-height: 95vh;
  }

  .search-header {
      padding: 1.5rem;
  }

  #search-input {
      font-size: 1.125rem;
      padding: 1rem 3.5rem;
  }

  .search-info {
      flex-direction: column;
      gap: 0.5rem;
      align-items: flex-start;
  }

  .search-result-item {
      flex-direction: column;
      text-align: center;
      gap: 1rem;
  }

  .result-content {
      width: 100%;
  }

  .result-details {
      justify-content: center;
  }

  .result-price {
      text-align: center;
  }

  .suggestion-list {
      flex-direction: column;
      align-items: center;
  }
}

@media (max-width: 480px) {
  .search-header {
      padding: 1rem;
  }

  #search-input {
      font-size: 1rem;
  }

  .result-image {
      width: 60px;
      height: 60px;
  }

  .result-name {
      font-size: 1.125rem;
  }

  .search-hint {
      display: none;
  }
}

/* ###########################################################
 ###   16. ACCESSIBILITY                                   ###
 ########################################################### */

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .search-backdrop,
  .search-modal-content,
  .search-result-item,
  .search-close {
      transition: none !important;
  }

  .search-spinner {
      animation: none;
      border-top-color: transparent;
      border-right-color: var(--imperial-gold);
  }
}

/* ===== FOCUS VISIBLE ===== */
.search-result-item:focus-visible,
.search-close:focus-visible,
#search-input:focus-visible {
  outline: 2px solid var(--imperial-gold);
  outline-offset: 2px;
}

/* ===== HIGH CONTRAST ===== */
@media (prefers-contrast: high) {
  .search-modal-content {
      border: 2px solid black;
  }

  .search-result-item {
      border: 1px solid var(--medium-gray);
  }

  .match {
      background: yellow;
      color: black;
  }
}

/* ###########################################################
   ###            END OF SEARCH MODAL STYLES               ###
   ########################################################### */

/*
=======================================================
IMPLEMENTATION NOTES: SEARCH MODAL STYLES
=======================================================

FULL-SCREEN MODAL:
- Overlay with backdrop
- Centred content box
- Maximum width constraint
- Mobile full-width

SEARCH INPUT:
- Large, prominent field
- Clear visual hierarchy
- Icon integration
- Focus states

RESULTS LAYOUT:
- Vertical list format
- Clear separators
- Hover states
- Active selection

KEYBOARD NAVIGATION:
- Visual selection indicator
- Focus visible states
- Tab order management
- Arrow key highlights

RESPONSIVE DESIGN:
- Mobile-first approach
- Touch-friendly results
- Appropriate spacing
- Readable typography

ANIMATIONS:
- Smooth open/close
- Result appearance
- Selection feedback
- Loading states
=======================================================
*/   