/* Galleria social — stile profilo Instagram, integrata nel sito Pegasus */

.ig-gallery {
    background: #fff;
    min-height: 60vh;
}

.ig-gallery .ig-section {
    padding: 2rem 0 3rem;
}

.ig-container {
    max-width: 935px;
}

/* Profilo */
.ig-profile {
    margin-bottom: 2rem;
}

.ig-profile-main {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.ig-avatar-ring {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    padding: 4px;
    border-radius: 50%;
    background: linear-gradient(45deg, #00a651, #004d99, #cc2936);
}

.ig-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    background: #fff;
}

.ig-profile-details {
    flex: 1;
    min-width: 0;
}

.ig-profile-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.ig-username {
    margin: 0;
    font-family: Montserrat, Roboto, sans-serif;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1.2;
    color: #262626;
}

.ig-stats {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 1rem;
    color: #262626;
}

.ig-stats strong {
    font-weight: 600;
}

.ig-bio {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #262626;
}

.ig-display-name {
    margin: 0 0 0.25rem;
    font-weight: 600;
}

.ig-bio p {
    margin: 0;
}

.ig-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.ig-btn:hover {
    opacity: 0.88;
}

.ig-btn-primary {
    background: #00a651;
    color: #fff;
}

.ig-btn-secondary {
    background: #efefef;
    color: #262626;
}

/* Tab POST */
.ig-tabs {
    display: flex;
    justify-content: center;
    border-top: 1px solid #dbdbdb;
    margin-bottom: 0;
}

.ig-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.85rem 0;
    margin-right: 3rem;
    border: none;
    border-top: 1px solid transparent;
    background: none;
    color: #8e8e8e;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: default;
}

.ig-tab.is-active {
    color: #262626;
    border-top-color: #262626;
    margin-top: -1px;
}

.ig-tab i {
    font-size: 0.85rem;
}

/* Griglia 3 colonne stile Instagram */
.ig-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 0;
}

.ig-grid-item {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: none;
    background: #000;
    cursor: pointer;
    overflow: hidden;
}

.ig-grid-item img,
.ig-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.ig-grid-video-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #fff;
    font-size: 1rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.ig-grid-hover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.ig-grid-item:hover .ig-grid-hover,
.ig-grid-item:focus-visible .ig-grid-hover {
    opacity: 1;
}

.ig-grid-item:hover img,
.ig-grid-item:hover video {
    transform: scale(1.02);
}

.ig-grid-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Empty state */
.ig-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: #8e8e8e;
}

.ig-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #dbdbdb;
}

.ig-empty h2 {
    margin: 0 0 0.5rem;
    color: #262626;
    font-weight: 600;
}

.ig-empty p {
    margin: 0 0 1.25rem;
}

/* Modal post Instagram */
.ig-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ig-modal[hidden] {
    display: none;
}

.ig-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.ig-modal-shell {
    position: relative;
    width: min(100%, 1100px);
    max-height: min(90vh, 900px);
    z-index: 1;
}

.ig-modal-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    z-index: 3;
}

.ig-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #262626;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ig-modal-prev { left: -3rem; }
.ig-modal-next { right: -3rem; }

.ig-modal-card {
    display: flex;
    width: 100%;
    max-height: min(90vh, 900px);
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.ig-modal-media-wrap {
    flex: 1 1 60%;
    min-width: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 400px;
}

.ig-modal-media-wrap img,
.ig-modal-media-wrap video {
    width: 100%;
    height: 100%;
    max-height: min(90vh, 900px);
    object-fit: contain;
    display: block;
}

.ig-heart-burst {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
}

.ig-heart-burst i {
    font-size: 5rem;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
    transform: scale(0.2);
}

.ig-heart-burst.is-visible i {
    animation: ig-heart-pop 0.85s ease forwards;
}

@keyframes ig-heart-pop {
    0% { opacity: 0; transform: scale(0.2); }
    15% { opacity: 1; transform: scale(1); }
    70% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.15); }
}

.ig-modal-sidebar {
    flex: 0 0 340px;
    max-width: 40%;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #efefef;
    min-width: 280px;
}

.ig-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #efefef;
}

.ig-mini-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.ig-modal-username {
    font-size: 0.875rem;
    font-weight: 600;
    color: #262626;
}

.ig-modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 120px;
}

.ig-modal-caption-block {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #262626;
}

.ig-modal-caption-block p {
    margin: 0;
}

.ig-modal-caption-block .ig-caption-user {
    font-weight: 600;
    margin-right: 0.35rem;
}

.ig-modal-footer {
    border-top: 1px solid #efefef;
    padding: 0.65rem 1rem 1rem;
}

.ig-modal-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.ig-like-btn {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: #262626;
    position: relative;
    width: 1.5rem;
    height: 1.5rem;
}

.ig-like-btn .ig-like-icon-filled {
    position: absolute;
    inset: 0;
    color: #ed4956;
    opacity: 0;
    transform: scale(0.5);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.ig-like-btn.is-liked .ig-like-icon-outline {
    opacity: 0;
}

.ig-like-btn.is-liked .ig-like-icon-filled {
    opacity: 1;
    transform: scale(1);
}

.ig-like-btn.is-animating .ig-like-icon-filled {
    animation: ig-like-tap 0.35s ease;
}

@keyframes ig-like-tap {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.ig-modal-likes {
    margin: 0 0 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #262626;
}

.ig-modal-date {
    display: block;
    font-size: 0.625rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8e8e8e;
}

/* Modal aperto — nasconde header/footer del sito su mobile */
body.ig-modal-open .main-header,
body.ig-modal-open .main-footer,
body.ig-modal-open .breadcrumb {
    visibility: hidden;
}

/* Responsive */
@media (max-width: 992px) {
    .ig-modal {
        padding: 0;
        align-items: stretch;
    }

    .ig-modal-backdrop {
        background: #000;
    }

    .ig-modal-shell {
        width: 100%;
        height: 100%;
        max-height: none;
        display: flex;
        flex-direction: column;
    }

    .ig-modal-prev { left: 0.5rem; }
    .ig-modal-next { right: 0.5rem; }

    .ig-modal-close {
        top: max(0.5rem, env(safe-area-inset-top, 0.5rem));
        right: max(0.5rem, env(safe-area-inset-right, 0.5rem));
        color: #fff;
        background: rgba(0, 0, 0, 0.45);
        border-radius: 50%;
        width: 2.25rem;
        height: 2.25rem;
        z-index: 4;
    }

    .ig-modal-card {
        flex: 1;
        flex-direction: column;
        max-height: none;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .ig-modal-media-wrap {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }

    .ig-modal-media-wrap img,
    .ig-modal-media-wrap video {
        max-height: none;
    }

    .ig-modal-sidebar {
        flex: 0 0 auto;
        max-width: none;
        min-width: 0;
        border-left: none;
        border-top: 1px solid #efefef;
    }

    .ig-modal-scroll.is-empty {
        display: none;
    }

    .ig-modal-caption-block .ig-mini-avatar,
    .ig-modal-caption-block .ig-caption-user {
        display: none;
    }

    .ig-modal-caption-block {
        padding-top: 0;
    }

    .ig-modal-footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    }
}

@media (max-width: 768px) {
    .ig-profile-main {
        flex-direction: column;
        text-align: center;
        gap: 1.25rem;
    }

    .ig-profile-row,
    .ig-stats {
        justify-content: center;
    }

    .ig-username {
        font-size: 1.35rem;
    }

    .ig-avatar-ring {
        width: 96px;
        height: 96px;
    }

    .ig-grid {
        gap: 2px;
    }
}

@media (max-width: 480px) {
    .ig-gallery .ig-section {
        padding: 1rem 0 2rem;
    }

    .ig-stats {
        gap: 1.25rem;
        font-size: 0.9rem;
    }
}

/* Admin pages in galleria (se usate) */
body.gallery-admin-page {
    margin: 0;
    font-family: Roboto, sans-serif;
    background: #fafafa;
}

.gallery-admin-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.gallery-alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.gallery-alert-success { background: #e8f8ef; color: #0a6b38; }
.gallery-alert-error { background: #fdecec; color: #a11; }

.gallery-admin-form {
    display: grid;
    gap: 0.85rem;
    max-width: 640px;
}

.gallery-admin-form label {
    display: grid;
    gap: 0.35rem;
}

.gallery-admin-form input,
.gallery-admin-form select,
.gallery-admin-form textarea {
    padding: 0.6rem 0.7rem;
    border: 1px solid #dbdbdb;
    border-radius: 6px;
    font: inherit;
}

.gallery-btn {
    display: inline-flex;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 6px;
    background: #00a651;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}
