/**
 * search-overlay.css — 검색 입력창·드롭다운만 담당
 * .global-header, .header-container 등 레이아웃은 layout.css에서만 정의. 여기서 건드리지 않음.
 */

.search-input-wrapper {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    /* Center-aligned for single line stability */
    /* Center-aligned for single line stability */
    background: var(--bg-glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: var(--glass-border);
    border-radius: 30px;
    height: auto;
    min-height: 52px;
    padding: 6px 20px;
    /* Reduced vertical padding */
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.search-input-wrapper:focus-within {
    background: var(--bg-glass-heavy);
    border-color: var(--border-medium);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(1px);
}

.bubble-container {
    display: flex;
    flex-wrap: wrap;
    /* Allow vertical wrapping */
    align-items: center;
    gap: 8px;
    flex: 1;
    min-height: 28px;
    overflow: visible;
    /* No scroll needed */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.bubble-container::-webkit-scrollbar {
    display: none;
}

.search-bubble {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    /* More compact */
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 30px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    white-space: nowrap;
}

.search-bubble:hover {
    background: var(--bg-glass-heavy);
    transform: scale(0.97);
}

.search-bubble.tag {
    background: rgba(0, 122, 255, 0.15);
    color: #007aff;
    border-color: rgba(0, 122, 255, 0.2);
}

.search-bubble.board {
    background: rgba(175, 82, 222, 0.1);
    color: #af52de;
    border-color: rgba(175, 82, 222, 0.1);
}

.bubble-remove {
    margin-left: 6px;
    font-size: 16px;
    line-height: 1;
    opacity: 0.5;
}

.search-bubble:hover .bubble-remove {
    opacity: 1;
}

.search-icon {
    color: var(--text-secondary);
    font-size: 18px;
    flex-shrink: 0;
}

.search-input-field {
    border: none;
    background: transparent;
    font-size: 17px;
    /* Matches compact feel */
    font-weight: 500;
    outline: none;
    flex: 1;
    min-width: 140px;
    color: var(--text-primary);
    height: 36px;
    /* Standard single-line height */
}

.search-input-field::placeholder {
    color: var(--text-muted);
}

.close-btn-inline {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-top: 2px;
}

.close-btn-inline:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.close-btn-inline.hidden {
    display: none;
}

/* Search Dropdown - Hanging from the Notch */
.search-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    left: 0;
    right: 0;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: var(--glass-border);
    z-index: 1001;
    overflow-y: auto;
    max-height: 500px;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-dropdown.shake-error {
    animation: shake 0.4s ease-in-out;
    background: rgba(255, 230, 230, 0.9);
    border-color: rgba(255, 0, 0, 0.2);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-6px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(6px);
    }
}

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

.search-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.search-dropdown.hidden {
    display: none;
}

.search-suggestions {
    padding: 20px;
}

.suggestion-section {
    margin-bottom: 24px;
}

.suggestion-section:last-child {
    margin-bottom: 0;
}

.suggestion-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 18px;
    font-weight: 800;
    letter-spacing: 1px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tag-suggestion.hidden {
    display: none;
}

.tag-suggestion {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: rgba(0, 122, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 30px;
    font-size: 13px;
    color: #007aff;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.recent-searches {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-msg {
    color: #ccc;
    font-size: 15px;
    font-style: italic;
}

/* Autocomplete/Dynamic Item Styles */
.suggestion-section h4 {
    font-size: 13px;
    color: var(--text-muted);
    padding: 0 4px 12px 4px;
    /* Reduced side padding */
    margin: 0;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.ac-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ac-item {
    padding: 14px 20px;
    font-size: 16px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.2s;
    border-radius: 12px;
    margin: 2px 0;
}

.ac-item:hover {
    background: var(--bg-secondary);
}

.ac-item i {
    width: 20px;
    text-align: center;
    color: #007aff;
    opacity: 0.8;
}

.ac-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.ac-desc {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-left: 4px;
}

.ac-item .count {
    margin-left: auto;
    font-size: 12px;
    color: #007aff;
    background: rgba(0, 122, 255, 0.1);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}
