/**
 * 卷王广告 - 用户中心样式表
 * 版本: 1.0.0
 * 作者: AI Assistant
 * 说明: 用户中心所有页面共用样式
 */

/* ============================================
   1. 基础设置 (Base)
   ============================================ */

/* 字体导入 - 使用系统字体 */
@import url('/assets/fonts/noto-sans-sc/font.css');

/* CSS 变量 */
:root {
    /* 主题色 */
    --primary: #facc15;
    --primary-hover: #eab308;
    --black: #000000;
    --dark: #111111;

    /* 灰度色阶 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* 功能色 */
    --red-500: #ef4444;
    --green-500: #22c55e;
    --blue-500: #3b82f6;
    --purple-500: #a855f7;

    /* 布局变量 */
    --sidebar-width: 224px;
    --header-height: 72px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面基础 - 优先使用系统字体，Noto Sans SC 异步加载 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   2. 布局系统 (Layout)
   ============================================ */

/* 整体布局容器 */
.jw-layout {
    display: flex;
    min-height: 100vh;
}

/* 主内容区 */
.jw-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 内容区域 */
.jw-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* 网格系统 */
.jw-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.jw-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.jw-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ============================================
   3. 侧边栏 (Sidebar)
   ============================================ */

/* 侧边栏容器 */
.jw-sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

/* 侧边栏头部 - Logo区域 */
.jw-sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-100);
}

.jw-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.jw-logo-icon {
    width: 44px;
    height: 44px;
    background: var(--black);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
    color: var(--primary);
}

.jw-logo-text {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.jw-logo-badge {
    font-size: 10px;
    background: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

/* 侧边栏导航 */
.jw-sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.jw-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--border-radius-lg);
    color: var(--gray-500);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.jw-nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    transform: translateX(4px);
}

.jw-nav-item.active {
    background: var(--black);
    color: var(--primary);
}

.jw-nav-item i {
    width: 20px;
    height: 20px;
}

/* 导航徽章 */
.jw-nav-badge {
    margin-left: auto;
    background: var(--red-500);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

/* 侧边栏底部 - 用户信息 */
.jw-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-100);
}

.jw-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
    transition: background 0.2s ease;
}

.jw-user-card:hover {
    background: var(--gray-200);
}

.jw-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-md);
    object-fit: cover;
}

.jw-user-info {
    flex: 1;
    min-width: 0;
}

.jw-user-name {
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jw-user-role {
    font-size: 10px;
    color: var(--gray-400);
    font-weight: 700;
    text-transform: uppercase;
}

/* 退出登录按钮 */
.jw-logout-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--red-500);
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.jw-logout-btn:hover {
    background: #fef2f2;
}

/* ============================================
   4. 顶部栏 (Header)
   ============================================ */

.jw-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.jw-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.jw-header-title {
    font-size: 20px;
    font-weight: 900;
}

.jw-header-subtitle {
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.jw-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 返回按钮 */
.jw-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.jw-back-btn:hover {
    background: var(--gray-200);
}

/* 余额卡片 */
.jw-balance-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
}

.jw-balance-label {
    font-size: 10px;
    color: var(--gray-400);
    font-weight: 700;
    text-transform: uppercase;
}

.jw-balance-value {
    font-size: 18px;
    font-weight: 900;
}

/* ============================================
   5. 卡片组件 (Cards)
   ============================================ */

/* 基础卡片 */
.jw-card {
    background: #fff;
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

.jw-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--gray-100);
}

.jw-card-title {
    font-size: 16px;
    font-weight: 900;
}

.jw-card-more {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.jw-card-more:hover {
    color: var(--black);
}

.jw-card-body {
    padding: 24px;
}

/* 统计卡片 */
.jw-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.jw-stat-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.jw-stat-card.primary {
    background: var(--black);
    color: #fff;
    border-color: var(--black);
}

.jw-stat-card.success {
    background: var(--green-500);
    color: #fff;
    border-color: var(--green-500);
}

.jw-stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.jw-stat-card.primary .jw-stat-label,
.jw-stat-card.success .jw-stat-label {
    color: rgba(255,255,255,0.6);
}

.jw-stat-value {
    font-size: 32px;
    font-weight: 900;
}

.jw-stat-card.primary .jw-stat-value {
    color: var(--primary);
}

.jw-stat-change {
    font-size: 11px;
    font-weight: 700;
    margin-top: 8px;
}

.jw-stat-change.up {
    color: var(--green-500);
}

.jw-stat-card.success .jw-stat-change.up {
    color: rgba(255,255,255,0.8);
}

/* ============================================
   6. 按钮组件 (Buttons)
   ============================================ */

.jw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.jw-btn-primary {
    background: var(--black);
    color: #fff;
}

.jw-btn-primary:hover {
    background: var(--dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.jw-btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.jw-btn-secondary:hover {
    background: var(--gray-200);
}

.jw-btn-yellow {
    background: var(--primary);
    color: var(--black);
}

.jw-btn-yellow:hover {
    background: var(--primary-hover);
}

.jw-btn-danger {
    background: var(--red-500);
    color: #fff;
}

.jw-btn-danger:hover {
    background: #dc2626;
}

.jw-btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.jw-btn-lg {
    padding: 16px 32px;
    font-size: 14px;
}

/* ============================================
   7. 表单组件 (Forms)
   ============================================ */

.jw-form-group {
    margin-bottom: 24px;
}

.jw-form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--gray-700);
}

.jw-form-input,
.jw-form-select,
.jw-form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fff;
}

.jw-form-input:focus,
.jw-form-select:focus,
.jw-form-textarea:focus {
    outline: none;
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.jw-form-input:disabled,
.jw-form-select:disabled,
.jw-form-textarea:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.jw-form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   8. 表格组件 (Tables)
   ============================================ */

.jw-table {
    width: 100%;
    border-collapse: collapse;
}

.jw-table th {
    text-align: left;
    padding: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    border-bottom: 1px solid var(--gray-100);
}

.jw-table td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-100);
}

.jw-table tr:last-child td {
    border-bottom: none;
}

.jw-table tr:hover td {
    background: var(--gray-50);
}

/* ============================================
   9. 标签与徽章 (Badges & Status)
   ============================================ */

/* 状态标签 */
.jw-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.jw-status-success {
    background: #dcfce7;
    color: #166534;
}

.jw-status-warning {
    background: #fef3c7;
    color: #92400e;
}

.jw-status-danger {
    background: #fee2e2;
    color: #991b1b;
}

.jw-status-info {
    background: #dbeafe;
    color: #1e40af;
}

/* 徽章 */
.jw-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.jw-badge-primary {
    background: var(--primary);
    color: var(--black);
}

.jw-badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

.jw-badge-success {
    background: #dcfce7;
    color: #166534;
}

.jw-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================
   10. 用户相关组件 (User Components)
   ============================================ */

/* 用户资料卡片 */
.jw-user-profile {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.jw-user-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius-xl);
    background: var(--primary);
    object-fit: cover;
}

.jw-user-profile-info h2 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 8px;
}

.jw-user-profile-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* 身份切换器 */
.identity-switcher {
    margin: 12px 0;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--border-radius-md);
}

.identity-switcher-title {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}

.identity-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.identity-tag {
    padding: 4px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    font-size: 11px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.identity-tag:hover,
.identity-tag.active {
    background: var(--primary);
    color: var(--black);
}

/* ============================================
   11. 空状态 (Empty State)
   ============================================ */

.jw-empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--gray-400);
}

.jw-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--gray-300);
}

.jw-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.jw-empty-desc {
    font-size: 14px;
    color: var(--gray-500);
}

/* ============================================
   12. 模态框 (Modal)
   ============================================ */

.jw-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.jw-modal.active {
    display: flex;
}

.jw-modal-content {
    background: #fff;
    border-radius: var(--border-radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.jw-modal-title {
    font-size: 18px;
    font-weight: 900;
}

.jw-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.jw-modal-close:hover {
    background: var(--gray-200);
}

.jw-modal-body {
    padding: 24px;
}

.jw-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* ============================================
   13. 工具类 (Utilities)
   ============================================ */

/* 文本对齐 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* 显示/隐藏 */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }

/* 间距 */
.m-0 { margin: 0 !important; }
.mt-8 { margin-top: 8px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-24 { margin-top: 24px !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-24 { margin-bottom: 24px !important; }

.p-0 { padding: 0 !important; }
.p-16 { padding: 16px !important; }
.p-24 { padding: 24px !important; }

/* 颜色 */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--green-500) !important; }
.text-danger { color: var(--red-500) !important; }
.text-muted { color: var(--gray-500) !important; }

/* 字体 */
.font-bold { font-weight: 700 !important; }
.font-black { font-weight: 900 !important; }

/* ============================================
   14. 滚动条样式 (Scrollbar)
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================
   15. 响应式设计 (Responsive)
   ============================================ */

@media (max-width: 1200px) {
    .jw-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* 侧边栏隐藏 */
    .jw-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    /* 主内容区全宽 */
    .jw-main {
        margin-left: 0;
    }

    /* 内容区域减少内边距 */
    .jw-content {
        padding: 16px;
    }

    /* 统计卡片单列 */
    .jw-stats-grid {
        grid-template-columns: 1fr;
    }

    /* 网格单列 */
    .jw-grid-2,
    .jw-grid-3,
    .jw-grid-4 {
        grid-template-columns: 1fr;
    }

    /* 头部减少内边距 */
    .jw-header {
        padding: 0 16px;
    }

    /* 用户资料垂直排列 */
    .jw-user-profile {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================
   16. 动画 (Animations)
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slide-up {
    animation: slideUp 0.3s ease;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ============================================
   17. 打印样式 (Print)
   ============================================ */

@media print {
    .jw-sidebar,
    .jw-header,
    .jw-btn {
        display: none !important;
    }

    .jw-main {
        margin-left: 0;
    }

    .jw-card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
