/* ==========================================================================
   网址收藏页面样式
   ========================================================================== */

/* ====== Alpine.js transition 工具类 ====== */
.transition { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.duration-100 { transition-duration: 100ms; }
.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-250 { transition-duration: 250ms; }
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }
.scale-95 { transform: scale(0.95); }
.scale-100 { transform: scale(1); }
.translate-y-0 { transform: translateY(0); }
.translate-y-4 { transform: translateY(1rem); }
.-translate-y-1 { transform: translateY(-0.25rem); }
.-translate-y-3 { transform: translateY(-0.75rem); }



/* ====== 页面标题 ====== */
.page-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-intro-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--headingColor);
}

/* ====== 操作栏 ====== */
.bookmark-actions {
    display: flex;
    gap: 10px;
}

/* ====== 分类胶囊 ====== */
.category-pills {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 28px;
}

.cat-pill {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 10px 8px;
    border-radius: 9999px;
    overflow: hidden;
    text-decoration: none;
    color: var(--headingColor);
    background: var(--accent1);
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
    white-space: nowrap;
    min-width: 0;
}

.cat-pill:hover {
    border-color: var(--accent4);
    background: var(--accent2);
}

.cat-pill.active {
    background: var(--headingColor);
    color: var(--bg);
    border-color: transparent;
}

.cat-pill.active .cat-pill-icon {
    background: rgba(255,255,255,0.2);
}

.cat-pill.active .cat-pill-count {
    opacity: 0.65;
    color: inherit;
}

.cat-pill-bg {
    position: absolute;
    inset: -8px;
    background-size: cover;
    background-position: center;
    z-index: 0;
    opacity: 0.12;
    transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease;
}

.cat-pill:hover .cat-pill-bg {
    transform: scale(1.3);
}

.cat-pill.active .cat-pill-bg {
    opacity: 0.08;
}

.cat-pill-content {
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 1;
    flex: 1 1 auto;
    min-width: 0;
}

.cat-pill-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent2);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    margin: -3px 0;
}

.cat-pill-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.cat-pill-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.cat-pill-count {
    font-size: 11px;
    color: var(--textSecondaryColor);
    z-index: 1;
}

/* ====== 网址卡片列表 ====== */
.bookmark-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

.bookmark-item {
    background: var(--accent1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: all 200ms ease;
}

.bookmark-item:hover {
    border-color: var(--accent4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.dark .bookmark-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.bookmark-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    color: inherit;
    text-decoration: none;
}

.bookmark-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent2);
    border-radius: 10px;
    overflow: hidden;
}

.bookmark-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
}

.bookmark-letter {
    font-size: 16px;
    font-weight: 600;
    color: var(--textSecondaryColor);
}

.bookmark-info {
    flex: 1;
    min-width: 0;
}

.bookmark-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--headingColor);
    line-height: 1.4;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-desc {
    font-size: 12px;
    color: var(--textSecondaryColor);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.bookmark-domain {
    font-size: 11px;
    color: var(--accent5);
}

/* 卡片操作按钮 */
.bookmark-item {
    position: relative;
}

.bookmark-item-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    z-index: 2;
}

.bm-action-btn {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    border: none;
    background: var(--accent2);
    color: var(--textSecondaryColor);
    cursor: pointer;
    transition: all 150ms ease;
    padding: 0;
}

.bm-action-btn:hover {
    background: var(--accent4);
    color: var(--headingColor);
}

.bm-action-delete:hover {
    background: #f56c6c;
    color: #fff;
}

/* 空状态 */
.no-posts {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--textSecondaryColor);
    font-size: 14px;
}

/* ====== 按钮 ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
    border: 1px solid transparent;
    font-family: inherit;
    line-height: 1.5;
    user-select: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--headingColor);
    color: var(--bg);
    border-color: var(--headingColor);
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.85;
}

.btn-secondary {
    background: var(--accent1);
    color: var(--textColor);
    border-color: var(--ac-border);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent4);
}

.btn-ghost {
    background: transparent;
    color: var(--textSecondaryColor);
    border-color: var(--ac-border);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--headingColor);
    border-color: var(--accent4);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-danger {
    background: #f56c6c;
    color: #fff;
    border-color: #f56c6c;
}

.btn-danger:hover:not(:disabled) {
    opacity: 0.85;
}

/* ====== 弹窗 ====== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.modal-content {
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.dark .modal-content {
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}

.modal-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--headingColor);
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    color: var(--accent5);
    font-size: 18px;
    cursor: pointer;
    transition: all 150ms ease;
    border: none;
}

.modal-close:hover {
    background: var(--accent2);
    color: var(--headingColor);
}

.modal-body {
    padding: 12px 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
}

/* ====== 表单字段 ====== */
.field-group {
    margin-bottom: 14px;
}

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

.field-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--textSecondaryColor);
    margin-bottom: 6px;
}

.field-group input[type="text"],
.field-group input[type="url"],
.field-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--ac-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--accent1);
    color: var(--headingColor);
    transition: border-color 150ms, box-shadow 150ms;
    outline: none;
}

.field-group textarea {
    min-height: 72px;
    resize: vertical;
}

.field-group input:focus,
.field-group textarea:focus {
    border-color: var(--accent4);
    box-shadow: 0 0 0 3px var(--accent2);
}

.field-group input::placeholder,
.field-group textarea::placeholder {
    color: var(--accent5);
}

.icon-upload-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ====== 图片上传区域（弹窗通用组件） ====== */
.upload-area {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px dashed var(--ac-border);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    background: var(--accent1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: var(--accent4);
    background: var(--accent2);
}

.upload-area-wide {
    width: 100%;
    height: 120px;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--accent5);
    pointer-events: none;
}

.upload-placeholder svg {
    opacity: 0.5;
}

.upload-placeholder span {
    font-size: 11px;
    font-weight: 500;
}

.upload-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.upload-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}

.upload-area:hover .upload-remove {
    opacity: 1;
}

.upload-remove:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* ====== 自定义 Select ====== */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--ac-border);
    border-radius: 10px;
    background: var(--accent1);
    font-size: 14px;
    font-family: inherit;
    color: var(--headingColor);
    cursor: pointer;
    transition: border-color 150ms, box-shadow 150ms;
    text-align: left;
    line-height: 1.5;
    outline: none;
}

.custom-select-trigger:hover {
    border-color: var(--accent4);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--accent4);
    box-shadow: 0 0 0 3px var(--accent2);
}

.custom-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 200ms ease;
    pointer-events: none;
    color: var(--accent5);
}

.custom-select-arrow.rotate {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-dropdown {
    position: fixed;
    background: var(--bg);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 4px;
    z-index: 10001;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
}

.dark .custom-select-dropdown {
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.custom-select-option {
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--textColor);
    cursor: pointer;
    transition: background 150ms, color 150ms;
    user-select: none;
    border-radius: 6px;
}

.custom-select-option:hover {
    background: var(--accent2);
    color: var(--headingColor);
}

.custom-select-option.active {
    color: var(--headingColor);
    font-weight: 500;
    background: var(--accent2);
}

/* ====== 通知提示 ====== */
.notification {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    background: var(--accent1);
    border: 1px solid var(--border-light);
    color: var(--headingColor);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    pointer-events: none;
}

.notification.success {
    color: var(--highlightColor);
}

/* ====== 覆盖 PJAX 动画：只让列表卡片动，标题和胶囊不动 ====== */
main[x-data="bookmarkPage()"].pjax-animate {
    animation: none;
}

main[x-data="bookmarkPage()"].pjax-animate .bookmark-item {
    animation: bmItemIn 0.35s ease both;
}
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(1)  { animation-delay: 0.02s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(2)  { animation-delay: 0.06s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(3)  { animation-delay: 0.10s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(4)  { animation-delay: 0.14s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(5)  { animation-delay: 0.18s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(6)  { animation-delay: 0.22s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(7)  { animation-delay: 0.26s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(8)  { animation-delay: 0.30s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(9)  { animation-delay: 0.34s; }
main[x-data="bookmarkPage()"].pjax-animate .bookmark-item:nth-child(10) { animation-delay: 0.38s; }

@keyframes bmItemIn {
    from { opacity: 0; transform: translateY(13px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notification.error {
    color: #f56c6c;
}
