@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* 蓝白配色系统 - 统一为 #1677FF */
    --primary: #1677FF;
    --primary-hover: #4096FF;
    --primary-light: #F0F5FF;
    --primary-dark: #003EB3;
    
    /* 背景色 */
    --bg-main: #F4F7FA;
    --bg-surface: #ffffff;
    
    /* 界线与阴影 - 极简主义 */
    --border-color: #e5e8ed;
    --border-hover: #1677FF;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.05);
    
    /* 文字系统 */
    --text-main: #1d2129;
    --text-secondary: #4e5969;
    --text-muted: #86909c;
    
    /* 状态色 */
    --success: #00B42A;
    --warning: #FF7D00;
    --danger: #F53F3F;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-main);
    color: var(--text-secondary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3, .logo {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    font-weight: 700;
}

/* 核心容器布局 - 现代白色风格 */
.glass {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0 !important;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

.glass:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

/* 顶部导航栏 - 现代白色风格 */
.topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px 0 24px;
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    z-index: 1001;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 0 !important;
    transition: all 0.2s;
}

.menu-toggle:hover {
    background: #f3f4f6;
    color: #1e40af;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 用户余额显示 */
.user-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0 !important;
    font-size: 0.875rem;
}

.user-balance span:first-child {
    color: var(--text-muted);
    font-weight: 500;
}

.user-balance span:last-child {
    font-weight: 700;
    font-size: 1rem;
    color: var(--success);
}

/* 用户头像 */
.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 !important;
}

/* 侧边栏 - 蓝色背景风格 */
.sidebar {
    width: 240px;
    background: #1e40af;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.nav-links {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 0 !important;
    margin: 2px 0;
    transition: all 0.15s ease;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar a.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 500;
}

.nav-divider {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 12px 8px;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar a:hover .nav-icon,
.sidebar a.active .nav-icon {
    color: white;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-footer a:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
}

/* 主内容区域 */
.main-content {
    margin-left: 240px;
    margin-top: 64px;
    padding: 2rem;
    min-height: calc(100vh - 64px);
    width: calc(100% - 240px);
}

/* 表单与输入框 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0 !important;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.input-control:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    outline: none;
}

/* 按钮组件 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0 !important;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    background: #1e3a8a;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    border-radius: 0 !important;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

thead {
    background: #f8fafc;
    border-bottom: 2px solid #e5e7eb;
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0 !important;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* 弹窗样式 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: #ffffff;
    border-radius: 0 !important;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

/* 移动端适配 */
.mobile-header {
    display: none;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 999;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mobile-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.mobile-logo span {
    color: var(--primary);
    margin-left: 4px;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 70px;
        background: #ffffff;
        border-right: 1px solid #e5e7eb;
    }

    .nav-links a span:not(.nav-icon),
    .nav-divider {
        display: none;
    }

    .nav-links a {
        justify-content: center;
        padding: 15px;
        background: transparent;
        border-radius: 8px;
        margin: 2px 0;
    }

    .nav-links a:hover {
        background: #f3f4f6;
    }

    .nav-links a.active {
        background: #eff6ff;
    }

    .nav-icon {
        color: #4b5563;
    }

    .nav-links a:hover .nav-icon,
    .nav-links a.active .nav-icon {
        color: #1e40af;
    }

    .sidebar-footer {
        display: none;
    }

    .topbar {
        left: 70px;
    }

    .main-content {
        margin-left: 70px;
        width: calc(100% - 70px);
        padding: 1.5rem;
    }

    .user-balance {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .user-balance span:last-child {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    /* 抽屉式侧边栏 */
    .sidebar {
        position: fixed;
        left: 0;
        top: 56px; /* mobile-header height */
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: calc(100vh - 56px);
        transform: translateX(-100%);
        z-index: 1001;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: #1e40af;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links a span:not(.nav-icon),
    .nav-divider {
        display: block;
    }

    .nav-links {
        padding: 0 1rem 1rem;
    }

    .nav-links a {
        justify-content: flex-start;
        background: transparent;
        border-radius: 8px;
        margin: 2px 0;
        padding: 12px 14px;
        gap: 12px;
        color: rgba(255, 255, 255, 0.8);
    }

    .nav-links a:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
        transform: translateX(4px);
    }

    .nav-links a.active {
        background: rgba(255, 255, 255, 0.15);
        color: white;
    }

    .nav-icon {
        color: rgba(255, 255, 255, 0.7);
        flex-shrink: 0;
    }

    .nav-links a:hover .nav-icon,
    .nav-links a.active .nav-icon {
        color: white;
    }

    .nav-divider {
        color: rgba(255, 255, 255, 0.6);
    }

    .sidebar-footer {
        display: block;
    }

    /* 抽屉打开状态 */
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* 遮罩层 */
    .mobile-overlay.active {
        display: block;
        opacity: 1;
        background: rgba(0, 0, 0, 0.5);
    }

    /* 隐藏桌面端topbar */
    .topbar {
        display: none;
    }

    /* 主内容区域 */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        margin-top: 0;
    }

    .glass {
        padding: 1rem !important;
    }

    .table-container {
        overflow-x: auto;
        margin: 0 -1rem;
        width: calc(100% + 2rem);
        padding: 0 1rem;
    }

    table {
        min-width: 600px;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    th {
        font-size: 0.7rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem !important;
        margin: 0 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
    }

    .glass {
        padding: 0.75rem !important;
    }

    .table-container {
        margin: 0 -0.75rem;
        width: calc(100% + 1.5rem);
        padding: 0 0.75rem;
    }

    table {
        min-width: 400px;
    }

    th, td {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
    }

    th {
        font-size: 0.65rem;
    }

    .modal-content {
        padding: 1rem !important;
        margin: 0 5px;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .input-control {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
    }
}

/* 链接样式 */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 用户中心特有样式 */
.member-center .topbar {
    padding: 0 20px;
}

.member-center .topbar-left {
    gap: 12px;
}

.member-center .topbar-right {
    gap: 12px;
}

/* 产品网格布局 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.product-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0 !important;
    padding: 1.75rem;
    transition: all 0.2s ease;
    box-shadow: var(--card-shadow);
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #1e40af;
    transform: translateY(-2px);
}

/* 授权状态徽章 */
.expire-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 0 !important;
    font-weight: 600;
}

.expire-ok {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.expire-warn {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.expire-err {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* 操作按钮组 */
.action-btns {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .action-btns {
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }

    .action-btns .btn,
    .action-btns form {
        width: 100%;
    }

    .action-btns .btn {
        padding: 8px 10px;
        font-size: 0.75rem;
        justify-content: center;
    }

    .expire-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    td code {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .action-btns .btn {
        font-size: 0.7rem;
        padding: 6px 8px;
    }
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-card .label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* 通知铃铛 */
.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.notification-bell:hover {
    background: #f3f4f6;
    color: var(--primary);
    border-color: var(--primary-light);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* 移动端铃铛 */
.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-bell {
    background: transparent;
    border: none;
}

@media (max-width: 768px) {
    .notification-bell {
        width: 36px;
        height: 36px;
    }
    
    .notification-badge {
        min-width: 16px;
        height: 16px;
        font-size: 10px;
        top: -3px;
        right: -3px;
    }
}
