/* 社区主样式文件 */
.community-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* 头部样式 */
.community-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

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

.community-user-nav {
    display: flex;
    align-items: center;
}

.community-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.community-user-name {
    margin-right: 15px;
    font-weight: 600;
    color: #333;
}

.community-notification-badge {
    position: relative;
    margin-right: 15px;
}

.community-notification-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* 导航菜单 */
.community-nav {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.community-nav-item {
    padding: 10px 20px;
    margin-right: 5px;
    color: #555;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.community-nav-item:hover,
.community-nav-item.active {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
}

/* 内容卡片 */
.community-card {
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.community-card-title {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.community-card-body {
    padding: 20px;
}

/* 话题列表 */
.community-topic-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

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

.community-topic-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
}

.community-topic-content {
    flex: 1;
}

.community-topic-title {
    margin: 0 0 5px;
    font-size: 16px;
}

.community-topic-title a {
    color: #333;
    text-decoration: none;
}

.community-topic-title a:hover {
    color: #4CAF50;
}

.community-topic-meta {
    font-size: 13px;
    color: #777;
    margin-bottom: 5px;
}

.community-topic-excerpt {
    color: #555;
    font-size: 14px;
    margin: 5px 0;
}

.community-topic-actions {
    display: flex;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.community-topic-action {
    margin-right: 15px;
    font-size: 13px;
    color: #777;
    cursor: pointer;
    margin-bottom: 5px;
}

.community-topic-action:hover {
    color: #4CAF50;
}

.community-topic-action i {
    margin-right: 5px;
}

/* 用户资料 */
.community-profile-header {
    display: flex;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.community-profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-right: 0;
    margin-bottom: 20px;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.community-profile-info {
    flex: 1;
    width: 100%;
}

.community-profile-name {
    margin: 0 0 10px;
    font-size: 28px;
    color: #333;
}

.community-profile-level {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    margin-left: 10px;
    vertical-align: middle;
}

.community-profile-meta {
    margin: 10px 0;
    color: #777;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.community-profile-meta span {
    margin: 0 10px 5px;
}

.community-profile-bio {
    margin: 15px 0;
    color: #555;
    line-height: 1.6;
}

.community-profile-stats {
    display: flex;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.community-profile-stat {
    margin: 0 15px 15px;
    text-align: center;
    min-width: 80px;
}

.community-profile-stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 5px;
}

.community-profile-stat-label {
    font-size: 13px;
    color: #777;
}

.community-profile-actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.community-profile-action {
    display: inline-block;
    padding: 8px 15px;
    background: #4CAF50;
    color: white;
    border-radius: 3px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
    margin: 5px;
}

.community-profile-action:hover {
    background: #3d8b40;
    color: white;
}

.community-profile-action.secondary {
    background: #eee;
    color: #555;
}

.community-profile-action.secondary:hover {
    background: #ddd;
}

/* 农场游戏 */
.community-farm-container {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.community-farm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.community-farm-stats {
    display: flex;
    flex-wrap: wrap;
}

.community-farm-stat {
    margin-right: 20px;
    background: white;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.community-farm-stat-label {
    font-size: 12px;
    color: #777;
    margin-bottom: 5px;
}

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

.community-farm-fields {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.community-farm-field {
    background: #e9f5e9;
    height: 120px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.community-farm-field:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.community-farm-field-plant {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.community-farm-field-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 5px;
    background: #4CAF50;
    width: 0%;
    transition: width 0.3s;
}

.community-farm-seeds {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.community-farm-seed {
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.community-farm-seed:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.community-farm-seed-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 10px;
}

.community-farm-seed-name {
    font-size: 14px;
    margin: 5px 0;
    color: #333;
}

.community-farm-seed-price {
    font-size: 13px;
    color: #777;
}

/* 私信和通知 */
.community-messages-container {
    display: flex;
}

.community-messages-sidebar {
    width: 300px;
    margin-right: 20px;
}

.community-messages-list {
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow: hidden;
}

.community-messages-user {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s;
}

.community-messages-user:hover,
.community-messages-user.active {
    background: #f9f9f9;
}

.community-messages-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.community-messages-user-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.community-messages-user-time {
    font-size: 12px;
    color: #999;
}

.community-messages-user-unread {
    width: 10px;
    height: 10px;
    background: #ff4757;
    border-radius: 50%;
    margin-left: 10px;
}

.community-messages-content {
    flex: 1;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.community-messages-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.community-messages-back {
    display: none;
    margin-right: 10px;
    cursor: pointer;
}

.community-messages-recipient {
    flex: 1;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.community-messages-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 400px;
}

.community-message {
    margin-bottom: 15px;
    display: flex;
}

.community-message.received {
    justify-content: flex-start;
}

.community-message.sent {
    justify-content: flex-end;
}

.community-message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
}

.community-message.received .community-message-bubble {
    background: #f1f1f1;
    color: #333;
    border-top-left-radius: 0;
}

.community-message.sent .community-message-bubble {
    background: #4CAF50;
    color: white;
    border-top-right-radius: 0;
}

.community-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    text-align: right;
}

.community-message.sent .community-message-time {
    color: rgba(255,255,255,0.7);
}

.community-messages-footer {
    padding: 15px;
    border-top: 1px solid #eee;
}

.community-messages-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    outline: none;
    font-family: inherit;
}

.community-messages-input:focus {
    border-color: #4CAF50;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .community-messages-container {
        flex-direction: column;
    }
    
    .community-messages-sidebar {
        width: 100%;
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .community-messages-back {
        display: block;
    }
    
    .community-farm-fields {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .community-farm-seeds {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .community-profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .community-profile-avatar {
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .community-profile-stats {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .community-profile-stat {
        flex: 1 1 calc(33.333% - 30px);
        min-width: auto;
        margin: 0 5px 10px;
    }
    
    .community-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    
    .community-nav-item {
        padding: 10px 15px;
    }
    
    .community-topic-item {
        flex-direction: column;
    }
    
    .community-topic-actions {
        flex-wrap: wrap;
    }
    
    .community-topic-action {
        margin-bottom: 5px;
    }

    /* 修复移动端按钮布局问题 */
    .community-profile-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .community-profile-action {
        margin: 5px;
        flex: 1 1 auto;
        min-width: 100px;
        text-align: center;
    }
}

/* 表单样式 */
.community-form-group {
    margin-bottom: 20px;
}

.community-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.community-form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.community-form-control:focus {
    border-color: #4CAF50;
    outline: none;
    box-shadow: 0 0 0 2px rgba(76,175,80,0.2);
}

.community-form-textarea {
    min-height: 120px;
    resize: vertical;
}

.community-form-submit {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.community-form-submit:hover {
    background: #3d8b40;
}

/* 按钮样式 */
.community-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.community-btn-primary {
    background: #4CAF50;
    color: white;
    border: 1px solid #4CAF50;
}

.community-btn-primary:hover {
    background: #3d8b40;
    border-color: #3d8b40;
    color: white;
}

.community-btn-secondary {
    background: white;
    color: #4CAF50;
    border: 1px solid #4CAF50;
}

.community-btn-secondary:hover {
    background: #f5f5f5;
    color: #3d8b40;
    border-color: #3d8b40;
}

.community-btn-danger {
    background: #ff4757;
    color: white;
    border: 1px solid #ff4757;
}

.community-btn-danger:hover {
    background: #e84118;
    border-color: #e84118;
    color: white;
}

/* 分页样式 */
.community-pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.community-pagination-item {
    margin: 0 5px;
}

.community-pagination-link {
    display: block;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #4CAF50;
    text-decoration: none;
}

.community-pagination-link:hover,
.community-pagination-link.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* 加载动画 */
.community-loading {
    display: flex;
    justify-content: center;
    padding: 30px;
}

.community-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: #4CAF50;
    animation: spin 1s linear infinite;
}

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

/* 空状态 */
.community-empty {
    text-align: center;
    padding: 40px 20px;
    color: #777;
}

.community-empty-icon {
    font-size: 50px;
    margin-bottom: 20px;
    color: #ddd;
}

.community-empty-text {
    font-size: 16px;
    margin-bottom: 20px;
}

/* 标签样式 */
.community-tag {
    display: inline-block;
    padding: 3px 8px;
    background: #f1f1f1;
    color: #555;
    border-radius: 3px;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.community-tag:hover {
    background: #ddd;
    color: #333;
}

/* 警告框 */
.community-alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.community-alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.community-alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.community-alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.community-alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}