/* 全局基础样式 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
    font-size: 16px;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏 */
.navbar {
    background-color: #4a90e2;
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 18px;
    font-weight: bold;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 24px;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 1;
}

/* 导航栏用户信息区 */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.nav-username {
    color: #fff;
    font-weight: 500;
}

.nav-role {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.nav-role-admin {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.nav-role-member {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
}

.btn-logout {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 5px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.30);
}

.btn-login {
    color: #fff;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 5px;
    padding: 4px 14px;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-login:hover {
    background: rgba(255,255,255,0.30);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 32px auto;
    padding: 0 24px;
}

/* 首页模块卡片 */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.module-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
}

.module-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.module-card h2 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #4a90e2;
}

.module-card p {
    font-size: 14px;
    color: #666;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 16px;
    font-size: 13px;
    color: #999;
    background-color: #fff;
    border-top: 1px solid #eee;
}

/* ---- 响应式设计（手机优化） ---- */

/* 平板及更小设备（宽度 <= 768px） */
@media (max-width: 768px) {
    .navbar {
        padding: 0 12px;
        height: 52px;
        flex-wrap: wrap;
    }

    .nav-brand {
        font-size: 16px;
    }

    .nav-links {
        gap: 12px;
        font-size: 13px;
    }

    .nav-links a {
        font-size: 13px;
    }

    .nav-user {
        gap: 6px;
        font-size: 12px;
    }

    .nav-role {
        padding: 1px 5px;
        font-size: 11px;
    }

    .btn-logout, .btn-login {
        padding: 3px 8px;
        font-size: 12px;
    }

    .main-content {
        margin: 20px auto;
        padding: 0 12px;
    }
}

/* 手机设备（宽度 <= 480px） */
@media (max-width: 480px) {
    .navbar {
        padding: 0 8px;
        height: 50px;
        gap: 6px;
    }

    .nav-brand {
        font-size: 15px;
        flex-shrink: 0;
        min-width: 50px;
    }

    .nav-links {
        gap: 6px;
        flex-wrap: wrap;
        flex: 1;
        justify-content: flex-start;
    }

    .nav-links li {
        min-width: 0;
    }

    .nav-links a {
        font-size: 12px;
        display: inline-block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 60px;
    }

    .nav-user {
        gap: 4px;
        font-size: 11px;
        flex-wrap: wrap;
        justify-content: flex-end;
        order: 3;
        width: 100%;
        margin-top: 4px;
    }

    .nav-username {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 80px;
    }

    .nav-role {
        padding: 1px 4px;
        font-size: 10px;
    }

    .btn-logout, .btn-login {
        padding: 2px 6px;
        font-size: 11px;
    }

    .main-content {
        margin: 16px auto;
        padding: 0 8px;
    }

    /* 首页模块卡片响应式 */
    .module-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .module-card {
        padding: 16px;
    }

    .module-card h2 {
        font-size: 16px;
    }

    .module-card p {
        font-size: 13px;
    }
}
