/* 布局相关样式 */

/* 侧边导航 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

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

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-menu {
    padding: 24px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: #f1f5f9;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    font-size: 16px;
}

/* 主要内容区 */
.main-content {
    margin-left: 0;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.sidebar-open {
    margin-left: 280px;
}

/* 顶部导航 */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 8px;
}

.menu-toggle:hover {
    background: var(--bg-color);
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-indicator.online {
    background: #dcfce7;
    color: #166534;
}

.status-indicator.offline {
    background: #fee2e2;
    color: #991b1b;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.start-server-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.start-server-btn:hover {
    background: var(--primary-hover);
}

/* 内容区域 */
.content {
    padding: 24px;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, var(--card-bg), #f8fafc);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #7c3aed);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: between;
    margin-bottom: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin-right: 16px;
}

.stat-icon.users { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-icon.messages { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.push { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.time { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 响应式设计 */
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 280px;
    }

    .menu-toggle {
        display: none;
    }
}

@media (max-width: 767px) {
    /* 侧边栏优化 */
    .sidebar {
        width: 260px;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    }

    .sidebar-header {
        padding: 16px;
    }

    .nav-item {
        padding: 14px 20px;
        font-size: 15px;
    }

    /* 内容区域优化 */
    .content {
        padding: 12px;
    }

    .card {
        padding: 16px;
        border-radius: 8px;
        margin-bottom: 16px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 12px;
    }

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

    /* 统计卡片 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-label {
        font-size: 13px;
    }

    /* 表单优化 */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    /* 顶部导航优化 */
    .page-title {
        font-size: 18px;
    }

    .header {
        padding: 12px;
    }

    .header-right {
        gap: 8px;
    }

    .status-indicator {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* 表格优化 */
    .table-container {
        font-size: 13px;
        margin: 0 -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .table th {
        font-size: 12px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f8fafc;
    }
}

/* 小屏幕额外优化 */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }

    .content {
        padding: 8px;
    }

    .card {
        padding: 12px;
    }

    .page-title {
        font-size: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .stat-value {
        font-size: 20px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 12px;
    }
}