/**
 * Instagram Feed Secure - Frontend Styles
 * Modern, responsive grid design matching Winny's website aesthetic
 */

/* Feed Container */
.ifs-feed-container {
    max-width: 1000px; /* Match your site's content width */
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Grid Layout */
.ifs-feed-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);
}

/* Column variations */
.ifs-feed-container[data-columns="2"] .ifs-feed-grid {
    grid-template-columns: repeat(2, 1fr);
}

.ifs-feed-container[data-columns="4"] .ifs-feed-grid {
    grid-template-columns: repeat(4, 1fr);
}

.ifs-feed-container[data-columns="5"] .ifs-feed-grid {
    grid-template-columns: repeat(5, 1fr);
}

/* Post Item */
.ifs-post-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: #fff;
}

.ifs-post-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Post Link */
.ifs-post-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Image Wrapper */
.ifs-post-image-wrapper {
    position: relative;
    padding-bottom: 100%;
    overflow: hidden;
    background: #f8f9fa;
}

.ifs-post-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ifs-post-item:hover .ifs-post-image {
    transform: scale(1.05);
}

/* Video Icon */
.ifs-video-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 2;
}

.ifs-video-icon svg {
    width: 18px;
    height: 18px;
}

/* Overlay */
.ifs-post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 20px;
    color: #fff;
}

.ifs-post-item:hover .ifs-post-overlay {
    opacity: 1;
}

.ifs-overlay-content {
    width: 100%;
}

/* Post Caption */
.ifs-post-caption {
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Post Stats */
.ifs-post-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.ifs-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.ifs-stat-item svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Error Message */
.ifs-error {
    background: #f8d7da;
    border-left: 4px solid #e74c3c;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.ifs-error .dashicons {
    color: #e74c3c;
    font-size: 24px;
}

/* Lightbox */
.ifs-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    padding: 20px;
    overflow-y: auto;
}

.ifs-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Lightbox Close Button */
.ifs-lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.ifs-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.ifs-lightbox-close svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

/* Lightbox Content */
.ifs-lightbox-content {
    max-width: 1000px;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.ifs-lightbox-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 70vh;
    object-fit: contain;
    background: #000;
}

/* Lightbox Info */
.ifs-lightbox-info {
    padding: 30px;
    background: #fff;
}

.ifs-lightbox-caption {
    color: #2c3e50;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.ifs-lightbox-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f8f9fa;
}

.ifs-lightbox-stats .ifs-stat-item {
    color: #2c3e50;
}

.ifs-lightbox-stats svg {
    fill: #e91e63;
}

/* View on Instagram Button */
.ifs-view-on-instagram {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 14px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
}

.ifs-view-on-instagram:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: #fff;
}

.ifs-view-on-instagram svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .ifs-feed-grid,
    .ifs-feed-container[data-columns="4"] .ifs-feed-grid,
    .ifs-feed-container[data-columns="5"] .ifs-feed-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ifs-feed-grid,
    .ifs-feed-container[data-columns="3"] .ifs-feed-grid,
    .ifs-feed-container[data-columns="4"] .ifs-feed-grid,
    .ifs-feed-container[data-columns="5"] .ifs-feed-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .ifs-post-item {
        border-radius: 8px;
    }
    
    .ifs-lightbox {
        padding: 10px;
    }
    
    .ifs-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .ifs-lightbox-content {
        border-radius: 12px;
    }
    
    .ifs-lightbox-info {
        padding: 20px;
    }
    
    .ifs-lightbox-caption {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .ifs-feed-container[data-columns="2"] .ifs-feed-grid {
        grid-template-columns: 1fr;
    }
    
    .ifs-post-overlay {
        opacity: 1;
        background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0) 50%,
            rgba(0, 0, 0, 0.8) 100%
        );
    }
    
    .ifs-overlay-content {
        padding: 15px;
    }
    
    .ifs-post-caption {
        font-size: 12px;
    }
    
    .ifs-stat-item {
        font-size: 12px;
    }
    
    .ifs-stat-item svg {
        width: 16px;
        height: 16px;
    }
}

/* Loading Animation */
.ifs-loading {
    text-align: center;
    padding: 40px;
}

.ifs-loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f8f9fa;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

