/* ============================================================
   Search Modal - MiniSearch UI
   ============================================================ */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 1rem 2rem;
}
.search-modal.open {
  display: flex;
}
.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 31, 68, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}
.search-modal-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  background: white;
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 24px 60px rgba(10, 31, 68, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200, #E5E7EB);
  background: var(--cream, #F8F5EE);
}
.search-icon {
  font-size: 1.3rem;
  color: var(--midnight-800, #0A1F44);
}
.search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--midnight-900, #0A1F44);
  font-weight: 500;
}
.search-input-wrap input::placeholder {
  color: var(--gray-500, #6B7280);
  font-weight: 400;
}
.search-kbd {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-600, #4B5563);
  background: white;
  border: 1px solid var(--gray-300, #D1D5DB);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.5px;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  min-height: 200px;
  max-height: 60vh;
}

.search-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--gray-600, #4B5563);
}
.search-empty p { margin: 0; }

.search-results-header {
  padding: 0.5rem 0.85rem;
  font-size: 0.75rem;
  color: var(--gray-500, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  cursor: pointer;
}
.search-result:hover, .search-result.selected {
  background: var(--midnight-50, #F0F2F8);
}
.search-result-cat {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-result-body {
  flex: 1;
  min-width: 0;
}
.search-result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--midnight-900, #0A1F44);
  margin-bottom: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-desc {
  font-size: 0.8rem;
  color: var(--gray-600, #4B5563);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result-arrow {
  color: var(--gray-400, #9CA3AF);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.search-result mark {
  background: #FFF3B0;
  color: var(--midnight-900, #0A1F44);
  font-weight: 700;
  padding: 0 2px;
  border-radius: 2px;
}

.search-footer {
  display: flex;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--cream, #F8F5EE);
  border-top: 1px solid var(--gray-200, #E5E7EB);
  font-size: 0.75rem;
  color: var(--gray-500, #6B7280);
}

/* ============================================================
   Search trigger button (đặt trong header)
   ============================================================ */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  background: var(--midnight-50, #F0F2F8);
  border: 1.5px solid var(--gray-200, #E5E7EB);
  border-radius: 9999px;
  color: var(--midnight-800, #0A1F44);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
}
.nav-search-btn:hover {
  background: var(--midnight-800, #0A1F44);
  color: white;
  border-color: var(--midnight-800, #0A1F44);
}
.nav-search-btn .kbd-hint {
  font-size: 0.65rem;
  background: rgba(0,0,0,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  margin-left: 0.25rem;
}
.nav-search-btn:hover .kbd-hint {
  background: rgba(255,255,255,0.2);
}

@media (max-width: 600px) {
  .search-modal { padding: 2vh 0.5rem 1rem; }
  .search-modal-panel { max-height: 95vh; }
  .nav-search-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    gap: 0;
  }
  .nav-search-btn .label { display: none; }
  .nav-search-btn .kbd-hint { display: none; }
}
