/* Instagram Carousel Styles */
.ig-carousel-container {
    width: 100%;
    padding: 0;
    background: transparent;
    position: relative;
    overflow: hidden;
}

.ig-carousel-wrapper {
    position: relative;
    max-width: 1170px; /* Match desktop max-width */
    margin: 0 auto;
}

.ig-carousel-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin; /* Firefox - show thin scrollbar */
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent; /* Firefox scrollbar color */
    -ms-overflow-style: auto; /* IE and Edge - show scrollbar */
    padding: 0;
    scroll-snap-type: none; /* Remove snap for free scroll */
    cursor: grab;
    user-select: none; /* Prevent text selection while dragging */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.ig-carousel-track:active,
.ig-carousel-track.dragging {
    cursor: grabbing !important;
}

.ig-carousel-track::-webkit-scrollbar {
    height: 8px; /* Show scrollbar for webkit browsers */
}

.ig-carousel-track::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.ig-carousel-track::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.ig-carousel-track::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.ig-carousel-item {
    flex: 0 0 calc((100% - 80px) / 5); /* Show 5 posts: (100% - 4 gaps of 20px) / 5 */
    min-width: 200px; /* Minimum width for smaller screens */
    max-width: 218px; /* Max width for 1170px container: (1170 - 80) / 5 = 218px */
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform 0.3s ease;
    position: relative;
}

.ig-carousel-item:hover {
    transform: translateY(-5px);
}

.ig-post-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow 0.3s ease;
}

.ig-post-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

/* Post Header */
.ig-post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.ig-post-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ig-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.ig-post-info {
    display: flex;
    flex-direction: column;
}

.ig-post-username {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    line-height: 1.2;
}

.ig-post-time {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.ig-post-icon {
    color: #E4405F;
    opacity: 0.8;
}

/* Post Content */
.ig-post-content {
    padding: 16px;
    flex-grow: 1;
}

.ig-post-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Post Thumbnail */
.ig-post-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
    background: #f5f5f5;
}

.ig-post-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ig-video-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.ig-video-indicator svg {
    margin-left: 2px;
}

/* Post Engagement */
.ig-post-engagement {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
}

.ig-engagement-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 14px;
}

.ig-engagement-item svg {
    color: #666;
}

.ig-share-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.ig-share-btn:hover {
    background: #f5f5f5;
}

/* Navigation Buttons - Always visible */
.ig-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex !important; /* Always visible */
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: #000000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    opacity: 1;
    pointer-events: all;
}

.ig-carousel-nav svg {
    width: 24px;
    height: 24px;
    fill: #000000;
    color: #000000;
}

.ig-carousel-nav:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.ig-carousel-prev {
    left: 10px;
}

.ig-carousel-next {
    right: 10px;
}

.ig-carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Empty State */
.ig-carousel-empty {
    text-align: center;
    padding: 40px 20px;
    color: #fff;
    font-size: 16px;
}

/* Popup Modal */
.ig-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.ig-popup-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ig-popup-container {
    position: relative;
    max-width: 1200px;
    max-height: 90vh;
    width: 95%;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: row; /* Changed to row for split view */
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ig-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex !important; /* Force display */
    align-items: center;
    justify-content: center;
    z-index: 10002; /* Higher z-index to ensure visibility */
    color: #000000 !important; /* Black color for X icon */
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ig-popup-close svg {
    width: 24px;
    height: 24px;
    fill: #000000 !important; /* Explicitly black */
    stroke: #000000;
    stroke-width: 0.5;
}

.ig-popup-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: rotate(90deg);
    border-color: rgba(0, 0, 0, 0.3);
}

.ig-popup-close:hover svg {
    fill: #000000 !important;
}

.ig-popup-content {
    padding: 0;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: row;
    width: 100%;
}

.ig-popup-post {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

/* Left side - Image/Media */
.ig-popup-media-section {
    flex: 0 0 50%;
    width: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.ig-popup-media-section img,
.ig-popup-media-section video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Right side - Content */
.ig-popup-content-section {
    flex: 0 0 50%;
    width: 50%;
    padding: 40px;
    overflow-y: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.ig-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 24px;
}

.ig-popup-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ig-popup-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

.ig-popup-info h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.ig-popup-info .ig-post-time {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* Media moved to left section - remove old styles */

.ig-popup-caption {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 24px;
    flex-grow: 1;
}

.ig-popup-engagement {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.ig-popup-engagement .ig-engagement-item {
    font-size: 15px;
}

.ig-popup-link {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 24px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.ig-popup-link:hover {
    opacity: 0.9;
}

/* Loading State */
.ig-popup-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.ig-popup-loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #E4405F;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-top: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (min-width: 1170px) {
    /* Desktop - Show 5 posts at 1170px max-width */
    .ig-carousel-item {
        flex: 0 0 calc((1170px - 80px) / 5); /* (1170 - 4 gaps) / 5 = 218px */
        max-width: 218px;
        min-width: 218px;
    }
}

@media (min-width: 992px) and (max-width: 1169px) {
    /* Laptop - Show 4 posts */
    .ig-carousel-item {
        flex: 0 0 calc((100% - 60px) / 4);
        max-width: 280px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    /* Tablet - Show 3 posts */
    .ig-carousel-item {
        flex: 0 0 calc((100% - 40px) / 3);
        max-width: 300px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    /* Tablet - Show 2 posts */
    .ig-carousel-item {
        flex: 0 0 280px;
        width: 280px;
    }
}

@media (max-width: 991px) {
    /* Tablet and below - Stack popup vertically */
    .ig-popup-container {
        flex-direction: column;
        max-width: 600px;
    }
    
    .ig-popup-post {
        flex-direction: column;
    }
    
    .ig-popup-media-section {
        flex: 0 0 auto;
        width: 100%;
        max-height: 50vh;
    }
    
    .ig-popup-content-section {
        flex: 0 0 auto;
        width: 100%;
        max-height: 50vh;
    }
}

@media (max-width: 767px) {
    /* Mobile - Show 1.5 posts for peek effect */
    .ig-carousel-item {
        flex: 0 0 280px;
        width: 280px;
        max-width: 280px;
    }
    
    .ig-carousel-track {
        padding: 0 15px;
    }
    
    .ig-popup-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .ig-popup-content-section {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    /* Small Mobile - Show 1.2 posts */
    .ig-carousel-item {
        flex: 0 0 260px;
        width: 260px;
        max-width: 260px;
    }
    
    .ig-carousel-track {
        padding: 0 10px;
    }
}

