/**
 * 前台导航样式 - 响应式导航栏
 * 包含顶部导航和左侧导航
 */

/* ============ 全局样式 ============ */
body {
    display: flex;
    min-height: 100vh;
    background-color: #f5f7fa;
    color: #333;
    transition: margin-left 0.3s ease;
}

/* ============ 顶部导航栏样式 ============ */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #fff;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.top-nav-left {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-area {
    padding: 0;
    margin-right: 30px;
    border-bottom: none;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo i {
    margin-right: 10px;
    color: #3498db;
}

.logo img {
    height: 40px;
    max-width: 200px;
}

.balance-info, .points-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.balance-label, .points-label {
    font-size: 13px;
    color: #6c757d;
}

.balance-value {
    font-size: 14px;
    font-weight: 600;
    color: #28a745;
}

.points-value {
    font-size: 14px;
    font-weight: 600;
    color: #007bff;
}

.recharge-btn, .buy-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.recharge-btn {
    background-color: #28a745;
    color: white;
}

.recharge-btn:hover {
    background-color: #218838;
}

.buy-btn {
    background-color: #007bff;
    color: white;
}

.buy-btn:hover {
    background-color: #0056b3;
}

/* 未登录用户样式 */
.nav-login-btn, .nav-register-btn {
    padding: 6px 16px;
    font-size: 14px;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-login-btn:hover, .nav-register-btn:hover {
    color: #007bff;
}

.nav-divider {
    margin: 0 8px;
    color: #6c757d;
}

/* 用户下拉菜单样式 */
.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-dropdown:hover {
    background-color: #e9ecef;
}

.username {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

.dropdown-arrow {
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.2s ease;
}

.user-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 160px;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    margin-top: 5px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
}

.user-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    padding: 8px 16px;
    color: #495057;
    text-decoration: none;
    display: block;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.dropdown-divider {
    height: 1px;
    margin: 4px 0;
    background-color: #e9ecef;
}

/* ============ 左侧导航栏样式 ============ */
.sidebar {
    width: 200px;
    background-color: #fff;
    border-right: 1px solid #e8eaed;
    height: calc(100vh - 60px);
    overflow-y: auto;
    position: fixed;
    left: 0;
    top: 60px;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
    z-index: 1000;
}

/* 极简滚动条样式 */
.sidebar::-webkit-scrollbar {
    width: 3px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(120, 120, 120, 0.2);
    border-radius: 1px;
    transition: background 0.3s ease;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 100, 100, 0.3);
}

.nav-section {
    margin-bottom: 25px;
}

.nav-title {
    font-size: 12px;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 20px;
    margin-bottom: 12px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    padding: 0 16px;
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #34495e;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-icon {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 16px;
}

.nav-text {
    font-size: 15px;
}

.nav-link:hover {
    background-color: #f8f9fa;
    color: #2980b9;
}

.nav-link.active {
    background-color: #e8f5e9;
    color: #27ae60;
    font-weight: 500;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: #27ae60;
    border-radius: 0 2px 2px 0;
}

/* ============ 右侧内容区域 ============ */
.content {
    flex: 1;
    margin-left: 200px;
    margin-top: 60px;
    padding: 15px;
    transition: margin-left 0.3s ease;
}

.header {
    margin-bottom: 30px;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
}

.description {
    color: #7f8c8d;
    line-height: 1.6;
    max-width: 800px;
}

.dashboard {
    background-color: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

/* ============ 移动端菜单按钮 ============ */
.menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1100;
    background: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
}

.menu-toggle i {
    font-size: 20px;
    color: #2c3e50;
}

/* ============ 响应式设计 ============ */
@media (max-width: 768px) {
    .top-nav {
        padding: 0 15px;
        justify-content: flex-end; /* 移动端将内容靠右 */
    }

    .top-nav-left {
        margin-right: 0;
        order: 2; /* 将logo移到右侧 */
    }

    .logo-area {
        margin-right: 0;
        margin-left: auto; /* 使logo靠右 */
    }

    .logo {
        flex-direction: row-reverse; /* 图标和文字位置交换 */
    }

    .logo i {
        margin-right: 0;
        margin-left: 10px;
    }

    .user-info {
        display: none; /* 在移动端隐藏用户信息 */
    }

    .balance-info, .points-info {
        display: none;
    }

    .sidebar {
        transform: translateX(-100%);
        top: 60px;
        height: calc(100vh - 60px);
    }

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

    .content {
        margin-left: 0;
        margin-top: 60px;
        padding: 20px 15px;
    }

    .menu-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1100;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 18px;
    }

    .logo i {
        font-size: 18px;
    }
}
