/* ===== 搜索卡片：尺寸变量 ===== */
.search-card--small {
    --sc-py: 24px;
    --sc-px: 20px;
    --sc-title: 20px;
    --sc-desc: 13px;
    --sc-input-h: 40px;
    --sc-input-fs: 14px;
    --sc-gap: 12px;
}

.search-card--medium {
    --sc-py: 40px;
    --sc-px: 28px;
    --sc-title: 26px;
    --sc-desc: 14px;
    --sc-input-h: 48px;
    --sc-input-fs: 15px;
    --sc-gap: 16px;
}

.search-card--large {
    --sc-py: 64px;
    --sc-px: 36px;
    --sc-title: 34px;
    --sc-desc: 16px;
    --sc-input-h: 56px;
    --sc-input-fs: 16px;
    --sc-gap: 20px;
}

/* ===== 容器 ===== */
.search-card {
    position: relative;
    padding: var(--sc-py) var(--sc-px);
    border-radius: var(--border-radius);
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    margin-bottom: 16px;
}

.search-card--bg-image {
    background-position: center;
    background-repeat: no-repeat;
    border-color: transparent;
}

.search-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    border-radius: inherit;
    z-index: 1;
}

.search-card__inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: var(--sc-gap);
    max-width: 720px;
}

.search-card--center .search-card__inner {
    margin: 0 auto;
    text-align: center;
    align-items: center;
}

.search-card--left .search-card__inner {
    margin: 0;
    text-align: left;
    align-items: flex-start;
}

/* ===== 标题与描述 ===== */
.search-card__title {
    margin: 0;
    font-size: var(--sc-title);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

.search-card__desc {
    margin: 0;
    font-size: var(--sc-desc);
    line-height: 1.6;
    color: var(--text-secondary);
}

/* 背景图模式：文字反白 */
.search-card--bg-image .search-card__title,
.search-card--bg-image .search-card__desc {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== 表单 ===== */
.search-card__form {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: var(--sc-input-h);
    background-color: var(--bg-card);
    border: 1px solid var(--border-input);
    border-radius: calc(var(--sc-input-h) / 2);
    overflow: visible;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-card__form:focus-within {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-color) 18%, transparent);
}

/* 分类下拉 */
.search-card__category {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 12px 0 18px;
    border-right: 1px solid var(--border-secondary);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-card__cat-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    outline: none;
    font-size: var(--sc-input-fs);
    color: var(--text-primary);
    padding: 0 18px 0 0;
    height: 100%;
    cursor: pointer;
    max-width: 120px;
}

.search-card__cat-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-tertiary);
}

/* 输入框区域 */
.search-card__field {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.search-card__input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0 18px;
    background: transparent;
    border: 0;
    outline: none;
    font-size: var(--sc-input-fs);
    color: var(--text-primary);
}

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

/* 提交按钮 */
.search-card__btn {
    flex-shrink: 0;
    width: var(--sc-input-h);
    height: 100%;
    margin: -1px -1px -1px 0;
    border: 0;
    border-radius: calc(var(--sc-input-h) / 2);
    background-color: var(--theme-color);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s, transform 0.2s;
}

.search-card__btn:hover {
    filter: brightness(1.08);
}

.search-card__btn:active {
    transform: scale(0.96);
}

/* ===== 搜索历史 ===== */
.search-card__history {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 5;
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 8px 0;
    text-align: left;
}

.search-card__history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px 8px;
    border-bottom: 1px solid var(--border-secondary);
    margin-bottom: 4px;
}

.search-card__history-title {
    font-size: 12px;
    color: var(--text-tertiary);
}

.search-card__history-clear {
    background: transparent;
    border: 0;
    color: var(--text-tertiary);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.search-card__history-clear:hover {
    color: var(--color-link);
}

.search-card__history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-card__history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: background-color 0.15s;
}

.search-card__history-item:hover {
    background-color: var(--bg-hover);
}

.search-card__history-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-card__history-remove {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.search-card__history-remove:hover {
    background-color: var(--bg-hover);
    color: var(--color-danger);
}

/* ===== 热词 ===== */
.search-card__hotwords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.search-card--center .search-card__hotwords {
    justify-content: center;
}

.search-card__hotwords-label {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-right: 4px;
}

.search-card--bg-image .search-card__hotwords-label {
    color: rgba(255, 255, 255, 0.85);
}

.search-card__hotword {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    border-radius: 14px;
    font-size: 13px;
    color: var(--text-secondary);
    background-color: var(--bg-hover);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, transform 0.15s;
}

.search-card__hotword:hover {
    background-color: var(--theme-color);
    color: #fff;
    transform: translateY(-1px);
}

.search-card--bg-image .search-card__hotword {
    background-color: rgba(255, 255, 255, 0.18);
    color: #fff;
    backdrop-filter: blur(6px);
}

.search-card--bg-image .search-card__hotword:hover {
    background-color: rgba(255, 255, 255, 0.32);
}

/* ===== 显示位置控制（PC ≥ 641px / 移动 < 641px） ===== */
@media (min-width: 641px) {
    .search-card--hide-pc { display: none !important; }
}

@media (max-width: 640px) {
    .search-card--hide-mobile { display: none !important; }

    .search-card--medium {
        --sc-py: 28px;
        --sc-px: 18px;
        --sc-title: 22px;
        --sc-input-h: 44px;
    }

    .search-card--large {
        --sc-py: 40px;
        --sc-px: 20px;
        --sc-title: 26px;
        --sc-input-h: 48px;
    }

    .search-card__category {
        padding: 0 8px 0 14px;
    }

    .search-card__cat-select {
        max-width: 80px;
        font-size: 13px;
    }

    .search-card__input {
        padding: 0 12px;
    }
}
