/* ==========================================================================
   个人中心全局样式 (public/assets/app.css)
   配色: 深蓝 #0f172a / 白色卡片 #f8fafc / 主色 #2563eb
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body, #app {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #0f172a;
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------- 主容器 ----------- */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* ----------- 顶部导航 ----------- */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: #ffffff;
    color: #f8fafc;
    border-bottom: 1px solid #e8ecf3;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-nav .brand {
    font-size: 17px;
    font-weight: 700;
    color: #1e3a8a;
    letter-spacing: 0.5px;
}

.top-nav .brand a {
    color: #1e3a8a;
    text-decoration: none;
}

.top-nav .nav-tag {
    color: #94a3b8;
    font-size: 13px;
}

/* 顶栏 登录/退出 按钮 */
.top-nav .auth-btn {
    cursor: pointer;
    background: #4472c4;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
}
.top-nav .auth-btn:hover { background: #3a63ae; }

.nav-items {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-items a {
    color: #cbd5e1;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.15s;
}

.nav-items a:hover,
.nav-items a.router-link-active {
    color: #ffffff;
}

.nav-items .nav-user {
    color: #e2e8f0;
    font-size: 13px;
}

/* 汉堡按钮：默认隐藏，移动端才显示 */
.mobile-toggle {
    display: none;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid rgba(248, 250, 252, 0.2);
    border-radius: 6px;
    color: #f8fafc;
    cursor: pointer;
    font-size: 18px;
    align-items: center;
    justify-content: center;
}
.mobile-toggle:hover { background: rgba(248, 250, 252, 0.08); }

/* ----------- 面包屑 ----------- */
.breadcrumb {
    margin: 0 0 18px;
    padding: 0;
    font-size: 13px;
    color: #64748b;
}
.breadcrumb a {
    color: #2563eb;
    text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep {
    margin: 0 6px;
    color: #94a3b8;
}
.breadcrumb .current {
    color: #334155;
    font-weight: 500;
}

/* ----------- 卡片网格 ----------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* ----------- 书签卡片 ----------- */
.bookmark-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow 0.15s, transform 0.08s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    min-height: 110px;
}
.bookmark-card:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}
.bookmark-card .title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 6px;
    line-height: 1.4;
    word-break: break-word;
}
.bookmark-card .desc {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 12px;
    flex: 1;
    word-break: break-word;
}
.bookmark-card .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #94a3b8;
}

/* 搜索命中高亮 */
.bookmark-card.matched {
    border: 2px solid #2563eb;
    background: #ffffff;
}

/* ----------- 密码点显示 ----------- */
.dot-pw {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    letter-spacing: 2px;
    color: #334155;
    user-select: all;
}

/* ----------- 骨架屏 Loading ----------- */
.skeleton {
    width: 100%;
    height: 24px;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        #e2e8f0 0%,
        #f1f5f9 40%,
        #e2e8f0 80%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ----------- 云盘上传进度条 ----------- */
#disk-upload-progress {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    position: relative;
}
#disk-upload-progress .bar {
    display: block;
    height: 100%;
    width: 0%;
    background: #2563eb;
    border-radius: 999px;
    transition: width 0.3s ease;
}
#disk-upload-progress .bar.indeterminate {
    width: 30%;
    animation: upload-indeterminate 1.2s linear infinite;
}
@keyframes upload-indeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* ----------- 通用内容卡片（白色面板） ----------- */
.panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

/* ------------------------------------------------------------------
   单页卡片流：所有功能模块以「卡片」形式在一页展示
   自适应网格 + 可拖拽排序 + 可折叠
------------------------------------------------------------------- */
.module-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 16px;
}
.module-toolbar .mt-tip {
    font-size: 13px;
    color: #64748b;
}
.module-toolbar .mt-actions { display: flex; gap: 8px; }

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    align-items: start;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.module-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    min-width: 0;
    overflow: hidden;
    background: #ffffff;
    border-top: 3px solid #4472c4;
    padding: 12px 14px;
}
.module-card.dragging { opacity: 0.4; }
.module-card.drag-over { outline: 2px dashed #2563eb; outline-offset: 2px; }

/* 卡片顶部标题栏（可拖动排序） */
.module-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: grab;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    user-select: none;
}
.module-card-header:active { cursor: grabbing; }
.module-card-handle {
    color: #cbd5e1;
    cursor: grab;
    font-size: 16px;
    line-height: 1;
    letter-spacing: 1px;
}
.module-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    gap: 8px;
    align-items: center;
}
.module-card-count {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: #eef2f7;
    border-radius: 999px;
    padding: 0 8px;
    line-height: 20px;
}

/* 折叠按钮 */
.module-card .collapse-btn {
    margin-left: auto;
    cursor: pointer;
    background: #eef2f7;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    color: #475569;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.module-card .collapse-btn:hover { background: #e2e8f0; }

/* 卡片主体：限高内部滚动，保证“一页展示” */
.module-card-body {
    padding-top: 10px;
    min-height: 0;
    max-height: 62vh;
    overflow: auto;
}

/* 编辑 / 收起切换按钮 */
.module-card .edit-btn {
    cursor: pointer;
    background: #eef2f7;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    color: #1e3a8a;
    margin-left: auto;
}
.module-card .edit-btn:hover { background: #e2e8f0; }

/* 方形圆角 logo + 名称 宫格 */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 14px 10px;
}
.tile-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-align: center;
}
.tile-logo {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(135deg, #4472c4, #6f9ae0);
}
.tile-logo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tile-name {
    font-size: 12px;
    color: #475569;
    line-height: 1.2;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* 卡片内去除视图自带的整页容器约束 */
.module-card-body .app-container {
    max-width: none;
    padding: 0;
}
.module-card-body .panel {
    padding: 14px 16px;
    margin-bottom: 12px;
    height: auto !important; /* 覆盖视图内部写死的 100vh 高度 */
}

.placeholder-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    padding: 8px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 12px;
}

/* ------------------------------------------------------------------
   门户工作台：Hero + 全局搜索 + 快捷入口宫格
------------------------------------------------------------------- */
.portal-hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 44px 24px 6px;
    text-align: center;
}
.portal-hero .pt-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0 0 8px;
    letter-spacing: 1px;
}
.portal-hero .pt-sub {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 26px;
}

.hero-search {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #4472c4;
    border-radius: 999px;
    padding: 6px 8px 6px 22px;
    box-shadow: 0 12px 32px rgba(68, 114, 196, 0.28);
}
.hero-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    background: transparent;
    color: #fff;
    padding: 8px 0;
}
.hero-search input::placeholder { color: rgba(255, 255, 255, 0.75); }
.hero-search button {
    background: #ffffff;
    color: #1e3a8a;
    border: none;
    border-radius: 999px;
    padding: 9px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.hero-search button:hover { background: #eef3fd; }

.quick-widget {
    max-width: 1200px;
    margin: 26px auto 0;
    padding: 0 24px;
}
.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.quick-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.quick-tile:hover {
    border-color: #4472c4;
    box-shadow: 0 8px 24px rgba(68, 114, 196, 0.16);
    transform: translateY(-2px);
}
.quick-tile .qt-icon { font-size: 26px; line-height: 1; }
.quick-tile .qt-label {
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.portal-section {
    max-width: 1200px;
    margin: 30px auto 0;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.portal-section h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e3a8a;
}
.panel h2 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}
.panel p { margin: 0 0 8px; color: #334155; }

/* ----------- 响应式：移动端 (<=768px) ----------- */
@media (max-width: 768px) {
    .app-container {
        padding: 16px;
    }

    .top-nav {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .mobile-toggle {
        display: inline-flex;
    }

    .nav-items {
        flex: 1 0 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 0 4px;
        margin-top: 6px;
        border-top: 1px solid rgba(248, 250, 252, 0.08);
        display: none; /* 默认收起，加 .open 展开 */
    }
    .nav-items.open {
        display: flex;
    }

    /* 卡片单列 */
    .card-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .module-grid {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
    }
    .portal-hero { padding: 30px 16px 4px; }
    .portal-hero .pt-title { font-size: 22px; }
    .hero-search { padding-left: 16px; }
    .hero-search button { padding: 9px 16px; }
    .quick-widget, .portal-section { padding-left: 12px; padding-right: 12px; }
    .quick-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    .quick-tile { padding: 14px 4px; }
    .quick-tile .qt-icon { font-size: 22px; }
    .quick-tile .qt-label { font-size: 12px; }

    .panel {
        padding: 16px;
    }
}
