/* ==========================================================================
   FACEBOOK-GROUPS STYLE COMMUNITIES & FEED STYLING (FULLY RESPONSIVE)
   ========================================================================== */

:root {
    --bg-page: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-alt: #f8fafc;
    --bg-input: #f0f2f5;
    
    --primary: #1877f2;
    --primary-hover: #166fe5;
    --primary-light: #e7f3ff;
    
    --accent-green: #42b72a;
    --accent-rose: #f02849;
    --accent-amber: #f7b125;
    
    --text-main: #050505;
    --text-muted: #65676b;
    --text-dim: #8a8d91;
    
    --border-color: #ced0d4;
    --border-soft: #e4e6eb;
    
    --font-ui: 'Cairo', 'Tajawal', sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.12);
    --container-max: 1280px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-ui);
    background-color: var(--bg-page);
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ========================================================
   TOP NAVIGATION BAR (FACEBOOK STYLE)
   ======================================================== */
.fb-top-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.fb-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fb-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1877f2, #0052cc);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.3);
    flex-shrink: 0;
}

.fb-search-wrap {
    position: relative;
    width: 260px;
}

.fb-search-input {
    width: 100%;
    padding: 9px 36px 9px 14px;
    background: var(--bg-input);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--text-main);
    outline: none;
}

.fb-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.fb-nav-center-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fb-tab-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 800;
    transition: all 0.2s;
    position: relative;
}

.fb-tab-item:hover {
    background: var(--bg-input);
}

.fb-tab-item.active {
    color: var(--primary);
}

.fb-tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -9px;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.fb-nav-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fb-btn-round {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e4e6eb;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.fb-btn-round:hover {
    background: #d8dadf;
}

.fb-user-mini-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-soft);
    cursor: pointer;
    flex-shrink: 0;
}

/* ========================================================
   THREE-COLUMN GROUPS LAYOUT
   ======================================================== */
.fb-groups-layout {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 20px;
    padding: 18px 16px 80px;
}

/* ========================================================
   LEFT SIDEBAR: MY GROUPS & DISCOVER
   ======================================================== */
.fb-sidebar-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 75px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
}

.fb-side-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.side-panel-heading {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-create-group {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-create-group:hover {
    background: #d0e7ff;
}

/* Group Item Row */
.group-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.group-nav-item:hover, .group-nav-item.active {
    background: #f0f2f5;
}

.group-item-img {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.group-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.group-item-name {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-item-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================================
   CENTER FEED: GROUP BANNER & POSTS FEED
   ======================================================== */
.fb-feed-center {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Group Hero Header Banner */
.group-header-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.group-cover-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.group-header-details {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.group-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
}

.group-main-title {
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1.3;
}

.group-privacy-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
    flex-wrap: wrap;
}

.group-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-joined-group {
    background: #e4e6eb;
    color: var(--text-main);
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-invite-members {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Group Sub-Tabs */
.group-sub-nav {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-soft);
    padding: 4px 16px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.sub-tab-btn {
    padding: 10px 14px;
    border: none;
    background: transparent;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.sub-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Create Post Box */
.create-post-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.user-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.fake-post-input {
    flex: 1;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    padding: 10px 16px;
    font-size: 0.88rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fake-post-input:hover {
    background: #e4e6eb;
}

.post-actions-buttons-row {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--border-soft);
    padding-top: 8px;
}

.action-post-tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s;
}

.action-post-tool-btn:hover {
    background: var(--bg-input);
}

/* ========================================================
   POST CARDS IN GROUP FEED
   ======================================================== */
.group-post-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.post-card-header {
    padding: 14px 16px 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.post-author-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.author-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-name-text {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.post-badge-admin {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.post-time-meta {
    font-size: 0.76rem;
    color: var(--text-dim);
}

.post-card-body {
    padding: 6px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-text-paragraph {
    font-size: 0.92rem;
    color: var(--text-main);
    line-height: 1.6;
}

.post-attached-media {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

/* Post Reactions & Comments Bar */
.post-stats-counter-bar {
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
}

.post-interactive-buttons {
    display: flex;
    justify-content: space-around;
    padding: 4px 6px;
}

.btn-post-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-post-action:hover {
    background: var(--bg-input);
}

.btn-post-action.liked {
    color: var(--primary);
}

/* Comments Section */
.post-comments-area {
    padding: 10px 16px 14px;
    background: #fafbfc;
    border-top: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-bubble-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-content-box {
    background: #f0f2f5;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    font-size: 0.84rem;
}

.comment-author-name {
    font-weight: 800;
    color: var(--text-main);
    font-size: 0.84rem;
}

/* ========================================================
   RIGHT SIDEBAR: GROUP INFO, RULES & ADMINS
   ======================================================== */
.fb-sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 75px;
}

.group-about-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.about-heading {
    font-size: 1rem;
    font-weight: 900;
    color: var(--text-main);
}

.about-desc-text {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.about-stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.84rem;
    color: var(--text-main);
    font-weight: 700;
}

.about-stat-row .stat-icon {
    font-size: 1.15rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Group Rules List */
.group-rules-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-item-box {
    background: var(--bg-input);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    line-height: 1.4;
}

.rule-number {
    font-weight: 900;
    color: var(--primary);
    margin-left: 4px;
}

/* Modal for Creating a New Group */
.fb-modal-container {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.fb-modal-container.active {
    display: flex;
}

.fb-modal-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 20px;
    box-shadow: var(--shadow-float);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 10px;
}

.modal-head h3 {
    font-size: 1.15rem;
    font-weight: 900;
}

.form-group-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group-field label {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-main);
}

.form-group-field input, .form-group-field select, .form-group-field textarea {
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    outline: none;
}

.btn-submit-create-group {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 11px;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
}

/* ========================================================
   COMPREHENSIVE RESPONSIVE DESIGN (ALL SCREENS)
   ======================================================== */

/* Large Tablets & Medium Desktops (max-width: 1200px) */
@media (max-width: 1200px) {
    .fb-groups-layout {
        grid-template-columns: 280px 1fr;
        gap: 16px;
    }
    .fb-sidebar-right {
        display: none;
    }
}

/* Tablets (max-width: 900px) */
@media (max-width: 900px) {
    .fb-nav-center-tabs {
        display: none;
    }
    .fb-groups-layout {
        grid-template-columns: 1fr;
        padding: 12px 10px 70px;
    }
    .fb-sidebar-left {
        display: none;
    }
    .group-cover-img {
        height: 160px;
    }
    .group-header-details {
        padding: 14px;
    }
    .group-main-title {
        font-size: 1.25rem;
    }
}

/* Mobile Screens (max-width: 600px) */
@media (max-width: 600px) {
    .fb-top-nav {
        padding: 6px 10px;
        gap: 8px;
    }
    .fb-search-wrap {
        width: 130px;
    }
    .fb-search-input {
        padding: 7px 30px 7px 10px;
        font-size: 0.78rem;
    }
    .fb-search-icon {
        right: 8px;
        font-size: 0.8rem;
    }
    .fb-btn-round {
        width: 34px;
        height: 34px;
        font-size: 0.88rem;
    }
    .fb-user-mini-avatar {
        width: 34px;
        height: 34px;
    }
    .group-cover-img {
        height: 140px;
    }
    .group-header-actions {
        width: 100%;
    }
    .btn-joined-group, .btn-invite-members {
        flex: 1;
        justify-content: center;
        padding: 8px 12px;
        font-size: 0.82rem;
    }
    .action-post-tool-btn span:last-child {
        font-size: 0.78rem;
    }
    .post-text-paragraph {
        font-size: 0.88rem;
    }
    .btn-post-action {
        font-size: 0.8rem;
        padding: 6px 4px;
    }
}

/* Extra Small Screens (max-width: 360px) */
@media (max-width: 360px) {
    .fb-search-wrap {
        display: none;
    }
    .action-post-tool-btn {
        padding: 4px 6px;
    }
}
