/**
 * Appis Instafeed - Frontend Styles
 */

.appis-instafeed-container {
    --columns: 3;
    --gap: 12px;
    --item-radius: 8px;
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --accent-color: #e1306c;
    width: 100%;
    max-width: 100%;
}

/* Grid Layout */
.appis-instafeed-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns), 1fr);
    gap: var(--gap);
}

/* Individual Item */
.appis-instafeed-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--item-radius);
    background: #f0f0f0;
}

.appis-instafeed-item a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: #fff;
}

/* Image Container */
.appis-instafeed-image-wrap {
    width: 100%;
    height: 100%;
    position: relative;
}

.appis-instafeed-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, filter 0.3s ease;
}

/* Hover Effect */
.appis-instafeed-item:hover img {
    transform: scale(1.08);
    filter: brightness(0.85);
}

/* Media Type Icons */
.appis-instafeed-video-icon,
.appis-instafeed-carousel-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    z-index: 2;
}

.appis-instafeed-video-icon svg,
.appis-instafeed-carousel-icon svg {
    width: 100%;
    height: 100%;
}

/* Overlay with Caption */
.appis-instafeed-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 16px 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1;
}

.appis-instafeed-item:hover .appis-instafeed-overlay {
    opacity: 1;
    transform: translateY(0);
}

.appis-instafeed-caption {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Follow Link */
.appis-instafeed-follow-wrap {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.appis-instafeed-follow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(135deg, #405de6 0%, #833ab4 25%, #e1306c 50%, #f56040 75%, #fcaf45 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 50px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-position 0.5s ease;
    box-shadow: 0 4px 16px rgba(225, 48, 108, 0.35);
}

.appis-instafeed-follow:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(225, 48, 108, 0.45);
    background-position: 100% 0;
    color: #fff;
}

.appis-instafeed-follow:active {
    transform: translateY(0);
}

.appis-instafeed-follow svg {
    flex-shrink: 0;
}

/* Error & Empty States */
.appis-instafeed-error,
.appis-instafeed-empty {
    padding: 32px;
    text-align: center;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--item-radius);
    color: #991b1b;
    font-size: 14px;
}

.appis-instafeed-empty {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #6b7280;
}

/* Mobile Styles - Horizontal Scroll */
@media (max-width: 768px) {
    .appis-instafeed-container {
        overflow: visible;
    }
    
    .appis-instafeed-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: scroll;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 12px;
        padding: 4px 16px 4px 0;
        margin: 0;
    }
    
    .appis-instafeed-grid::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
    
    .appis-instafeed-item {
        flex: 0 0 80vw;
        width: 80vw;
        min-width: 80vw;
        max-width: 80vw;
        scroll-snap-align: start;
        aspect-ratio: 1;
    }
    
    /* Show overlay by default on mobile since no hover */
    .appis-instafeed-overlay {
        opacity: 1;
        transform: translateY(0);
        padding: 30px 12px 12px;
    }
    
    .appis-instafeed-caption {
        font-size: 12px;
    }
    
    .appis-instafeed-follow-wrap {
        margin-top: 24px;
    }
    
    .appis-instafeed-follow {
        padding: 12px 24px;
        font-size: 14px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .appis-instafeed-item {
        flex: 0 0 85vw;
        width: 85vw;
        min-width: 85vw;
        max-width: 85vw;
    }
}
