/* ============================================
   Search - Spotlight / Command Palette Style
   全局搜索模态框 - Spotlight 风格
   ============================================ */

/* 搜索触发按钮（导航栏上的图标） */
.navbar-search-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
}

.search-trigger {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #64748b;
    font-size: 15px;
    background: transparent;
}
@media (hover: hover) and (pointer: fine) {
    /* 触摸端不套用悬停/按压背景：手指点过之后 :hover 会残留，看起来像点完仍高亮。
       桌面端 (hover: hover) 成立，样式照常生效。 */
.search-trigger:hover {
    background: #f1f5f9;
    color: #0f172a;
}
}


/* ===== Spotlight 搜索遮罩层 ===== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: min(18vh, 160px);
    background: rgba(15, 23, 42, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    visibility: hidden;
    pointer-events: none;
    transition: background 0.35s ease, backdrop-filter 0.35s ease, visibility 0s 0.35s;
}

.search-overlay.active {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    visibility: visible;
    pointer-events: auto;
    transition: background 0.35s ease, backdrop-filter 0.35s ease, visibility 0s;
}

/* ===== Spotlight 搜索对话框 ===== */
.search-dialog {
    width: 580px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: scale(0.95) translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-overlay.active .search-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ===== 搜索输入区域 ===== */
.search-input-area {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 64px;
    border-bottom: 1px solid #f1f5f9;
    gap: 14px;
}

.search-input-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    color: #94a3b8;
    position: relative;
}

.search-input-icon i {
    font-size: 18px;
}

.search-input-field {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 17px;
    font-weight: 400;
    color: #1e293b;
    padding: 0;
    height: 100%;
    letter-spacing: -0.01em;
}

.search-input-field::placeholder {
    color: #cbd5e1;
    font-weight: 400;
}

.search-input-field:focus::placeholder {
    color: #e2e8f0;
}

.search-kbd-hint {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    font-family: var(--blog-font-sans);
    line-height: 1;
}

/* ===== 搜索操作区 ===== */
.search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.search-submit-btn {
    display: none;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 20px;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 6px;
    white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
    /* 触摸端不套用悬停/按压背景：手指点过之后 :hover 会残留，看起来像点完仍高亮。
       桌面端 (hover: hover) 成立，样式照常生效。 */
.search-submit-btn:hover {
    background: #1e293b;
}
}


.search-submit-btn.visible {
    display: inline-flex;
}

.search-submit-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.search-clear-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
    /* 触摸端不套用悬停/按压背景：手指点过之后 :hover 会残留，看起来像点完仍高亮。
       桌面端 (hover: hover) 成立，样式照常生效。 */
.search-clear-btn:hover {
    background: #e2e8f0;
    color: #334155;
}
}


.search-clear-btn.visible {
    display: inline-flex;
}

/* ===== 搜索提示区 ===== */
.search-hints {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid #f8fafc;
    background: #fafbfc;
}

.search-hint-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
}

.search-hint-item kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    font-family: var(--blog-font-sans);
}

/* ===== 搜索结果统计 ===== */
.search-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    margin: 0;
    background: #0f172a;
    border-radius: 14px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.search-stats .stats-icon {
    display: none;
}

.search-stats .stats-content {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.search-stats .count {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
}

.search-stats .keyword {
    font-weight: 600;
    color: #8faabe;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ===== 搜索结果列表 ===== */
.search-result-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 20px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
}
@media (hover: hover) and (pointer: fine) {
    /* 触摸端不套用悬停/按压背景：手指点过之后 :hover 会残留，看起来像点完仍高亮。
       桌面端 (hover: hover) 成立，样式照常生效。 */
.search-result-item:hover {
    background: #f8fafc;
}
}


.search-result-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 14px;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-snippet {
    display: none;
    margin: 2px 0 0;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-date {
    font-size: 12px;
    color: #94a3b8;
    flex-shrink: 0;
}

/* 搜索高亮 */
.search-highlight {
    background-color: #e8edf4;
    color: #3d5a80;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 600;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .search-overlay {
        padding-top: 0;
        align-items: center;
        justify-content: center;
    }

    .search-dialog {
        width: calc(100vw - 32px);
        max-width: 420px;
        border-radius: 20px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .search-input-area {
        height: 56px;
        padding: 0 16px;
    }

    .search-input-field {
        font-size: 16px;
    }

    .search-kbd-hint {
        display: none;
    }

    .search-hints {
        display: none;
    }

    .search-submit-btn {
        display: inline-flex;
        height: 36px;
        padding: 0 16px;
        font-size: 14px;
    }

    .search-trigger {
        width: 36px;
        height: 36px;
        font-size: 14px;
        border-radius: 10px;
    }

    .search-stats {
        margin: 12px 16px;
        border-radius: 12px;
        font-size: 13px;
        padding: 12px 16px;
    }

    .search-result-item {
        padding: 12px;
    }

    .search-result-icon {
        width: 36px;
        height: 36px;
    }

    .search-result-title {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .search-dialog {
        width: calc(100vw - 24px);
        max-width: 360px;
        border-radius: 16px;
    }

    .search-input-area {
        height: 52px;
        padding: 0 14px;
        gap: 10px;
    }

    .search-input-field {
        font-size: 15px;
    }

    .search-submit-btn {
        height: 34px;
        padding: 0 14px;
        font-size: 13px;
    }

    .search-stats {
        margin: 10px 14px;
        font-size: 12px;
        padding: 10px 14px;
    }

    .search-result-item {
        padding: 10px;
        gap: 10px;
    }

    .search-result-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        font-size: 12px;
    }

    .search-result-title {
        font-size: 13px;
    }

    .search-result-date {
        font-size: 11px;
    }
}

/* ===== 暗色模式 ===== */
@media (prefers-color-scheme: dark) {
    .search-dialog {
        background: #1e293b;
        box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
    }

    .search-input-area {
        border-bottom-color: #334155;
    }

    .search-input-field {
        color: #f1f5f9;
    }

    .search-input-field::placeholder {
        color: #475569;
    }

    .search-kbd {
        background: #334155;
        border-color: #475569;
        color: #64748b;
    }

    .search-hints {
        background: #162032;
        border-top-color: #334155;
    }

    .search-hint-item {
        color: #475569;
    }

    .search-hint-item kbd {
        background: #1e293b;
        border-color: #475569;
        color: #64748b;
    }

    @media (hover: hover) and (pointer: fine) {


    .search-result-item:hover {
        background: #334155;
    }


    }

    .search-result-icon {
        background: #334155;
        color: #94a3b8;
    }

    .search-result-title {
        color: #f1f5f9;
    }

    .search-result-snippet {
        color: #64748b;
    }

    .search-result-date {
        color: #64748b;
    }

    .search-clear-btn {
        background: #334155;
        color: #94a3b8;
    }

    @media (hover: hover) and (pointer: fine) {


    .search-clear-btn:hover {
        background: #475569;
        color: #e2e8f0;
    }


    }

    .search-highlight {
        background-color: rgba(91, 127, 166, 0.2);
        color: #8faabe;
    }
}
