/* forum_styles.css - Enhanced Forum Styles with FIXED Mobile Responsive */

/* ===== FORUM-SPECIFIC VARIABLES ===== */
:root {
    /* Extended color palette for forum */
    --forum-accent-blue: #3b82f6;
    --forum-accent-purple: #8b5cf6;
    --forum-accent-pink: #ec4899;
    --forum-accent-orange: #f97316;
    --forum-accent-teal: #14b8a6;
    --forum-success: #10b981;
    --forum-warning: #f59e0b;
    --forum-error: #ef4444;
}

/* ===== LOGO STYLES - FORUM SPECIFIC ===== */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.02);
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo-main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.logo-icon {
    font-size: 28px;
    color: var(--text-primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-text {
    font-size: 22px;
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
}

.logo-tagline {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    font-weight: 400;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.logo-link:hover .logo-tagline {
    opacity: 1;
    color: var(--accent-main);
}

.logo-link:hover .logo-icon {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-2px); }
}

/* ===== MAIN CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* ===== COMPACT AI APPS SECTION ===== */
.ai-apps-compact {
    max-width: 1400px;
    margin: 0 auto 2rem;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(104, 211, 145, 0.1);
    border-radius: 16px;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.ai-apps-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ai-app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 130px;
}

.ai-app-item:hover {
    transform: translateY(-2px) scale(1.05);
    background: rgba(104, 211, 145, 0.05);
}

.ai-app-icon-mini {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ai-app-item:hover .ai-app-icon-mini {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.ai-app-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    transition: color 0.3s ease;
}

.ai-app-item:hover .ai-app-name {
    color: var(--accent-main);
}

/* Individual App Colors */
.ai-app-icon-mini.chatgpt { 
    background: linear-gradient(135deg, #74a9ad, #5a8a8e);
}

.ai-app-icon-mini.claude { 
    background: linear-gradient(135deg, #cc6633, #b8552c);
}

.ai-app-icon-mini.gemini { 
    background: linear-gradient(135deg, #4285f4, #3367d6);
}

.ai-app-icon-mini.veo { 
    background: linear-gradient(135deg, #ea4335, #d33b2c);
}

.ai-app-icon-mini.perplexity { 
    background: linear-gradient(135deg, #20c997, #17a589);
}

.ai-app-icon-mini.midjourney { 
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
}

.ai-app-icon-mini.canva { 
    background: linear-gradient(135deg, #00c3ff, #0099cc);
}

.ai-app-icon-mini.runway { 
    background: linear-gradient(135deg, #65a30d, #4d7c0f);
}

.ai-app-icon-mini.replika { 
    background: linear-gradient(135deg, #ff6987, #ff4568);
}

/* ===== FEATURED GENERAL CHAT STYLES ===== */
.com-general-featured {
    grid-column: span 6 !important;
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.15) 0%,
        rgba(5, 150, 105, 0.12) 50%,
        rgba(4, 120, 87, 0.10) 100%);
    border: 2px solid rgba(16, 185, 129, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.com-general-featured::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981, #059669, #047857, #065f46);
    opacity: 0.9;
    animation: featuredGlow 3s ease-in-out infinite alternate;
}

@keyframes featuredGlow {
    0% { 
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
        opacity: 0.8;
    }
    100% { 
        box-shadow: 0 0 35px rgba(16, 185, 129, 0.5);
        opacity: 1;
    }
}

.com-general-featured::after {
    content: '⭐';
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    animation: starPulse 2s infinite;
    z-index: 3;
}

@keyframes starPulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.8;
    }
    50% { 
        transform: scale(1.2); 
        opacity: 1;
    }
}

.com-general-featured:hover {
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 0 20px 60px rgba(16, 185, 129, 0.25) !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
}

/* ===== FEATURED BADGE ===== */
.badge-popular {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: popularBadge 2s infinite;
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.4);
}

@keyframes popularBadge {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(22, 163, 74, 0.4);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(22, 163, 74, 0.6);
    }
}

/* ===== FEATURED ICON ===== */
.featured-icon {
    width: 64px !important;
    height: 64px !important;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4) !important;
    border-radius: 16px !important;
    font-size: 1.8rem !important;
    position: relative;
    overflow: hidden;
}

.featured-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: rotate(45deg);
    animation: iconShine 3s infinite;
}

@keyframes iconShine {
    0% { transform: translateX(-200%) translateY(-200%) rotate(45deg); }
    50% { transform: translateX(200%) translateY(200%) rotate(45deg); }
    100% { transform: translateX(-200%) translateY(-200%) rotate(45deg); }
}

/* ===== FEATURED TITLE ===== */
.featured-title {
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    background: linear-gradient(135deg, #10b981, #059669);
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text;
    margin-bottom: 12px !important;
    position: relative;
}

.featured-title::after {
    content: '👑';
    position: absolute;
    right: -25px;
    top: -2px;
    font-size: 0.9rem;
    animation: crownFloat 3s ease-in-out infinite alternate;
}

@keyframes crownFloat {
    0% { transform: translateY(0px) rotate(-5deg); }
    100% { transform: translateY(-3px) rotate(5deg); }
}

/* ===== FEATURED DESCRIPTION ===== */
.featured-description {
    font-size: 1rem !important;
    line-height: 1.6 !important;
    color: #d1fae5 !important;
    margin-bottom: 20px !important;
    padding: 12px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 12px;
    border-left: 4px solid #10b981;
    position: relative;
}

.featured-description strong {
    color: #10b981 !important;
    font-weight: 700;
}

/* ===== FEATURED MEMBERS ===== */
.featured-members {
    background: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    padding: 12px !important;
    border-radius: 12px !important;
    margin-bottom: 20px !important;
}

.featured-member-info {
    color: #ffffff !important;
}

.featured-member-info strong {
    color: #10b981 !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
}

/* ===== FEATURED JOIN BUTTON ===== */
.featured-join-btn {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
    color: white !important;
    padding: 10px 20px !important;
    border-radius: 12px !important;
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.featured-join-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

.featured-join-btn:hover::before {
    left: 100%;
}

.featured-join-btn:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 30px rgba(22, 163, 74, 0.5) !important;
    background: linear-gradient(135deg, #15803d, #166534) !important;
}

/* ===== SPECIAL EMPHASIS FOR GENERAL CHAT ===== */
.com-general-featured .community-stats .stat-number {
    font-size: 1.2rem !important;
    font-weight: 800 !important;
    color: #10b981 !important;
}

.com-general-featured .community-stats .stat-label {
    color: #6ee7b7 !important;
    font-weight: 600 !important;
}

/* ===== COMMUNITIES GRID ===== */
.communities-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* ===== HERO COMMUNITY (ข่าว AI) ===== */
.community-hero {
    grid-column: span 12;
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.1) 0%,
        rgba(59, 130, 246, 0.1) 50%,
        rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 24px;
    padding: 3rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.community-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: heroShine 3s infinite;
}

.community-hero:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.2);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 20px;
    color: #ef4444;
    font-size: 0.85rem;
    font-weight: 600;
    width: fit-content;
    animation: pulseHero 2s infinite;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
}

.hero-description {
    font-size: 1.1rem;
    color: #cccccc;
    line-height: 1.6;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

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

.hero-stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
}

.hero-stat-label {
    font-size: 0.85rem;
    color: #888888;
}

.hero-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.join-community-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.join-community-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.community-preview {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

.preview-title {
    font-size: 0.9rem;
    color: #cccccc;
    margin-bottom: 1rem;
    font-weight: 600;
}

.active-members {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.member-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.member-avatars {
    display: flex;
    gap: -8px;
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #0a0a0a;
    margin-left: -8px;
}

.member-avatar:first-child {
    margin-left: 0;
}

.member-count {
    font-size: 0.75rem;
    color: #888888;
}

.recent-activity {
    font-size: 0.8rem;
    color: #aaaaaa;
    line-height: 1.4;
}

/* ===== REGULAR COMMUNITIES ===== */
.community-card {
    background: rgba(25, 25, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.community-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

/* ===== FIGMA STYLE (Creative Communities) ===== */
.community-figma {
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.1) 0%,
        rgba(219, 39, 119, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.community-figma::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

.community-figma:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 48px rgba(139, 92, 246, 0.2);
}

/* ===== DRIBBBLE STYLE (Clean Communities) ===== */
.community-dribbble {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

.community-dribbble:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* ===== UPDATED GRID POSITIONING ===== */
.com-general-featured { grid-column: span 6; }
.com-creative { grid-column: span 3; }
.com-coding { grid-column: span 3; }
.com-showcase { grid-column: span 6; }
.com-market { grid-column: span 6; }
.com-assistant { grid-column: span 12; }

/* ===== COMMUNITY CONTENT ===== */
.community-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.community-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    margin-bottom: 1rem;
}

.figma .community-icon {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    box-shadow: 0 4px 24px rgba(139, 92, 246, 0.4);
    animation: pulseIcon 2s infinite;
}

.dribbble .community-icon {
    background: linear-gradient(135deg, #64748b, #475569);
    box-shadow: 0 4px 16px rgba(100, 116, 139, 0.2);
}

.community-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-hot {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    animation: glow 2s infinite;
}

.badge-new {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
}

.badge-premium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
}

.community-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #ffffff;
    position: relative;
    z-index: 2;
}

.community-description {
    font-size: 0.9rem;
    color: #888888;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    position: relative;
    z-index: 2;
}

.community-members {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.member-avatars-small {
    display: flex;
    gap: -6px;
}

.member-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #0a0a0a;
    margin-left: -6px;
}

.member-avatar-small:first-child {
    margin-left: 0;
}

.member-info {
    font-size: 0.8rem;
    color: #cccccc;
}

.member-info strong {
    color: #ffffff;
}

.community-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.stats-left {
    display: flex;
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}

.stat-label {
    font-size: 0.7rem;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.join-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.join-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ===== ANIMATIONS ===== */
@keyframes heroShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes float {
    0%, 100% { transform: rotate(0deg) translate(0px, 0px); }
    50% { transform: rotate(180deg) translate(20px, -20px); }
}

@keyframes pulseHero {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.8); }
}

/* ===== SPARKLE EFFECT ===== */
.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    animation: sparkle 3s infinite;
    pointer-events: none;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1); }
}

/* ===== IMPROVED MOBILE RESPONSIVE DESIGN ===== */

/* Large Tablet */
@media (max-width: 1200px) {
    .ai-apps-row {
        gap: 0.75rem;
    }
    
    .ai-app-item {
        min-width: 110px;
        padding: 1.2rem;
    }
    
    .ai-app-icon-mini {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    .communities-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 1.2rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .com-general-featured { grid-column: span 8; }
    .com-creative, .com-coding { grid-column: span 4; }
    .com-showcase, .com-market { grid-column: span 4; }
    .com-assistant { grid-column: span 8; }
}

/* Small Tablet */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }

    .ai-apps-compact {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .ai-apps-row {
        gap: 0.6rem;
    }
    
    .ai-app-item {
        min-width: 90px;
        padding: 1rem;
    }
    
    .ai-app-icon-mini {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }
    
    .ai-app-name {
        font-size: 0.75rem;
    }

    .communities-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }

    .hero-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .com-general-featured { grid-column: span 4; }
    .com-creative, .com-coding { grid-column: span 2; }
    .com-showcase, .com-market { grid-column: span 2; }
    .com-assistant { grid-column: span 4; }

    .community-card {
        padding: 1.5rem;
    }

    .community-title {
        font-size: 1.1rem;
    }

    .community-description {
        font-size: 0.85rem;
    }
}

/* Mobile Large (768px and below) - MAIN FIX */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .ai-apps-compact {
        padding: 0.8rem;
        margin-bottom: 1.2rem;
    }
    
    .ai-apps-row {
        gap: 0.4rem;
        justify-content: flex-start;
    }
    
    .ai-app-item {
        min-width: 70px;
        padding: 0.8rem 0.4rem;
        gap: 0.5rem;
    }
    
    .ai-app-icon-mini {
        width: 45px;
        height: 45px;
        font-size: 1.4rem;
        border-radius: 12px;
    }
    
    .ai-app-name {
        font-size: 0.7rem;
        line-height: 1.1;
    }

    /* CRITICAL MOBILE GRID FIX */
    .communities-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        margin-bottom: 2rem;
    }
    
    /* Reset all grid-column spans for mobile */
    .community-hero,
    .com-general-featured, 
    .com-creative, 
    .com-coding,
    .com-showcase, 
    .com-market, 
    .com-assistant {
        grid-column: unset !important;
        width: 100% !important;
        margin-bottom: 0 !important;
    }
    
    /* Hero Section Mobile */
    .community-hero {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .hero-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .hero-title {
        font-size: 1.6rem;
        line-height: 1.2;
    }

    .hero-description {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .hero-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
        margin-top: 1rem;
    }

    .hero-stat-number {
        font-size: 1.2rem;
    }

    .hero-stat-label {
        font-size: 0.75rem;
    }

    .join-community-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .community-preview {
        padding: 1rem;
    }

    /* Community Cards Mobile */
    .community-card {
        padding: 1.2rem !important;
        border-radius: 16px;
        margin-bottom: 0 !important;
    }

    .community-icon {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }

    .community-title {
        font-size: 1rem !important;
        margin-bottom: 0.6rem;
        line-height: 1.3;
    }

    .community-description {
        font-size: 0.8rem !important;
        line-height: 1.4;
        margin-bottom: 1rem;
    }

    .community-members {
        margin-bottom: 0.8rem;
        gap: 0.8rem;
    }

    .member-info {
        font-size: 0.75rem;
    }

    .community-stats {
        flex-direction: column !important;
        gap: 0.8rem !important;
        align-items: flex-start !important;
    }

    .stats-left {
        gap: 1.2rem;
        align-self: stretch;
        justify-content: space-around;
    }

    .stat-number {
        font-size: 0.9rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .join-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.75rem;
        align-self: stretch;
        text-align: center;
    }

    /* Featured Card Mobile Adjustments */
    .featured-title {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
    }

    .featured-title::after {
        right: -20px;
        font-size: 0.8rem;
    }
    
    .featured-description {
        font-size: 0.85rem !important;
        padding: 10px;
    }
    
    .featured-icon {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.3rem !important;
    }

    .featured-members {
        padding: 10px !important;
    }

    .featured-member-info strong {
        font-size: 1rem !important;
    }

    .featured-join-btn {
        padding: 0.7rem 1.5rem !important;
        font-size: 0.8rem !important;
    }

    /* Community Badges Mobile */
    .community-badge {
        padding: 0.2rem 0.6rem;
        font-size: 0.6rem;
        margin-bottom: 0.5rem;
        display: inline-block;
    }

    .badge-popular {
        padding: 0.25rem 0.8rem;
        font-size: 0.65rem;
    }
}

/* Mobile Small (480px and below) - EXTRA SMALL SCREENS */
@media (max-width: 480px) {
    .container {
        padding: 0.8rem;
    }

    .ai-apps-compact {
        padding: 0.6rem;
        border-radius: 12px;
    }
    
    .ai-apps-row {
        gap: 0.3rem;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .ai-app-item {
        min-width: 60px;
        padding: 0.6rem 0.3rem;
        flex-shrink: 0;
    }
    
    .ai-app-icon-mini {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
        border-radius: 10px;
    }
    
    .ai-app-name {
        font-size: 0.65rem;
        line-height: 1;
    }

    /* Ultra-compact mobile layout */
    .communities-grid {
        gap: 0.8rem !important;
    }

    .community-hero {
        padding: 1rem;
    }

    .hero-title {
        font-size: 1.3rem;
    }

    .hero-description {
        font-size: 0.8rem;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
    }

    .community-card {
        padding: 1rem !important;
    }

    .community-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .community-title {
        font-size: 0.9rem !important;
    }

    .community-description {
        font-size: 0.75rem !important;
        line-height: 1.3;
    }

    .community-stats {
        gap: 0.6rem !important;
    }

    .stats-left {
        gap: 1rem;
    }

    .member-avatars-small {
        gap: -4px;
    }

    .member-avatar-small {
        width: 20px;
        height: 20px;
        margin-left: -4px;
    }

    .join-btn {
        padding: 0.5rem 1rem;
        font-size: 0.7rem;
    }

    /* Featured adjustments for very small screens */
    .featured-title {
        font-size: 1rem !important;
    }

    .featured-title::after {
        display: none; /* Hide crown on very small screens */
    }
    
    .featured-description {
        font-size: 0.8rem !important;
        padding: 8px;
    }
    
    .featured-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.1rem !important;
    }

    /* Badges for small screens */
    .community-badge,
    .badge-popular {
        font-size: 0.55rem;
        padding: 0.15rem 0.5rem;
    }
}

/* Extra small screens (320px and below) */
@media (max-width: 320px) {
    .container {
        padding: 0.5rem;
    }

    .ai-apps-compact {
        padding: 0.5rem;
    }

    .ai-app-item {
        min-width: 50px;
        padding: 0.4rem 0.2rem;
    }
    
    .ai-app-icon-mini {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .ai-app-name {
        font-size: 0.6rem;
    }

    .hero-title {
        font-size: 1.1rem;
    }

    .community-title {
        font-size: 0.85rem !important;
    }

    .community-description {
        font-size: 0.7rem !important;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-contrast: high) {
    .community-card {
        border: 2px solid #ffffff;
    }
    
    .community-title {
        color: #ffffff;
    }
    
    .community-description {
        color: #cccccc;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .ai-apps-compact,
    .community-hero::before,
    .community-card::before {
        display: none;
    }
    
    .communities-grid {
        display: block !important;
    }
    
    .community-card {
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
}