/* ============================================================
   navbar.css - 左侧导航栏样式
   ============================================================ */

/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

body {
    min-height: 100vh;
    margin-left: 240px;
    transition: margin-left 0.2s ease;
}

/* ===== 导航栏 ===== */
.navbar {
    border-right: 1px solid #ebebeb;
    background: #f3f3f3;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    z-index: 10000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
}

.nav-container {
    border-right: 1px solid #eeeeee;
    padding: 30px 16px 5px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

.nav-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 30px;
    flex: 1;
}

/* ===== Logo ===== */
.logo-nav {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    color: #2c2c2c;
    text-decoration: none;
    margin-bottom: 5px;
    width: 100%;
}

.logo-img {
    height: 28px;
    width: 28px;
    overflow: hidden;
    flex-shrink: 0;
}

.logo-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-nav span {
    white-space: nowrap;
}

/* ===== 导航菜单 ===== */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    list-style: none;
    width: 100%;
}

.nav-link {
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    font-weight: 500;
}

.nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    color: #5a5a5a;
}

.nav-link:hover {
    background: #e9ecf5;
    color: #667eea;
}

.nav-link.active {
    background: #e0e7ff;
    color: #4f46e5;
    font-weight: 600;
}

.nav-link.active i {
    color: #4f46e5;
}

/* ===== 右侧用户区域 ===== */
.nav-right {
    margin-top: auto;
    padding: 10px 0px 20px;
    border-top: 1px solid #dbe0e8;
}

.nav-credit-item {
    background-color: #ffffff;
    color: #4d4d4d;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 0.9rem;
    text-decoration: none;
}

.user-info-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 30px;
    transition: background 0.3s;
    text-decoration: none;
    color: inherit;
}

.user-info-nav:hover {
    background: #e2e6f0;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.user-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.user-name-nav {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-credits {
    color: #667eea;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== 左下角训练信息显示 ===== */
.user-training-info {
    font-size: 11px;
    color: #6b6b7e;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.user-training-info i {
    color: #f5a623;
    font-size: 11px;
}

.fa-chevron-down {
    color: #667eea;
    font-size: 11px;
    flex-shrink: 0;
}

/* ===== 登录按钮 ===== */
.login-btn {
    border: 1px solid #dddddd;
    color: rgb(61, 61, 61);
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

/* ===== 下拉菜单 ===== */
.user-dropdown {
    position: fixed;
    left: 0px;
    bottom: 0px;
    width: 240px;
    background: #f3f3f3;
    opacity: 0;
    visibility: hidden;
    transform: translateY(320px);
    transition: all 0.25s;
    z-index: 10001;
}

.dropdown-user-content {
    padding-bottom: 20px;
}

.user-dropdown.show {
    border-top: 1px solid #dfdfdf;
    border-right: 1px solid #dfdfdf;
    background: white;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ===== 下拉 - 登录/注册 ===== */
.dropdown-login-links {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dropdown-login-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
}

.dropdown-login-btn:hover {
    opacity: 0.9;
}

.dropdown-register-btn {
    background: #f0f4fe;
    color: #667eea;
    border: 1px solid #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
}

.dropdown-register-btn:hover {
    background: #e8edfa;
}

/* ===== 下拉 - 用户信息头 ===== */
.dropdown-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.dropdown-user-info {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.dropdown-username {
    color: #2d3748;
    font-weight: 700;
    font-size: 16px;
    display: block;
    margin-bottom: 12px;
}

/* ===== 积分行 ===== */
.dropdown-credits-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.dropdown-credits {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #2d3748;
}

.dropdown-credits i {
    color: #fbbf24;
}

/* ===== 训练行 ===== */
.dropdown-training-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.dropdown-training-info {
    font-size: 12px;
    color: #6b6b7e;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropdown-training-info i {
    color: #fbbf24;
    font-size: 12px;
}

/* ===== 统一的充值按钮 ===== */
.dropdown-recharge-btn {
    font-size: 11px;
    color: #ffffff;
    text-decoration: none;
    padding: 1px 14px;
    border-radius: 12px;
    transition: all 0.2s;
    cursor: pointer;
    line-height: 22px;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
}

/* 积分充值按钮 - 蓝色系 */
.dropdown-recharge-btn.credits-btn {
    background: rgb(61, 135, 255);
    border: 1px solid rgb(49, 108, 202);
}

.dropdown-recharge-btn.credits-btn:hover {
    background: rgba(59, 130, 246, 0.6);
}

/* 训练开卡按钮 - 金色系 */
.dropdown-recharge-btn.training-btn {
    background: rgb(209, 158, 30);
}

.dropdown-recharge-btn.training-btn:hover {
    background: rgb(161, 122, 23);
}

/* ===== 下拉菜单项 ===== */
.dropdown-divider {
    height: 1px;
    background: #dfdfdf;
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #2d3748;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.dropdown-item i {
    width: 22px;
    color: #667eea;
}

.dropdown-item:hover {
    background: #f2f5fd;
}

/* ===== 加载动画 ===== */
.loading-spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid #ddd;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 12px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   移动端适配
   ============================================================ */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    right: 12px;
    top: 15px;
    z-index: 1100;
    background: #ffffff;
    color: rgb(107, 107, 107);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #dfdfdf;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.mobile-menu-toggle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

@media (max-width: 768px) {
    body {
        margin-left: 0 !important;
    }

    .navbar {
        transform: translateX(-100%);
        width: 260px;
        box-shadow: none;
        transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
    }

    .navbar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .user-dropdown {
        left: 0px;
        bottom: 0px;
        width: 260px;
    }
}