﻿/* CONTAINER */
.post-container {
    max-width: 600px;
    margin: auto;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 10px 10px 10px 10px;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}

/* BIG IMAGE */
/* BIG IMAGES SIDE BY SIDE */
.big-images {
    display: flex;
    gap: 10px;
}
.main-image {
    flex: 1;
}
.main-image img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 10px;
    object-position: top;
}

.main-image img {
    transition: transform 0.3s ease;
}

.main-image:hover img {
    transform: scale(0.9);
}

.main-image img:hover {
    transform: scale(1.03);
}

/* THUMB GRID */
.thumb-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    justify-content: center;
}

/* THUMB WRAPPER */
.thumb-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
}

    .thumb-wrapper img {
        width: 100px;
        height: 100px;
        object-fit: cover;
        transition: transform 0.3s;
    }

    /* HOVER ZOOM */
    .thumb-wrapper:hover img {
        transform: scale(1.1);
    }

/* +MORE OVERLAY */
.more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* FULLSCREEN MODAL */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    margin: 0;
    padding: 0;
}

/* CENTER WRAPPER (VERY IMPORTANT) */
.modal-content-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
/* IMAGE PERFECT CENTER */
.modal-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;

    user-select: none;
    cursor: zoom-in;
    transition: transform 0.15s ease;
    /*cursor: grab;
    user-select: none;
    touch-action: none;*/
}

.modal-img:active {
    cursor: grabbing;
}
/* CLOSE BUTTON (TOP RIGHT ALWAYS) */
/* OUTER OVERLAY (separate from layout) */
.gallery-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* 🔥 prevents scroll */
    animation: fadeIn 0.2s ease;
}
/* CONTENT */
.gallery-content {
    /*position: relative;*/
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* MODAL */
.gallery-modal {
    position: relative;
    width: 100vw; /* 🔥 force full viewport */
    height: 100vh; /* 🔥 THIS FIXES YOUR ISSUE */

    display: flex;
    align-items: center; /* vertical center */
    justify-content: center; /* horizontal center */
}

/* IMAGE */
.modal-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    cursor: grab;
    user-select: none;
    transition: transform 0.1s ease-out; /* 🔥 smooth */
}

/* CLOSE BUTTON */
.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 28px;
    color: white;
    cursor: pointer;
    z-index: 100000;
}

/* NAV BUTTONS (FIXED INSIDE SCREEN) */
.nav {
    position: absolute; /* 🔥 changed from fixed */
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
    color: white;
    background: rgba(0,0,0,0.4);
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    /*border-radius: 6px;*/
}

/* LEFT / RIGHT */
.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.modal-img {
    animation: zoomIn 0.3s ease;
}

body.modal-open {
    padding-right: 0 !important;
}

body {
    overflow-x: hidden;
}

/* CARD */
.post-card {
    max-width: 600px;
    margin: 20px auto;
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* HEADER */
.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info {
    flex: 1;
    margin-left: 10px;
}

    .user-info h6 {
        margin: 0;
        font-weight: 600;
    }

    .user-info span {
        font-size: 12px;
        color: gray;
    }

.follow-btn {
    border: none;
    background: #007bff;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
}

/* THUMBNAILS */
.thumb-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.thumb-wrapper {
    position: relative;
}

    .thumb-wrapper img {
        width: 90px;
        height: 90px;
        object-fit: cover;
        border-radius: 6px;
        cursor: pointer;
    }

/* OVERLAY */
.more-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 6px;
}

/* ACTIONS */
.post-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.post-actions button {
    border: none;
    background: #f1f1f1;
    color:black;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

/* CONTENT */
.post-content h5 {
    margin-top: 10px;
    margin-bottom: 5px;
}

.post-content p {
    color: #555;
}

/* Image Grid */
.image-grid {
    display: grid;
    gap: 0px;
    padding: 0;
    margin: 0px;
    grid-template-columns: repeat(2, 1fr); /* 2 columns always */
}
.img-item {
    margin: -10px !important;
    padding: 0 !important;
}
/* COMMON IMAGE STYLE */
.img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    object-position: center top; /* 🔥 keeps face visible */
    transform: scale(0.9); /* 🔥 zoom out */
    display: block;
}

/* =========================
   1 IMAGE
========================= */
.image-grid:has(.img-item:only-child) {
    grid-template-columns: 1fr;
}

    .image-grid:has(.img-item:only-child) img {
        height: 450px;
        object-fit: contain; /* no crop */
    }

/* =========================
   2 IMAGES
========================= */
.image-grid:has(.img-item:nth-child(2):last-child) {
    grid-template-columns: 1fr 1fr;
}

    .image-grid:has(.img-item:nth-child(2):last-child) img {
        height: 400px;
    }

/* =========================
   3 IMAGES (1 big + 2 small)
========================= */
.image-grid:has(.img-item:nth-child(3):last-child) {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
}

    .image-grid:has(.img-item:nth-child(3):last-child) .img-item:nth-child(1) {
        grid-row: span 2;
    }

    .image-grid:has(.img-item:nth-child(3):last-child) img {
        height: 100%;
    }

/* =========================
   4 IMAGES (2x2 grid)
========================= */
.image-grid:has(.img-item:nth-child(4):last-child) {
    grid-template-columns: 1fr 1fr;
}

    .image-grid:has(.img-item:nth-child(4):last-child) img {
        height: 250px;
    }

/* =========================
   5+ IMAGES
========================= */
.image-grid:has(.img-item:nth-child(n+5)) {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* 🔥 base grid */
    gap: 4px;
}

    /* FIRST 2 IMAGES (BIG) */
    .image-grid:has(.img-item:nth-child(n+5)) .img-item:nth-child(1),
    .image-grid:has(.img-item:nth-child(n+5)) .img-item:nth-child(2) {
        grid-column: span 3; /* 50% width each */
        height: 220px;
    }

    /* SMALL IMAGES (3 PER ROW) */
    .image-grid:has(.img-item:nth-child(n+5)) .img-item:nth-child(n+3) {
        grid-column: span 2; /* 3 items per row (6/2 = 3) */
        height: 120px;
    }

/* LIMIT DISPLAY TO 6 */
.image-grid .img-item:nth-child(n+6) {
    display: none;
}

/* =========================
   +MORE OVERLAY
========================= */
.img-item {
    position: relative;
}

    .img-item.more::after {
        content: attr(data-more);
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,0.6);
        color: white;
        font-size: 20px;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
    }
body.modal-open {
    overflow: hidden;
}
.nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
/* Automatically disable body scroll if the overlay exists */
html:has(.gallery-overlay) {
    overflow: hidden;
}

/*for post icons*/
.post-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap : wrap;
    /*flex-wrap: nowrap;*/ /* prevents breaking line */
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    padding: 6px;
}
    .icon-btn i {
        line-height: 1;
    }
    .icon-btn:hover {
        transform: scale(1.15);
        color: #0d6efd;
    }
.text-danger {
    color: #e0245e !important;
}

.like-count {
    font-size: 14px;
    margin-right: 8px;
    color: #555;
}

/*animate Like Buttons*/
.bi-heart-fill {
    animation: pop 0.2s ease;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/*comments css*/
/*.comment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.comment-box {
    background: white;
    width: 100%;
    max-height: 50%;
    border-radius: 15px 15px 0 0;
    padding: 15px;
    overflow-y: auto;
}*/
/* The semi-transparent background */
/*.comment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);*/ /* Dims the background */
    /*display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}*/
.comment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999; /* Ensure it is above everything else */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The modal box */
.comment-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative; /* Necessary for positioning the close button */
    max-height: 80vh;
    overflow-y: auto;
}

/* Small close icon in the top-right */
.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    color: #666;
}

.close-btn:hover {
    color: #000;
}

.comment-list {
    max-height: 300px;
    overflow-y: auto;
}

.comment-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ddd;
}
.comment-input {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

    .comment-input input {
        flex: 1;
        padding: 8px;
    }

    .comment-input button {
        padding: 8px 12px;
    }
.post-actions span {
    font-size: 14px;
    color: #555;
}

.login-msg {
    color: #888;
    font-size: 12px;
    margin-top: 5px;
}
/* ✅ comments box Desktop fix */
@media (min-width: 768px) {

    .comment-overlay {
        align-items: center; /* center modal */
    }

    .comment-box {
        width: 500px;
        max-height: 80%;
        border-radius: 12px;
        margin-left:auto;
        margin-top:30px;
    }
}

/* Automatically disable body scroll if the comments overlay exists */
html:has(.comment-overlay) {
    overflow: hidden;
}
/*comments code end*/
/*blur images*/

/*following/follow*/
.follow-btn {
    background: #0d6efd;
    color: darkslateblue;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
}

.following-btn {
    background: #f1f1f1;
    color: #333;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
}
/*description text show/hide*/
/*.collapsed-text {
    display: -webkit-box;
    -webkit-line-clamp: 1;*/ /* number of lines */
    /*-webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expanded-text {
    display: block;
}*/

.toggle-text {
    color: #0095f6;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
}

/*loading page*/
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-box {
    text-align: center;
    color: white;
}

.loading-text {
    margin-top: 15px;
    font-size: 18px;
    font-weight: 500;
}