/* User Dashboard Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    display: flex;
}

/* 侧边栏导航 - 保持原有样式 */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-username {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
}

.sidebar-role {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-nav {
    list-style: none;
    padding: 20px 0;
}

.sidebar-nav-item {
    margin-bottom: 5px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.sidebar-nav-link:hover, .sidebar-nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.sidebar-nav-icon {
    font-size: 18px;
}

.sidebar-nav-text {
    font-size: 14px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 顶部栏（移动端） */
.top-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    width: 50px;
    cursor: pointer;
    margin: 0; /* ✅ 移除默认外边距 */
    padding: 0; /* ✅ 移除默认内边距 */
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

/* 页面内容 */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-outline {
    background: white;
    color: #667eea;
    border: 1px solid #e0e0e0;
}

.btn-outline:hover {
    border-color: #667eea;
    background: #f5f7fa;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}

.stat-icon.blue { background: #e0f2fe; }
.stat-icon.green { background: #dcfce7; }
.stat-icon.orange { background: #fef3c7; }
.stat-icon.purple { background: #f3e8ff; }

.stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.stat-subvalue {
    font-size: 12px;
    color: #999;
}

/* 内容网格 */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

/* 账号列表 */
.account-list {
    list-style: none;
}

.account-item {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
}

.account-item:hover {
    background: #f8f9fa;
}

.account-item:last-child {
    border-bottom: none;
}

.account-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.account-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    font-size: 13px;
    color: #666;
}

/* 进度条 */
.progress-section {
    margin-bottom: 20px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.progress-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s;
}

/* 提示框 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    background-image: url('/assets/logo/loading-spinner.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 auto 15px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 分销推广样式 */
.referral-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.referral-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.referral-link {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    word-break: break-all;
    margin-bottom: 12px;
}

.referral-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.referral-stat {
    text-align: center;
}

.referral-stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.referral-stat-label {
    font-size: 12px;
    opacity: 0.9;
}

/* 收益明细列表 */
.income-list-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.income-list-item:hover {
    background: #f8f9fa;
}

.income-list-item:last-child {
    border-bottom: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 80px 15px 15px; /* ✅ 减小内边距 */
        overflow-x: hidden; /* ✅ 防止横向滚动 */
    }

    .top-bar {
        display: flex;
    }

    .menu-toggle {
        display: block;
    }

    /* ✅ 内容网格 - 单列布局 */
    .content-grid {
        grid-template-columns: 1fr;
        gap: 15px; /* ✅ 减小间距 */
    }

    /* ✅ 统计卡片网格 - 单列布局 */
    .stats-grid {
        grid-template-columns: 1fr; /* ✅ 改为单列，防止溢出 */
        gap: 12px; /* ✅ 减小间距 */
    }

    /* ✅ 顶部栏 - 调整高度和位置 */
    .top-bar {
        height: 70px; /* ✅ 增加高度以容纳语言选择器 */
        padding: 0 10px 0 0; /* ✅ 左边无内边距，让菜单按钮靠左；右边保留 10px */
        position: fixed; /* ✅ 保持固定定位 */
        z-index: 999; /* ✅ 确保在内容之上 */
    }

    /* ✅ 导航栏品牌文字 - 缩小字体 */
    .navbar-brand {
        font-size: 13px; /* ✅ 进一步减小字体 */
        white-space: nowrap; /* ✅ 防止换行 */
        overflow: hidden; /* ✅ 隐藏溢出 */
        text-overflow: ellipsis; /* ✅ 显示省略号 */
        max-width: 300px; /* ✅ 进一步增加最大宽度，显示更多文本 */
    }

    /* ✅ 卡片头部 - 垂直布局 */
    .card-header {
        flex-direction: column; /* ✅ 标题和按钮垂直排列 */
        align-items: flex-start;
        gap: 10px;
        padding: 15px; /* ✅ 减小内边距 */
    }

    /* ✅ 卡片内容 - 减小内边距 */
    .card-body {
        padding: 15px; /* ✅ 减小内边距 */
    }

    /* ✅ 按钮 - 自适应宽度 */
    .btn, button {
        width: 100%; /* ✅ 按钮占满容器宽度 */
        max-width: none; /* ✅ 移除最大宽度限制 */
    }

    /* ✅ 表格 - 允许横向滚动 */
    .table-responsive {
        overflow-x: auto; /* ✅ 表格可以横向滚动 */
    }

    table {
        min-width: 600px; /* ✅ 设置最小宽度 */
    }

    /* ✅ 文本 - 自动换行 */
    .account-name, .phone-number, .text-overflow {
        word-wrap: break-word; /* ✅ 长文本自动换行 */
        word-break: break-all; /* ✅ 强制断词 */
        white-space: normal; /* ✅ 允许换行 */
    }

    /* ✅ 状态标签 - 缩小尺寸 */
    .badge, .status-badge {
        font-size: 11px; /* ✅ 减小字体 */
        padding: 3px 8px; /* ✅ 减小内边距 */
    }

    /* ✅ 语言选择器 - 调整位置 */
    #languageSelect {
        position: static !important; /* ✅ 取消固定定位 */
        width: 100%; /* ✅ 占满宽度 */
        margin-bottom: 10px;
    }

    /* ✅ 绑定账号模态框 - 移动端优化 */
    #bindAccountModal > div {
        max-width: 95%; /* ✅ 减小最大宽度 */
        padding: 16px; /* ✅ 减小内边距 */
        max-height: 90vh; /* ✅ 增加最大高度 */
    }

    /* ✅ 绑定模态框标题 */
    #bindAccountModal h3 {
        font-size: 14px; /* ✅ 减小字体 */
        white-space: nowrap; /* ✅ 防止换行 */
        overflow: hidden; /* ✅ 隐藏溢出 */
        text-overflow: ellipsis; /* ✅ 显示省略号 */
    }

    /* ✅ 绑定选项卡按钮 */
    #bindAccountModal button[id^="tab"] {
        font-size: 12px; /* ✅ 减小字体 */
        padding: 8px; /* ✅ 减小内边距 */
    }

    /* ✅ 扫码模式 - 垂直布局 */
    #qrMode > div:first-child {
        flex-direction: column; /* ✅ 改为垂直布局 */
        gap: 12px; /* ✅ 减小间距 */
    }

    /* ✅ 操作引导区域 */
    #qrMode > div:first-child > div:first-child {
        padding: 12px; /* ✅ 减小内边距 */
        width: 100%; /* ✅ 占满宽度 */
    }

    #qrMode ol {
        font-size: 12px; /* ✅ 进一步减小字体 */
        line-height: 1.8; /* ✅ 进一步减小行高 */
        padding-left: 16px; /* ✅ 进一步减小左内边距 */
    }

    #qrMode li {
        margin-bottom: 4px; /* ✅ 减小列表项间距 */
    }

    /* ✅ 二维码容器 - 自适应宽度 */
    #qrCodeContainer {
        width: 100% !important; /* ✅ 占满容器宽度 */
        height: auto !important; /* ✅ 自动高度 */
        aspect-ratio: 1 / 1; /* ✅ 保持正方形 */
        max-width: 220px; /* ✅ 限制最大宽度，防止溢出 */
        margin: 0 auto; /* ✅ 居中 */
    }

    /* ✅ 二维码倒计时提示 */
    #qrTimer {
        font-size: 11px; /* ✅ 减小字体 */
        padding: 8px 10px; /* ✅ 减小内边距 */
    }

    /* ✅ 刷新按钮 */
    #qrMode button:last-child {
        font-size: 12px; /* ✅ 减小字体 */
        padding: 8px; /* ✅ 减小内边距 */
    }

    /* ✅ 验证码模式 - 优化 */
    #codeMode > div:first-child {
        padding: 8px; /* ✅ 减小内边距 */
    }

    #codeMode ol {
        font-size: 11px; /* ✅ 减小字体 */
        line-height: 1.5; /* ✅ 减小行高 */
        padding-left: 16px; /* ✅ 减小左内边距 */
    }

    /* ✅ 电话号码输入框 */
    #phoneNumberInput {
        font-size: 13px; /* ✅ 减小字体 */
        padding: 8px 12px; /* ✅ 减小内边距 */
    }

    /* ✅ 配对码显示 */
    #pairingCode {
        font-size: 24px; /* ✅ 减小字体 */
        letter-spacing: 2px; /* ✅ 减小字母间距 */
        padding: 8px; /* ✅ 减小内边距 */
    }

    /* ✅ 获取验证码按钮 */
    #getCodeBtn {
        font-size: 12px; /* ✅ 减小字体 */
        padding: 6px 12px; /* ✅ 减小内边距 */
    }
}

/* ✅ 超小屏幕优化（< 480px） */
@media (max-width: 480px) {
    .main-content {
        padding: 70px 10px 10px; /* ✅ 进一步减小内边距 */
    }

    .card-header {
        padding: 12px; /* ✅ 进一步减小内边距 */
    }

    .card-body {
        padding: 12px; /* ✅ 进一步减小内边距 */
    }

    .stat-card {
        padding: 15px; /* ✅ 减小统计卡片内边距 */
    }

    .stat-value {
        font-size: 24px; /* ✅ 减小数值字体 */
    }

    .stat-label {
        font-size: 12px; /* ✅ 减小标签字体 */
    }
}

/* ✅ 动画效果 */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 3px 12px rgba(255,215,0,0.4), 0 0 20px rgba(255,215,0,0.3); }
    50% { box-shadow: 0 3px 16px rgba(255,215,0,0.6), 0 0 30px rgba(255,215,0,0.5); }
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

.card {
    animation: slideIn 0.4s ease-out;
}
