/* ========== favorites.css ========== */
/**
 * 收藏模块样式 - Nebula 设计语言 · 现代化卡片式重构
 * 玻璃拟态 · 紫靛渐变 · 微光发光 · 网格卡片 · 高级质感
 *
 * 设计令牌（Nebula 暗色主题）：
 *   --primary  #6366f1   --accent #06b6d4
 *   --bg-base  #0a0c1e   --bg-card rgba(20,22,48,0.6)
 *   --border   rgba(99,102,241,0.15)
 *
 * 变量作用域限定在 #module-content，避免影响其它模块；
 * 模态框为 #module-content 的 DOM 后代，故同样继承。
 */

/* ==================== 设计令牌 ==================== */
#module-content {
    /* 核心色 */
    --fav-primary: #6366f1;
    --fav-accent: #06b6d4;
    --fav-bg-base: #0a0c1e;
    --fav-bg-card: rgba(20, 22, 48, 0.6);
    --fav-border: rgba(99, 102, 241, 0.15);

    /* 派生色 */
    --fav-primary-light: #818cf8;
    --fav-accent-light: #22d3ee;
    --fav-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    --fav-gradient-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(6, 182, 212, 0.12) 100%);
    --fav-bg-hover: rgba(99, 102, 241, 0.12);
    --fav-bg-input: rgba(10, 12, 30, 0.55);
    --fav-border-glow: rgba(99, 102, 241, 0.25);
    --fav-border-strong: rgba(99, 102, 241, 0.45);

    /* 文字 */
    --fav-text: #e6e8f5;
    --fav-text-secondary: #9aa0c4;
    --fav-text-muted: #656b94;

    /* 圆角：统一使用共享 --radius-* token（与 theme.css 一致） */

    /* 阴影 */
    --fav-shadow-card: 0 10px 34px rgba(0, 0, 0, 0.42);
    --fav-shadow-glow: 0 0 26px rgba(99, 102, 241, 0.28);
    --fav-shadow-modal: 0 28px 70px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(99, 102, 241, 0.12);

    /* 动效 */
    --fav-t: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --fav-t-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);

    /* 分类色 */
    --cat-all: #6366f1;
    --cat-life: #10b981;
    --cat-work: #3b82f6;
    --cat-interest: #f59e0b;
    --cat-other: #6b7280;

    color: var(--fav-text);
}

/* ==================== 布局容器 ==================== */
.favorites-header,
.favorites-stats,
.favorites-search-bar,
.category-tabs,
.favorites-list {
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* ==================== 页面头部 ==================== */
.favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 28px;
    padding: 26px 30px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(6, 182, 212, 0.05) 100%);
    border: 1px solid var(--fav-border-glow);
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--fav-shadow-card);
}

.favorites-header::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -8%;
    width: 420px;
    height: 220%;
    background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.18) 0%, transparent 62%);
    pointer-events: none;
}

.favorites-header > * {
    position: relative;
    z-index: 1;
}

.favorites-header h2 {
    font-size: 26px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
    background: var(--fav-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ==================== 按钮系统 ==================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--fav-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--fav-t), box-shadow var(--fav-t), filter var(--fav-t);
    box-shadow: var(--fav-shadow-glow);
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--fav-shadow-glow), 0 10px 30px rgba(99, 102, 241, 0.35);
    filter: brightness(1.06);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--fav-border-glow);
    border-radius: var(--radius-md);
    color: var(--fav-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--fav-t);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    white-space: nowrap;
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.16);
    border-color: var(--fav-border-strong);
    transform: translateY(-1px);
}

/* ==================== 统计区 ==================== */
.favorites-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 22px 24px;
    background: var(--fav-bg-card);
    border: 1px solid var(--fav-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--fav-shadow-card);
    position: relative;
    overflow: hidden;
    transition: transform var(--fav-t), border-color var(--fav-t);
}

.stat-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--fav-gradient-soft);
    opacity: 0;
    transition: opacity var(--fav-t);
    pointer-events: none;
}

.stat-item:hover {
    transform: translateY(-3px);
    border-color: var(--fav-border-glow);
}

.stat-item:hover::after {
    opacity: 1;
}

.stat-value {
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    background: var(--fav-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--fav-text-secondary);
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

/* ==================== 搜索框 ==================== */
.favorites-search-bar {
    margin-bottom: 22px;
}

/* 隐藏反自动填充蜜罐输入（已通过 inline 离屏定位，此处双保险） */
.favorites-search-bar > input[tabindex="-1"] {
    display: none !important;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 620px;
}

/* CSS 绘制放大镜图标 */
.search-input-wrapper::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid var(--fav-text-secondary);
    border-radius: 50%;
    transition: border-color var(--fav-t);
    pointer-events: none;
    z-index: 1;
}

.search-input-wrapper::after {
    content: '';
    position: absolute;
    left: 29px;
    top: calc(50% + 5px);
    width: 7px;
    height: 2px;
    background: var(--fav-text-secondary);
    border-radius: 2px;
    transform: rotate(45deg);
    transform-origin: left center;
    transition: background var(--fav-t);
    pointer-events: none;
    z-index: 1;
}

#fav-search {
    flex: 1;
    width: 100%;
    padding: 14px 44px 14px 46px;
    background: var(--fav-bg-input);
    border: 1px solid var(--fav-border);
    border-radius: var(--radius-full);
    color: var(--fav-text);
    font-size: 14px;
    transition: border-color var(--fav-t), box-shadow var(--fav-t), background var(--fav-t);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

#fav-search::placeholder {
    color: var(--fav-text-muted);
}

#fav-search:focus {
    outline: none;
    border-color: var(--fav-primary);
    background: rgba(10, 12, 30, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), var(--fav-shadow-glow);
}

.search-input-wrapper:focus-within::before {
    border-color: var(--fav-accent);
}

.search-input-wrapper:focus-within::after {
    background: var(--fav-accent);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.16);
    border: 1px solid var(--fav-border-glow);
    border-radius: 50%;
    color: var(--fav-text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--fav-t-fast);
    z-index: 2;
}

.search-clear:hover {
    background: var(--fav-primary);
    color: #fff;
    transform: translateY(-50%) scale(1.08);
}

/* ==================== 批量操作栏（底部固定） ==================== */
.batch-actions {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translate(-50%, 140%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: min(720px, calc(100vw - 32px));
    padding: 14px 20px;
    background: rgba(18, 20, 44, 0.82);
    border: 1px solid var(--fav-border-glow);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), var(--fav-shadow-glow);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--fav-t), opacity var(--fav-t);
    z-index: 900;
}

.batch-actions.show {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

.batch-actions-left,
.batch-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.batch-count {
    font-size: 14px;
    color: var(--fav-text-secondary);
}

.batch-count strong {
    color: var(--fav-accent-light);
    font-size: 16px;
    font-weight: 700;
}

/* 全选复选框美化 */
#select-all-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--fav-primary);
    cursor: pointer;
}

/* ==================== 分类标签（胶囊） ==================== */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.cat-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid var(--fav-border);
    border-radius: var(--radius-full);
    color: var(--fav-text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--fav-t);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.cat-tab:hover {
    color: var(--fav-text);
    border-color: var(--fav-border-glow);
    background: rgba(99, 102, 241, 0.12);
    transform: translateY(-1px);
}

.cat-tab .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(99, 102, 241, 0.18);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    color: var(--fav-text);
    transition: background var(--fav-t), color var(--fav-t);
}

/* 选中态：渐变背景 */
.cat-tab.active {
    color: #fff;
    border-color: transparent;
    box-shadow: var(--fav-shadow-glow);
    transform: translateY(-1px);
}

.cat-tab.active .count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* 各分类配色 */
.cat-tab[data-category="all"].active { background: linear-gradient(135deg, #6366f1, #818cf8); }
.cat-tab[data-category="生活"].active { background: linear-gradient(135deg, #10b981, #34d399); }
.cat-tab[data-category="工作"].active { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.cat-tab[data-category="兴趣"].active { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.cat-tab[data-category="uncategorized"].active { background: linear-gradient(135deg, #6b7280, #9ca3af); }

/* 非选中态悬停时呼应分类色 */
.cat-tab[data-category="生活"]:hover { border-color: rgba(16, 185, 129, 0.5); color: #34d399; }
.cat-tab[data-category="工作"]:hover { border-color: rgba(59, 130, 246, 0.5); color: #60a5fa; }
.cat-tab[data-category="兴趣"]:hover { border-color: rgba(245, 158, 11, 0.5); color: #fbbf24; }
.cat-tab[data-category="uncategorized"]:hover { border-color: rgba(156, 163, 175, 0.5); color: #d1d5db; }

/* ==================== 卡片网格 ==================== */
.favorites-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-bottom: 90px; /* 给底部批量操作栏留空 */
    max-height: min(62vh, 740px);
    overflow-y: auto;
    overscroll-behavior: contain;
    align-content: start;
    padding-right: 8px;
}

.favorites-list::-webkit-scrollbar { width: 6px; }
.favorites-list::-webkit-scrollbar-track { background: transparent; }
.favorites-list::-webkit-scrollbar-thumb { background: rgba(129, 140, 248, 0.34); border-radius: 999px; }
.favorites-list::-webkit-scrollbar-thumb:hover { background: rgba(129, 140, 248, 0.58); }

/* ==================== 收藏卡片 ==================== */
.favorite-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--fav-bg-card);
    border: 1px solid var(--fav-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--fav-shadow-card);
    position: relative;
    overflow: hidden;
    transition: transform var(--fav-t), border-color var(--fav-t), box-shadow var(--fav-t);
    animation: fav-card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* 卡片顶部渐变光带 */
.favorite-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--fav-gradient);
    opacity: 0.6;
    transition: opacity var(--fav-t);
}

/* 卡片背景微光 */
.favorite-card::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--fav-t);
}

.favorite-card:hover {
    transform: translateY(-6px) scale(1.015);
    border-color: var(--fav-border-strong);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5), var(--fav-shadow-glow);
}

.favorite-card:hover::before {
    opacity: 1;
}

.favorite-card:hover::after {
    opacity: 1;
}

/* 选中态 */
.favorite-card.selected {
    border-color: var(--fav-accent);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.35), 0 18px 44px rgba(0, 0, 0, 0.5), var(--fav-shadow-glow);
}

.favorite-card.selected::before {
    background: linear-gradient(135deg, var(--fav-accent), var(--fav-primary));
    opacity: 1;
}

@keyframes fav-card-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 卡片头部 */
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(6, 182, 212, 0.12) 100%);
    border: 1px solid var(--fav-border-glow);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.12);
}

.card-title-group {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-name {
    font-size: 15.5px;
    font-weight: 650;
    color: var(--fav-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-category {
    align-self: flex-start;
    padding: 2px 10px;
    background: var(--fav-gradient-soft);
    border: 1px solid var(--fav-border-glow);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--fav-primary-light);
    white-space: nowrap;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity var(--fav-t);
}

.favorite-card:hover .card-actions {
    opacity: 1;
}

.card-action-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--fav-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--fav-t-fast);
}

.card-action-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--fav-border-glow);
    color: var(--fav-text);
    transform: translateY(-1px);
}

/* 卡片正文 */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.card-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: rgba(10, 12, 30, 0.4);
    border: 1px solid rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-sm);
    transition: border-color var(--fav-t-fast), background var(--fav-t-fast);
}

.card-field:hover {
    border-color: var(--fav-border-glow);
    background: rgba(10, 12, 30, 0.6);
}

.card-field .label {
    flex-shrink: 0;
    font-size: 13px;
    opacity: 0.8;
}

.card-field .value {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--fav-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-field .value.url {
    color: var(--fav-accent-light);
    cursor: pointer;
    transition: color var(--fav-t-fast);
}

.card-field .value.url:hover {
    color: var(--fav-accent);
    text-decoration: underline;
}

.card-field .value.notes {
    white-space: normal;
    color: var(--fav-text-secondary);
    line-height: 1.5;
}

.card-field .value.real {
    color: var(--fav-text);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.sensitive-field {
    cursor: pointer;
}

.sensitive-field:hover {
    border-color: rgba(6, 182, 212, 0.4);
}

.copy-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--fav-text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--fav-t-fast);
}

.copy-btn:hover {
    background: var(--fav-primary);
    color: #fff;
    transform: scale(1.08);
}

/* ==================== 空状态 ==================== */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 64px 32px;
    background: rgba(10, 12, 30, 0.3);
    border: 2px dashed var(--fav-border-glow);
    border-radius: var(--radius-xl);
    text-align: center;
}

.empty-icon {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    background: var(--fav-gradient-soft);
    border: 1px solid var(--fav-border-glow);
    border-radius: 50%;
    box-shadow: var(--fav-shadow-glow), inset 0 0 24px rgba(99, 102, 241, 0.15);
    animation: fav-pulse 2.6s ease-in-out infinite;
}

@keyframes fav-pulse {
    0%, 100% { box-shadow: 0 0 24px rgba(99, 102, 241, 0.25), inset 0 0 24px rgba(99, 102, 241, 0.15); }
    50% { box-shadow: 0 0 38px rgba(99, 102, 241, 0.45), inset 0 0 24px rgba(99, 102, 241, 0.22); }
}

.empty-state p {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    background: var(--fav-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-hint {
    font-size: 14px;
    color: var(--fav-text-muted);
}

/* ==================== 模态框 ==================== */
.favorites-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 7, 20, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity var(--fav-t);
}

.favorites-modal.show {
    opacity: 1;
}

.modal-content {
    width: min(560px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: rgba(16, 18, 40, 0.92);
    border: 1px solid var(--fav-border-glow);
    border-radius: var(--radius-xl);
    box-shadow: var(--fav-shadow-modal);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    overflow: hidden;
    transform: scale(0.94) translateY(12px);
    opacity: 0;
    transition: transform var(--fav-t), opacity var(--fav-t);
}

.favorites-modal.show .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

#categories-modal .modal-content {
    width: min(460px, 100%);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--fav-border);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    background: var(--fav-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--fav-border);
    border-radius: 50%;
    color: var(--fav-text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--fav-t-fast);
}

.btn-close:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    transform: rotate(90deg);
}

.modal-body {
    padding: 22px 24px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--fav-border);
    position: sticky;
    bottom: 0;
    background: var(--fav-modal-bg, rgba(20, 22, 48, 0.95));
    backdrop-filter: blur(12px);
}

/* ==================== 表单 ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fav-text-secondary);
}

.form-group .required {
    color: #f87171;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="search"],
.form-group select,
.form-group textarea,
#new-category-name {
    width: 100%;
    padding: 12px 14px;
    background: var(--fav-bg-input);
    border: 1px solid var(--fav-border);
    border-radius: var(--radius-md);
    color: var(--fav-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--fav-t), box-shadow var(--fav-t), background var(--fav-t);
}

.form-group input::placeholder,
#new-category-name::placeholder {
    color: var(--fav-text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
#new-category-name:focus {
    outline: none;
    border-color: var(--fav-primary);
    background: rgba(10, 12, 30, 0.8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.url-input-group,
.password-input {
    display: flex;
    gap: 8px;
}

.url-input-group select,
.password-input .toggle-btn {
    flex-shrink: 0;
    width: auto; /* 覆盖 .form-group select 的 width:100%，避免挤掉 URL input */
    padding: 12px 14px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--fav-border);
    border-radius: var(--radius-md);
    color: var(--fav-text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--fav-t-fast);
}

.url-input-group input,
.password-input input {
    flex: 1;
    min-width: 0;
}

.password-input .toggle-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--fav-border-glow);
}

.category-select-row {
    display: flex;
    gap: 8px;
}

.category-select-row select {
    flex: 1;
}

.category-select-row input {
    flex: 1;
    min-width: 0;
}

.category-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--fav-text-secondary);
    cursor: pointer;
    user-select: none;
}

.category-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--fav-primary);
    cursor: pointer;
}

/* ==================== 分类管理弹窗 ==================== */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(10, 12, 30, 0.4);
    border: 1px solid var(--fav-border);
    border-radius: var(--radius-md);
    transition: border-color var(--fav-t-fast), background var(--fav-t-fast);
}

.category-item:hover {
    border-color: var(--fav-border-glow);
    background: rgba(10, 12, 30, 0.6);
}

.category-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-icon {
    font-size: 18px;
}

.category-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--fav-text);
}

.category-count {
    font-size: 12px;
    color: var(--fav-text-muted);
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.12);
    border-radius: var(--radius-full);
}

.delete-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--fav-text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--fav-t-fast);
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.add-category-form {
    display: flex;
    gap: 10px;
}

.add-category-form input {
    flex: 1;
}

.add-category-form .btn-primary {
    flex-shrink: 0;
}

/* ==================== Toast 降级样式 ==================== */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    padding: 14px 22px;
    background: rgba(16, 18, 40, 0.92);
    border: 1px solid var(--fav-border-glow);
    border-radius: var(--radius-md);
    color: var(--fav-text);
    font-size: 14px;
    box-shadow: var(--fav-shadow-modal);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    transform: translateX(120%);
    transition: opacity var(--fav-t), transform var(--fav-t);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success { border-left: 3px solid #10b981; }
.toast.error { border-left: 3px solid #ef4444; }

/* ==================== 滚动条 ==================== */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-full);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* ==================== 兼容旧版类名（保险） ==================== */
.favorites-page {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.fav-form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.fav-form-row input {
    flex: 1;
    padding: 12px 14px;
    background: var(--fav-bg-input);
    border: 1px solid var(--fav-border);
    border-radius: var(--radius-md);
    color: var(--fav-text);
    font-size: 14px;
    transition: all var(--fav-t);
}

.fav-form-row input:focus {
    outline: none;
    border-color: var(--fav-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.fav-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .favorites-header {
        padding: 20px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .header-actions {
        justify-content: center;
    }

    .favorites-header h2 {
        font-size: 22px;
    }

    .favorites-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-value {
        font-size: 28px;
    }

    .stat-item {
        padding: 16px 18px;
    }

    .favorites-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .category-tabs {
        justify-content: center;
    }

    .batch-actions {
        width: calc(100vw - 24px);
        padding: 12px 14px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .batch-actions-left,
    .batch-actions-right {
        justify-content: center;
    }

    .modal-content {
        max-height: 94vh;
    }

    .favorites-modal {
        padding: 12px;
    }
}

@media (max-width: 420px) {
    .favorites-stats {
        grid-template-columns: 1fr;
    }

    .cat-tab {
        padding: 8px 14px;
        font-size: 12.5px;
    }
}

/* ==================== 减少动效（无障碍） ==================== */
@media (prefers-reduced-motion: reduce) {
    .favorite-card,
    .empty-icon,
    .modal-content,
    .favorites-modal,
    .batch-actions,
    .toast {
        animation: none !important;
        transition: none !important;
    }
}
