/* ============================================
   SEARCH OVERLAY (Sidebar style)
   ============================================ */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 15, 34, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: calc(var(--z-modal) + 5);
  display: block;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

/* Legacy article search markup support */
.search-overlay > .search-header {
  position: absolute;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: auto;
  min-height: 118px;
  background: var(--white);
  padding: 40px var(--sp-6) var(--sp-4);
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  border-bottom: 2px solid var(--gray-100);
}

.search-overlay.active > .search-header {
  right: 0;
}

.search-overlay > .search-header input {
  width: 100%;
  height: 48px;
  min-width: 0;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-full);
  padding: 0 18px;
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  outline: none;
  box-shadow: none;
}

.search-overlay > .search-header input::placeholder {
  color: var(--gray-400);
  font-weight: 500;
}

.search-overlay > .search-results {
  position: absolute;
  top: 118px;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: calc(100vh - 118px);
  background: var(--white);
  padding: var(--sp-5) var(--sp-6) 40px;
  overflow-y: auto;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 30px 50px rgba(0, 0, 0, 0.08);
}

.search-overlay.active > .search-results {
  right: 0;
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.search-container {
  position: absolute;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: 100vh;
  background: var(--white);
  padding: 40px var(--sp-6);
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.search-overlay.active .search-container {
  right: 0;
}

.search-header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
  border-bottom: 2px solid var(--gray-100);
  padding-bottom: var(--sp-4);
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper input {
  width: 100%;
  background: transparent;
  border: none;
  padding: var(--sp-2) 0 var(--sp-2) 36px;
  font-family: var(--font-primary);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gray-900);
  outline: none;
}

.search-input-wrapper input::placeholder {
  color: var(--gray-400);
  font-weight: 500;
}

.search-input-wrapper svg {
  position: absolute;
  left: 0;
  color: var(--gray-400);
  width: 22px;
  height: 22px;
}

.search-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.search-close:hover {
  background: var(--primary-bg);
  color: var(--primary);
  transform: rotate(90deg);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding-right: 5px;
}

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

.search-results::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 10px;
}

.search-empty {
  text-align: center;
  margin-top: var(--sp-12);
  color: var(--gray-400);
}

.search-empty p {
  font-size: 1rem;
  font-family: var(--font-ui);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
  margin-bottom: var(--sp-2);
  text-decoration: none;
  border: 1px solid transparent;
}

.search-result-item:hover {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

.search-result-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: var(--primary-bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.search-result-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-info {
  flex: 1;
}

.search-result-info h4 {
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 2px;
  line-height: 1.2;
}

.search-result-info p {
  font-size: 0.8rem;
  color: var(--gray-400);
}

@media (max-width: 600px) {
  .search-container {
    padding: 20px var(--sp-4);
    max-width: 100%;
  }

  .search-overlay > .search-header {
    max-width: 100%;
    min-height: 96px;
    padding: 24px var(--sp-4) var(--sp-3);
  }

  .search-overlay > .search-results {
    top: 96px;
    max-width: 100%;
    height: calc(100vh - 96px);
    padding: var(--sp-4);
  }
}
