/* ============================================================
   layout.css - 布局样式（顶部导航 + 侧边栏 + 内容区）
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f0f2f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    padding-top: 60px;
    padding-bottom: 0;
}

/* ===== 全屏加载 ===== */
.fullscreen-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10000;
}

/* ===== 顶部导航 ===== */
.navbar-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 60px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}

.nav-container {
    max-width: 100%;
    height: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.nav-brand i {
    font-size: 22px;
}

.nav-brand .version {
    font-size: 11px;
    opacity: 0.7;
    font-weight: 400;
    margin-left: 2px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
}

/* ===== 桌面端导航链接 ===== */
.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    display: inline-block;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-links a.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-links .user-badge {
    color: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: 8px;
}

.nav-links .logout-btn {
    color: rgba(255, 255, 255, 0.7);
}

.nav-links .logout-btn:hover {
    background: rgba(255, 70, 70, 0.25);
    color: #ff6b6b;
}

/* ===== 主布局 ===== */
.app-wrapper {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: 220px;
    min-height: calc(100vh - 60px);
    background: white;
    border-right: 1px solid #eaeaea;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar-inner {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-user {
    text-align: center;
    padding: 0 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 16px;
}

.sidebar-user .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 10px;
}

.sidebar-user .user-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.sidebar-user .user-role {
    font-size: 12px;
    color: #667eea;
    margin-top: 2px;
}

/* ===== 侧边栏会员信息 ===== */
.user-membership {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    font-size: 12px;
}

.user-membership .membership-status {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.user-membership .membership-status.status-active {
    color: #28a745;
    background: #d4edda;
}

.user-membership .membership-status.status-trial {
    color: #856404;
    background: #fff3cd;
}

.user-membership .membership-status.status-expired {
    color: #721c24;
    background: #f8d7da;
}

.user-membership .membership-status.status-none {
    color: #6c757d;
    background: #e9ecef;
}

.user-membership .membership-expire,
.user-membership .membership-remaining {
    color: #8e8e93;
    font-size: 11px;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #555;
    text-decoration: none;
    transition: all 0.25s;
    font-size: 14px;
    margin-bottom: 2px;
}

.sidebar-nav a:hover {
    background: #f0f4ff;
    color: #667eea;
}

/* 极浅红 */
.sidebar-nav a.active {
    background: #fef2f2;
    color: #7f1d1d;
    box-shadow: none;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 12px 0;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #999;
    text-decoration: none;
    transition: all 0.25s;
    font-size: 14px;
}

.sidebar-footer a:hover {
    background: #f5f5f5;
    color: #e53e3e;
}

/* ===== 主内容 ===== */
.main-content {
    flex: 1;
    padding: 20px 24px;
    min-height: calc(100vh - 60px);
    overflow-y: auto;
    background: #f0f2f5;
}

/* ===== 页面切换 ===== */
.page-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 移动端遮罩 ===== */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.mobile-overlay.active {
    display: block;
}

/* ============================================================ */
/* ===== 移动端底部导航 ===== */
/* ============================================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 6px 0 8px 0;
    height: 70px;
    border-top: 1px solid #eaeaea;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1001;
}

.mobile-bottom-nav a,
.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8e8e93;
    text-decoration: none;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.2s;
    flex: 1;
    text-align: center;
    background: transparent !important;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.mobile-bottom-nav a i,
.mobile-bottom-nav .nav-item i {
    font-size: 22px;
    margin-bottom: 2px;
    display: block;
}

.mobile-bottom-nav a.active,
.mobile-bottom-nav .nav-item.active {
    color: #667eea;
    background: transparent !important;
}

.mobile-bottom-nav a:hover,
.mobile-bottom-nav .nav-item:hover {
    color: #667eea;
    background: transparent !important;
}

.mobile-bottom-nav .nav-item.logout-item {
    color: #e53e3e;
}

.mobile-bottom-nav .nav-item.logout-item:hover {
    color: #c53030;
}

.mobile-bottom-nav .user-badge-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8e8e93;
    font-size: 12px;
    padding: 4px 8px;
    flex: 1;
    text-align: center;
    cursor: default;
}

.mobile-bottom-nav .user-badge-mobile i {
    font-size: 22px;
    margin-bottom: 2px;
    display: block;
}

/* ============================================================ */
/* ===== 响应式 ===== */
/* ============================================================ */

/* 平板及手机 */
@media (max-width: 992px) {
    .nav-links {
        display: none !important;
    }

    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 1000;
        width: 260px;
        height: calc(100vh - 60px);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-overlay.active {
        display: block;
    }

    .nav-toggle {
        display: block;
    }

    .mobile-bottom-nav {
        display: flex !important;
    }

    body {
        padding-bottom: 70px;
    }
}

@media (max-width: 768px) {
    .navbar-top {
        height: 54px;
    }

    body {
        padding-top: 54px;
        padding-bottom: 64px;
    }

    .main-content {
        padding: 12px;
    }

    .nav-brand {
        font-size: 15px;
        gap: 6px;
    }

    .nav-brand .version {
        display: none;
    }

    .nav-container {
        padding: 0 12px;
    }

    .sidebar {
        top: 54px;
        height: calc(100vh - 54px);
    }

    .mobile-overlay {
        top: 54px;
    }

    .mobile-bottom-nav {
        height: 64px;
        padding: 5px 0 6px 0;
    }

    .mobile-bottom-nav a,
    .mobile-bottom-nav .nav-item,
    .mobile-bottom-nav .user-badge-mobile {
        font-size: 11px;
        padding: 4px 4px;
    }

    .mobile-bottom-nav a i,
    .mobile-bottom-nav .nav-item i,
    .mobile-bottom-nav .user-badge-mobile i {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .mobile-bottom-nav {
        height: 60px;
        padding: 4px 0 5px 0;
    }

    .mobile-bottom-nav a,
    .mobile-bottom-nav .nav-item,
    .mobile-bottom-nav .user-badge-mobile {
        font-size: 10px;
        padding: 2px 2px;
    }

    .mobile-bottom-nav a i,
    .mobile-bottom-nav .nav-item i,
    .mobile-bottom-nav .user-badge-mobile i {
        font-size: 18px;
    }

    body {
        padding-bottom: 60px;
    }
}