/* =========================================================
   LinkNest 资源搜索 - 主样式
   视觉参考 quanpan.xyz（全盘搜索），浅色现代风格
   ========================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background-color: #eaeff5;
    color: #1f2937;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { -webkit-user-drag: none; }

main { margin: 0 auto; max-width: 860px; padding: 0 20px; }

/* ==================== 品牌区 ==================== */
.brand {
    display: grid;
    justify-items: center;
    gap: 18px;
    padding: 8vh 0 0;
    text-align: center;
    transition: transform .3s ease, padding .3s ease;
}

.brand-logo img {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    display: block;
    box-shadow: 0 10px 30px rgba(82, 104, 255, .28);
}

.brand-slogan {
    font-size: 30px;
    font-weight: 600;
    color: #222;
    letter-spacing: .5px;
    line-height: 1.3;
}

.brand-slogan-strong {
    background: linear-gradient(135deg, #cf54f7, #507dff, #19bc12);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.brand-subtitle {
    display: flex;
    align-items: center;
    gap: 24px;
    color: #5b6370;
    font-size: 14px;
}

.brand-subtitle-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.icon { display: inline-flex; align-items: center; justify-content: center; }

/* 对勾图标 */
.icon-yes {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #63df89, #5bcf2c);
    flex-shrink: 0;
}
.icon-yes::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

/* ==================== 搜索框 ==================== */
.search { margin-top: 32px; position: relative; }

.search-form {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e5e7ed;
    border-radius: 50px;
    padding: 0 8px 0 24px;
    height: 56px;
    box-shadow: 0 6px 24px rgba(30, 60, 120, .08);
    transition: background .2s, border-color .2s, box-shadow .2s;
}

.search-form:hover,
.search-form:focus-within {
    background: #f4faff;
    border-color: #9fb8ff;
    box-shadow: 0 8px 28px rgba(82, 104, 255, .16);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: #1f2937;
    height: 100%;
    min-width: 0;
}
.search-input::placeholder { color: #9aa3b2; }

/* 清除按钮 */
.search-clear {
    display: none;
    width: 30px;
    height: 30px;
    border: none;
    background: #eef2f6;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.search-clear:hover { background: #e5e9f0; }
.icon-no { position: relative; width: 14px; height: 14px; }
.icon-no::before,
.icon-no::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 2px;
    background: #6b7280;
    border-radius: 1px;
}
.icon-no::before { transform: translate(-50%, -50%) rotate(45deg); }
.icon-no::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* 搜索按钮 */
.search-btn {
    width: 96px;
    height: 42px;
    border: none;
    border-radius: 22px;
    background: linear-gradient(135deg, #4577fc, #2356dc);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 15px;
    flex-shrink: 0;
    transition: background .2s, transform .15s;
}
.search-btn:hover { background: linear-gradient(135deg, #5a86ff, #2f63f0); }
.search-btn:active { transform: scale(.97); }
.search-btn:disabled { opacity: .7; cursor: default; }
.icon-search { position: relative; width: 16px; height: 16px; }
.icon-search::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 11px;
    height: 11px;
    border: 2px solid #fff;
    border-radius: 50%;
}
.icon-search::after {
    content: '';
    position: absolute;
    right: -1px;
    bottom: 1px;
    width: 7px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transform: rotate(45deg);
}

.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 联想框（本地搜索历史） */
.suggest-box {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7ed;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(30, 60, 120, .12);
    overflow: hidden;
    z-index: 20;
}
.suggest-item {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 8px;
}
.suggest-item:hover { background: #f4faff; color: #2356dc; }
.suggest-word { flex: 1; word-break: break-all; }
.suggest-tag { color: #9aa3b2; font-size: 12px; flex-shrink: 0; }

/* ==================== 热搜榜 ==================== */
.category-list { margin-top: 22px; text-align: center; }
.category-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.category-title-main {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 6px;
    background: linear-gradient(90deg, #4577fc, #7c3aed, #4577fc);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: titleShimmer 3s linear infinite;
}
.category-title-sub {
    font-size: 12px;
    color: #8a94a6;
    letter-spacing: 2px;
}
@keyframes titleShimmer {
    to { background-position: 200% center; }
}
.category-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.category-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e5e7ed;
    border-radius: 20px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px) scale(.9);
    transition: transform .25s, box-shadow .25s, border-color .25s, color .25s, background .25s;
    animation: categoryPop .5s ease forwards;
}
@keyframes categoryPop {
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.category-item:hover {
    border-color: #2356dc;
    color: #fff;
    background: linear-gradient(135deg, #4577fc, #2356dc);
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 8px 20px rgba(35, 86, 220, .35);
}
.category-item:active { transform: translateY(0) scale(.97); }

/* ==================== 搜索 loading ==================== */
.search-loading { text-align: center; margin-top: 40px; }
.loading { overflow: hidden; -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent); }
.loading-box {
    display: flex;
    width: max-content;
    animation: marquee 24s linear infinite;
}
.loading-dot {
    width: 58px;
    height: 58px;
    margin: 0 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.loading-dot img {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(30, 60, 120, .12);
}
.loader-text { margin-top: 20px; font-size: 15px; color: #5b6370; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ==================== 结果区 ==================== */
.result-main { margin-top: 12px; padding-bottom: 40px; }

.result-meta { font-size: 13px; color: #6b7280; padding: 8px 6px; }
.result-meta .keyword { color: #2356dc; font-weight: 600; }
.result-meta .count { color: #2356dc; font-weight: 600; }

/* 搜索结果顶部来源说明：浅灰底提示条，随结果区整体显隐 */
.source-notice {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0 0 8px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.6;
    color: #6b7280;
    background: #f6f8fb;
    border: 1px solid #eef1f6;
    border-radius: 6px;
}
.source-notice b { color: #4b5563; font-weight: 600; }

.tabbar {
    display: flex;
    gap: 10px;
    padding: 8px 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e5e7ed;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
    flex-shrink: 0;
}
.tab-item:hover { border-color: #9fb8ff; color: #2356dc; }
.tab-item.active {
    color: #fff;
    border-color: transparent;
    background: var(--c, #2356dc);
    box-shadow: 0 4px 14px rgba(35, 86, 220, .25);
}
.tab-item.active:hover { color: #fff; }
.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 11px;
    background: #eef2f6;
    color: #5b6370;
}
.tab-item.active .tab-count { background: rgba(255, 255, 255, .25); color: #fff; }

.tabpanel { display: flex; flex-direction: column; gap: 12px; }

/* 结果卡片 */
.result-card {
    background: #fff;
    border: 1px solid #e5e7ed;
    border-radius: 16px;
    padding: 16px 18px;
    transition: box-shadow .2s, transform .2s;
    /* 纵向两行：第一行 = 徽标 + 标题 + 提取按钮，第二行 = 活动行（仅百度卡片有） */
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.result-card:hover { box-shadow: 0 8px 24px rgba(30, 60, 120, .1); transform: translateY(-1px); }

.card-top { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }

/* 提取按钮：恒在卡片右侧，不随标题换行 */
.card-extract { flex-shrink: 0; }

.platform-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    background: #cacaca;
}
.platform-badge img { width: 100%; height: 100%; }

.card-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
    word-break: break-all;
}

.card-status {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.card-status.ok { background: #e0fde0; color: #15803d; }
.card-status.warn { background: #fff7e6; color: #b45309; }
.card-status.bad { background: #ffebeb; color: #d53131; }

.card-note {
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.card-links {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.card-link {
    flex: 1;
    min-width: 220px;
    font-size: 13px;
    color: #4b5563;
    background: #f7f8f9;
    border: 1px solid #eef2f6;
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    word-break: break-all;
}
.card-link .url { flex: 1; color: #2563eb; }
.card-link .pwd { flex-shrink: 0; color: #4b5563; }
.card-link .pwd b { color: #2356dc; }

.card-actions { display: flex; gap: 8px; flex-shrink: 0; margin-top: 12px; }

.btn {
    border: none;
    border-radius: 9px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, #4577fc, #2356dc); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #5a86ff, #2f63f0); }
.btn-ghost { background: #eef2f6; color: #4b5563; }
.btn-ghost:hover { background: #e5e9f0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card-meta {
    margin-top: 10px;
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: #9aa3b2;
}

/* 空态 / 错误态 */
.empty, .error-box { text-align: center; padding: 56px 0; color: #8a94a6; font-size: 14px; }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.error-box { color: #d53131; }

/* ==================== 转存弹窗 ==================== */
.transfer-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .55);
    padding: 20px;
}
.transfer-modal[hidden] { display: none; }
.transfer-modal-box {
    width: 460px;
    max-width: 100%;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    animation: modal-in .2s ease;
}
@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to { opacity: 1; transform: none; }
}
.transfer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eef2f6;
}
.transfer-title { font-size: 16px; font-weight: 600; }
.transfer-close {
    border: none;
    background: transparent;
    font-size: 22px;
    color: #8a94a6;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    line-height: 1;
}
.transfer-close:hover { background: #f3f4f6; color: #1f2937; }

.transfer-body { padding: 20px; }
.transfer-res-title {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 14px;
    word-break: break-all;
    line-height: 1.5;
}
.account-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}
.account-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e5e7ed;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s;
}
.account-item:hover { border-color: #9fb8ff; }
.account-item.selected {
    border-color: #2356dc;
    background: #f4faff;
    box-shadow: 0 0 0 1px #2356dc inset;
}
.account-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #cacaca;
    flex-shrink: 0;
    position: relative;
}
.account-item.selected .account-radio { border-color: #2356dc; }
.account-item.selected .account-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #2356dc;
}
.account-info { flex: 1; min-width: 0; }
.account-name { font-size: 14px; color: #1f2937; font-weight: 500; }
.account-dir { font-size: 12px; color: #8a94a6; margin-top: 2px; word-break: break-all; }
.account-empty { text-align: center; padding: 30px 0; color: #8a94a6; font-size: 14px; }

.transfer-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.transfer-tip {
    font-size: 12px;
    color: #8a94a6;
    margin-top: 12px;
    text-align: center;
}

/* ==================== 转存弹窗：加载/失败/二维码 ==================== */
.transfer-loading {
    text-align: center;
    padding: 40px 0;
    color: #8a94a6;
    font-size: 14px;
}
.transfer-error {
    text-align: center;
    padding: 30px 10px;
    color: #d53131;
    font-size: 14px;
}
.qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0 4px;
}
.qr-box {
    width: 210px;
    height: 210px;
    border: 1px solid #eef2f6;
    border-radius: 14px;
    padding: 5px;
    background: #fff;
}
.qr-box canvas,
.qr-box img {
    display: block;
    width: 200px;
    height: 200px;
}
.qr-tip { font-size: 13px; color: #4b5563; }
.qr-pwd { font-size: 14px; color: #4b5563; }
.qr-pwd b { color: #2356dc; }
.qr-hint { font-size: 12px; color: #b45309; }
.qr-timer { width: 100%; max-width: 220px; }
.qr-progress {
    height: 6px;
    border-radius: 3px;
    background: #eef2f6;
    overflow: hidden;
}
.qr-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 1s linear;
}
.qr-progress-bar.safe { background: #22c55e; }
.qr-progress-bar.warn { background: #f59e0b; }
.qr-progress-bar.danger { background: #ef4444; }
.qr-countdown {
    margin-top: 6px;
    text-align: center;
    font-size: 13px;
    color: #4b5563;
}
.qr-countdown.expired { color: #d53131; font-weight: 600; }
.qr-wrap.expired { opacity: .55; filter: grayscale(1); }
.qr-wrap.expired .qr-box { pointer-events: none; }

/* 移动端打开分享链接按钮 */
.transfer-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 30px;
    background: linear-gradient(135deg, #4577fc, #2356dc);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 26px;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(35, 86, 220, .3);
    transition: transform .2s, box-shadow .2s;
}
.transfer-open-btn:active { transform: scale(.97); }
.qr-wrap.expired .transfer-open-btn { opacity: .5; pointer-events: none; }

/* ==================== toast ==================== */
.toast {
    position: fixed;
    left: 50%;
    bottom: 60px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(31, 41, 55, .92);
    color: #fff;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 22px;
    opacity: 0;
    pointer-events: none;
    transition: all .25s;
    z-index: 200;
    max-width: 82vw;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================== footer ==================== */
.footbar {
    text-align: center;
    padding: 34px 0 26px;
    font-size: 13px;
    color: #8a94a6;
}
.footbar-disclaimer {
    max-width: 720px;
    margin: 0 auto 18px;
    padding: 0 16px;
    text-align: left;
    font-size: 12px;
    line-height: 1.9;
    color: #9aa3b2;
}
.footbar-disclaimer p { margin: 6px 0; }
.footbar-disclaimer b { color: #7d8794; }
.footbar-contact { color: #2563eb; }
.footbar-feedback {
    margin: 0 0 10px;
    font-size: 13px;
    color: #6b7280;
}
.footbar-feedback b { color: #2356dc; cursor: pointer; }

/* 搜索中的品牌收缩 */
body.page-searching .brand { transform: scale(.8); padding-top: 4vh; }
body.page-searching .category-list { display: none !important; }

/* ==================== 响应式 ==================== */
@media only screen and (max-width: 767px) {
    main { padding: 0 16px; }
    .brand { padding-top: 6vh; gap: 14px; }
    .brand-logo img { width: 66px; height: 66px; border-radius: 18px; }
    .brand-slogan { font-size: 21px; }
    .brand-subtitle { gap: 12px; font-size: 12px; flex-wrap: wrap; justify-content: center; }
    .search { margin-top: 24px; }
    .search-form { height: 50px; padding-left: 18px; gap: 6px; }
    .search-btn { width: 62px; height: 38px; }
    .category-item { font-size: 12px; padding: 6px 12px; }
    .result-card { padding: 14px; }
    .card-links { flex-direction: column; align-items: stretch; }
    .card-actions { justify-content: flex-end; }
    .card-link { min-width: 0; }
}

/* ==================== 结果卡片内的活动行 ==================== */
/* 第一行放徽标/标题/提取按钮（见 .card-top），活动行作为卡片第二个子元素整宽独占一行 */
.card-promo {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #fff8ec;
    border: 1px solid #ffe3bf;
    font-size: 12px;
    line-height: 1.55;
    color: #a8630a;
}

.card-promo .promo-tag {
    flex-shrink: 0;
    padding: 0 6px;
    border-radius: 20px;
    background: #ff8a2b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
}

.card-promo .promo-text {
    flex: 1;
    word-break: break-all;
}

@media only screen and (max-width: 767px) {
    .card-promo { font-size: 11px; padding: 5px 8px; }
}
