/* ============================================
   Instagram Feed Widget — Frontend Styles
   ============================================ */

/* Loading State */
.ifw-widget {
    position: relative;
    width: 100%;
}

.ifw-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #888;
    font-size: 14px;
    gap: 12px;
}

.ifw-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f0f0f0;
    border-top-color: #e1306c;
    border-radius: 50%;
    animation: ifw-spin 0.8s linear infinite;
}

@keyframes ifw-spin {
    to { transform: rotate(360deg); }
}

/* Error / Placeholder */
.ifw-error,
.ifw-error-msg {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.ifw-placeholder {
    border: 2px dashed #c8c8c8;
    border-radius: 8px;
    padding: 40px 20px;
}

.ifw-placeholder-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #aaa;
    text-align: center;
    font-size: 14px;
}

.ifw-placeholder-inner svg {
    color: #ccc;
}

/* ============================================
   GALLERY LAYOUT
   ============================================ */
.ifw-gallery {
    display: grid;
    grid-template-columns: repeat(var(--ifw-columns, 3), 1fr);
    gap: 8px;
}

/* ============================================
   ITEM (shared by gallery & slider)
   ============================================ */
.ifw-item {
    position: relative;
    overflow: hidden;
    display: block;
    cursor: pointer;
    background: #f0f0f0;
}

.ifw-item-inner {
    position: relative;
    width: 100%;
    aspect-ratio: var(--ifw-aspect, 1/1);
    overflow: hidden;
}

.ifw-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.ifw-item:hover img {
    transform: scale(1.06);
}

/* ============================================
   OVERLAY
   ============================================ */
.ifw-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.ifw-item:hover .ifw-overlay {
    opacity: 1;
}

.ifw-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
    padding: 12px;
    text-align: center;
}

.ifw-overlay-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
}

.ifw-overlay-icon svg {
    fill: #fff;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.ifw-overlay-caption {
    font-size: 12px;
    line-height: 1.4;
    max-width: 160px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.9;
}

/* ============================================
   SLIDER LAYOUT
   ============================================ */
.ifw-slider-wrapper {
    position: relative;
    width: 100%;
}

.ifw-slider-wrapper .swiper {
    width: 100%;
    overflow: hidden;
}

.ifw-slider-wrapper .swiper-slide .ifw-item {
    border-radius: inherit;
}

/* Navigation arrows */
.ifw-slider-wrapper .swiper-button-prev,
.ifw-slider-wrapper .swiper-button-next {
    width: 38px;
    height: 38px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    color: #fff;
    transition: background 0.2s ease, transform 0.2s ease;
}

.ifw-slider-wrapper .swiper-button-prev:hover,
.ifw-slider-wrapper .swiper-button-next:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.1);
}

.ifw-slider-wrapper .swiper-button-prev::after,
.ifw-slider-wrapper .swiper-button-next::after {
    font-size: 13px;
    font-weight: 700;
}

/* Pagination */
.ifw-slider-wrapper .swiper-pagination {
    position: relative;
    margin-top: 14px;
}

.ifw-slider-wrapper .swiper-pagination-bullet {
    background: #ccc;
    opacity: 1;
    transition: background 0.25s ease, transform 0.25s ease;
}

.ifw-slider-wrapper .swiper-pagination-bullet-active {
    background: #e1306c;
    transform: scale(1.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 767px) {
    .ifw-gallery {
        grid-template-columns: repeat(min(var(--ifw-columns, 3), 2), 1fr) !important;
    }
}

@media (max-width: 480px) {
    .ifw-gallery {
        grid-template-columns: repeat(min(var(--ifw-columns, 3), 2), 1fr) !important;
    }
}
