.ig-widget {
    width: 100%;
    box-sizing: border-box;
}

.ig-header {
    margin-bottom: 24px;
}

.ig-username {
    font-family: Inter, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #111;
    text-decoration: none;
}

.ig-stats {
    display: flex;
    gap: 18px;
    margin-top: 6px;
}

.ig-stats span {
    font-size: 13px;
    color: #666;
    font-family: Inter, sans-serif;
}

.ig-carousel-wrapper {
    position: relative;
    width: 100%;
}

.ig-carousel {
    overflow: hidden;
    width: 100%;
    border-radius: 14px;
}

.ig-track {
    display: flex;
    gap: 16px; 
    transition: transform .45s ease;
    will-change: transform;
}

.ig-card {
    flex: 0 0 calc((100% - 64px) / 5);
    box-sizing: border-box;
}

.ig-card a {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1; 
    border-radius: 14px;
    overflow: hidden;
    position: relative;
}

.ig-card img,
.ig-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s ease;
    will-change: transform;
}

.ig-overlay {
    position: absolute;
    inset: 0;
    padding: 16px;
    background:
        linear-gradient(
            to top,
            rgba(0,0,0,.85),
            rgba(0,0,0,.3),
            transparent
        );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: opacity .3s ease;
}

.ig-counts {
    display: flex;
    gap: 14px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: Inter, sans-serif;
}

.ig-caption {
    color: rgba(255,255,255,.85);
    font-size: 12px;
    line-height: 1.5;
    font-family: Inter, sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ig-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;  
    height: 36px; 
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px; 
    color: #111;
    transition: opacity .3s, transform .2s, background-color .2s;
}

.ig-prev { left: 16px; }
.ig-next { right: 16px; }

.ig-loader {
    text-align: center;
    padding: 60px;
    color: #999;
    font-family: Inter, sans-serif;
}

.ig-likes-container, .ig-comments-container {
    display: flex;
    gap: 5px;
}
.ig-likes-container img, .ig-comments-container img {
   width: 15px;
   height: auto;
   object-fit: contain;
}

@media (max-width: 1269px) {
    .ig-card {
        flex: 0 0 calc((100% - 48px) / 4);
    }
}

@media (max-width: 1019px) {
    .ig-card {
        flex: 0 0 calc((100% - 32px) / 3);
    }
    .ig-arrow {
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

@media (max-width: 769px) {
    .ig-card {
        flex: 0 0 calc((100% - 16px) / 2);
    }
    .ig-arrow {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    .ig-prev { left: 12px; }
    .ig-next { right: 12px; }
}

@media (max-width: 539px) {
    .ig-widget { padding: 20px 0; }
    .ig-header { padding: 0; margin-bottom: 16px; } 
    .ig-username { font-size: 16px; }
    
    .ig-card {
        flex: 0 0 100%;
    }
    .ig-card a {
        border-radius: 10px;
    }
    .ig-arrow {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    .ig-prev { left: 10px; }
    .ig-next { right: 10px; }
    .ig-overlay { padding: 12px; }
    .ig-counts, .ig-caption { font-size: 11px; }
}

@media (hover: hover) {
    .ig-arrow {
        opacity: 0;
        pointer-events: none;
    }
    .ig-carousel-wrapper:hover .ig-arrow {
        opacity: 1;
        pointer-events: auto;
    }
    .ig-arrow:hover {
        background: #f5f5f5;
        transform: translateY(-50%) scale(1.05);
    }
    .ig-overlay {
        opacity: 0;
    }
    .ig-card a:hover .ig-overlay {
        opacity: 1;
    }
    .ig-card a:hover img,
    .ig-card a:hover video {
        transform: scale(1.06);
    }
}