 /* 基础变量定义 */
:root {
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --primary-color: #3b82f6;
    --accent-color: #2563eb;
    --nav-bg: rgba(255, 255, 255, 0.92);
    --nav-border: rgba(148, 163, 184, 0.15);
    --search-bg: rgba(255, 255, 255, 0.98);
    --hover-bg: rgba(59, 130, 246, 0.08);
    --sidebar-width: 240px;
    --header-height: 64px;
    --border-radius: 12px;
    --transition-speed: 0.3s;
    /* 流光渐变方案 */
    --gradient-1: linear-gradient(
        120deg,
        #60a5fa 0%,
        #3b82f6 20%,
        #8b5cf6 40%,
        #ec4899 60%,
        #60a5fa 80%
    );
    
    --gradient-2: linear-gradient(
        120deg,
        #22c55e 0%,
        #10b981 20%,
        #14b8a6 40%,
        #0ea5e9 60%,
        #22c55e 80%
    );
    
    --gradient-3: linear-gradient(
        120deg,
        #f59e0b 0%,
        #f97316 20%,
        #ef4444 40%,
        #ec4899 60%,
        #f59e0b 80%
    );
    
    --gradient-4: linear-gradient(
        120deg,
        #6366f1 0%,
        #8b5cf6 20%,
        #d946ef 40%,
        #ec4899 60%,
        #6366f1 80%
    );
    
    --gradient-5: linear-gradient(
        120deg,
        #06b6d4 0%,
        #0ea5e9 20%,
        #3b82f6 40%,
        #6366f1 60%,
        #06b6d4 80%
    );
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 顶部导航栏 */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--nav-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--nav-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

/* 日期时间容器 */
.datetime-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#time {
    font-size: 1.25rem;
    font-weight: 500;
}

#date {
    font-size: 0.875rem;
    color: #64748b;
}

/* 搜索部分 */
.search-section {
    flex: 1;
    max-width: 800px;
    margin: 0 32px;
}

.search-container {
    position: relative;
}

.search-box {
    width: 100%;
    position: relative;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--search-bg);
    border: 2px solid var(--nav-border);
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: white;
}

.search-engine-select {
    position: relative;
    padding: 8px 28px 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.875rem;
    cursor: pointer;
    border-right: 1px solid var(--nav-border);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    transition: all var(--transition-speed);
}

.search-engine-select:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.search-engine-select:focus {
    outline: none;
    background-color: rgba(59, 130, 246, 0.05);
}

#search-box {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-color);
    width: 100%;
    transition: all var(--transition-speed);
}

#search-box:focus {
    outline: none;
}

#search-box::placeholder {
    color: #94a3b8;
    transition: color var(--transition-speed);
}

#search-box:focus::placeholder {
    color: #cbd5e1;
}

.search-icon {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon:hover {
    color: var(--primary-color);
}

.search-icon i {
    font-size: 1.25rem;
}

/* 导航右侧 */
.nav-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.motto {
    display: flex;
    gap: 8px;
    color: #64748b;
    font-size: 0.875rem;
}

.add-link {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: all var(--transition-speed);
}

.add-link:hover {
    background: var(--accent-color);
    transform: translateY(-1px);
}

/* 主布局 */
.main-layout {
    display: flex;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

/* 侧边栏 */
.sidebar-container {
    width: var(--sidebar-width);
    height: 100%;
    overflow-y: auto;
    padding: 24px 16px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    border-right: 1px solid var(--nav-border);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-item {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    font-size: 0.9375rem;
}

.sidebar-item:hover {
    background: var(--hover-bg);
}

.sidebar-item.active {
    background: var(--primary-color);
    color: white;
}

/* 书签容器 */
.bookmarks-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.bookmarks-content {
    max-width: 1200px;
    margin: 0 auto;
}

.subcategory {
    margin-bottom: 32px;
}

.subcategory h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-color);
    font-weight: 500;
}

.bookmark-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.bookmark {
    background: white;
    border-radius: var(--border-radius);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 1;
    height: 100%;
    --bookmark-gradient: var(--gradient-1); /* 默认渐变 */
}

.bookmark::after {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: var(--border-radius);
    background: var(--bookmark-gradient); /* 使用动态分配的渐变 */
    background-size: 300% 300%;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: borderGlow 6s ease-in-out infinite;
}

.bookmark:hover::after {
    opacity: 0.8;
}

.bookmark a {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    text-decoration: none;
    color: inherit;
}

.bookmark::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.1),
        rgba(37, 99, 235, 0.05)
    );
    opacity: 0;
    transition: opacity var(--transition-speed);
    z-index: 0;
}

.bookmark:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1),
                0 4px 8px rgba(59, 130, 246, 0.1);
}

.bookmark-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-color);
    transition: color var(--transition-speed);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark:hover .bookmark-title {
    color: var(--primary-color);
}

.bookmark-description {
    font-size: 0.875rem;
    color: #64748b;
    transition: color var(--transition-speed);
    line-height: 1.5;
    flex: 1;
}

.bookmark:hover .bookmark-description {
    color: #4b5563;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .motto {
        display: none;
    }

    .search-section {
        margin: 0 16px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 200px;
    }

    .top-nav {
        padding: 0 16px;
    }

    .datetime-container {
        display: none;
    }

    .search-engine-select {
        padding: 8px;
    }

    .bookmark-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 640px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar-container {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--nav-border);
        padding: 16px;
    }

    .sidebar-content {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .sidebar-item {
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    .bookmarks-container {
        padding: 16px;
    }

    .bookmark-list {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bookmark {
    animation: fadeIn 0.3s ease-out;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --text-color: #e2e8f0;
        --nav-bg: rgba(15, 23, 42, 0.92);
        --nav-border: rgba(148, 163, 184, 0.1);
        --search-bg: rgba(15, 23, 42, 0.98);
        --hover-bg: rgba(59, 130, 246, 0.1);
    }

    .bookmark {
        background: rgba(30, 41, 59, 0.5);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    .bookmark:hover {
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3),
                    0 4px 8px rgba(59, 130, 246, 0.2);
    }

    .bookmark::before {
        background: linear-gradient(
            135deg,
            rgba(59, 130, 246, 0.15),
            rgba(37, 99, 235, 0.1)
        );
    }

    .bookmark:hover .bookmark-description {
        color: #94a3b8;
    }

    .sidebar-container {
        background: rgba(15, 23, 42, 0.5);
    }

    ::-webkit-scrollbar-thumb {
        background: #334155;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: #475569;
    }

    .search-input-wrapper {
        background: rgba(30, 41, 59, 0.8);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .search-input-wrapper:focus-within {
        background: rgba(30, 41, 59, 0.95);
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    }

    .search-engine-select {
        color: #e2e8f0;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    }

    .search-engine-select:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .search-engine-select:focus {
        background-color: rgba(59, 130, 246, 0.1);
    }

    #search-box::placeholder {
        color: #64748b;
    }

    #search-box:focus::placeholder {
        color: #475569;
    }

    .bookmark::after {
        background: var(--bookmark-gradient);
        opacity: 0;
        padding: 1.5px;
    }

    .bookmark-title {
        color: #e2e8f0;
    }

    .bookmark-description {
        color: #94a3b8;
    }

    .bookmark-meta {
        border-top-color: rgba(148, 163, 184, 0.05);
        color: #64748b;
    }

    .bookmark:hover .bookmark-title {
        color: #60a5fa;
    }

    .bookmark:hover .bookmark-description {
        color: #cbd5e1;
    }
}

/* 添加书签点击效果 */
.bookmark:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.1s;
}

/* 搜索引擎选项样式 */
.search-engine-select option {
    padding: 8px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* 添加流光动画关键帧 */
@keyframes borderGlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 添加图标和元数据容器 */
.bookmark-meta {
    display: flex;
    align-items: center;
    color: #94a3b8;
    line-height: 1.5;
}

.bookmark-meta i {
    font-size: 0.875rem;
}

/* 包装容器 */
.description-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

/* 移除旧的浮动相关样式 */
.bookmark-meta {
    border-top: none;
    padding-top: 0;
    margin: 0;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .bookmark-meta {
        color: #64748b;
    }
    
    .bookmark-description {
        color: #94a3b8;
    }
}

/* 添加 favicon 样式 */
.bookmark-favicon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 3px;
}

.bookmark-title {
    display: flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
    transition: color var(--transition-speed);
}

/* 加载动画 */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.skeleton-loading {
  background: linear-gradient(
    to right,
    rgba(255,255,255,0.1) 0%,
    rgba(255,255,255,0.3) 50%,
    rgba(255,255,255,0.1) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}