/* Prompt 工具箱 · Apple 风格组件层（加载顺序：base → components → modes） */
/* Lucide 统一尺寸规则：随父级字号缩放 */
.lucide { width: 1em; height: 1em; stroke-width: 2; flex-shrink: 0; }

.action-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 7px 14px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}
.action-btn .lucide { width: 15px; height: 15px; }
.action-btn:hover {
    background: var(--hover);
    border-color: var(--border);
}
.action-btn:active {
    background: var(--hover-strong);
}
.action-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.action-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.action-btn.primary:active {
    background: var(--accent-active);
}

.theme-btn,
.auth-btn {
    display: flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--fg);
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.theme-btn .lucide,
.auth-btn .lucide { width: 15px; height: 15px; }
.theme-btn:hover,
.auth-btn:hover { background: var(--hover); }
.theme-btn.active,
.auth-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

#searchBtn { display: none; }

/* 媒体查询：位置与原文件一致（在 .card 之前），保持层叠语义不变 */
@media (max-width: 620px) {
    .grid { grid-template-columns: 1fr; }
    .search-box input { max-width: 140px; }
    .header-inner { padding: 0 16px; }
    .main { padding: 0 16px; }
    .filter-bar { padding: 4px 8px; margin-top: 10px; }
    .logo-text p { display: none; }
    .controls .search-box { display: none; }
    #searchBtn { display: flex; }
    .toolbar-left, .toolbar-right { flex-wrap: wrap; }
}
@media (max-width: 480px) {
    .shortcut-hint { display: none; }
    .search-box input { max-width: 120px; font-size: 12px; padding: 7px 32px 7px 28px; }
    .search-box > .lucide { left: 9px; }
    .controls { gap: 4px; }
    .action-btn { padding: 7px 8px; font-size: 12px; }
    .section-title { font-size: 15px; }
    .card { padding: 18px; }
    .overlay { padding: 12px; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 16px 16px 0; }
    .modal-footer { padding: 12px 16px 16px; }
}
@media (max-width: 380px) {
    .search-box input { max-width: 90px; }
}

/* 工具栏新增/导入：与标签/批量按钮高度对齐（仅作用于 toolbar-action，不影响批量模式条） */
.toolbar-action { padding: 5px 14px; font-size: 12px; }
@media (max-width: 480px) {
    .toolbar-action { padding: 5px 10px; font-size: 11px; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
}
.card-header h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--fg);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header h3 .lucide {
    color: var(--accent);
    width: 16px;
    height: 16px;
}

.tag {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    white-space: nowrap;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.tag.c0 {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}
.tag.c1 {
    background: var(--ph-bg);
    color: var(--ph-fg);
}
.tag.c2 {
    background: rgba(255, 159, 10, 0.16);
    color: var(--warn);
}
.tag.c3 {
    background: rgba(175, 82, 222, 0.16);
    color: #af52de;
}
.tag.c4 {
    background: rgba(90, 200, 250, 0.16);
    color: #5ac8fa;
}
.tag.c5 {
    background: rgba(255, 55, 95, 0.13);
    color: #ff375f;
}

.card-desc {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 14px;
    line-height: 1.5;
}
.card-desc b {
    color: var(--fg);
    font-weight: 550;
}

.prompt-block {
    background: var(--fill);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    position: relative;
}
.prompt-text {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--fg);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.65;
}
.prompt-text .ph {
    color: var(--ph-fg);
    font-weight: 500;
    background: var(--ph-bg);
    padding: 0 3px;
    border-radius: 4px;
}

/* ── Prompt 折叠展示 ── */
.prompt-block { --prompt-collapse-h: 130px; }
.prompt-block.collapsible .prompt-text {
    max-height: var(--prompt-collapse-h);
    overflow: hidden;
}
.prompt-block.collapsible .prompt-text.expanded {
    max-height: none;
}
.prompt-block.collapsible .prompt-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46px;
    background: linear-gradient(180deg, transparent, var(--fill));
    pointer-events: none;
}
.prompt-block.collapsible .prompt-text.expanded + .prompt-fade {
    display: none;
}
.prompt-expand {
    display: none;
    position: absolute;
    bottom: 6px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    align-items: center;
    gap: 2px;
    transition: color 0.15s, background 0.15s;
}
.prompt-block.collapsible .prompt-expand {
    display: inline-flex;
}
.prompt-expand .lucide { width: 13px; height: 13px; }
.prompt-expand:hover {
    color: var(--fg);
    background: var(--hover);
}

/* ── 弹窗 Prompt 只读预览样式见 modes.css ── */

.tip {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: 10px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}
.tip .lucide {
    color: var(--warn);
    margin-top: 2px;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}
.tip b {
    color: var(--fg);
    font-weight: 550;
}

.card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    align-self: stretch;
    margin-top: 4px;
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.card-actions-left {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: auto;
    flex-wrap: wrap;
}
.card-actions-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.card-actions .copy-btn {
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 16px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    letter-spacing: 0.02em;
}
.card-actions .copy-btn .lucide { width: 14px; height: 14px; }
.card-actions .copy-btn:hover {
    background: var(--hover);
    border-color: var(--border);
}
.card-actions .copy-btn:active {
    transform: scale(0.97);
}
.card-actions .copy-btn.copied {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    width: 32px;
    height: 32px;
    border-radius: 9px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    opacity: 0;
}
.icon-btn .lucide { width: 15px; height: 15px; }
.card:hover .icon-btn {
    opacity: 1;
}
.icon-btn:hover {
    background: var(--hover);
    color: var(--fg);
}
.icon-btn.danger:hover {
    background: rgba(255, 59, 48, 0.12);
    color: var(--danger);
}

.empty-state {
    display: none;
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.empty-state.visible {
    display: block;
}
.empty-state .lucide {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
    color: var(--border);
    stroke-width: 1.5;
}
.empty-state h3 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 6px;
}
.empty-state p {
    font-size: 14px;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--toast-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    padding: 10px 20px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
}
.toast .lucide { width: 15px; height: 15px; color: var(--success); }
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden-file-input {
    display: none;
}

/* ── Search highlight ── */
.ph-hl { background: var(--hl-bg); color: var(--fg); padding: 1px 2px; border-radius: 3px; font-weight: 500; }

/* ── Use badge ── */
.use-badge { font-size: 11px; color: var(--muted); letter-spacing: 0.01em; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.use-badge .lucide { width: 12px; height: 12px; }
.ub-num { position: relative; cursor: help; }
.ub-num[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28, 28, 30, 0.92);
    color: #fff;
    font-size: 11px;
    line-height: 1.4;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 20;
}
.ub-num:hover::after { opacity: 1; }

/* ── Batch bar ── */
.batch-bar { display: none; align-items: center; gap: 10px; margin-bottom: 16px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--accent); border-radius: 14px; box-shadow: var(--shadow-sm); }
.batch-bar.open { display: flex; flex-wrap: wrap; }
.batch-bar .count { font-size: 13px; font-weight: 500; color: var(--fg); margin-right: auto; }
.batch-checkbox { position: absolute; top: 12px; left: 12px; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; display: none; align-items: center; justify-content: center; transition: all 0.12s; z-index: 1; }
.batch-checkbox .lucide { width: 13px; height: 13px; }
.batch-checkbox.checked { background: var(--accent); border-color: var(--accent); color: #fff; }
.batch-checkbox .lucide { display: none; }
.batch-checkbox.checked .lucide { display: block; }
.batch-mode .batch-checkbox { display: flex; }
.batch-mode .card { padding-left: 44px; }
.batch-mode .icon-btn { opacity: 1; }

/* ── Tag pill ── */
.tag-pill { background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 11px; color: var(--muted); cursor: pointer; white-space: nowrap; transition: all 0.12s; letter-spacing: 0.01em; }
.tag-pill:hover { border-color: var(--muted); color: var(--fg); }
.tag-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-filter-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 14px;
    display: none;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}
.tag-filter-wrap.open { display: flex; }
