/* Waterfall Layout for Community */
.waterfall-grid {
    column-count: 2;
    column-gap: 0.75rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .waterfall-grid {
        column-count: 3;
        column-gap: 1rem;
    }
}

@media (min-width: 1280px) {
    .waterfall-grid {
        column-count: 5;
        column-gap: 1rem;
    }
}

.waterfall-item {
    break-inside: avoid;
    margin-bottom: 0.75rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,250,246,0.98));
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    border: 1px solid rgba(255, 237, 213, 0.65);
}

@media (min-width: 768px) {
    .waterfall-item {
        margin-bottom: 1rem;
    }
}

.waterfall-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 40px rgba(120, 53, 15, 0.14);
    border-color: rgba(251, 191, 36, 0.35);
}

.waterfall-img {
    width: 100%;
    display: block;
    object-fit: cover;
    background: #f1f5f9;
}

.waterfall-footer {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.like-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #64748b;
    font-weight: 700;
    transition: color 0.3s;
}

.like-btn.liked {
    color: #f43f5e;
}

.like-icon {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.like-btn.liked .like-icon {
    animation: heartBounce 0.4s ease-out forwards;
    fill: #f43f5e;
}

#community-modal {
    overscroll-behavior: contain;
}

.community-dashboard-body {
    min-height: 0;
    overflow-y: auto;
}

.community-dashboard-shell {
    min-height: 0;
    box-sizing: border-box;
    padding-bottom: 2rem;
}

.community-sidebar,
.community-feed-panel {
    min-height: 0;
}

.community-works-card {
    display: flex;
    flex-direction: column;
    box-shadow: none;
    border-style: solid;
    border-width: 1px;
    border-color: rgba(251, 191, 36, 0.24) !important;
}

.community-user-projects-panel,
.community-waterfall-panel {
    min-height: 0;
    overscroll-behavior: contain;
    background-clip: padding-box;
}

.community-user-projects-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-bottom-left-radius: 2rem;
    border-bottom-right-radius: 2rem;
}

.community-waterfall-panel {
    border-radius: 2rem;
}

@media (min-width: 1280px) {
    .community-dashboard-header {
        flex: 0 0 auto;
    }

    .community-dashboard-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    .community-dashboard-shell {
        min-height: 100%;
        overflow: visible;
    }

    .community-sidebar {
        min-height: 0;
    }

    #community-home-profile {
        flex: none;
    }

    .community-works-card {
        min-height: 0;
    }

    .community-user-projects-panel {
        max-height: none;
        overflow: visible;
    }

    .community-feed-panel {
        min-height: 0;
    }

    .community-waterfall-panel {
        max-height: none;
        overflow: visible;
    }
}

#community-modal .project-card {
    margin-bottom: 0;
}

#community-nav-btn {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

#community-hero-card,
#community-waterfall,
#community-home-profile section,
#community-user-projects-list,
#community-modal .project-card {
    box-shadow: none;
}

#community-waterfall {
    background-image: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,245,235,0.98));
    border-color: rgba(251, 191, 36, 0.28);
}

#community-user-projects-list {
    background: linear-gradient(180deg, rgba(255,252,248,0.98), rgba(255,241,229,0.98));
    border-top: 1px solid rgba(251, 191, 36, 0.16);
}

#community-home-profile section {
    background-image: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(255,244,232,0.99));
    border-color: rgba(251, 191, 36, 0.24);
}

#community-hero-card {
    background-image: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(255,246,236,0.99));
    border-color: rgba(251, 191, 36, 0.24);
}

#community-modal header {
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,248,240,0.94));
    border-bottom-color: rgba(251, 191, 36, 0.24);
}

#community-modal .project-card {
    background: linear-gradient(180deg, rgba(255,255,255,1), rgba(255,243,231,0.98));
    border-color: rgba(251, 191, 36, 0.22);
}

#community-modal .project-card:hover {
    transform: translateY(-2px);
    box-shadow: none;
    border-color: rgba(249, 115, 22, 0.38);
}

#community-home-profile section,
#community-waterfall,
#community-modal header {
    box-sizing: border-box;
}

@media (max-width: 1279px) {
    .community-dashboard-body {
        overflow-y: auto;
    }

    .community-dashboard-shell {
        height: auto;
    }

    #community-user-projects-list {
        max-height: none !important;
    }

    .community-waterfall-panel {
        overflow: visible;
    }
}

@media (max-width: 767px) {
    #community-modal {
        background: linear-gradient(180deg, #fffaf4 0%, #fff7ef 100%);
    }

    .community-dashboard-body {
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    }

    .community-dashboard-shell {
        padding: 0.875rem 0.875rem 1.5rem;
        gap: 1rem;
    }

    #community-modal header {
        padding-top: max(0.9rem, env(safe-area-inset-top));
        padding-bottom: 1rem;
        gap: 0.9rem;
        border-bottom-color: rgba(251, 191, 36, 0.18);
    }

    .community-dashboard-header > div:last-child {
        width: 100%;
    }

    .community-sidebar,
    .community-feed-panel {
        gap: 1rem;
    }

    #community-waterfall {
        padding: 0.875rem;
        border-radius: 1.75rem;
    }

    .community-works-card {
        border-radius: 1.75rem;
    }

    .community-works-card > div:first-child {
        padding: 1rem;
    }

    .community-user-projects-panel {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 0.875rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.875rem 0.875rem 1rem;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        border-bottom-left-radius: 1.5rem;
        border-bottom-right-radius: 1.5rem;
    }

    .community-user-projects-panel > * {
        flex: 0 0 min(15.5rem, 82vw);
        margin-top: 0 !important;
        scroll-snap-align: start;
    }

    .community-user-projects-panel .project-card {
        width: min(15.5rem, 82vw);
        min-width: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        border-radius: 1.4rem;
    }

    .community-user-projects-panel .project-card .h-40 {
        height: 10rem;
    }

    .community-waterfall-panel {
        border-radius: 1.75rem;
    }

    #community-hero-card {
        padding: 1rem;
        border-radius: 1.75rem;
    }

    #community-home-profile section {
        border-radius: 1.75rem;
        overflow: hidden;
    }

    #community-home-profile section .p-5,
    #community-home-profile section .lg\:p-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #community-home-profile section .flex.items-center.gap-4 {
        align-items: flex-start;
        gap: 0.875rem;
    }

    .waterfall-grid {
        column-count: 2;
        column-gap: 0.7rem;
        max-width: none;
    }

    #community-modal .project-card {
        border-radius: 1.25rem;
    }

    .waterfall-item {
        border-radius: 1.35rem;
        margin-bottom: 0.9rem;
    }

    .waterfall-img {
        aspect-ratio: 4 / 3.2;
    }

    #community-modal .waterfall-footer {
        padding: 0.875rem;
        align-items: center;
    }

    #community-modal .waterfall-footer .flex.items-center.gap-2 {
        min-width: 0;
    }

    #community-modal .waterfall-footer .truncate {
        max-width: 4.75rem;
    }
}

@keyframes heartBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}
