/**
 * Instagram Feed Widget Styles
 */

/* Container */
.iew-instagram-feed {
    position: relative;
    width: 100%;
}

/* Grid Layout */
.iew-instagram-grid {
    display: grid;
    width: 100%;
}

/* Masonry Layout */
.iew-layout-masonry .iew-instagram-grid {
    display: grid;
    grid-auto-flow: dense;
}

/* Post Item */
.iew-post-item {
    position: relative;
    overflow: hidden;
    background: #fff;
    transition: all 0.3s ease;
}

.iew-post-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Post Image */
.iew-post-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-bottom: 100%; /* Square aspect ratio */
    background: #f0f0f0;
}

.iew-post-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

/* Ensure images are visible */
.iew-post-item img {
    max-width: 100%;
    height: auto;
}

/* Loading state */
.iew-post-image img[src=""],
.iew-post-image img:not([src]) {
    background: #e0e0e0;
    min-height: 200px;
}

.iew-post-image img:not([src])::before {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
}

/* Video Icon */
.iew-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    pointer-events: none;
    opacity: 0.9;
}

/* Hover Effects */
.iew-hover-zoom .iew-post-item:hover .iew-post-image img {
    transform: scale(1.1);
}

.iew-hover-fade .iew-post-item:hover .iew-post-image img {
    opacity: 0.7;
}

.iew-hover-slide .iew-post-overlay {
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.iew-hover-slide .iew-post-item:hover .iew-post-overlay {
    transform: translateY(0);
}

/* Post Overlay */
.iew-post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.iew-post-item:hover .iew-post-overlay {
    opacity: 1;
}

.iew-post-overlay-content {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.iew-likes,
.iew-comments {
    display: flex;
    align-items: center;
    gap: 5px;
}

.iew-likes svg,
.iew-comments svg {
    width: 20px;
    height: 20px;
}

/* Caption */
.iew-post-caption {
    padding: 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

/* Meta */
.iew-post-meta {
    padding: 0 15px 15px;
    font-size: 12px;
    color: #999;
}

/* Slider/Carousel */
.iew-instagram-slider {
    position: relative;
}

.iew-instagram-slider .swiper-slide {
    height: auto;
}

/* Slider Navigation */
.iew-instagram-slider .swiper-button-next,
.iew-instagram-slider .swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.iew-instagram-slider .swiper-button-next:after,
.iew-instagram-slider .swiper-button-prev:after {
    font-size: 20px;
}

.iew-instagram-slider .swiper-button-next:hover,
.iew-instagram-slider .swiper-button-prev:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Slider Pagination */
.iew-instagram-slider .swiper-pagination {
    bottom: 10px;
}

.iew-instagram-slider .swiper-pagination-bullet {
    background: #fff;
    opacity: 0.5;
    width: 8px;
    height: 8px;
}

.iew-instagram-slider .swiper-pagination-bullet-active {
    opacity: 1;
    background: #fff;
}

/* Error & No Posts Messages */
.iew-error,
.iew-no-posts {
    padding: 20px;
    text-align: center;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.iew-no-posts {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* Loading State */
.iew-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.iew-loading:after {
    content: "";
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: iew-spin 1s linear infinite;
}

@keyframes iew-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .iew-post-overlay-content {
        font-size: 12px;
        gap: 15px;
    }
    
    .iew-likes svg,
    .iew-comments svg {
        width: 16px;
        height: 16px;
    }
    
    .iew-instagram-slider .swiper-button-next,
    .iew-instagram-slider .swiper-button-prev {
        width: 32px;
        height: 32px;
    }
    
    .iew-instagram-slider .swiper-button-next:after,
    .iew-instagram-slider .swiper-button-prev:after {
        font-size: 16px;
    }
}

/* Elementor Editor Specific */
.elementor-editor-active .iew-instagram-feed {
    min-height: 200px;
}
