/* --- 搜索模块样式 --- */

/* 聊天记录搜索屏幕 */
#search-history-screen {
    background-color: #f7f7f7;
    flex-direction: column;
}

.search-header {
    background-color: #fff;
    padding: 10px 15px;
    padding-top: max(10px, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.search-input-wrapper {
    flex-grow: 1;
    background-color: #f2f2f2;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input-wrapper svg {
    color: #999;
    flex-shrink: 0;
}

.search-input-wrapper input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 14px;
    color: #333;
    padding: 0;
}

.search-input-wrapper input:focus {
    outline: none;
}

.search-cancel-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 15px;
    font-weight: 500;
    padding: 0;
    cursor: pointer;
}

.search-filter-bar {
    background-color: #fff;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.search-scope-select {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.search-scope-select.active {
    background-color: #f0f0f0;
    color: #333;
    font-weight: 500;
}

.search-option-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0;
}

.search-result-item {
    background-color: #fff;
    padding: 12px 15px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-item:active {
    background-color: #f9f9f9;
}

.result-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

.result-sender {
    font-weight: 500;
    color: #666;
}

.result-text {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.highlight {
    color: var(--primary-color);
    font-weight: bold;
}

.scope-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
}

.scope-modal.visible {
    display: flex;
}

.scope-modal-content {
    background-color: #fff;
    width: 80%;
    max-width: 300px;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.scope-list {
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.scope-item {
    padding: 10px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

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

.scope-item.selected {
    color: var(--primary-color);
    font-weight: bold;
}

/* --- 表情包搜索 Tag 样式 --- */
.sticker-search-tag {
    display: flex;
    align-items: center;
    padding: 0 10px !important; /* 覆盖默认 padding */
    width: 36px; /* 初始宽度，只够放图标 */
    height: 30px; /* 与其他 tag 高度一致 */
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.5, 1), background-color 0.3s ease, border-color 0.3s ease;
    background-color: #f5f5f5; /* 默认背景 */
    cursor: pointer;
    box-sizing: border-box;
    border-radius: 15px !important; /* 圆角 */
    border: 1px solid transparent;
}

.sticker-search-tag:hover {
    background-color: #e0e0e0;
}

.sticker-search-tag.expanded {
    width: 140px; /* 展开宽度 */
    background-color: #fff; /* 展开后背景变白 */
    border-color: var(--primary-color); /* 高亮边框 */
    cursor: text;
}

.sticker-search-tag .search-icon {
    flex-shrink: 0;
    color: #666;
    width: 16px;
    height: 16px;
}

.sticker-search-tag.expanded .search-icon {
    color: var(--primary-color);
}

.sticker-search-tag .sticker-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    margin-left: 6px;
    width: 100%;
    color: #333;
    padding: 0;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s ease 0.1s; /* 延迟显示文字 */
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    z-index: 10;
    position: relative;
}

.sticker-search-tag.expanded .sticker-search-input {
    opacity: 1;
}
