/* === style.css (full file) === */

/* === GRID VIEW (shared base) === */
.igp-grid {
    margin-top: 20px;
    box-sizing: border-box;
    position: relative;
}

.igp-grid-item {
    position: relative;
}

/* === ADMIN PAGE STYLES (untouched) === */
body.wp-admin .igp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

body.wp-admin .igp-grid-item {
    position: relative;
}

body.wp-admin .igp-grid-item img {
    width: 100%;
    max-width: 100px;
    height: auto;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

/* Delete button (Admin only) */
.igp-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 5px;
    cursor: pointer;
    border-radius: 50%;
}

/* === FRONTEND (Masonry via Masonry.js) ===
   - This section is scoped to frontend only (won't affect wp-admin)
   - Masonry JS will position items; CSS provides sensible defaults/fallbacks
*/
body:not(.wp-admin) .igp-grid {
    display: block;      /* Masonry will absolutely/relatively position items */
    position: relative;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0;
}

body:not(.wp-admin) .igp-grid-item {
    display: block;
    margin: 0 0 10px 0;   /* vertical spacing fallback; Masonry's gutter used too */
    box-sizing: border-box;
}

/* Images in frontend */
body:not(.wp-admin) .igp-grid-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s ease;
    cursor: pointer;
}

/* Slight lift/scale on hover for each item (keeps the item scaling as before) */
body:not(.wp-admin) .igp-grid-item:hover {
    transform: translateY(-4px) scale(1.02);
    z-index: 2;
}

/* === FULLSCREEN VIEW (Instagram-style) === */
.igp-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Content Wrapper (Image + Caption) */
.igp-fullscreen-content {
    display: flex;
    background: #fff;
    border-radius: 10px;
    max-width: 80%;
    max-height: 90%;
    overflow: hidden;
}

/* Image Section */
.igp-fullscreen-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.igp-fullscreen-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 0;
}

/* Caption Section */
.igp-fullscreen-text-container {
    width: 300px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: #fff;
}

/* Close Button */
.igp-close-btn {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #F5F227;
}

.igp-close-btn:hover {
    color: #FFF;
}

/* Caption Text */
.igp-fullscreen-caption {
    font-size: 16px;
    color: #333;
    margin-top: 10px;
    line-height: 1.5;
}

/* === MOBILE RESPONSIVENESS (Instagram-style phone layout) === */
@media (max-width: 768px) {
    .igp-fullscreen-content {
        flex-direction: column;
        max-width: 95%;
        max-height: 95%;
    }

    .igp-fullscreen-image-container {
        width: 100%;
        background: #000;
    }

    .igp-fullscreen-img {
        width: 100%;
        max-height: 70vh;
    }

    .igp-fullscreen-text-container {
        width: 100%;
        padding: 15px;
        text-align: left;
    }

    .igp-fullscreen-caption {
        font-size: 14px;
        color: #333;
    }

    .igp-close-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        font-size: 24px;
    }
}

/* small adjustment on narrow screens to reduce gaps */
@media (max-width: 900px) {
    body:not(.wp-admin) .igp-grid {
        /* keep container responsive and compact */
        padding: 0;
    }
}