/* MindCare Community Premium */

:root {
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(15, 118, 110, 0.12);
    --glass-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.06);
    --card-radius: 20px;
    --anim-speed: 0.3s;
    --bg-color: #fafafa;
    /* Names kept so existing rules still work; values are MindCare teal. */
    --accent-lavender: var(--mc-primary, #0f766e);
    --accent-sky: var(--mc-accent-teal, #0d9488);
    /* Modal & card colours */
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --input-bg: #f0fdfa;
    --input-border: rgba(13, 148, 136, 0.4);
    --divider-color: #e2e8f0;
    --chip-bg: #f0fdfa;
    --chip-color: #115e59;
    --chip-border: rgba(13, 148, 136, 0.2);
    --close-btn-bg: #f1f5f9;
    --icon-color: #0f766e;
}

body.theme-charcoal {
    --glass-bg: rgba(22, 32, 34, 0.85);
    --glass-border: rgba(13, 148, 136, 0.12);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --bg-color: #121212;
    --accent-lavender: #2dd4bf;
    --accent-sky: #14b8a6;
    /* Modal & card colours */
    --bg-card: #182325;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --input-bg: rgba(13, 148, 136, 0.08);
    --input-border: rgba(13, 148, 136, 0.3);
    --divider-color: rgba(13, 148, 136, 0.12);
    --chip-bg: rgba(13, 148, 136, 0.1);
    --chip-color: #99f6e4;
    --chip-border: rgba(13, 148, 136, 0.25);
    --close-btn-bg: rgba(13, 148, 136, 0.12);
    --icon-color: #2dd4bf;
}

/* Community Transition Helper (Removed universal * transition) */

/* Hide universal sidebar on community page ON DESKTOP ONLY (has its own nav) */
/* Sidebar is now consistent with dashboard */
@media (min-width: 768px) {
    body.community-page .sidebar-nav {
        display: flex !important;
    }
}
/* Note: mobile-sidebar-toggle is intentionally NOT hidden so users can navigate to other pages */

/* Fix mobile viewport height issues */
@media (max-width: 768px) {
    html, body.community-page {
        height: 100%;
        height: -webkit-fill-available;
        overflow-x: hidden;
    }
}
/* Ensure community's custom bottom nav is visible on mobile despite navigation-v2 hiding it */
/* Bottom nav is now removed; sidebar handles all navigation. */
/* Override nav-v2 max-width constraint so community grid fills the viewport */
body.community-page .main-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 0 100px 0 !important;
    margin: 0 !important;
}

/* Layout Container */
.community-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 60px; /* Reduced space above header */
    min-height: 100vh;
}

@media (max-width: 768px) {
    .community-container {
        padding: 56px 16px 100px; /* Aligned with top bar height + horizontal padding */
    }
}

/* Premium Navigation */
.community-top-bar {
    display: none; /* Hidden on desktop by default, like dashboard */
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: fixed;
    width: 100%;
    left: 0;
    top: 0;
    z-index: 10000;
    height: 60px;
}

@media (max-width: 768px) {
    .community-top-bar.dash-top-bar {
        display: flex !important;
    }
}

body.theme-charcoal .community-top-bar {
    background: rgba(15, 23, 42, 0.9);
    background-image: radial-gradient(at 0% 0%, rgba(13, 148, 136, 0.15) 0px, transparent 40%),
                      radial-gradient(at 100% 0%, rgba(20, 184, 166, 0.15) 0px, transparent 40%);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.header-search-container {
    flex: 0 1 400px;
    position: relative;
    margin: 0 20px;
}

.header-search-container input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.03);
    outline: none;
    font-family: inherit;
    transition: all 0.3s ease;
}

.header-search-container i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Header & Top Bar */
.page-title {
    font-weight: 800;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    margin-left: 12px;
}

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

.header-icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, color 0.2s;
}

.header-icon-btn:hover {
    color: var(--accent-lavender);
    transform: scale(1.1);
}

.header-icon-btn .badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: #ff4757;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

body.theme-charcoal .header-icon-btn .badge {
    border-color: #1e1e1e;
}

/* Premium Button Unification */
.circle-action-btn, 
.header-back-btn, 
.header-more-btn, 
.back-btn-profile, 
.menu-btn-profile {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(226, 232, 240, 0.6); /* Soft slate */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

body.theme-charcoal .circle-action-btn,
body.theme-charcoal .header-back-btn,
body.theme-charcoal .header-more-btn,
body.theme-charcoal .back-btn-profile,
body.theme-charcoal .menu-btn-profile {
    background: rgba(38, 38, 38, 0.9);
    color: #fff;
}

.circle-action-btn:hover, 
.header-back-btn:hover, 
.header-more-btn:hover, 
.back-btn-profile:hover, 
.menu-btn-profile:hover {
    background: var(--accent-lavender);
    color: white !important;
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(13, 148, 136, 0.4);
}

.circle-action-btn:active, 
.header-back-btn:active, 
.header-more-btn:active {
    transform: scale(0.92);
}

.header-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--accent-lavender);
    flex-shrink: 0;
}

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

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

@media (max-width: 768px) {
    .header-search-container {
        display: none; /* Hide wide search on mobile */
    }
    .community-top-bar {
        height: 56px;
        padding: 0 12px;
        padding-left: 68px; /* Make room for the fixed .mobile-sidebar-toggle to avoid overlap with back button */
    }
    .community-top-bar .page-title {
        font-size: 1.3rem; /* slightly smaller on mobile to fit nicely */
        margin-left: 2px;
    }
}

@media (max-width: 600px) {
    .header-actions {
        gap: 12px;
    }
}

/* Sidebar Refinement */
.community-nav-sidebar {
    position: sticky;
    top: 72px; /* Touching top header */
    height: calc(100dvh - 72px);
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px; /* Slight breathing room inside sidebar */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    transition: width 0.3s ease;
}

@media (max-width: 768px) {
    .community-nav-sidebar {
        display: none;
    }
}

/* Community Nav Toggle Button */
.comm-nav-toggle-btn {
    background: none;
    border: 1px solid var(--glass-border, rgba(0,0,0,0.08));
    border-radius: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    align-self: flex-end;
    flex-shrink: 0;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.comm-nav-toggle-btn:hover {
    background: rgba(15, 118, 110, 0.08);
    border-color: var(--accent-lavender);
    color: var(--accent-lavender);
}

body.theme-charcoal .comm-nav-toggle-btn {
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.45);
}

body.theme-charcoal .comm-nav-toggle-btn:hover {
    background: rgba(13, 148, 136, 0.12);
    border-color: var(--accent-lavender);
    color: var(--accent-lavender);
}

@media (max-width: 1100px) {
    .comm-nav-toggle-btn { display: none; }
}

/* Community Nav Collapsed State */
.community-nav-sidebar.collapsed {
    overflow: hidden;
}

.community-nav-sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 12px;
    gap: 0;
}

.community-nav-sidebar.collapsed .sidebar-item-text,
.community-nav-sidebar.collapsed .support-channels-mini {
    display: none;
}

.community-nav-sidebar.collapsed .comm-nav-toggle-btn {
    align-self: center;
}

/* Scoped to the community's own nav. */
.community-nav-sidebar .sidebar-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    border-radius: 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    min-width: 0;
    transition: all var(--anim-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.community-nav-sidebar .sidebar-item-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.community-nav-sidebar .sidebar-item i {
    font-size: 1.4rem;
    width: 24px;
    text-align: center;
}

.community-nav-sidebar .sidebar-item:hover {
    background: rgba(15, 118, 110, 0.08);
    transform: translateX(5px);
    color: var(--accent-lavender);
}

.community-nav-sidebar .sidebar-item.active {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.15), rgba(20, 184, 166, 0.15));
    font-weight: 700;
    color: var(--accent-lavender);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.1);
}

/* Community Feed Hero */
.community-hero-v2 {
    padding: 60px 40px;
    background: var(--accent-lavender);
    color: white;
    border-radius: 40px;
    margin: 0 0 40px; /* Reduced top margin to 0 */
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 40px rgba(13, 148, 136, 0.3);
}

body.theme-charcoal .community-hero-v2 {
    background: var(--accent-lavender);
    border-color: rgba(255, 255, 255, 0.1);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.hero-title .accent {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.post-bar-v2 {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: 24px;
    margin-bottom: 24px;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
}

.post-bar-v2:hover {
    transform: translateY(-2px);
    border-color: var(--accent-lavender);
    box-shadow: 0 15px 40px rgba(13, 148, 136, 0.1);
}

.post-bar-avatar-container {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--glass-border);
}

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

.post-bar-content {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.post-bar-actions {
    font-size: 1.3rem;
    color: var(--accent-lavender);
    opacity: 0.7;
}

.header-icon-btn i {
    font-size: 1.4rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.hero-desc {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 500px;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .community-hero-v2 {
        padding: 24px 20px 12px;
    }
    .hero-title {
        font-size: 2rem;
    }
}

/* Stories Section */
.stories-section {
    padding: 10px 0 24px;
    margin-bottom: 0;
}

.stories-bar {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 20px;
    -webkit-overflow-scrolling: touch; /* Smooth touch scrolling for mobile */
}

.stories-bar::-webkit-scrollbar { display: none; }

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    cursor: pointer;
}

.story-ring {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(45deg, #5eead4, #0f766e);
    transition: transform 0.3s ease;
}

.story-item:hover .story-ring {
    transform: scale(1.05) rotate(5deg);
}

.story-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-color);
    border: 2px solid var(--bg-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.story-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    max-width: 80px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    margin-top: 4px;
}

/* Post Cards Refurbished */
.post-card-v2 {
    background: var(--bg-card);
    border: 1px solid #f1f5f9;
    border-radius: 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card-v2:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
    border-color: var(--glass-border);
}

.feed-column {
    width: 100%;
    max-width: 100%;
}

.comm-nav-collapsed .feed-column {
    max-width: 900px;
    justify-self: center;
}

.post-header-v2 {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.post-avatar-v2 {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f766e, #0d9488);
    padding: 2px;
}

.post-avatar-v2 img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.post-user-info .username {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.post-user-info .post-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.post-body-v2 {
    padding: 0 16px 16px;
}

/* Text is escaped now, so keep the student's own line breaks. */
.post-body-v2 p,
.comment-text,
.message p,
.grid-post-text {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.post-image-v2 {
    width: 100%;
    border-radius: 12px;
    margin-top: 12px;
    cursor: zoom-in;
}

.post-actions-v2 {
    display: flex;
    padding: 12px 16px;
    gap: 20px;
    border-top: 1px solid var(--glass-border);
}

.react-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.react-btn span {
    font-size: 0.9rem;
    font-weight: 600;
}

.react-btn:hover {
    color: var(--accent-lavender);
    transform: scale(1.1);
}

/* Affirmation Card Glass */
.affirmation-card {
    /* A quiet tint: the hero above is the one bold teal block. */
    background: #f0fdfa;
    border: 1px solid #ccfbf1;
    border-radius: 24px;
    padding: 28px;
    color: #134e4a;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.affirmation-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 250px;
    height: 250px;
    background: rgba(15, 118, 110, 0.06);
    border-radius: 50%;
}

body.theme-charcoal .affirmation-card {
    background: rgba(45, 212, 191, 0.08);
    border-color: rgba(45, 212, 191, 0.2);
    color: #ccfbf1;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .main-content {
        padding-top: 0 !important;
    }
    
    .community-wrapper {
        padding-bottom: 100px;
    }

    .post-card-v2 {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin-bottom: 12px;
    }

    .stories-bar {
        padding: 12px;
        background: var(--bg-color);
        border-bottom: 1px solid var(--glass-border);
    }

    .affirmation-card {
        border-radius: 0;
        margin-bottom: 16px;
        padding: 20px;
    }

    .community-layout-grid {
        margin-top: 0;
    }
}

/* Group Detail Refurbished */
.group-detail-overlay {
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    background: rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .group-detail-overlay {
        padding: 0 !important; /* Full screen on mobile */
    }
}

.group-detail-container {
    width: 100%;
    height: 100%;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    max-width: 1100px; /* Stretch for desktop but keep centered */
    margin: 0 auto;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

@media (min-width: 1200px) {
    .group-detail-container {
        height: 90vh;
        border-radius: 24px;
        margin-top: 5vh;
    }
}

.group-header {
    padding: 16px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 100;
}


.group-identity {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}

.group-header-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-lavender);
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.2);
}

.group-info-stack {
    display: flex;
    flex-direction: column;
}

.group-name {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.group-status {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-lavender);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(13, 148, 136, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.group-tabs {
    display: flex;
    background: var(--bg-color);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 12px;
}

.group-tab {
    flex: 1;
    padding: 16px;
    border: none;
    background: none;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.group-tab.active {
    color: var(--accent-lavender);
}

.group-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 3px;
    background: var(--accent-lavender);
    border-radius: 3px 3px 0 0;
}

.group-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.group-feed-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: block;
}

.group-chat-container {
    flex: 1;
    display: none;
    flex-direction: column;
    background: var(--bg-color);
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Tighter gap */
    scroll-behavior: smooth;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Message Bubbles (IG Style) */
.message {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    animation: messageSlideIn 0.3s cubic-bezier(0.1, 0.8, 0.2, 1);
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.received {
    align-self: flex-start;
}

.message.sent {
    align-self: flex-end;
}

.msg-sender {
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
    margin-left: 12px;
}

.message.sent .msg-sender {
    display: none;
}

.message p {
    padding: 10px 16px;
    border-radius: 22px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-break: break-word;
    margin: 0;
}

.message.received p {
    background: rgba(13, 148, 136, 0.08); /* slight lavender tint */
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

body.theme-charcoal .message.received p {
    background: rgba(255, 255, 255, 0.1);
}

.message.sent p {
    background: var(--accent-lavender); /* Solid lavender for IG-vibe */
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 0.65rem;
    margin-top: 5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.message.sent .msg-time {
    align-self: flex-end;
    margin-right: 8px;
}

.message.received .msg-time {
    margin-left: 12px;
}

.chat-input-area {
    padding: 20px 24px;
    background: var(--bg-color);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
}

.chat-input-wrapper {
    flex: 1;
    max-width: 852px; /* Alignment with messages */
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-border);
    padding: 8px 12px 8px 24px;
    border-radius: 30px;
    border: 1.5px solid transparent;
    transition: all 0.3s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-lavender);
    background: var(--bg-color);
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.15);
}

.chat-input-wrapper input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 10px 0;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-lavender);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
}

.chat-send-btn:hover {
    transform: scale(1.1) rotate(10deg);
    background: var(--accent-sky);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* Page switching rules moved to bottom for priority */

@media (max-width: 600px) {
    .group-header { padding: 12px 16px; gap: 12px; height: 64px; }
    .group-header-img { width: 36px; height: 36px; }
    .group-name { font-size: 1rem; }
    .chat-messages-list { padding: 16px; padding-bottom: 20px; }
    .message { max-width: 90%; }
    .chat-input-area { 
        padding: 12px;
        background: var(--bg-color);
        position: sticky;
        bottom: 0;
        z-index: 1000;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--glass-border);
    }
    .chat-input-wrapper { padding: 8px 8px 8px 20px; min-height: 50px; }
    .chat-send-btn { width: 44px; height: 44px; }
    
    .create-post-modal {
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
    }
}

/* Bottom Navigation */
.bottom-nav {
    display: none !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--bg-card, #fff) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border-top: 1px solid var(--glass-border, rgba(0,0,0,0.08)) !important;
    height: 65px !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    z-index: 10001 !important;
    justify-content: space-around !important;
    align-items: center !important;
    overflow: visible !important;
    transition: none !important;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex !important;
    }
}

.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.bottom-nav .nav-item i {
    font-size: 1.25rem;
}

.bottom-nav .nav-item.active {
    color: var(--accent-lavender);
}

/* More Sheet */
.more-sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 10002;
}
.more-sheet-backdrop.open { display: block; }

.more-sheet {
    position: fixed;
    bottom: calc(75px + env(safe-area-inset-bottom));
    right: 16px;
    width: 220px;
    background: var(--bg-card, #fff);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    z-index: 10003;
    padding: 8px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}
.more-sheet.open { 
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.more-sheet-handle {
    display: none; /* Removed for floating menu style */
}

.more-sheet-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.more-sheet-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.more-sheet-item:active { background: rgba(15, 118, 110, 0.1); }
.more-sheet-item i { font-size: 1.1rem; color: var(--accent-lavender); width: 24px; text-align: center; }

/* Story Refinement */
.story-item:hover {
    transform: scale(1.05);
}

.story-label {
    transition: color 0.2s;
}

.story-item.active .story-label {
    color: var(--accent-lavender);
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 0 4px;
    gap: 12px;
}

.section-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    flex: 0 1 auto;
}

.section-header .see-all {
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.section-header .see-all:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.5);
}

.section-header .see-all:active {
    transform: translateY(0) scale(0.98);
}

/* Modals & Overlays Refurbished */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.create-post-modal {
    background: var(--bg-card);
    width: 100%;
    max-width: 600px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    border-radius: 32px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--glass-border);
}

@keyframes modalScaleIn {
    from { transform: scale(0.9) translateY(40px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header-premium {
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--divider-color);
    background: var(--bg-card);
}

.premium-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.premium-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.modal-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--close-btn-bg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--icon-color);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: rgba(13, 148, 136, 0.2);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body-premium {
    padding: 24px 32px 32px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.textarea-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-lavender);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 6px;
    margin-top: 4px;
}

.premium-textarea {
    width: 100%;
    min-height: 160px;
    border: 2px solid var(--input-border);
    background: var(--input-bg);
    border-radius: 16px;
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-primary);
    resize: none;
    outline: none;
    padding: 18px;
    margin-top: 10px;
    box-shadow: inset 0 2px 6px rgba(13, 148, 136, 0.08), 0 0 0 0 transparent;
    transition: all 0.25s ease;
}

.premium-textarea:focus {
    border-color: var(--accent-lavender);
    background: var(--input-bg);
    box-shadow: inset 0 2px 6px rgba(13, 148, 136, 0.08), 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.premium-textarea::placeholder {
    color: #9c8cc0;
    opacity: 1;
    font-weight: 400;
    font-size: 0.98rem;
}

.image-preview-wrapper {
    position: relative;
    margin-top: 20px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.image-preview-wrapper img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
}

.remove-preview-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.2s;
}

.remove-preview-btn:hover {
    background: rgba(239, 68, 68, 0.8);
    transform: scale(1.1);
}

.modal-actions-premium {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--divider-color);
}

.action-tools {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.action-tool-btn {
    font-size: 1.4rem;
    color: var(--icon-color);
    cursor: pointer;
    transition: all 0.2s;
}

.action-tool-btn:hover {
    color: var(--accent-lavender);
    transform: scale(1.1);
}

.tool-divider {
    width: 1px;
    height: 20px;
    background: var(--divider-color);
}

.tool-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mood-tags-container-premium {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.mood-tags-container-premium::-webkit-scrollbar { display: none; }

.mood-tag-chip {
    padding: 10px 20px;
    background: var(--chip-bg);
    border: 1.5px solid var(--chip-border);
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--chip-color);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.mood-tag-chip:hover {
    background: rgba(13, 148, 136, 0.15);
    border-color: var(--accent-lavender);
    color: var(--accent-lavender);
}

.mood-tag-chip.active {
    background: var(--accent-lavender);
    color: white;
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.3);
}

.modal-footer-premium {
    padding: 0 32px 32px;
    flex-shrink: 0; /* Never let the footer get pushed off screen */
    background: var(--bg-card);
}

.post-submit-btn-premium {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    border: none;
    color: white;
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(13, 148, 136, 0.4);
}

.post-submit-btn-premium:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 40px rgba(13, 148, 136, 0.5);
}

.post-submit-btn-premium:active {
    transform: translateY(0) scale(0.98);
}

@media (max-width: 600px) {
    .create-post-modal {
        height: 100%;
        height: 100dvh;
        max-height: 100%;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        padding: 0;
    }
    
    .modal-overlay {
        padding: 0;
    }

    .modal-body-premium {
        padding: 0 20px 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-header-premium {
        padding: 20px 20px 14px;
        flex-shrink: 0;
    }

    .modal-footer-premium {
        padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
        flex-shrink: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--glass-border);
    }

    .premium-textarea {
        min-height: 90px;
    }

    .premium-title {
        font-size: 1.4rem;
    }

    .post-submit-btn-premium {
        padding: 14px;
        font-size: 1rem;
        border-radius: 14px;
    }
}

/* Post Submit Button */
.post-submit-btn {
    width: 100%;
    margin-top: 24px;
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    color: white;
    border: none;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 148, 136, 0.5);
    filter: brightness(1.05);
}

.post-submit-btn:active {
    transform: translateY(0) scale(0.98);
}

.post-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #ccc;
}

/* Group Buttons */
.group-btn-primary {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    color: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}

.group-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(13, 148, 136, 0.4);
}

/* Chat Send Button */
.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-lavender);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-send-btn:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--accent-sky);
    box-shadow: 0 6px 15px rgba(20, 184, 166, 0.4);
}

/* Mobile FAB */
.mobile-post-fab {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, #0f766e, #0d9488) !important;
    color: white !important;
    font-size: 1.4rem;
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-14px);
    flex-shrink: 0;
}

.mobile-post-fab i {
    color: white !important;
    font-size: 1.4rem;
}

.post-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #0f766e;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-size: 0.65rem;
    font-weight: 700;
    text-decoration: none;
    padding-top: 2px;
}

.post-nav-item span {
    transform: translateY(-10px);
}

.post-nav-item:active .mobile-post-fab {
    transform: translateY(-14px) scale(0.92);
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.35);
}

.mobile-post-fab:hover {
    box-shadow: 0 10px 26px rgba(13, 148, 136, 0.7);
}

#postImagePreview {
    display: none;
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: 12px;
    margin-top: 15px;
}

/* Inbox Pull-out */
.inbox-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: var(--bg-color);
    z-index: 21000;
    transition: right 0.3s ease;
    box-shadow: -10px 0 40px rgba(0,0,0,0.1);
}

.inbox-overlay.active {
    right: 0;
}

.inbox-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--glass-border);
}

.inbox-item:hover {
    background: rgba(13, 148, 136, 0.05);
}

.inbox-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

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

.inbox-info {
    flex: 1;
    overflow: hidden;
}

.inbox-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.inbox-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-top: 4px;
}

@media (max-width: 420px) {
    .inbox-overlay {
        max-width: 100%;
    }
}

/* Community Profile (Instagram-Style Refurbish) */
.profile-overlay {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(0,0,0,0.5);
}

.profile-container {
    width: 100%;
    height: 100dvh;
    background: var(--bg-color);
    max-width: 935px; /* Instagram desktop width */
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 100px rgba(0,0,0,0.4);
}

@media (min-width: 1100px) {
    .profile-container {
        height: 85vh;
        margin-top: 7.5vh;
        border-radius: 12px;
    }
}

.profile-scroll-wrapper {
    height: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.profile-header-new {
    padding: 20px 20px 30px;
    border-bottom: 1px solid var(--glass-border);
}

.profile-top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 10;
}

.header-username {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-main-info {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 25px;
}

.profile-avatar-wrapper {
    flex: 0 0 35%;
    display: flex;
    justify-content: center;
}

.avatar-ring {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    position: relative;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.3);
}

@media (min-width: 768px) {
    .avatar-ring { width: 150px; height: 150px; }
}

.avatar-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-color);
}

.profile-stats-grid {
    flex: 1;
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
}

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

.stat-number {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.profile-bio-section {
    padding: 0 10px;
    margin-bottom: 25px;
}

.full-name {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.bio-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-primary);
}

.profile-action-buttons {
    display: flex;
    gap: 10px;
    padding: 0 10px;
    margin-bottom: 24px;
}

.btn-profile-primary, .btn-profile-secondary {
    flex: 1;
    padding: 10px 0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-profile-primary {
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    color: white;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.2);
}

body.theme-charcoal .btn-profile-primary {
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    color: white;
}

.btn-profile-secondary {
    background: rgba(13, 148, 136, 0.1);
    color: var(--accent-lavender);
    border: 1.5px solid var(--accent-lavender);
}

body.theme-charcoal .btn-profile-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-profile-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

.btn-profile-secondary:hover {
    background: rgba(13, 148, 136, 0.2);
    transform: translateY(-2px);
}

body.theme-charcoal .btn-profile-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.profile-tabs-new {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--glass-border);
}

.profile-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #64748B;
    cursor: pointer;
    position: relative;
}

.profile-tab.active {
    color: var(--accent-lavender);
}

.profile-tab.active::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 1.5px;
    background: var(--text-primary);
}

.profile-content-area {
    padding: 3px;
}

.posts-grid-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.grid-post-item {
    aspect-ratio: 1 / 1;
    background: #efefef;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

body.theme-charcoal .grid-post-item {
    background: #262626;
}

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

.grid-post-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 800;
}

.grid-post-item:hover .grid-post-overlay {
    opacity: 1;
}

.grid-post-text {
    padding: 10px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Post Comments Section */
.post-comments-section {
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    padding: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.comments-list {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
}

.comment-item {
    font-size: 0.9rem;
    line-height: 1.5;
    background: white;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.comment-author {
    font-weight: 800;
    color: var(--accent-lavender);
    margin-right: 6px;
}

.comment-text {
    color: var(--text-primary);
}

.no-comments {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 10px 0;
}

.comment-input-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.comment-input-row input {
    flex: 1;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 12px 18px;
    border-radius: 100px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.comment-input-row input:focus {
    border-color: var(--accent-lavender);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.comment-input-row button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-lavender);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
}


/* Page Switching & Visibility Priority */
body.group-page-active .main-content,
body.group-page-active .community-top-bar,
body.group-page-active .bottom-nav,
body.group-page-active .inbox-overlay,
body.profile-open .main-content,
body.profile-open .community-top-bar,
body.profile-open .bottom-nav,
body.modal-open-custom .bottom-nav { /* Added custom modal guard */
    display: none !important;
}

/* Ensure post form doesn't show when circle is active */
body.group-page-active #postForm {
    display: none !important;
}

@media (max-width: 768px) {
    .group-detail-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100dvh;
        z-index: 20001;
    }
    
    .mobile-post-fab {
        width: 56px;
        height: 56px;
        border-radius: 18px;
        background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
        color: white;
        border: none;
        font-size: 1.5rem;
        box-shadow: 0 8px 25px rgba(13, 148, 136, 0.4);
        margin-top: -30px; /* Float above nav */
        border: 4px solid var(--bg-color);
        cursor: pointer;
    }

    body.group-page-active,
    body.modal-open-custom {
        overflow: hidden !important;
    }
}

/* Edit Profile Modal */
.profile-edit-modal {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border-radius: 32px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    animation: modalScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    max-height: 90vh;
}

.profile-edit-modal .modal-header-premium {
    padding: 20px 24px;
}

.profile-edit-modal h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.save-profile-btn {
    background: none;
    border: none;
    color: var(--accent-lavender);
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.save-profile-btn:hover {
    opacity: 0.8;
}

.save-profile-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.edit-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 16px;
}

#editProfileAvatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-lavender);
}

.change-photo-btn {
    background: none;
    border: none;
    color: var(--accent-sky);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}

.change-photo-btn:hover {
    text-decoration: underline;
}

.edit-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.edit-input-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.edit-input-group input,
.edit-input-group textarea {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s;
}

.edit-input-group textarea {
    resize: vertical;
    min-height: 100px;
}

.edit-input-group input:focus,
.edit-input-group textarea:focus {
    outline: none;
    border-color: var(--accent-lavender);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.profile-edit-modal .modal-body-premium {
    padding: 0 24px 24px;
}

@media (max-width: 600px) {
    .profile-edit-modal {
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
    }
    
    .profile-edit-modal .modal-header-premium {
        padding: 16px 20px;
    }
    
    .profile-edit-modal .modal-body-premium {
        padding: 0 20px 20px;
    }
}

/* Bugfix: Mobile Bottom Nav Offset for Interactive Elements */
@media (max-width: 768px) {
    /* Main feed needs to scroll above bottom nav */
    .main-content, .feed-column {
        padding-bottom: calc(85px + env(safe-area-inset-bottom)) !important;
    }

    /* Group Detail container must shrink or pad so chat input isn't blocked by bottom nav */
    .group-detail-container {
        height: 100dvh !important;
        padding-bottom: calc(65px + env(safe-area-inset-bottom)) !important; 
    }
    
    /* The inbox overlay shouldn't go under bottom nav either */
    .inbox-overlay {
        padding-bottom: calc(65px + env(safe-area-inset-bottom)) !important;
    }

    /* For absolute safe measure on all chat input wrapper containers */
    .chat-input-area, .chat-input-row {
        margin-bottom: 0 !important;
    }
}

/* Floating Community Menu */
.floating-comm-menu-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

@media (max-width: 768px) {
    .floating-comm-menu-container {
        top: 64px;
        right: 12px;
    }
}

.floating-comm-toggle {
    width: 42px;
    height: 42px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--glass-border, rgba(0,0,0,0.08));
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.floating-comm-toggle:hover {
    background: rgba(13, 148, 136, 0.08);
    color: var(--accent-lavender);
}

.floating-comm-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-comm-menu-container.active .floating-comm-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.floating-comm-menu-container.active .floating-comm-toggle {
    color: var(--accent-lavender);
}

.comm-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comm-menu-item:hover {
    background: rgba(13, 148, 136, 0.1);
    color: var(--accent-lavender);
}

.comm-menu-item i {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: color 0.2s;
    width: 20px;
    text-align: center;
}

.comm-menu-item:hover i {
    color: var(--accent-lavender);
}

body.theme-charcoal .floating-comm-card {
    background: rgba(22, 32, 34, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Community Posts Modal FAB */
.mobile-fab-btn {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sky));
    color: white;
    border: none;
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.4);
    font-size: 1.6rem;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-fab-btn:active {
    transform: scale(0.9);
}

@media (max-width: 768px) {
    .mobile-fab-btn {
        display: flex; /* Show FAB on mobile */
    }
}
