:root {
    --bg-primary: #f1f5f9; 
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-md: 12px;
    --radius-lg: 16px;
    /* 新增主题色全局变量，便于维护 */
    --theme-color: #0078D4;
}

[v-cloak] { opacity: 0 !important; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ==========================================================================
   ⚡ 正在加载组件（包含全屏 Loader、动态骨架屏 与 呼吸文字）
   ========================================================================== */

/* 1. 全屏加载遮罩层 */
.first-load-shimmer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(241, 245, 249, 0.96); 
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 1;
}

.first-load-shimmer-overlay.fade-out-complete {
    opacity: 0;
    pointer-events: none;
}

/* 2. 核心旋转能量圈 */
.quantum-spinner {
    width: 42px;
    height: 42px;
    /* 优化：配合 #0078D4 的淡蓝色背景圈 */
    border: 3.5px solid rgba(0, 120, 212, 0.15);
    border-top-color: var(--theme-color);
    border-radius: 50%;
    animation: quantum-spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* 3. 加载文字 */
.shimmer-loading-text {
    color: #475569;
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0;
    margin-top: 16px;
    letter-spacing: 0.5px;
    animation: pulse-text 1.5s infinite ease-in-out;
}

@keyframes quantum-spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse-text { 
    0%, 100% { opacity: 0.6; } 50% { opacity: 1; } 
}

/* 4. 骨架屏流光闪烁矩阵 */
.skeleton-matrix-item {
    pointer-events: none;
    background: #ffffff !important;
}

.category-card-title-skeleton,
.sk-matrix-icon,
.sk-matrix-line {
    position: relative;
    overflow: hidden;
    background: #f1f5f9 !important;
}

.category-card-title-skeleton::after,
.sk-matrix-icon::after,
.sk-matrix-line::after {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.7) 20%,
        rgba(255, 255, 255, 0.7) 60%,
        rgba(255, 255, 255, 0) 100
    );
    animation: shimmer 1.5s ease-in-out infinite;
    content: '';
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

.category-card-title-skeleton { width: 120px; height: 20px; border-radius: 4px; margin-bottom: 12px; }
.sk-matrix-icon { width: 48px; height: 48px; border-radius: 12px; margin-bottom: 8px; }
.sk-matrix-line { width: 60%; height: 10px; border-radius: 4px; margin: 0 auto; }


/* ==========================================================================
   布局、导航栏与卡片主体（🎯 已优化宽度与质感）
   ========================================================================== */

.nav-brand-text-shimmer {
    font-size: 1.15rem; 
    font-weight: 700;
    background: linear-gradient(
        110deg, 
        #0f172a 0%, 
        #0f172a 45%, 
        #ffffff 50%, 
        #0f172a 55%, 
        #0f172a 100%
    );
    background-size: 300% 100%;
    background-position: 100% 0;
    background-clip: text; 
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; 
    animation: textShine 5s ease-in-out infinite;
}

@keyframes textShine {
    0% { background-position: 100% 0; }
    18% { background-position: 0% 0; }
    100% { background-position: 0% 0; }
}

.nav-brand-logo-wrap { width: 32px; height: 32px; flex-shrink: 0; }
.nav-brand-logo { height: 100%; width: 100%; object-fit: contain; border-radius: 6px; -webkit-text-fill-color: initial; }

.navbar-wrapper { width: 100%; display: flex; justify-content: center; background: #ffffff; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; }

/* ✨ 优化：导航栏最大宽度缩窄至 1000px */
.navbar { max-width: 1000px; width: 92%; height: 60px; display: flex; justify-content: space-between; align-items: center; }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; -webkit-tap-highlight-color: transparent !important; }
.logo:hover { opacity: 0.85; }
.logo:focus, .logo:active { outline: none !important; background-color: transparent !important; box-shadow: none !important; }
.nav-links { display: flex; align-items: center; gap: 12px; }

/* ✨ 优化：主内容容器最大宽度缩窄至 1000px */
.container { max-width: 1000px; width: 92%; margin: 0 auto; padding: 20px 0; }

.main-search-card { background: #ffffff; border: 1px solid var(--border-color); border-radius: 50px; padding: 10px 20px; display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.main-search-input { flex: 1; border: none; outline: none; font-size: 0.95rem; background: transparent; }
.main-search-clear { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); }

.category-horizontal-bar { width: 100%; margin-bottom: 20px; }
.category-scroll-container { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.category-scroll-container::-webkit-scrollbar { display: none; }
.category-btn { padding: 6px 14px; border: 1px solid var(--border-color); background: #ffffff; border-radius: 30px; font-size: 0.88rem; cursor: pointer; white-space: nowrap; }
/* 修改：高亮分类按钮为新主题色 */
.category-btn.active { background: var(--theme-color); color: white; border-color: var(--theme-color); }

/* 大卡片聚合流容器 */
.mega-stream-wrapper { display: flex; flex-direction: column; gap: 24px; }

/* ✨ 优化：升级主卡片的阴影投射，配合缩窄后的页面更有悬浮高级感 */
.mega-links-container-card { 
    background: #ffffff; 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-lg); 
    padding: 24px; 
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.02), 0 4px 12px -2px rgba(15, 23, 42, 0.01); 
}

/* 分类头部标题栏 */
.category-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; border-bottom: 1px dashed var(--border-color); padding-bottom: 12px; }
.category-card-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.category-card-count { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* 电脑端高密度自适应网格 */
.grid-layout-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 16px; }

/* 网址精简组件 */
.matrix-item { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 8px; border-radius: var(--radius-md); text-decoration: none; background: transparent; transition: all 0.2s ease-in-out; text-align: center; cursor: pointer; }
.matrix-item:hover { background: #f8fafc; transform: scale(1.05); }
.matrix-icon-avatar { width: 48px; height: 48px; background: #f1f5f9; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 8px; transition: background 0.2s; }
.matrix-item:hover .matrix-icon-avatar { background: #e2e8f0; }
.matrix-item-title { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 基础通用组件 */
.btn { padding: 6px 14px; border-radius: 6px; font-weight: 500; cursor: pointer; font-size: 0.85rem; border: none; }
/* 修改：全局主按钮改为新主题色 */
.btn-primary-global { background-color: var(--theme-color); color: white; }
.btn-sub { background-color: #f1f5f9; color: #475569; }
/* 修改：编辑操作按钮的浅蓝背景和蓝字 */
.btn-edit-action { background: #f0f7ff; color: var(--theme-color); border: none; padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.btn-danger-action { background: #fef2f2; color: #ef4444; border: none; padding: 2px 6px; border-radius: 4px; cursor: pointer; }

/* 弹窗核心样式区 */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15,23,42,0.2); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: white; border-radius: var(--radius-lg); padding: 20px; box-shadow: 0 15px 30px -5px rgba(0,0,0,0.1); max-width: 500px; width: 90%; box-sizing: border-box; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-weight: 700; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.form-group { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.form-control { padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 6px; outline: none; font-size: 0.9rem; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-color); margin-bottom: 16px; padding-bottom: 4px; overflow-x: auto; }
.tab-btn { padding: 6px 10px; background: none; border: none; font-size: 0.88rem; cursor: pointer; color: var(--text-muted); white-space: nowrap; }
/* 修改：激活态的标签文字与下划线改为新主题色 */
.tab-btn.active { color: var(--theme-color); font-weight: 600; border-bottom: 2px solid var(--theme-color); }

/* 菜单容器与列表 */
.hamburger-container { position: relative; display: inline-block; }
.hamburger-menu { position: absolute; right: 0; top: 110%; background: white; border: 1px solid var(--border-color); border-radius: 8px; padding: 4px; box-shadow: 0 8px 16px rgba(0,0,0,0.06); display: flex; flex-direction: column; min-width: 120px; z-index: 1050; }
.hamburger-menu button { padding: 8px 10px; background: none; border: none; font-size: 0.85rem; text-align: left; cursor: pointer; color: var(--text-primary); }
.hamburger-menu button:hover { background-color: #f1f5f9; border-radius: 4px; }

/* 全局提示容器（已深度优化为居中胶囊样式） */
.toast-container { 
    position: fixed; 
    top: 24px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 999999; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 10px; 
    pointer-events: none; 
    width: 90%; 
    max-width: 400px;
}

.toast { 
    background: rgba(15, 23, 42, 0.9); 
    backdrop-filter: blur(8px); 
    color: white; 
    padding: 10px 22px; 
    border-radius: 50px; 
    font-size: 0.88rem; 
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    text-align: center;
    pointer-events: auto; 
    animation: toast-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes toast-in {
    0% { opacity: 0; transform: translateY(15px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.footer { text-align: center; padding: 30px 0; font-size: 0.8rem; color: var(--text-muted); margin-top: 40px; }


/* ==========================================================================
   📱 移动端自适应加固区
   ========================================================================== */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 12px;
        box-sizing: border-box;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .modal {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px 18px 20px 18px !important;
        border-radius: 14px !important;
    }

    .tabs {
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        gap: 6px !important;
        padding-bottom: 8px !important;
        margin-bottom: 16px !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .tabs::-webkit-scrollbar {
        display: none; 
    }

    .tab-btn {
        padding: 6px 12px !important;
        font-size: 0.82rem !important;
        flex-shrink: 0 !important; 
    }

    .modal table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal th, .modal td {
        padding: 8px 6px !important;
        font-size: 0.8rem !important;
    }

    /* 分类管理界面自适应微调 */
    .modal [v-if="currentTab === 'categories'"] > div:last-child {
        max-height: 220px !important;
    }
    
    .modal [v-if="currentTab === 'categories'"] > div:last-child > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    
    .modal [v-if="currentTab === 'categories'"] > div:last-child > div > div:last-child {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    
    .hamburger-menu {
        right: 0 !important;
        margin-top: 4px !important;
    }
}

/* 📱 锁死一行 4 个 */
@media (max-width: 600px) {
    .mega-links-container-card { padding: 16px 12px; }
    .category-card-header { margin-bottom: 14px; padding-bottom: 8px; }
    .category-card-title { font-size: 0.95rem; }
    
    .grid-layout-matrix {
        grid-template-columns: repeat(4, 1fr) !important; 
        gap: 12px 6px; 
    }
    .matrix-icon-avatar { width: 40px; height: 40px; font-size: 1.25rem; }
    .matrix-item-title { font-size: 0.75rem; }
    .sk-matrix-icon { width: 40px; height: 40px; margin-bottom: 8px; }
}