/* ============================================================
   index.css — 社会工作者工具网 · 应用中心（应用商店模式）
   风格：玻璃拟态浅色 · 彩色渐变图标 · 大圆角
   包含：首页桌面网格 + 库页面（问卷库/文章库）列表样式
   ============================================================ */

/* ========== 全局重置 & 字体 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f4f7fc;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background-image:
        radial-gradient(circle at 10% 30%, rgba(66, 153, 225, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 90% 70%, rgba(56, 178, 172, 0.06) 0%, transparent 50%);
}

/* ========== 主容器 ========== */
.dashboard {
    max-width: 1360px;
    width: 100%;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 2.5rem;
    padding: 2.2rem 2.5rem 2.8rem;
    box-shadow: 0 20px 60px rgba(0, 20, 40, 0.10), 0 8px 24px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.25s ease;
}

/* ========== 头部 ========== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.4rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* 站点 Logo（品牌标识：绿底 SW 徽标，圆角裁切） */
.header-left .logo-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 6px 14px -4px rgba(15, 40, 80, 0.3);
    transition: 0.2s;
}

.header-left .logo-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.header-left h1 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0a2540;
}

.header-left h1 span {
    font-weight: 300;
    color: #5b7f95;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    color: #2c5775;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.4rem 1.2rem 0.4rem 1.6rem;
    border-radius: 60px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
}

.header-right i {
    font-size: 1.1rem;
    color: #3d7b9e;
}

.header-right .badge-date {
    font-weight: 500;
}

/* ========== 应用桌面网格（居中换行，任何数量都美观） ========== */
.app-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.4rem;
    min-height: 240px;
    align-content: center;
}

/* ========== 应用卡片 ========== */
.app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    width: 150px;
    padding: 1.4rem 0.8rem 1.1rem;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 1.5rem;
    text-decoration: none;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.2s, border-color 0.2s;
    opacity: 0;
    animation: fadeUp 0.5s ease forwards;
}

.app:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(66, 153, 225, 0.3);
    box-shadow: 0 14px 30px rgba(26, 67, 113, 0.12);
}

/* 应用图标：squircle 渐变底 + 白色图标 + 顶部高光 */
.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--g1), var(--g2));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 8px 18px -5px rgba(15, 40, 80, 0.32);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.app-icon {
    color: #ffffff;
}

.app-icon i {
    font-size: 2.05rem;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* 自定义 SVG 图标（线性 · 单色白 · 跟随容器缩放） */
.app-icon svg {
    width: 46%;
    height: 46%;
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12));
}

/* 品牌位图图标（肥鹅 · 透明 PNG 铺满容器） */
.app-icon img.icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.app:hover .app-icon {
    transform: scale(1.07);
}

/* 应用名称：最多两行，超出省略 */
.app-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1c3b4f;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}

/* 分类小标签 */
.app-tag {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.55rem;
    border-radius: 40px;
    flex-shrink: 0;
}

.app-tag.tag-blue   { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.app-tag.tag-green  { background: rgba(16, 185, 129, 0.12); color: #059669; }
.app-tag.tag-purple { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.app-tag.tag-orange { background: rgba(245, 158, 11, 0.14); color: #d97706; }

/* ========== 库页面（问卷库 / 文章库） ========== */

/* 顶栏：返回按钮 */
.lib-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.1rem 0.45rem 0.9rem;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 60px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2c5775;
    text-decoration: none;
    transition: 0.2s;
    box-shadow: 0 2px 8px rgba(0, 20, 40, 0.03);
}

.back-btn:hover {
    background: rgba(43, 108, 148, 0.1);
    border-color: rgba(43, 108, 148, 0.2);
    transform: translateX(-2px);
}

.back-btn i {
    font-size: 0.8rem;
}

/* 库页顶栏：站点 Logo + 返回按钮 */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-logo {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 10px -3px rgba(15, 40, 80, 0.28);
}

.topbar-logo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* 库页标题区 */
.lib-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.8rem;
}

.lib-hero .app-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
}

.lib-hero .app-icon i {
    font-size: 1.65rem;
}

.lib-hero h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0a2540;
    letter-spacing: -0.01em;
}

.lib-hero p {
    font-size: 0.85rem;
    color: #5b7f95;
    margin-top: 0.2rem;
}

/* 列表条 */
.lib-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.lib-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1.1rem;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.2s, border-color 0.2s;
    opacity: 0;
    animation: fadeUp 0.45s ease forwards;
}

.lib-item:hover {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(66, 153, 225, 0.3);
    box-shadow: 0 4px 14px rgba(26, 67, 113, 0.08);
    transform: translateX(4px);
}

.lib-item-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--g1), var(--g2));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 4px 10px -3px rgba(15, 40, 80, 0.28);
    flex-shrink: 0;
}

.lib-item-icon i {
    font-size: 1.05rem;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.lib-item-name {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 500;
    color: #1c3b4f;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-arrow {
    color: #a9c2d1;
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: color 0.2s, transform 0.2s;
}

.lib-item:hover .lib-arrow {
    color: #2b6c94;
    transform: translateX(2px);
}

/* ========== 底部 ========== */
.footer-note {
    margin-top: 2.4rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    padding-top: 1.6rem;
    font-size: 0.85rem;
    color: #5b7f95;
}

.footer-note .stats {
    display: flex;
    gap: 1.6rem;
}

.footer-note .stats span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-note .stats i {
    font-size: 0.8rem;
    color: #7a9bb3;
}

.footer-note .action-btn {
    background: rgba(43, 108, 148, 0.08);
    border: none;
    padding: 0.4rem 1.2rem;
    border-radius: 60px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1f5777;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
    font-family: inherit;
}

.footer-note .action-btn:hover {
    background: rgba(43, 108, 148, 0.15);
    border-color: rgba(43, 108, 148, 0.2);
    transform: scale(1.02);
}

/* ========== Toast 提示 ========== */
.custom-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: rgba(10, 37, 64, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f0f7ff;
    padding: 0.7rem 1.8rem;
    border-radius: 60px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 9999;
    letter-spacing: 0.02em;
    max-width: 90%;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.custom-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== 入场动画 ========== */
@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .dashboard { padding: 1.8rem 1.8rem 2.2rem; }
    .app-grid { gap: 1.1rem; }
    .app { width: 136px; }
    .app-icon { width: 68px; height: 68px; border-radius: 19px; }
    .app-icon i { font-size: 1.75rem; }
}

@media (max-width: 820px) {
    .dashboard { padding: 1.5rem 1.2rem 2rem; border-radius: 1.8rem; }
    .header-left h1 { font-size: 1.4rem; }
    .app-grid { gap: 0.9rem; }
    .app { width: 122px; padding: 1.1rem 0.6rem 0.95rem; }
    .app-icon { width: 58px; height: 58px; border-radius: 16px; }
    .app-icon i { font-size: 1.5rem; }
    .app-name { font-size: 0.8rem; }
}

@media (max-width: 560px) {
    body { padding: 1rem 0.8rem; }
    .dashboard { padding: 1.1rem 0.9rem 1.5rem; border-radius: 1.5rem; }
    .header { flex-direction: column; align-items: flex-start; margin-bottom: 1.6rem; }
    .header-right { width: 100%; justify-content: center; padding: 0.3rem 0.8rem; font-size: 0.8rem; }
    .header-left h1 { font-size: 1.2rem; }
    .app-grid { gap: 0.7rem; }
    .app { width: calc(33.33% - 0.5rem); padding: 0.85rem 0.4rem 0.7rem; border-radius: 1rem; }
    .app-icon { width: 54px; height: 54px; border-radius: 15px; }
    .app-icon i { font-size: 1.35rem; }
    .app-name { font-size: 0.72rem; }
    .app-tag { display: none; }
    .lib-topbar { margin-bottom: 1.4rem; }
    .topbar-logo { width: 28px; height: 28px; border-radius: 9px; }
    .lib-hero h1 { font-size: 1.2rem; }
    .lib-hero .app-icon { width: 52px; height: 52px; border-radius: 14px; }
    .lib-hero .app-icon i { font-size: 1.35rem; }
    .lib-item { padding: 0.7rem 0.8rem; gap: 0.65rem; }
    .lib-item-name { font-size: 0.84rem; }
    .footer-note { flex-direction: column; align-items: flex-start; }
    .footer-note .stats { flex-wrap: wrap; gap: 0.8rem; }
}
