/**
 * BWG Instagram Feed - Frontend Styles
 *
 * @package BWG_Instagram_Feed
 */

/* Feed container */
.bwg-igf-feed {
    width: 100%;
    max-width: 100%;
}

/* Feed Header (Feature #53 - Follow button moved to header) */
.bwg-igf-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 15px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #efefef;
    gap: 15px;
}

/* Grid layout: Header spans all columns to appear above the grid */
.bwg-igf-grid .bwg-igf-feed-header {
    grid-column: 1 / -1;
}

.bwg-igf-account-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.bwg-igf-account-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bwg-igf-account-icon svg {
    width: 24px;
    height: 24px;
}

.bwg-igf-account-name {
    font-size: 15px;
    font-weight: 600;
    color: #262626;
    line-height: 1.4;
}

.bwg-igf-account-name a {
    color: #262626;
    text-decoration: none;
    transition: color 0.2s ease;
}

.bwg-igf-account-name a:hover {
    color: #e1306c;
}

/* Grid layout */
.bwg-igf-grid {
    display: grid;
    gap: var(--bwg-igf-gap, 10px);
}

.bwg-igf-grid-1 { grid-template-columns: repeat(1, 1fr); }
.bwg-igf-grid-2 { grid-template-columns: repeat(2, 1fr); }
.bwg-igf-grid-3 { grid-template-columns: repeat(3, 1fr); }
.bwg-igf-grid-4 { grid-template-columns: repeat(4, 1fr); }
.bwg-igf-grid-5 { grid-template-columns: repeat(5, 1fr); }
.bwg-igf-grid-6 { grid-template-columns: repeat(6, 1fr); }

/* Feed item */
.bwg-igf-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--bwg-igf-border-radius, 0);
    cursor: pointer;
}

/* Feature #54: When items are links, ensure proper display */
a.bwg-igf-item {
    display: block;
    text-decoration: none;
    color: inherit;
}

a.bwg-igf-item:hover,
a.bwg-igf-item:focus {
    text-decoration: none;
    color: inherit;
}

/* Grid items maintain square 1:1 aspect ratio for consistent layout */
.bwg-igf-grid .bwg-igf-item {
    aspect-ratio: 1 / 1;
}

/* Image Height Modes (Feature #165) */
/* Original aspect ratio - let images display naturally */
.bwg-igf-image-original .bwg-igf-item {
    aspect-ratio: auto;
}

.bwg-igf-image-original .bwg-igf-item img {
    height: auto;
    object-fit: contain;
}

/* Fixed height mode - use CSS variable for height */
.bwg-igf-image-fixed .bwg-igf-item {
    aspect-ratio: auto;
    height: var(--bwg-igf-image-height, 200px);
}

.bwg-igf-image-fixed .bwg-igf-item img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

/* Keyboard focus styles for feed items - only show on keyboard navigation */
.bwg-igf-item:focus {
    outline: none;
}

.bwg-igf-item:focus-visible {
    outline: 3px solid #e1306c;
    outline-offset: 2px;
}

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

/* Feature #47: Video Play Icon Overlay */
.bwg-igf-video-item {
    position: relative;
}

.bwg-igf-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: none;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 5;
}

.bwg-igf-video-play-icon svg {
    width: 32px;
    height: 32px;
    margin-left: 4px; /* Slight offset to center the play triangle visually */
}

/* Hover effect for video items */
.bwg-igf-video-item:hover .bwg-igf-video-play-icon {
    background: rgba(225, 48, 108, 0.85); /* Instagram pink */
    transform: translate(-50%, -50%) scale(1.1);
}

/* Video item indicator in top-right corner (alternative compact indicator) */
.bwg-igf-video-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: none;
    z-index: 5;
}

.bwg-igf-video-badge svg {
    width: 14px;
    height: 14px;
}

/* Responsive adjustments for video play icon */
@media (max-width: 480px) {
    .bwg-igf-video-play-icon {
        width: 44px;
        height: 44px;
    }

    .bwg-igf-video-play-icon svg {
        width: 24px;
        height: 24px;
        margin-left: 3px;
    }
}

/* Caption below image */
.bwg-igf-caption {
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #262626;
    background: #fafafa;
    border-top: 1px solid #efefef;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* When caption is shown, item needs to adjust aspect ratio */
.bwg-igf-item:has(.bwg-igf-caption) {
    aspect-ratio: auto;
}

.bwg-igf-item:has(.bwg-igf-caption) img {
    aspect-ratio: 1 / 1;
    height: auto;
}

/* Hover effects */
.bwg-igf-hover-zoom .bwg-igf-item:hover img {
    transform: scale(1.1);
}

.bwg-igf-hover-brightness .bwg-igf-item:hover img {
    filter: brightness(1.2);
}

/* Overlay */
.bwg-igf-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bwg-igf-overlay-color, rgba(0, 0, 0, 0.5));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bwg-igf-item:hover .bwg-igf-overlay {
    opacity: 1;
}

.bwg-igf-overlay-content {
    color: #fff;
    text-align: center;
    max-width: 100%;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Overlay caption text */
.bwg-igf-overlay-caption {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 8px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Engagement stats */
.bwg-igf-stats {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.bwg-igf-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Slider layout */
.bwg-igf-slider {
    position: relative;
    overflow: hidden;
}

.bwg-igf-slider-track {
    display: flex;
    /* Transition duration set dynamically via JavaScript based on user configuration */
    /* Default fallback: 0.6s for smooth animation with cubic-bezier easing */
    transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

.bwg-igf-slider-slide {
    flex-shrink: 0;
}

/* Slider navigation */
.bwg-igf-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.3s ease;
}

.bwg-igf-slider-nav:hover {
    background: #fff;
}

.bwg-igf-slider-prev {
    left: 10px;
}

.bwg-igf-slider-next {
    right: 10px;
}

/* Slider pagination */
.bwg-igf-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 15px 0;
}

.bwg-igf-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.bwg-igf-slider-dot.active {
    background: #333;
}

/* Popup/Lightbox - Feature #50: Improved performance */
.bwg-igf-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    /* GPU acceleration for smoother performance */
    will-change: opacity;
}

.bwg-igf-popup.active {
    opacity: 1;
    visibility: visible;
}

.bwg-igf-popup-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    gap: 20px;
    /* Smooth scale animation for content */
    transform: scale(0.95);
    transition: transform 0.2s ease;
    /* GPU acceleration */
    will-change: transform;
}

.bwg-igf-popup.active .bwg-igf-popup-content {
    transform: scale(1);
}

.bwg-igf-popup-image {
    max-width: 70vw;
    max-height: 90vh;
    object-fit: contain;
}

/* Feature #48: Video support in popup */
.bwg-igf-popup-video {
    max-width: 70vw;
    max-height: 90vh;
    object-fit: contain;
    background: #000;
}

/* Feature #55: Wrapper for media and View on Instagram link */
.bwg-igf-popup-media-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.bwg-igf-popup-media-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bwg-igf-popup-details {
    color: #fff;
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Popup caption - handle long text */
.bwg-igf-popup-caption {
    margin: 0 0 15px 0;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    white-space: pre-wrap;
}

/* Popup stats */
.bwg-igf-popup-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.bwg-igf-popup-stats span {
    white-space: nowrap;
}

/* Popup link */
.bwg-igf-popup-link {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bwg-igf-popup-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    color: #fff;
}

.bwg-igf-popup-link:focus,
.bwg-igf-popup-link:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.bwg-igf-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.bwg-igf-popup-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* Focus styles for popup controls */
.bwg-igf-popup-close:focus,
.bwg-igf-popup-close:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.bwg-igf-popup-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.bwg-igf-popup-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.bwg-igf-popup-nav:focus,
.bwg-igf-popup-nav:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.2);
}

.bwg-igf-popup-prev {
    left: 20px;
}

.bwg-igf-popup-next {
    right: 20px;
}

/* Follow button */
.bwg-igf-follow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bwg-igf-follow:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: #fff;
}

/* Follow button styles */
.bwg-igf-follow-gradient {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
}

.bwg-igf-follow-solid {
    background: #e1306c;
    color: #fff;
}

.bwg-igf-follow-solid:hover {
    background: #c13584;
    color: #fff;
}

.bwg-igf-follow-outline {
    background: transparent;
    border: 2px solid #e1306c;
    color: #e1306c;
}

.bwg-igf-follow-outline:hover {
    background: #e1306c;
    color: #fff;
}

.bwg-igf-follow-minimal {
    background: transparent;
    color: #262626;
    padding: 8px 16px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    border-radius: 0;
}

.bwg-igf-follow-minimal:hover {
    border-bottom-color: #e1306c;
    color: #e1306c;
    transform: none;
    box-shadow: none;
}

/* Loading state */
.bwg-igf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    grid-column: 1 / -1; /* Span all columns in grid */
}

.bwg-igf-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.bwg-igf-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #e1306c;
    border-right: 4px solid #f77737;
    border-bottom: 4px solid #fcaf45;
    border-radius: 50%;
    animation: bwg-igf-spin 1s linear infinite;
}

.bwg-igf-loading-text {
    margin: 0;
    font-size: 14px;
    color: #666;
    animation: bwg-igf-pulse 1.5s ease-in-out infinite;
}

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

@keyframes bwg-igf-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Skeleton loading placeholders */
.bwg-igf-skeleton-grid {
    display: grid;
    gap: var(--bwg-igf-gap, 10px);
    grid-column: 1 / -1;
}

.bwg-igf-grid-1 .bwg-igf-skeleton-grid { grid-template-columns: repeat(1, 1fr); }
.bwg-igf-grid-2 .bwg-igf-skeleton-grid { grid-template-columns: repeat(2, 1fr); }
.bwg-igf-grid-3 .bwg-igf-skeleton-grid { grid-template-columns: repeat(3, 1fr); }
.bwg-igf-grid-4 .bwg-igf-skeleton-grid { grid-template-columns: repeat(4, 1fr); }
.bwg-igf-grid-5 .bwg-igf-skeleton-grid { grid-template-columns: repeat(5, 1fr); }
.bwg-igf-grid-6 .bwg-igf-skeleton-grid { grid-template-columns: repeat(6, 1fr); }

.bwg-igf-skeleton-item {
    position: relative;
    padding-top: 100%; /* 1:1 aspect ratio */
    overflow: hidden;
    border-radius: var(--bwg-igf-border-radius, 0);
}

.bwg-igf-skeleton-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: bwg-igf-skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes bwg-igf-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Loading feed container - show loading inside */
.bwg-igf-loading-feed {
    min-height: 300px;
}

/* Error state */
.bwg-igf-error {
    padding: 20px;
    text-align: center;
    color: #721c24;
    background: #f8d7da;
    border-radius: 5px;
}

/* Network error state */
.bwg-igf-network-error {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border: 1px solid #feb2b2;
    border-radius: 8px;
    color: #c53030;
}

.bwg-igf-network-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bwg-igf-network-error-icon svg {
    width: 24px;
    height: 24px;
    color: #c53030;
}

.bwg-igf-network-error-text {
    flex: 1;
    min-width: 200px;
}

.bwg-igf-network-error-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.bwg-igf-network-error-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.bwg-igf-retry-btn {
    padding: 10px 20px;
    background: #c53030;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.bwg-igf-retry-btn:hover {
    background: #9b2c2c;
    transform: translateY(-1px);
}

.bwg-igf-retry-btn:active {
    transform: translateY(0);
}

/* Shake animation for retry button when still offline */
.bwg-igf-shake {
    animation: bwg-igf-shake 0.5s ease;
}

@keyframes bwg-igf-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Image error state */
.bwg-igf-item-error {
    position: relative;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    min-height: 150px;
}

.bwg-igf-item-error::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21,15 16,10 5,21'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.6;
}

.bwg-igf-img-error {
    opacity: 0.3;
}

/* Rate Limit Warning */
.bwg-igf-rate-limit-warning {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    grid-column: 1 / -1; /* Span all columns in grid */
}

.bwg-igf-rate-limit-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.bwg-igf-rate-limit-icon svg {
    width: 24px;
    height: 24px;
    color: #ffc107;
}

.bwg-igf-rate-limit-text {
    flex: 1;
    min-width: 200px;
}

.bwg-igf-rate-limit-text strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #856404;
}

.bwg-igf-rate-limit-text p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #856404;
    opacity: 0.9;
}

/* Rate limit warning pulse animation for icon */
.bwg-igf-rate-limit-warning .bwg-igf-rate-limit-icon {
    animation: bwg-igf-rate-pulse 2s ease-in-out infinite;
}

@keyframes bwg-igf-rate-pulse {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
    }
}

/* Responsive adjustments for rate limit warning */
@media (max-width: 480px) {
    .bwg-igf-rate-limit-warning {
        flex-direction: column;
        text-align: center;
    }

    .bwg-igf-rate-limit-text {
        min-width: auto;
    }
}

/* Empty state */
.bwg-igf-empty,
.bwg-igf-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    border-radius: 12px;
    border: 2px dashed #ddd;
    min-height: 200px;
    grid-column: 1 / -1; /* Span all columns in grid */
}

.bwg-igf-empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-radius: 50%;
    opacity: 0.3;
}

.bwg-igf-empty-state-icon svg {
    width: 40px;
    height: 40px;
    fill: #fff;
}

.bwg-igf-empty-state h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.bwg-igf-empty-state p {
    margin: 0;
    font-size: 14px;
    color: #666;
    max-width: 300px;
    line-height: 1.5;
}

/* Private Account Warning */
.bwg-igf-private-account-warning {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border: 2px solid #e57373;
}

.bwg-igf-private-account-warning .bwg-igf-empty-state-icon {
    background: linear-gradient(45deg, #ef5350 0%, #e53935 50%, #c62828 100%);
    opacity: 0.9;
}

.bwg-igf-private-account-warning .bwg-igf-empty-state-icon svg {
    fill: #fff;
}

.bwg-igf-private-account-warning h3 {
    color: #c62828;
}

.bwg-igf-private-account-warning p {
    color: #b71c1c;
    max-width: 400px;
}

/* User Not Found Warning */
.bwg-igf-user-not-found-warning {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border: 2px solid #ffb74d;
}

.bwg-igf-user-not-found-warning .bwg-igf-empty-state-icon {
    background: linear-gradient(45deg, #ff9800 0%, #f57c00 50%, #e65100 100%);
    opacity: 0.9;
}

.bwg-igf-user-not-found-warning .bwg-igf-empty-state-icon svg {
    fill: #fff;
}

.bwg-igf-user-not-found-warning h3 {
    color: #e65100;
}

.bwg-igf-user-not-found-warning p {
    color: #bf360c;
    max-width: 400px;
}

/* Feature #17: Rate Limit Error State (when no cache available) */
.bwg-igf-rate-limit-error {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #ff9800;
}

.bwg-igf-rate-limit-error .bwg-igf-empty-state-icon {
    background: linear-gradient(45deg, #ff9800 0%, #f57c00 50%, #ff5722 100%);
    opacity: 0.9;
    animation: bwg-igf-pulse 2s ease-in-out infinite;
}

.bwg-igf-rate-limit-error .bwg-igf-empty-state-icon svg {
    fill: #fff;
}

.bwg-igf-rate-limit-error h3 {
    color: #e65100;
}

.bwg-igf-rate-limit-error p {
    color: #bf360c;
    max-width: 420px;
}

/* Pulse animation for rate limit icon */
@keyframes bwg-igf-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* Feature #34: Account Disconnected Warning State */
.bwg-igf-account-disconnected-warning {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
    border: 2px solid #ec407a;
}

.bwg-igf-account-disconnected-warning .bwg-igf-empty-state-icon {
    background: linear-gradient(45deg, #ec407a 0%, #d81b60 50%, #880e4f 100%);
    opacity: 0.9;
}

.bwg-igf-account-disconnected-warning .bwg-igf-empty-state-icon svg {
    fill: #fff;
}

.bwg-igf-account-disconnected-warning h3 {
    color: #880e4f;
}

.bwg-igf-account-disconnected-warning p {
    color: #6a1b4d;
    max-width: 400px;
}

.bwg-igf-account-disconnected-warning p a {
    color: #d81b60;
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.bwg-igf-account-disconnected-warning p a:hover {
    color: #880e4f;
}

/* Feature #35: Suggestion to use public feed */
.bwg-igf-suggestion-box {
    margin-top: 20px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 100%;
}

.bwg-igf-suggestion-box p {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #555;
    max-width: 100%;
}

.bwg-igf-suggestion-box strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.bwg-igf-suggestion-link {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff !important;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    font-size: 13px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bwg-igf-suggestion-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 39, 67, 0.3);
    color: #fff !important;
    text-decoration: none;
}

/* Feature #23: Stale Data Indicator */
.bwg-igf-stale-data-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-bottom: 12px;
    background: rgba(120, 120, 120, 0.08);
    border-radius: 20px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.bwg-igf-stale-data-indicator:hover {
    background: rgba(120, 120, 120, 0.12);
    color: #555;
}

.bwg-igf-stale-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bwg-igf-stale-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    opacity: 0.7;
}

.bwg-igf-stale-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive adjustments for stale indicator */
@media (max-width: 480px) {
    .bwg-igf-stale-data-indicator {
        font-size: 11px;
        padding: 5px 10px;
    }

    .bwg-igf-stale-icon svg {
        width: 12px;
        height: 12px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .bwg-igf-grid-4,
    .bwg-igf-grid-5,
    .bwg-igf-grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .bwg-igf-popup-content {
        flex-direction: column;
        max-width: 95vw;
        max-height: 95vh;
        gap: 15px;
    }

    .bwg-igf-popup-image,
    .bwg-igf-popup-video {
        max-width: 100%;
        max-height: 50vh;
        width: auto;
    }

    .bwg-igf-popup-details {
        width: auto;
        max-width: 100%;
        padding: 0 10px 10px;
        overflow-y: auto;
        max-height: 40vh;
    }

    /* Larger close button for touch targets */
    .bwg-igf-popup-close {
        width: 44px;
        height: 44px;
        top: 10px;
        right: 10px;
        font-size: 32px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
    }

    /* Mobile-friendly nav buttons */
    .bwg-igf-popup-nav {
        width: 44px;
        height: 44px;
        border-radius: 50%;
    }

    .bwg-igf-popup-prev {
        left: 10px;
    }

    .bwg-igf-popup-next {
        right: 10px;
    }

    /* Feature #53: Stack header on mobile */
    .bwg-igf-feed-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .bwg-igf-feed-header .bwg-igf-follow {
        align-self: stretch;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .bwg-igf-grid-3,
    .bwg-igf-grid-4,
    .bwg-igf-grid-5,
    .bwg-igf-grid-6 {
        grid-template-columns: repeat(1, 1fr);
    }

    /* Full-screen popup on small screens */
    .bwg-igf-popup {
        padding: 0;
    }

    .bwg-igf-popup-content {
        max-width: 100vw;
        max-height: 100vh;
        width: 100%;
        height: 100%;
        gap: 10px;
        padding: 50px 0 0;
        box-sizing: border-box;
        justify-content: flex-start;
    }

    .bwg-igf-popup-image,
    .bwg-igf-popup-video {
        max-width: 100%;
        max-height: 45vh;
        width: 100%;
        object-fit: contain;
    }

    .bwg-igf-popup-details {
        padding: 10px 15px 20px;
        max-height: calc(55vh - 60px);
        overflow-y: auto;
    }

    .bwg-igf-popup-caption {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 10px;
    }

    .bwg-igf-popup-stats {
        display: flex;
        gap: 15px;
        margin-bottom: 10px;
        font-size: 14px;
    }

    /* Ensure close button is always visible and accessible */
    .bwg-igf-popup-close {
        position: fixed;
        top: 5px;
        right: 5px;
        z-index: 100;
    }

    /* Position nav buttons in the middle of image area */
    .bwg-igf-popup-nav {
        top: calc(50px + 22.5vh);
    }

    .bwg-igf-popup-prev {
        left: 5px;
    }

    .bwg-igf-popup-next {
        right: 5px;
    }
}
