/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 暗黑模式样式 */
body.dark-mode {
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --text-color: #e0e0e0;
    --card-bg: rgba(30, 30, 30, 0.9);
    --card-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(40, 40, 40, 0.8);
    --input-border: rgba(255, 255, 255, 0.2);
    --input-text: #e0e0e0;
    --button-bg: linear-gradient(135deg, #007aff 0%, #0056d6 100%);
    --button-text: #ffffff;
    --bookmark-bg: rgba(40, 40, 40, 0.9);
    --bookmark-hover: rgba(60, 60, 60, 0.9);
    --preview-bg: rgba(60, 60, 60, 0.9);
    --preview-text: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* 白色模式样式（默认） */
body {
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --text-color: #1d1d1f;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(0, 0, 0, 0.05);
    --input-bg: rgba(255, 255, 255, 0.8);
    --input-border: #d1d1d6;
    --input-text: #1d1d1f;
    --button-bg: linear-gradient(135deg, #007aff 0%, #0056d6 100%);
    --button-text: #ffffff;
    --bookmark-bg: rgba(255, 255, 255, 0.8);
    --bookmark-hover: rgba(255, 255, 255, 0.1);
    --preview-bg: rgba(240, 240, 240, 0.9);
    --preview-text: #1d1d1f;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* 登录界面样式 */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    width: 90%;
    animation: loginSlideIn 0.5s ease-out;
}

@keyframes loginSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 10px;
}

.login-header p {
    color: #86868b;
    font-size: 14px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1d1d1f;
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d1d6;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.input-group input:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.login-button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #007aff 0%, #0056d6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.login-button:hover {
    background: linear-gradient(135deg, #0056d6 0%, #003d99 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
}

.login-button:active {
    transform: translateY(0);
}

.login-error {
    color: #ff3b30;
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
    min-height: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-error.show {
    opacity: 1;
}

/* 主界面样式 */
.main-screen {
    opacity: 0;
    transition: opacity 0.5s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ASCII艺术标题 */
.ascii-art {
    text-align: center;
    margin: 20px 0;
    opacity: 0.8;
    position: relative;
    z-index: 1999;
}

.ascii-art pre {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.2;
    color: #5e5e5e;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0;
    display: inline-block;
}

/* 设置按钮容器 */
.settings-container {
    position: relative;
    z-index: 2000;
    flex-shrink: 0;
}

/* 主界面容器不需要相对定位了 */
#mainScreen .container {
    padding: 20px;
}

/* 设置按钮 */
.settings-button {
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.3);
    color: #007aff;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.settings-button:hover {
    background: rgba(0, 122, 255, 0.2);
    border-color: rgba(0, 122, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.settings-button:active {
    transform: translateY(0);
}

/* 设置菜单 */
.settings-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-width: 150px;
    animation: menuSlideIn 0.2s ease-out;
    z-index: 2001;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-menu-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
}

.settings-menu-item:hover {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
}

.settings-menu-item:active {
    background: rgba(0, 122, 255, 0.2);
}

.settings-menu-item:first-child {
    border-radius: 12px 12px 0 0;
}

.settings-menu-item:last-child {
    border-radius: 0 0 12px 12px;
}

.settings-menu-item:only-child {
    border-radius: 12px;
}

/* 充值对话框 */
.charge-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: dialogFadeIn 0.3s ease-out;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.charge-dialog-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: dialogSlideIn 0.3s ease-out;
}

@keyframes dialogSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.charge-dialog-content h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.charge-dialog-content > p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.charge-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.charge-package {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.charge-package:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.charge-package:active {
    transform: translateY(-2px);
}

.package-title {
    font-size: 16px;
    font-weight: bold;
}

.package-price {
    font-size: 24px;
    font-weight: bold;
}

.package-desc {
    font-size: 14px;
    opacity: 0.9;
}

.close-charge-dialog {
    width: 100%;
    padding: 12px;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #ff3b30;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-charge-dialog:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
}

/* 搜索框和设置按钮的容器 */
.search-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
    margin: 30px 10%;
    box-sizing: border-box;
}

/* 搜索框样式 */
.search-wrapper {
    flex: 1;
    min-width: 0;
}

.search-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50px;
    padding: 8px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    width: 100%;
}

/* 设置按钮样式 */
.settings-wrapper {
    flex-shrink: 0;
}

.settings-container {
    position: relative;
}

.search-container:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

#searchInput {
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    width: 100%;
    min-width: 200px;
    padding: 8px;
    color: #1d1d1f;
}

#searchInput::placeholder {
    color: #86868b;
}

#searchBtn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

#searchBtn:hover {
    transform: scale(1.1);
}

/* 布局控制栏 */
.layout-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.reset-layout-btn {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #ff3b30;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-layout-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    transform: scale(1.05);
}

.layout-hint {
    color: #86868b;
    font-size: 12px;
    font-style: italic;
}

.close-hint-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #86868b;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.close-hint-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: scale(1.1);
}

.close-hint-btn:active {
    transform: scale(0.95);
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    width: 80%;
    margin: 10px auto 0 auto;
    margin-left: auto;
    margin-right: auto;
}

/* 拖拽相关样式 */
.draggable-section {
    position: relative;
    transition: all 0.3s ease;
}

.draggable-section.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    z-index: 1000;
}

.draggable-section.drag-over {
    background: rgba(0, 122, 255, 0.1);
    border: 2px dashed #007aff;
    border-radius: 16px;
}

.draggable-handle {
    cursor: move;
}

.drag-handle {
    color: #86868b;
    font-size: 14px;
    cursor: move;
    padding: 0 8px;
    user-select: none;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.drag-handle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #007aff;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

/* 区域标题样式 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1d1d1f;
}

/* 面包屑导航样式 */
.breadcrumb-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.breadcrumb-nav.visible {
    min-height: auto;
    max-height: 60px;
    opacity: 1;
    animation: breadcrumbSlideIn 0.3s ease-out;
}

@keyframes breadcrumbSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.breadcrumb-path {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.breadcrumb-item {
    color: #007aff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.breadcrumb-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #007aff;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.breadcrumb-item:hover::before {
    width: 80%;
}

.breadcrumb-item:hover {
    background: rgba(0, 122, 255, 0.1);
    transform: translateY(-2px);
    color: #0056b3;
}

.breadcrumb-item:last-child {
    color: #1d1d1f;
    cursor: default;
    font-weight: 600;
    position: relative;
}

.breadcrumb-item:last-child::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #1d1d1f;
    border-radius: 1px;
}

.breadcrumb-item:last-child:hover {
    background: transparent;
    transform: none;
    color: #1d1d1f;
}

/* 省略号样式 */
.breadcrumb-ellipsis {
    color: #86868b;
    cursor: default;
    font-weight: 400;
    padding: 4px 6px;
    user-select: none;
}

.breadcrumb-ellipsis:hover {
    background: transparent;
    transform: none;
    color: #86868b;
}

.breadcrumb-ellipsis::before {
    display: none;
}

.breadcrumb-separator {
    color: #86868b;
    font-size: 14px;
    margin: 0 2px;
    user-select: none;
    animation: separatorPulse 2s ease-in-out infinite;
}

@keyframes separatorPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.back-button {
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.3);
    color: #007aff;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    overflow: hidden;
}

.back-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 122, 255, 0.2);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

.back-button:hover::before {
    width: 100px;
    height: 100px;
}

.back-button:hover {
    background: rgba(0, 122, 255, 0.2);
    transform: scale(1.05) translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.back-button:active {
    transform: scale(1.02) translateY(-0.5px);
}

.back-button > * {
    position: relative;
    z-index: 1;
}

/* 书签区域 */
.bookmarks-section {
    grid-column: span 2;
}

.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 16px;
    padding: 10px;
}

.bookmark-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #1d1d1f;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 12px;
    will-change: transform, opacity;
}

.bookmark-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.bookmark-icon-container {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.bookmark-icon-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bookmark-item:hover .bookmark-icon-container::before {
    opacity: 1;
}

.bookmark-item:hover .bookmark-icon-container {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.bookmark-item:active .bookmark-icon-container {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.bookmark-favicon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 1;
}

.bookmark-favicon img {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    object-fit: cover;
}

.bookmark-favicon.text-only {
    font-size: 24px;
    font-weight: 600;
    color: var(--preview-text);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.bookmark-icon-container.text-only {
    background: var(--preview-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bookmark-title {
    font-size: 11px;
    font-weight: 400;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
    margin-top: 6px;
}

.bookmark-url {
    display: none;
}

.ascii-decoration {
    display: none;
}

/* 默认网站颜色 */
.bookmark-icon-container.default-color {
    background: var(--preview-bg);
}

/* 书签夹预览样式 */
.bookmark-icon-container.folder-preview {
    background: var(--preview-bg);
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1;
    padding: 4px;
    box-sizing: border-box;
}

/* 确保书签夹在网格中的标题显示在图标容器下方 */
.folder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.folder-item .bookmark-title {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 400;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
}

.folder-preview-grid {
    display: grid;
    gap: 2px;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-content: center;
}

/* 9宫格布局（3x3） */
.folder-preview-grid.grid-9 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

/* 4宫格布局（2x2） */
.folder-preview-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.preview-item {
    background: var(--preview-bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 500;
    color: var(--preview-text);
    overflow: hidden;
    position: relative;
    aspect-ratio: 1;
}

/* 单个元素占2行2列（4宫格左上位置，占1/4） */
.preview-item.span-2x2 {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: 1;
}

.preview-item.favicon {
    padding: 0;
}

.preview-item.favicon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

.preview-item.text {
    background: rgba(0, 0, 0, 0.05);
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--preview-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-item.text-only {
    background: rgba(0, 0, 0, 0.05);
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--preview-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 书签夹悬停效果 */
.bookmark-item:hover .folder-preview-grid {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.preview-item:hover {
    background: rgba(0, 122, 255, 0.1);
    z-index: 1;
}

/* 有图标时使用纯白色背景 */
.bookmark-icon-container {
    background: var(--bookmark-bg);
    border-radius: 8px;
}

/* 无图标时使用网站特定背景色 */
.bookmark-icon-container.text-only.github {
    background: linear-gradient(135deg, #24292e 0%, #1a1e22 100%);
}

.bookmark-icon-container.text-only.google {
    background: linear-gradient(135deg, #4285f4 0%, #1a73e8 100%);
}

.bookmark-icon-container.text-only.youtube {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
}

.bookmark-icon-container.text-only.twitter {
    background: linear-gradient(135deg, #1da1f2 0%, #0d8bd9 100%);
}

.bookmark-icon-container.text-only.reddit {
    background: linear-gradient(135deg, #ff4500 0%, #e63900 100%);
}

.bookmark-icon-container.text-only.stackoverflow {
    background: linear-gradient(135deg, #f48024 0%, #e76f00 100%);
}

.bookmark-icon-container.text-only.mdn {
    background: linear-gradient(135deg, #000000 0%, #333333 100%);
}

.bookmark-icon-container.text-only.react {
    background: linear-gradient(135deg, #61dafb 0%, #20a8d8 100%);
}

.bookmark-icon-container.text-only.vue {
    background: linear-gradient(135deg, #4fc08d 0%, #3ba776 100%);
}

.bookmark-icon-container.text-only.angular {
    background: linear-gradient(135deg, #dd0031 0%, #c3002f 100%);
}

.bookmark-icon-container.text-only.nodejs {
    background: linear-gradient(135deg, #339933 0%, #2d7d2d 100%);
}

.bookmark-icon-container.text-only.python {
    background: linear-gradient(135deg, #3776ab 0%, #2d5f8a 100%);
}

.bookmark-icon-container.text-only.java {
    background: linear-gradient(135deg, #f89820 0%, #e88700 100%);
}

.bookmark-icon-container.text-only.vscode {
    background: linear-gradient(135deg, #007acc 0%, #005a9e 100%);
}

.bookmark-icon-container.text-only.webstorm {
    background: linear-gradient(135deg, #00c8ff 0%, #00a6d6 100%);
}

.bookmark-icon-container.text-only.sublime {
    background: linear-gradient(135deg, #ff9800 0%, #e68900 100%);
}

.bookmark-icon-container.text-only.git {
    background: linear-gradient(135deg, #f05032 0%, #e04022 100%);
}

.bookmark-icon-container.text-only.gitlab {
    background: linear-gradient(135deg, #fc6d26 0%, #e24329 100%);
}

.bookmark-icon-container.text-only.figma {
    background: linear-gradient(135deg, #f24e1e 0%, #e04022 100%);
}

.bookmark-icon-container.text-only.sketch {
    background: linear-gradient(135deg, #fdad00 0%, #e5a000 100%);
}

.bookmark-icon-container.text-only.adobe-xd {
    background: linear-gradient(135deg, #ff61f6 0%, #e050d6 100%);
}

.bookmark-icon-container.text-only.font-awesome {
    background: linear-gradient(135deg, #339af0 0%, #1c7ed6 100%);
}

.bookmark-icon-container.text-only.material-icons {
    background: linear-gradient(135deg, #757575 0%, #616161 100%);
}

.bookmark-icon-container.text-only.feather-icons {
    background: linear-gradient(135deg, #000000 0%, #333333 100%);
}

.bookmark-icon-container.text-only.coursera {
    background: linear-gradient(135deg, #0056d2 0%, #0047b8 100%);
}

.bookmark-icon-container.text-only.udemy {
    background: linear-gradient(135deg, #a435f0 0%, #9028d6 100%);
}

.bookmark-icon-container.text-only.edx {
    background: linear-gradient(135deg, #02262b 0%, #023238 100%);
}

.bookmark-icon-container.coursera {
    background: linear-gradient(135deg, #0056d2 0%, #0047b8 100%);
}

.bookmark-icon-container.udemy {
    background: linear-gradient(135deg, #a435f0 0%, #9028d6 100%);
}

.bookmark-icon-container.edx {
    background: linear-gradient(135deg, #02262b 0%, #023238 100%);
}

/* 文件夹项目样式 */
.folder-item {
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

.folder-item .bookmark-icon-container {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 122, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.folder-item .bookmark-icon-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 122, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.folder-item:hover .bookmark-icon-container::before {
    left: 100%;
}

.folder-item:hover .bookmark-icon-container {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 122, 255, 0.15);
    border-color: rgba(0, 122, 255, 0.4);
}

.folder-item:active .bookmark-icon-container {
    transform: translateY(-2px) scale(1.01);
    transition: all 0.1s ease;
}

.folder-arrow {
    font-size: 16px;
    color: #007aff;
    transition: all 0.3s ease;
    display: inline-block;
}

.folder-item:hover .folder-arrow {
    transform: translateX(5px) scale(1.1);
}

/* 文件夹进入动画 */
.folder-enter {
    animation: folderEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes folderEnter {
    from {
        opacity: 0;
        transform: scale(0.8) rotateX(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateX(0);
    }
}

/* 文件夹退出动画 */
.folder-exit {
    animation: folderExit 0.3s ease-in;
}

@keyframes folderExit {
    from {
        opacity: 1;
        transform: scale(1) rotateX(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) rotateX(10deg);
    }
}

/* 文件夹内容进入动画 */
.folder-content-enter {
    animation: folderContentEnter 0.5s ease-out;
}

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

/* 保留原有的书签夹样式（用于向后兼容） */
.bookmark-folder {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.bookmark-folder:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.bookmark-folder.expanded {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    gap: 10px;
    transition: background 0.2s ease;
}

.folder-header:hover {
    background: rgba(0, 122, 255, 0.05);
}

.folder-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #007aff;
    transition: transform 0.3s ease;
}

.bookmark-folder.expanded .folder-toggle {
    transform: rotate(90deg);
}

.folder-content {
    background: rgba(248, 248, 248, 0.8);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 10px;
}

.child-bookmark {
    background: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.child-bookmark:last-child {
    margin-bottom: 0;
}

.child-bookmark:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.bookmark-count {
    font-size: 11px;
    color: #86868b;
    font-weight: 400;
}

.bookmark-favicon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

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

.bookmark-url {
    font-size: 12px;
    color: #86868b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 刷新按钮 */
.refresh-btn {
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.3);
    color: #007aff;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: rgba(0, 122, 255, 0.2);
    transform: scale(1.05);
}

/* 历史记录区域 */
.history-section {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    text-decoration: none;
    color: #1d1d1f;
    transition: background 0.2s ease;
}

.history-item:hover {
    background: rgba(0, 122, 255, 0.1);
}

.history-time {
    font-size: 11px;
    color: #86868b;
    margin-right: 12px;
    min-width: 50px;
}

.history-title {
    font-size: 14px;
    font-weight: 500;
}

.history-url {
    font-size: 12px;
    color: #86868b;
    margin-left: auto;
}

/* 历史筛选器 */
#historyFilter {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    color: #1d1d1f;
}

/* 最常使用区域 */
.frequent-section {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.frequent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 16px;
    padding: 10px;
}

.frequent-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #1d1d1f;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 12px;
}

.frequent-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.frequent-item .bookmark-icon-container {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.frequent-item:hover .bookmark-icon-container {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.frequent-item .bookmark-title {
    font-size: 11px;
    font-weight: 400;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
    margin-top: 6px;
}

.frequent-count {
    font-size: 10px;
    color: #86868b;
    margin-top: 4px;
    text-align: center;
}

/* ASCII装饰元素 */
.ascii-decoration {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: rgba(94, 94, 94, 0.3);
    user-select: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .bookmarks-section {
        grid-column: span 1;
    }

    #searchInput {
        width: 250px;
    }

    .ascii-art pre {
        font-size: 10px;
    }
}

/* 小屏幕优化（iPhone SE/Mini 等小尺寸设备） */
@media (max-width: 420px) {
    /* 顶部区域布局调整 */
    .container {
        padding: 10px;
    }

    /* 搜索和设置在同一行 */
    .search-settings-row {
        margin: 15px 0;
        gap: 10px;
    }

    /* 搜索框 */
    .search-container {
        padding: 6px 12px;
    }

    #searchInput {
        width: 100%;
        min-width: 0;
        font-size: 14px;
        padding: 6px;
    }

    /* 设置按钮 */
    .settings-button {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* 设置菜单在小屏幕上的位置 */
    .settings-menu {
        position: absolute;
        top: 100%;
        right: 0;
        z-index: 20;
    }
}

    #searchInput {
        width: 100%;
        min-width: 0;
        font-size: 14px;
        padding: 6px;
    }

    #searchBtn {
        font-size: 16px;
        padding: 3px;
    }

    /* 布局控制栏调整 */
    .layout-controls {
        padding: 8px 10px;
        margin: 10px 0;
    }

    .layout-hint {
        font-size: 11px;
    }

    /* 面包屑导航调整 */
    .breadcrumb-nav {
        padding: 8px 12px;
        margin-bottom: 10px;
    }

    .breadcrumb-item {
        font-size: 12px;
        padding: 3px 6px;
    }

    .back-button {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* 主内容区域调整 */
    .main-content {
        margin-top: 20px;
        gap: 15px;
    }

    /* 书签网格调整 */
    .bookmarks-grid {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
        gap: 10px;
        padding: 8px;
    }

    .bookmark-item {
        padding: 6px;
    }

    .bookmark-icon-container {
        width: 48px;
        height: 48px;
    }

    .bookmark-favicon {
        font-size: 20px;
    }

    .bookmark-favicon.text-only {
        font-size: 20px;
    }

    .bookmark-title {
        font-size: 10px;
        margin-top: 4px;
    }

    /* 频繁使用网格调整 */
    .frequent-grid {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
        gap: 10px;
        padding: 8px;
    }

    .frequent-item {
        padding: 6px;
    }

    .frequent-count {
        font-size: 10px;
    }

    /* 历史记录和频繁使用区域调整 */
    .history-section,
    .frequent-section {
        padding: 15px;
        border-radius: 12px;
    }

    .section-header h2 {
        font-size: 18px;
    }

    /* 搜索结果调整 */
    .search-result-item {
        padding: 10px 12px;
    }

    .search-result-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 16px;
        margin-right: 10px;
    }

    .search-result-icon img {
        width: 20px;
        height: 20px;
    }

    .search-result-title {
        font-size: 14px;
    }

    .search-result-path,
    .search-result-url,
    .search-result-meta {
        font-size: 11px;
    }

    /* 历史记录调整 */
    .history-item {
        padding: 8px;
    }

    .history-time {
        font-size: 10px;
        min-width: 45px;
        margin-right: 8px;
    }

    .history-title {
        font-size: 13px;
    }

    .history-url {
        font-size: 10px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 122, 255, 0.3);
    border-radius: 50%;
    border-top-color: #007aff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 页面切换动画 */
.page-transition {
    animation: pageFadeIn 0.4s ease-out;
}

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

/* 滑动切换动画 */
.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 淡出动画 */
.fade-out {
    animation: fadeOut 0.2s ease-out;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* 弹性进入动画 */
.bounce-in {
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 交错动画 */
.stagger-animation > * {
    opacity: 0;
    animation: staggerFadeIn 0.4s ease-out forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-animation > *:nth-child(8) { animation-delay: 0.4s; }

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

/* 搜索结果样式 */

/* 搜索模式 - 使用 flex 列表布局替代 grid 布局 */
.bookmarks-grid.search-mode {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px;
    max-width: 100%;
}

/* 搜索结果信息 */
.search-result-info {
    text-align: center;
    color: var(--text-color);
    padding: 15px 20px;
    font-size: 14px;
    opacity: 0.7;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 10px;
}

/* 搜索结果项 */
.search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bookmark-bg);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-color);
    width: 100%;
    box-sizing: border-box;
}

.search-result-item:hover {
    background: var(--bookmark-hover);
    transform: translateX(4px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.search-result-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--preview-bg);
    border-radius: 8px;
    margin-right: 12px;
    font-size: 20px;
    flex-shrink: 0;
}

.search-result-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
}

.search-result-path {
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.6;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-url {
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.5;
    margin-top: 2px;
}

.search-result-folder {
    background: linear-gradient(135deg, var(--bookmark-bg) 0%, var(--preview-bg) 100%);
}

.search-result-folder:hover {
    background: linear-gradient(135deg, var(--bookmark-hover) 0%, var(--bookmark-bg) 100%);
}

/* 无结果提示 */
.no-result {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color);
    width: 100%;
    box-sizing: border-box;
}

.no-result-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-result-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.no-result-hint {
    font-size: 14px;
    opacity: 0.6;
}

/* 搜索结果进入动画 */
.search-result-item {
    animation: searchResultSlideIn 0.3s ease-out;
}

@keyframes searchResultSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 交错动画 - 只在搜索模式下生效 */
.bookmarks-grid.search-mode .search-result-item:nth-child(1) { animation-delay: 0.05s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(2) { animation-delay: 0.1s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(3) { animation-delay: 0.15s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(4) { animation-delay: 0.2s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(5) { animation-delay: 0.25s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(6) { animation-delay: 0.3s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(7) { animation-delay: 0.35s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(8) { animation-delay: 0.4s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(9) { animation-delay: 0.45s; }
.bookmarks-grid.search-mode .search-result-item:nth-child(10) { animation-delay: 0.5s; }