/* ==========================================================================
   FitTrack Pro - Community Styles
   Mapped to Design System Variables (--text-main, --bg-surface, etc.)
   ========================================================================== */

/* Layout */
.community-container {
    max-width: 860px;
    margin: 0 auto;
}

.community-header {
    margin-bottom: 1.75rem;
}

.community-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.community-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Tab Navigation */
.community-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.3rem;
    margin-bottom: 1.75rem;
}

.community-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.community-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.community-tab.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.community-tab i {
    font-size: 0.95rem;
}

/* Tab Panels */
.community-panel {
    display: none;
}

.community-panel.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

/* Post Composer */
.post-composer {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card);
}

.post-composer textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
    resize: none;
    min-height: 80px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    margin-bottom: 0.75rem;
}

.post-composer textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.post-composer textarea::placeholder {
    color: var(--text-subtle);
}

.post-composer-actions {
    display: flex;
    justify-content: flex-end;
}

/* Feed Posts */
.community-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.community-post {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast);
}

.community-post:hover {
    border-color: var(--border-hover);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-meta {
    display: flex;
    flex-direction: column;
}

.post-author {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.post-time {
    font-size: 0.78rem;
    color: var(--text-subtle);
}

.post-content {
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Friends Panel */
.friends-search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.friends-search-bar input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.8rem 1rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.friends-search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.friends-search-bar input::placeholder {
    color: var(--text-subtle);
}

.friends-list,
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.friend-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color var(--transition-fast);
}

.friend-card:hover {
    border-color: var(--border-hover);
}

.friend-avatar {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.friend-info {
    flex: 1;
}

.friend-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.friend-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* Section Labels */
.community-section-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
    margin-top: 1.25rem;
}

.community-section-label:first-child {
    margin-top: 0;
}

/* Empty State */
.community-empty {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--text-muted);
}

.community-empty i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
    display: block;
}

.community-empty h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.community-empty p {
    font-size: 0.9rem;
}

/* Loading Skeleton */
.skeleton-post {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skeleton-line {
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    height: 14px;
    animation: shimmer 1.6s infinite ease-in-out;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }
.skeleton-line.full { width: 100%; }
.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    animation: shimmer 1.6s infinite ease-in-out;
    flex-shrink: 0;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .community-tabs {
        flex-direction: column;
        gap: 0.2rem;
    }

    .community-tab {
        justify-content: flex-start;
        padding: 0.65rem 0.85rem;
        font-size: 0.88rem;
    }

    .friends-search-bar {
        flex-direction: column;
    }
}
