/* ==========================================================================
   Facebook-Style School Newsfeed & Multi-Photo Grid System
   ========================================================================== */

.fb-feed-container {
    max-width: 680px;
    margin: 0 auto;
}

/* 1. Quick Facebook Post Creator Trigger Box */
.fb-create-post-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px -6px rgba(15, 23, 42, 0.05);
    display: flex;
    align-items: center;
    gap: 14px;
}

.fb-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.fb-create-trigger-input {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 12px 20px;
    color: #64748b;
    font-size: 0.95rem;
    font-family: 'Be Vietnam Pro', sans-serif;
    flex-grow: 1;
    cursor: pointer;
    transition: all 0.25s ease;
}

.fb-create-trigger-input:hover {
    background: #e2e8f0;
    color: #334155;
}

/* 2. Facebook Post Card */
.fb-post-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.fb-post-header {
    padding: 18px 20px 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fb-post-author-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fb-post-author-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 1.02rem;
    line-height: 1.25;
    font-family: 'Be Vietnam Pro', sans-serif;
    margin-bottom: 2px;
}

.fb-post-subtext {
    font-size: 0.78rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.fb-post-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.fb-post-text {
    padding: 0 20px 14px 20px;
    font-size: 0.98rem;
    line-height: 1.6;
    color: #1e293b;
    font-family: 'Be Vietnam Pro', sans-serif;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    max-width: 100%;
}

.fb-post-text strong,
.fb-post-text p,
.fb-post-text div,
.fb-post-author-name {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.fb-post-text-body {
    white-space: pre-line;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.fb-post-text-body.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fb-post-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary, #0ea5e9);
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    transition: color 0.15s ease, opacity 0.15s ease;
    user-select: none;
}

.fb-post-toggle-btn:hover {
    color: #0284c7;
    text-decoration: underline;
}

/* 3. Facebook Multi-Photo Grid System (1, 2, 3, 4+ photos with +N overlay) */
.fb-photo-grid {
    position: relative !important;
    width: auto !important;
    margin: 12px 16px 14px 16px !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    background: #0f172a !important;
    cursor: pointer !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
}

/* Grid 1 Image */
.fb-grid-1 {
    display: block !important;
    width: 100% !important;
    max-height: 480px !important;
    overflow: hidden !important;
}
.fb-grid-1 img {
    width: 100% !important;
    height: auto !important;
    max-height: 480px !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}
.fb-grid-1 img:hover {
    transform: scale(1.015) !important;
}

/* Grid 2 Images */
.fb-grid-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 3px !important;
    height: 350px !important;
}
.fb-grid-2 img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
}
.fb-grid-2 img:hover {
    transform: scale(1.02) !important;
}

/* Grid 3 Images (1 Left Hero + 2 Right Stacked) */
.fb-grid-3 {
    display: grid !important;
    grid-template-columns: 1.4fr 1fr !important;
    gap: 3px !important;
    height: 380px !important;
}
.fb-grid-3-col-right {
    display: grid !important;
    grid-template-rows: 1fr 1fr !important;
    gap: 3px !important;
    height: 100% !important;
}
.fb-grid-3 img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
}
.fb-grid-3 img:hover {
    transform: scale(1.02) !important;
}

/* Grid 4 Images (1 Left Hero + 3 Right Stacked) */
.fb-grid-4 {
    display: grid !important;
    grid-template-columns: 1.3fr 1fr !important;
    gap: 3px !important;
    height: 390px !important;
}
.fb-grid-4-col-right {
    display: grid !important;
    grid-template-rows: repeat(3, 1fr) !important;
    gap: 3px !important;
    height: 100% !important;
}
.fb-grid-4 img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
}
.fb-grid-4 img:hover {
    transform: scale(1.02) !important;
}

/* Grid 5+ Images (Facebook Standard 2 Top + 3 Bottom Grid Layout) */
.fb-grid-5 {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    height: 400px !important;
    background: #0f172a !important;
}

.fb-grid-5-row-top {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 3px !important;
    height: 58% !important;
    overflow: hidden !important;
}

.fb-grid-5-row-top img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
}
.fb-grid-5-row-top img:hover {
    transform: scale(1.02) !important;
}

.fb-grid-5-row-bottom {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 3px !important;
    height: 42% !important;
    overflow: hidden !important;
}

.fb-grid-5-row-bottom img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
}
.fb-grid-5-row-bottom img:hover {
    transform: scale(1.02) !important;
}

.fb-photo-thumb-box {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    display: block !important;
}
.fb-photo-thumb-box img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
}
.fb-photo-thumb-box:hover img {
    transform: scale(1.02) !important;
}

.fb-photo-more-overlay {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.52) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    color: #ffffff !important;
    font-size: 2.8rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    letter-spacing: -0.5px !important;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.8) !important;
    white-space: nowrap !important;
    user-select: none !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: background 0.2s ease !important;
}

.fb-photo-thumb-box:hover .fb-photo-more-overlay {
    background: rgba(0, 0, 0, 0.38) !important;
}

.fb-photo-more-count {
    color: #ffffff !important;
    font-size: 2.8rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    letter-spacing: -0.5px !important;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.8) !important;
    white-space: nowrap !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
    text-align: center !important;
    transform: none !important;
    transition: transform 0.2s ease !important;
}

.fb-photo-thumb-box:hover .fb-photo-more-count {
    transform: scale(1.08) !important;
}

/* 4. Facebook Footer Actions Bar */
.fb-post-stats {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.fb-post-actions {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 6px;
}

.fb-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: #475569;
    font-weight: 600;
    font-size: 0.88rem;
    font-family: 'Be Vietnam Pro', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fb-action-btn:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.fb-action-btn.active {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
}

/* 5. Facebook Style Create Post Modal CSS */
.sch-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    z-index: 11000 !important;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 24px 16px;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.sch-modal.show {
    display: flex !important;
    animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fb-modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 540px;
    border-radius: 20px;
    padding: 20px 24px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    border: 1px solid #e2e8f0;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.sch-close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    font-size: 1.1rem;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    z-index: 10 !important;
    transition: all 0.2s ease;
}

.sch-close-modal:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.fb-modal-header {
    text-align: center;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 16px;
    position: relative;
}

.fb-modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.fb-modal-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.fb-modal-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.fb-modal-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fb-modal-user-name {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.fb-modal-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fb-modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.fb-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.fb-modal-title-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s;
    background: #ffffff;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.fb-modal-title-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.fb-modal-title-input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.fb-modal-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: #0f172a;
    outline: none;
    resize: vertical;
    min-height: 110px;
    transition: border-color 0.2s;
    background: #ffffff;
    font-family: 'Be Vietnam Pro', sans-serif;
    line-height: 1.5;
}

.fb-modal-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.fb-modal-textarea::placeholder {
    color: #94a3b8;
}

.fb-modal-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    margin-bottom: 16px;
    background: #ffffff;
}

.fb-modal-action-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.fb-modal-action-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fb-modal-action-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.fb-modal-action-btn:hover {
    background: #e2e8f0;
}

.fb-modal-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.fb-modal-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    font-family: 'Be Vietnam Pro', sans-serif;
}

.fb-modal-submit-btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.fb-modal-submit-btn:active {
    transform: translateY(0);
}

/* ============================================================
   5. Facebook Post Comments Section
   ============================================================ */
.fb-comments-section {
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px 16px 16px;
    background: #f8fafc;
    display: none;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.fb-comments-section.show {
    display: block;
    animation: modalFadeIn 0.25s ease;
}

.fb-comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.fb-comment-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

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

.fb-comment-bubble {
    background: #f1f5f9;
    border-radius: 18px;
    padding: 8px 14px;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.fb-comment-author {
    font-weight: 700;
    font-size: 0.84rem;
    color: #0f172a;
    margin-bottom: 2px;
}

.fb-comment-text {
    font-size: 0.88rem;
    color: #334155;
    word-break: break-word;
    line-height: 1.4;
}

.fb-comment-meta {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 3px;
    padding-left: 44px;
}

.fb-comment-input-box {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.fb-comment-input {
    flex: 1;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.88rem;
    color: #0f172a;
    outline: none;
    transition: all 0.2s ease;
}

.fb-comment-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.fb-comment-send-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.fb-comment-send-btn:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

/* Mobile Responsive Optimization for Post Feed & Photo Grid */
@media (max-width: 768px) {
    .fb-post-card, .nf-post-card {
        border-radius: 14px !important;
        margin-bottom: 14px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .fb-post-header, .nf-author-box {
        padding: 12px 14px 10px 14px !important;
    }

    .fb-post-text {
        padding: 0 14px 10px 14px !important;
        font-size: 0.92rem !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        box-sizing: border-box !important;
    }

    .fb-post-text strong,
    .fb-post-text p,
    .fb-post-text div,
    .fb-post-author-name {
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        white-space: normal !important;
    }

    /* Mobile Photo Grid Responsiveness */
    .fb-photo-grid {
        margin: 8px 10px 10px 10px !important;
        border-radius: 12px !important;
        box-sizing: border-box !important;
    }

    .fb-grid-1 { max-height: 380px !important; }
    .fb-grid-1 img { max-height: 380px !important; }
    .fb-grid-2 { height: 260px !important; }
    .fb-grid-3 { height: 280px !important; }
    .fb-grid-4 { height: 290px !important; }
    .fb-grid-5 { height: 310px !important; }

    /* Mobile +N Overlay Count */
    .fb-photo-more-count {
        font-size: 2.2rem !important;
    }

    /* Mobile Reactions & Actions Bar */
    .nf-post-actions, .fb-post-actions {
        padding: 6px 8px !important;
        gap: 2px !important;
    }

    .nf-action-btn, .fb-action-btn {
        padding: 8px 6px !important;
        font-size: 0.8rem !important;
        gap: 4px !important;
    }

    .nf-action-btn span, .fb-action-btn span {
        font-size: 0.78rem !important;
    }
}

