/* ============================================
   官方后台样式
   ============================================ */

.admin-layout {
    display: block;
    min-height: 100vh;
}

/* 侧边栏 */
.admin-sidebar {
    background: #1a1a2e;
    color: white;
    display: flex;
    flex-direction: column;
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    z-index: 200;
}

.admin-logo {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-logo span {
    font-size: 28px;
}

.admin-logo strong {
    display: block;
    font-size: 16px;
}

.admin-logo small {
    font-size: 12px;
    opacity: 0.7;
}

.admin-nav {
    flex: 1;
    padding: 15px 0;
}

.admin-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.admin-nav .nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.admin-nav .nav-item.active {
    background: rgba(102, 126, 234, 0.2);
    color: white;
    border-left-color: #667eea;
}

.admin-nav .nav-item span:first-child {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.admin-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.admin-footer .btn {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.8);
}

.admin-footer .btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* 主内容区 */
.admin-main {
    margin-left: 260px;
    background: #f5f7fa;
    min-height: 100vh;
}

/* 顶部栏 */
.admin-header {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.admin-tools {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #666;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #f5f7fa;
    border-radius: 20px;
}

/* 内容区 */
.admin-content {
    padding: 30px;
}

/* Tab 切换 */
.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

/* 登录页面 - 全屏覆盖 */
.admin-login {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 9999;
}

.admin-login.hidden {
    display: none;
}

.login-box {
    background: white;
    padding: 50px 45px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
}

.login-brand {
    text-align: center;
    margin-bottom: 35px;
}

.login-brand span {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.login-brand h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    color: #333;
}

.login-brand p {
    margin: 0;
    font-size: 14px;
    color: #999;
}

.login-box .form-group {
    margin-bottom: 22px;
}

.login-box .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.login-box .form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.login-box .form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.login-box .btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 10px;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.users { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-icon.points { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-icon.recharge { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-icon.today { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.stat-label {
    font-size: 13px;
    color: #999;
    margin-top: 5px;
}

/* 图表区域 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

.dashboard-card h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #333;
}

.chart-placeholder {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 柱状图 */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    height: 150px;
    padding: 0 20px;
}

.bar {
    width: 40px;
    background: linear-gradient(to top, #667eea, #764ba2);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s;
}

.bar:hover {
    opacity: 0.8;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 10px;
    color: #999;
    font-size: 12px;
}

/* 饼图 */
.pie-chart {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        #667eea 0% 40%,
        #764ba2 40% 70%,
        #f093fb 70% 90%,
        #f5576c 90% 100%
    );
    position: relative;
}

.pie-chart::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
}

.pie-legend {
    margin-left: 30px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* 功能排行 */
.feature-ranking {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.rank-number {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fa;
    border-radius: 50%;
    font-weight: bold;
    color: #666;
}

.rank-item:first-child .rank-number {
    background: #ffd700;
    color: white;
}

.rank-item:nth-child(2) .rank-number {
    background: #c0c0c0;
    color: white;
}

.rank-item:nth-child(3) .rank-number {
    background: #cd7f32;
    color: white;
}

.rank-name {
    width: 100px;
    font-size: 14px;
    color: #333;
}

.rank-bar {
    flex: 1;
    height: 10px;
    background: #f5f7fa;
    border-radius: 5px;
    overflow: hidden;
}

.rank-progress {
    height: 100%;
    background: linear-gradient(to right, #667eea, #764ba2);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.rank-value {
    width: 80px;
    text-align: right;
    font-size: 13px;
    color: #666;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 250px;
}

.filter-group select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* 表格 */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

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

.admin-table th {
    background: #f5f7fa;
    padding: 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.admin-table td {
    padding: 15px;
    border-top: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
}

.admin-table tr:hover {
    background: #fafafa;
}

.empty-cell {
    text-align: center;
    color: #999;
    padding: 50px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

/* 配置区 */
.config-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.config-section h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.config-form .form-group {
    margin: 0;
}

.config-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.config-form input,
.config-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.config-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* 积分用户卡片 */
.points-user-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.user-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.points-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr auto;
    gap: 15px;
    align-items: end;
}

/* 日志 */
.log-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.log-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.log-item:last-child {
    border-bottom: none;
}

.log-time {
    font-size: 13px;
    color: #999;
    width: 150px;
}

.log-type {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.log-type.login { background: #e3f2fd; color: #1976d2; }
.log-type.points { background: #f3e5f5; color: #7b1fa2; }
.log-type.config { background: #e8f5e9; color: #388e3c; }
.log-type.user { background: #fff3e0; color: #f57c00; }

.log-content {
    flex: 1;
    font-size: 14px;
    color: #333;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    max-height: 60vh;
}

.modal-body .form-group {
    margin-bottom: 12px;
}

.modal-body .form-group label {
    font-size: 13px;
    margin-bottom: 4px;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    padding: 8px 10px;
    font-size: 13px;
}

.modal-body textarea {
    min-height: 60px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

/* 响应式 */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }

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

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .points-actions {
        grid-template-columns: 1fr;
    }
}
