/* ========== Bookmark View ========== */
.bookmark-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bookmark-view .journal-header { /* reuse journal-header layout */ }

.bookmark-body {
    flex: 1;
    padding: 28px 36px;
    overflow-y: auto;
    background: #FAF7F3;
}

/* ========== Bookmark List (table-like rows) ========== */
.bookmark-table {
    background: #FFFCF8;
    border-radius: 18px;
    border: 1px solid #EBE5DD;
    box-shadow: 0 1px 2px rgba(45,41,38,0.02);
    overflow: hidden;
    animation: slideInRight 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Table header */
.bookmark-table-header {
    display: flex;
    align-items: center;
    padding: 16px 28px;
    border-bottom: 1px solid #EBE5DD;
    background: rgba(247, 243, 239, 0.6);
}

.bookmark-table-header .col-url {
    flex: 1;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 500;
    color: #6E645A;
    letter-spacing: var(--track-wider);
    text-transform: uppercase;
}

.bookmark-table-header .col-desc {
    width: 260px;
    padding-left: 20px;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 500;
    color: #6E645A;
    letter-spacing: var(--track-wider);
    text-transform: uppercase;
}

.bookmark-table-header .col-actions {
    width: 80px;
    text-align: right;
}

/* Table row */
.bookmark-row {
    display: flex;
    align-items: center;
    padding: 18px 28px;
    border-bottom: 1px solid #F2EDE7;
    transition: background 200ms ease;
}
.bookmark-row:last-child { border-bottom: none; }
.bookmark-row:hover { background: rgba(194,133,91,0.02); }

.bookmark-row .col-url {
    flex: 1;
    min-width: 0;             /* 允许 flex 子项收缩，触发 ellipsis */
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.bookmark-row .url-favicon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #F2EDE7;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.bookmark-row .url-favicon img {
    width: 16px;
    height: 16px;
}
.bookmark-row .url-favicon .fallback-icon {
    width: 12px;
    height: 12px;
    color: #8F8478;
}

.bookmark-row .url-link {
    display: block;            /* 行内元素不会触发 text-overflow，需 block */
    max-width: 100%;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    color: #C2855B;
    text-decoration: none;
    letter-spacing: var(--track-normal);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 200ms ease;
}
.bookmark-row .url-link:hover { color: #A66E47; text-decoration: underline; }

.bookmark-row .col-desc {
    width: 260px;
    padding-left: 20px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 400;
    color: #5C5650;
    letter-spacing: var(--track-normal);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-row .col-actions {
    width: 80px;
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 180ms ease;
}
.bookmark-row:hover .col-actions { opacity: 1; }

.bookmark-row .row-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8F8478;
    transition: all 180ms ease;
}
.bookmark-row .row-btn:hover { background: rgba(194,133,91,0.06); color: #C2855B; }
.bookmark-row .row-btn.row-btn-danger:hover { background: rgba(196,114,110,0.08); color: #C4726E; }

/* ========== Add Button ========== */
.bookmark-add-bar {
    text-align: center;
    padding: 14px 0 0;
}

.bookmark-add-bar .btn-start {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border: 1px dashed #B0A599;
    border-radius: 12px;
    background: transparent;
    color: #8F8478;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: var(--track-wide);
    cursor: pointer;
    transition: all 280ms ease;
}
.bookmark-add-bar .btn-start:hover {
    border-color: #C2855B;
    color: #A66E47;
    background: rgba(194,133,91,0.04);
}

/* ========== Inline Edit Form ========== */
.bookmark-edit-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    border-bottom: 1px solid #F2EDE7;
    background: rgba(194,133,91,0.03);
    animation: lineFadeIn 200ms ease;
}

.bookmark-edit-row .edit-url-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #C2855B;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 400;
    color: #2D2926;
    background: #FFFCF8;
    letter-spacing: var(--track-normal);
    outline: none;
    box-shadow: 0 0 0 3px rgba(194,133,91,0.06);
}
.bookmark-edit-row .edit-desc-input {
    width: 260px;
    padding: 10px 14px;
    border: 1px solid #EBE5DD;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 400;
    color: #2D2926;
    background: #FFFCF8;
    letter-spacing: var(--track-normal);
    outline: none;
}
.bookmark-edit-row .edit-desc-input:focus { border-color: #C2855B; }

.bookmark-edit-row .edit-btn-save {
    padding: 10px 18px;
    background: #C2855B;
    color: #FFF;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: var(--track-wide);
    border: none;
    cursor: pointer;
    transition: all 200ms ease;
}
.bookmark-edit-row .edit-btn-save:hover { background: #A66E47; }
.bookmark-edit-row .edit-btn-cancel {
    padding: 10px 14px;
    background: transparent;
    color: #6E645A;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: var(--track-wide);
    border: none;
    cursor: pointer;
}
.bookmark-edit-row .edit-btn-cancel:hover { color: #5C5650; }

/* ========== Empty State ========== */
.bookmark-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    background: #FFFCF8;
    border-radius: 20px;
    border: 1px solid #EBE5DD;
    animation: slideInRight 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.bookmark-empty .empty-illustration {
    width: 92px;
    height: 92px;
    border-radius: 22px;
    background: linear-gradient(135deg, #F7F3EF 0%, rgba(194,133,91,0.04) 100%);
    color: #8F8478;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}
.bookmark-empty .empty-title {
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: 600;
    color: #2D2926;
    margin-bottom: 10px;
    letter-spacing: var(--track-wide);
}
.bookmark-empty .empty-subtitle {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 400;
    color: #6E645A;
    margin-bottom: 36px;
    letter-spacing: var(--track-wider);
}

/* ========== Toolbar: Search + Tag Filter ========== */
.bookmark-toolbar {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 260ms ease;
}

.bm-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.bm-search-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #8F8478;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    transition: all 150ms ease;
}
.bm-search-btn:hover { color: #C2855B; background: #F2EDE7; }

.bm-search-input {
    width: 100%;
    padding: 12px 44px 12px 42px;
    border: 1px solid #EBE5DD;
    border-radius: 12px;
    background: #FFFCF8;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 400;
    color: #2D2926;
    letter-spacing: var(--track-normal);
    outline: none;
    transition: all 200ms ease;
}
.bm-search-input:focus {
    border-color: #C2855B;
    box-shadow: 0 0 0 3px rgba(194,133,91,0.08);
}
.bm-search-input::placeholder { color: #8F8478; }

.bm-search-clear {
    position: absolute;
    right: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: #F2EDE7;
    color: #6E645A;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 180ms ease;
}
.bm-search-clear:hover { background: #EBE5DD; color: #5C5650; }

/* 标签筛选栏 */
.bm-tagbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bm-tag-filter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #EBE5DD;
    background: #FFFCF8;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 500;
    color: #5C5650;
    letter-spacing: var(--track-wide);
    cursor: pointer;
    transition: all 180ms ease;
}
.bm-tag-filter:hover {
    border-color: #B0A599;
    background: #FAF7F3;
}
.bm-tag-filter.active {
    border-color: #C2855B;
    background: rgba(194,133,91,0.1);
    color: #A66E47;
}

.bm-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========== Tag Chip (in row) ========== */
.bm-desc-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bm-tag-line {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bm-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--tag-c);
    color: #FFF;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: var(--track-wide);
    cursor: pointer;
    transition: all 180ms ease;
    user-select: none;
}
.bm-tag-chip .bm-tag-dot {
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.75) !important;
}
.bm-tag-chip:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
}

/* 空结果 */
.bookmark-empty-compact {
    min-height: 220px;
    padding: 40px;
}

/* ========== Edit Form: tag + color picker ========== */
.bookmark-edit-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 28px;
    border-bottom: 1px solid #F2EDE7;
    background: rgba(194,133,91,0.03);
    animation: lineFadeIn 200ms ease;
}

.bookmark-edit-row .edit-mid {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bookmark-edit-row .edit-tag-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bookmark-edit-row .edit-tag-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #EBE5DD;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 400;
    color: #2D2926;
    background: #FFFCF8;
    letter-spacing: var(--track-normal);
    outline: none;
}
.bookmark-edit-row .edit-tag-input:focus { border-color: #C2855B; }

.bookmark-edit-row .edit-btns {
    display: flex;
    gap: 8px;
    padding-top: 2px;
}

/* 7 色选择器 */
.tag-colors {
    display: flex;
    align-items: center;
    gap: 7px;
}

.tag-colors .color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: all 180ms ease;
    flex-shrink: 0;
}
.tag-colors .color-dot:hover {
    transform: scale(1.12);
}
.tag-colors .color-dot.selected {
    border-color: #2D2926;
    box-shadow: 0 0 0 2px #FFF inset, 0 0 0 2px #2D2926;
    transform: scale(1.12);
}

/* 覆盖旧的固定宽度说明输入框 */
.bookmark-edit-row .edit-desc-input {
    width: 100%;
}

/* ========== 多网址展示 ========== */
.bm-url-stack {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.bm-extra-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bm-extra-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 180px;
    padding: 4px 10px;
    border-radius: 8px;
    background: #F2EDE7;
    color: #C2855B;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: var(--track-wide);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 180ms ease;
}
.bm-extra-link:hover {
    background: #EBE5DD;
    color: #A66E47;
}

/* ========== 多网址表单 ========== */
.bm-url-inputs {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bm-url-main-row,
.bm-url-extra-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bm-url-label {
    flex-shrink: 0;
    width: 50px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    color: #6E645A;
    letter-spacing: var(--track-wide);
    text-align: right;
}

.bm-url-extra-row .edit-url-input {
    flex: 1;
    border: 1px solid #EBE5DD;
    box-shadow: none;
}
.bm-url-extra-row .edit-url-input:focus { border-color: #C2855B; }

.bm-add-url-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border: 1px dashed #B0A599;
    border-radius: 10px;
    background: transparent;
    color: #6E645A;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: var(--track-wide);
    cursor: pointer;
    transition: all 200ms ease;
}
.bm-add-url-btn:hover {
    border-color: #C2855B;
    color: #A66E47;
    background: rgba(194,133,91,0.04);
}

/* 编辑行内删除按钮与输入框对齐 */
.bm-url-extra-row .row-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

/* 响应式：小屏额外链接全宽 */
@media (max-width: 768px) {
    .bookmark-edit-row { flex-direction: column; gap: 10px; }
    .bookmark-edit-row .edit-mid { width: 100%; }
    .bm-url-inputs { width: 100%; }
    .bm-extra-link { max-width: 100%; }
}
