/* 核心变量 */
:root {
    --primary-color: #00f2fe;
    --primary-hover: #4facfe;
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.0); /* 完全透明 */
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1); /* 减弱阴影 */
    --card-bg: rgba(255, 255, 255, 0.02); /* 卡片极度透明 */
    --card-hover: rgba(255, 255, 255, 0.08);
    --border-radius: 16px;
    --border-radius-sm: 10px;
    --transition-fast: 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    color: var(--text-color);
    overflow: hidden;
    background-color: #000; /* 底色改黑以衬托视频 */
    height: 100vh;
    width: 100vw;
}

/* ================== 底层背景 ================== */
#media-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
}

#bg-video, #bg-image {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translateX(-50%) translateY(-50%);
    object-fit: cover;
    transition: opacity 1s ease;
}

#bg-image {
    background-size: cover;
    background-position: center;
    opacity: 0; /* 默认隐藏，由 JS 控制 */
}

.bg-overlay {
    position: absolute;
    inset: 0;
    /* 弱化遮罩，让视频更亮 */
    background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
}

/* 预设 CSS 背景主题 */
.theme-gradient-aurora {
    background: linear-gradient(120deg, #1a2a6c, #11998e, #38ef7d);
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
}

.theme-gradient-dusk {
    background: linear-gradient(to right, #ff4e50, #f9d423);
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.secret-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

/* ================== 顶层交互面板 ================== */
.glass-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    display: flex;
    flex-direction: column;
    /* 物理拖拽特效通过 JS transform 实现 */
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    
    /* 核心属性：极度透明 */
    background: var(--glass-bg);
    /* 降低模糊度以增加通透感 */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-bottom: 1px solid var(--glass-border);
}

.glass-panel.dragging {
    transition: none;
    cursor: grabbing !important;
}

/* ================== 顶部导航栏 ================== */
header {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 1.8rem;
    background: -webkit-linear-gradient(45deg, var(--primary-color), #b122e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.4));
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.actions {
    display: flex;
    gap: 15px;
}

/* ================== 按钮组件 ================== */
.glass-btn {
    padding: 8px 18px;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    background: var(--glass-bg);
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    backdrop-filter: blur(5px);
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.3);
}

.glass-btn:active {
    transform: translateY(0);
}

.primary-glow {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(79, 172, 254, 0.2));
    border-color: rgba(0, 242, 254, 0.4);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

.primary-glow:hover {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.4), rgba(79, 172, 254, 0.4));
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
}

.glass-btn.outline {
    background: transparent;
}

/* ================== 内容区左右布局 ================== */
.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ================== 左侧边栏 ================== */
.glass-sidebar {
    width: 240px;
    border-right: 1px solid var(--glass-border);
    overflow-y: auto;
    padding: 20px 0;
    scrollbar-width: none; /* Firefox */
}
.glass-sidebar::-webkit-scrollbar { display: none; }

#category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 15px;
}

.category-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    font-weight: 500;
}

.category-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.8;
}

.category-item:hover {
    background: var(--card-bg);
    color: var(--text-color);
}

.category-item.active {
    background: var(--primary-glow);
    background: linear-gradient(90deg, rgba(0,242,254,0.15) 0%, transparent 100%);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    box-shadow: inset 0 0 10px rgba(0,242,254,0.05);
}
.category-item.active i {
    color: var(--primary-color);
    opacity: 1;
}

/* ================== 右侧主内容 ================== */
main {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    position: relative;
    /* 增加底部极大的内边距，确保最后一个分类能滚到最上面 */
    padding-bottom: 70vh; 
}

/* 隐藏主内容的滚动条，但保留滚动功能 */
main::-webkit-scrollbar {
    width: 6px;
}
main::-webkit-scrollbar-track {
    background: transparent;
}
main::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* ================== 拖拽手柄 ================== */
.drag-handle {
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    background: linear-gradient(0deg, rgba(0,0,0,0.1) 0%, transparent 100%);
    border-top: 1px solid var(--glass-border);
}
.drag-handle:active {
    cursor: grabbing;
}

.drag-indicator {
    width: 60px;
    height: 4px;
    background: rgba(255,255,255,0.4);
    border-radius: 10px;
    transition: width var(--transition-fast), background var(--transition-fast);
}

.drag-handle:hover .drag-indicator {
    width: 80px;
    background: rgba(255,255,255,0.8);
}

/* ================== 状态与动画 ================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80%;
    color: var(--text-muted);
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.empty-icon-wrap i {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.5;
    background: -webkit-linear-gradient(45deg, #fff, #888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================== 书签卡片网格 ================== */
.folder-section {
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease forwards;
}

.folder-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.bookmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* 高级卡片样式 */
.bookmark-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: var(--text-color);
    backdrop-filter: blur(5px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    /* 光晕伪元素准备 */
    z-index: 1;
    min-height: 85px; /* 增加卡片高度 */
}

/* 鼠标悬停光标发光特效 (JS 控制 --x/--y) */
.bookmark-card::before {
    content: '';
    position: absolute;
    top: var(--y, 0);
    left: var(--x, 0);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle closest-side, rgba(255,255,255,0.1), transparent);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
    pointer-events: none;
}

.bookmark-card:hover {
    transform: translateY(-4px) scale(1.02);
    background: var(--card-hover);
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3), 0 0 15px rgba(255,255,255,0.05);
}

.bookmark-card:hover::before {
    opacity: 1;
}

.bookmark-icon {
    width: 36px;
    height: 36px;
    margin-right: 16px;
    border-radius: 8px;
    background: #fff; /* 兜底白底防透明图看不清 */
    padding: 4px;
    object-fit: contain;
    flex-shrink: 0; /* 防止图标被压缩 */
}

.bookmark-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.bookmark-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    margin-bottom: 6px;
}

.bookmark-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-actions {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) translateX(20px);
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: var(--transition-fast);
}

.bookmark-card:hover .bookmark-actions {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.action-icon {
    color: var(--text-color);
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.action-icon:hover {
    background: var(--primary-color);
    color: #000;
    border-color: transparent;
}

.action-icon.delete:hover {
    background: #ff4757;
    color: #fff;
}

/* ================== 弹窗系统 ================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.glass-modal {
    background: rgba(20, 25, 40, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 35px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.1);
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); /* 回弹特效 */
}

.modal-overlay.active .glass-modal {
    transform: scale(1) translateY(0);
}

.glass-modal.large-modal {
    max-width: 700px;
}

.glass-modal h2 {
    margin-bottom: 25px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: var(--transition-fast);
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0,242,254,0.2);
    background: rgba(0,0,0,0.5);
}

.form-group input::placeholder {
    color: rgba(255,255,255,0.4);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

/* 自定义背景输入框 */
.custom-bg-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.custom-bg-input input {
    flex: 1;
    padding: 10px 15px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    outline: none;
}

.section-subtitle {
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 视频壁纸选项网格 */
.bg-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 5px;
}

.bg-options::-webkit-scrollbar { width: 4px; }
.bg-options::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.bg-option {
    position: relative;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-fast);
}

.bg-option video, .bg-option img, .bg-option .preview-color {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.bg-option span {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 2;
}

.bg-option:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.bg-option:hover video, .bg-option:hover img {
    transform: scale(1.1);
}

.bg-option.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0,242,254,0.5);
}

/* ================== 响应式适配 ================== */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .glass-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 10px 0;
        background: rgba(0,0,0,0.2); /* 稍微加深底色以区分 */
    }
    
    #category-list {
        flex-direction: row;
        overflow-x: auto;
        padding: 5px 15px;
        gap: 10px;
    }
    
    .category-item {
        white-space: nowrap;
        background: var(--card-bg);
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 8px 16px;
        border-radius: 20px;
    }
    
    .category-item.active {
        background: rgba(0,242,254,0.15);
        border-bottom: none;
        border: 1px solid var(--primary-color);
    }
    
    header {
        flex-wrap: wrap;
        gap: 15px;
        padding: 15px;
    }
    
    .actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .actions button span {
        display: none; /* 手机端只显示图标 */
    }
    
    main {
        padding: 20px;
    }
    
    .bookmark-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}
