/* Newsfeed Modern PWA UI Override */

/* Feed Card Essentials */
.feed-posts-container .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feed-content {
    color: #334155;
    font-size: 15px;
    line-height: 1.6;
}
.feed-content a {
    color: #4f46e5;
}

/* Professional Like Button (Thumbs Up instead of Heart) */
.btn-like.active {
    color: #0284c7 !important; /* Professional Blue */
    background-color: #f0f9ff !important;
}

/* Mobile Bottom Sheet (Half Popup) for Comments */
.nf-bottom-sheet {
    position: fixed;
    bottom: -100vh;
    left: 0;
    width: 100vw;
    height: 85vh; /* Takes up 85% of screen on mobile */
    background: #fff;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    z-index: 1050;
    transition: bottom 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.nf-bottom-sheet.open {
    bottom: 0;
}

.nf-bottom-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.nf-bottom-sheet-backdrop.show {
    display: block;
    opacity: 1;
}

.nf-bottom-sheet-header {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
}

.nf-bottom-sheet-header .drag-handle {
    width: 40px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 5px;
    margin: 0 auto 10px auto;
}

.nf-bottom-sheet-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px 20px;
    background: #f8fafc;
}

.nf-bottom-sheet-footer {
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

/* WhatsApp-style Comment Input */
.nf-comment-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f1f5f9;
    border-radius: 24px;
    padding: 6px 6px 6px 16px;
    border: 1px solid #cbd5e1;
}

.nf-comment-input-wrap textarea {
    border: none;
    resize: none;
    outline: none;
    flex-grow: 1;
    max-height: 100px;
    background: transparent;
    padding: 6px 0;
    font-size: 15px;
    color: #1e293b;
}

.nf-comment-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4f46e5;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s;
}

.nf-comment-send-btn:active {
    transform: scale(0.9);
}

.nf-comment-send-btn i {
    font-size: 16px;
    margin-right: 2px;
}

/* Individual Comment Styling inside Sheet */
.nf-comment-item {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

@media (min-width: 768px) {
    /* Desktop Modals */
    .nf-bottom-sheet {
        width: 500px;
        left: 50%;
        margin-left: -250px;
        height: auto;
        max-height: 80vh;
        border-radius: 24px;
        bottom: -100vh;
    }
    .nf-bottom-sheet.open {
        bottom: 50%;
        transform: translateY(50%);
    }
}

/* ===================================================
   COMPOSE MODAL — Media Attachments
   =================================================== */

/* Drag-over visual feedback */
.nf-dragover {
    background-color: #eff6ff !important;
    outline: 2px dashed #3b82f6;
    outline-offset: -4px;
    border-radius: 12px;
}

/* Compose Image Preview Grid */
.nf-image-preview-grid {
    display: grid;
    gap: 4px;
    border-radius: 12px;
    overflow: hidden;
    max-height: 360px;
}
.nf-grid-1 { grid-template-columns: 1fr; }
.nf-grid-2 { grid-template-columns: 1fr 1fr; }
.nf-grid-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.nf-grid-3 .nf-grid-cell:first-child { grid-row: 1 / 3; }
.nf-grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.nf-grid-cell {
    position: relative;
    min-height: 120px;
    overflow: hidden;
    background: #f1f5f9;
}
.nf-grid-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.nf-img-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: bold;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
    padding: 0;
}
.nf-img-remove:hover {
    background: rgba(0,0,0,0.85);
}
.nf-img-loader {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.nf-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: nf-spin 0.6s linear infinite;
}
@keyframes nf-spin {
    to { transform: rotate(360deg); }
}

/* Compose Link Preview */
.nf-link-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: #64748b;
    font-size: 14px;
}
.nf-link-card {
    display: flex;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    position: relative;
}
.nf-link-thumb {
    flex-shrink: 0;
    width: 140px;
    min-height: 100px;
}
.nf-link-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.nf-link-info {
    padding: 12px 16px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.nf-link-domain {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.nf-link-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nf-link-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nf-link-remove, .nf-video-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    font-size: 15px;
    font-weight: bold;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    padding: 0;
}
.nf-link-remove:hover, .nf-video-remove:hover {
    background: rgba(0,0,0,0.8);
}

/* Compose Video Preview */
.nf-video-card {
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #000;
}
.nf-video-thumb {
    position: relative;
}
.nf-video-thumb img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    display: block;
}
.nf-video-thumb-placeholder {
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    color: #94a3b8;
    font-size: 14px;
    gap: 8px;
}
.nf-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.nf-video-play-icon i {
    color: #fff;
    font-size: 20px;
    margin-left: 3px;
}

/* ===================================================
   FEED — Media Format Rendering
   =================================================== */

/* Single Image in Feed */
.nf-media-image {
    background: #f1f5f9;
}
.nf-media-image img {
    transition: transform 0.3s ease;
}
.nf-media-image:hover img {
    transform: scale(1.01);
}

/* Image Grid in Feed */
.nf-feed-image-grid {
    display: grid;
    gap: 3px;
    background: #f1f5f9;
}
.nf-feed-grid-1 { grid-template-columns: 1fr; }
.nf-feed-grid-1 .nf-feed-grid-cell { min-height: 320px; }

.nf-feed-grid-2 { grid-template-columns: 1fr 1fr; }
.nf-feed-grid-2 .nf-feed-grid-cell { min-height: 240px; }

.nf-feed-grid-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.nf-feed-grid-3 .nf-feed-grid-cell:first-child { grid-row: 1 / 3; min-height: 320px; }
.nf-feed-grid-3 .nf-feed-grid-cell { min-height: 160px; }

.nf-feed-grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.nf-feed-grid-4 .nf-feed-grid-cell { min-height: 180px; }

.nf-feed-grid-cell {
    overflow: hidden;
    position: relative;
}
.nf-feed-grid-cell a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Video in Feed */
.nf-media-video {
    background: #000;
}
.nf-media-video .nf-video-poster:hover .ow_oembed_video_cover {
    background: rgba(0,0,0,0.35) !important;
}
.nf-media-video iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: 300px;
    border: 0;
}
.nf-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}
.nf-video-wrapper iframe,
.nf-video-wrapper embed,
.nf-video-wrapper object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Link Card in Feed */
.nf-media-link-card {
    transition: box-shadow 0.2s ease;
}
.nf-media-link-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.nf-media-content {
    transition: box-shadow 0.2s ease;
}
.nf-media-content:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ===================================================
   RESPONSIVE ADJUSTMENTS
   =================================================== */
@media (max-width: 575px) {
    .nf-link-card {
        flex-direction: column;
    }
    .nf-link-thumb {
        width: 100%;
        max-height: 180px;
    }
    .nf-feed-grid-2 .nf-feed-grid-cell,
    .nf-feed-grid-4 .nf-feed-grid-cell { min-height: 140px; }
    .nf-feed-grid-3 .nf-feed-grid-cell:first-child { min-height: 200px; }
    .nf-feed-grid-3 .nf-feed-grid-cell { min-height: 100px; }
}

/* ===================================================
   CONTEXT MENU FIX (z-index for dropdowns over cards)
   =================================================== */
.ow_newsfeed_context_menu_wrap {
    z-index: 1030 !important;
}

/* PHASE 3: Native DOM Windowing (Point 5) */
.ow_newsfeed_item {
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

