/**
 * Instagram Feed Pro - Public Styles
 * Modern 2025/2026 Frontend Design
 */

:root {
    --ifp-primary: #E1306C;
    --ifp-overlay-bg: rgba(0, 0, 0, 0.7);
    --ifp-transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Feed Container */
.ifp-feed-container {
    width: 100%;
    margin: 0 auto;
}

.ifp-feed-grid {
    display: grid;
    grid-template-columns: repeat(var(--ifp-columns, 3), 1fr);
    gap: var(--ifp-spacing, 10px);
}

/* Post Item */
.ifp-post-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--ifp-border-radius, 8px);
    background: #f5f5f5;
    aspect-ratio: 1;
}

.ifp-post-link {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.ifp-post-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ifp-post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--ifp-transition);
}

/* Video & Carousel Indicators */
.ifp-video-indicator,
.ifp-carousel-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.ifp-carousel-indicator {
    right: auto;
    left: 12px;
}

/* Overlay */
.ifp-post-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.85) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: var(--ifp-transition);
}

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

/* Stats */
.ifp-post-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.ifp-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.ifp-stat svg {
    flex-shrink: 0;
}

/* Caption */
.ifp-post-caption {
    color: white;
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

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

.ifp-hover-fade .ifp-post-item:hover .ifp-post-image {
    opacity: 0.8;
}

.ifp-hover-slide .ifp-post-item:hover .ifp-post-image {
    transform: translateY(-5%);
}

.ifp-hover-none .ifp-post-overlay {
    opacity: 1;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .ifp-feed-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
    }
}

@media (max-width: 768px) {
    .ifp-feed-grid[data-columns="6"],
    .ifp-feed-grid[data-columns="5"],
    .ifp-feed-grid[data-columns="4"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .ifp-feed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ifp-post-stats {
        font-size: 12px;
    }
    
    .ifp-post-caption {
        font-size: 12px;
    }
    
    .ifp-video-indicator,
    .ifp-carousel-indicator {
        top: 8px;
        right: 8px;
        padding: 4px;
    }
    
    .ifp-video-indicator svg,
    .ifp-carousel-indicator svg {
        width: 16px;
        height: 16px;
    }
}

/* Loading State */
.ifp-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
}

.ifp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--ifp-primary);
    border-radius: 50%;
    animation: ifp-spin 1s linear infinite;
}

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

/* Error State */
.ifp-error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    padding: 16px;
    color: #c53030;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

/* Animation on Load */
.ifp-post-item {
    animation: ifp-fadeInUp 0.5s ease-out backwards;
}

.ifp-post-item:nth-child(1) { animation-delay: 0.05s; }
.ifp-post-item:nth-child(2) { animation-delay: 0.1s; }
.ifp-post-item:nth-child(3) { animation-delay: 0.15s; }
.ifp-post-item:nth-child(4) { animation-delay: 0.2s; }
.ifp-post-item:nth-child(5) { animation-delay: 0.25s; }
.ifp-post-item:nth-child(6) { animation-delay: 0.3s; }
.ifp-post-item:nth-child(7) { animation-delay: 0.35s; }
.ifp-post-item:nth-child(8) { animation-delay: 0.4s; }
.ifp-post-item:nth-child(9) { animation-delay: 0.45s; }

@keyframes ifp-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility */
.ifp-post-link:focus {
    outline: 2px solid var(--ifp-primary);
    outline-offset: 2px;
}

.ifp-post-link:focus:not(:focus-visible) {
    outline: none;
}

/* Print Styles */
@media print {
    .ifp-post-overlay {
        display: none;
    }
}
