/**
 * @file search.css
 * @description 검색창 UI 및 결과 모달 스타일
 */

/* ==========================================================================
   1. 검색 입력창 (Nav Search)
   ========================================================================== */

.nav-search {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 100;
}

#search-form {
    display: flex;
    align-items: center;
    border: 1px solid #a2a9b1;
    border-radius: 2px;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden; /* 입력창과 버튼의 경계를 자연스럽게 처리 */
}

/* 검색창 포커스 시 위키피디아 스타일의 강조 효과 */
#search-form:focus-within {
    border-color: #36c;
    box-shadow: inset 0 0 0 1px #36c;
}

#search-input {
    border: none;
    padding: 6px 10px;
    font-size: 14px;
    outline: none;
    width: 200px;
    background: transparent;
}

#search-button {
    background: #f8f9fa;
    border: none;
    border-left: 1px solid #a2a9b1;
    color: #202122;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#search-button:hover {
    background-color: #eaecef;
}

/* ==========================================================================
   2. 검색 결과 모달 (Overlay & Modal)
   ========================================================================== */

#search-overlay {
    display: none; /* JS에서 제어 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 80px;
    backdrop-filter: blur(2px); /* 배경 살짝 흐리게 */
}

.search-modal {
    background-color: #fff;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    border-radius: 4px;
    overflow-y: auto;
    padding: 0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    border: 1px solid #a2a9b1;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eaecef;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.search-header h2 {
    margin: 0;
    font-size: 18px;
    color: #202122;
}

#search-close {
    font-size: 24px;
    cursor: pointer;
    color: #72777d;
    line-height: 1;
}

#search-close:hover {
    color: #000;
}

/* ==========================================================================
   3. 검색 결과 아이템 (Results List)
   ========================================================================== */

#search-results-list {
    padding: 10px 0;
}

.search-item {
    padding: 12px 20px;
    transition: background-color 0.1s;
    border-bottom: 1px solid #f8f9fa;
}

.search-item:hover {
    background-color: #f8f9fa;
}

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

.search-item-title {
    font-size: 16px;
    font-weight: bold;
    color: #36c; /* 위키피디아 블루 */
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}

.search-item-title:hover {
    text-decoration: underline;
}

.search-item-snippet {
    margin: 0;
    font-size: 14px;
    color: #54595d;
    line-height: 1.6;
}

/* 검색 키워드 하이라이트 */
.search-item-snippet strong {
    color: #000;
    background-color: #fffbdd; /* 연한 노란색 배경 */
    font-weight: bold;
    padding: 0 2px;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #72777d;
    font-size: 15px;
}

/* ==========================================================================
   4. 반응형 디자인 (Responsive)
   ========================================================================== */

@media (max-width: 720px) {
    #search-input {
        width: 100%;
    }
    #search-form {
        width: 100%;
    }
    .search-modal {
        width: 95%;
        margin: 0 10px;
    }
}
