/* =====================================================
   Instagram Feed for Elementor — Frontend CSS
   ===================================================== */

/* --- Base --- */
.aif-feed-wrap { width: 100%; }

.aif-no-account,
.aif-error,
.aif-empty {
    padding: 24px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    color: #795548;
    font-size: 14px;
}
.aif-error { background: #fce4ec; border-color: #f48fb1; color: #c62828; }

/* --- Perfil cabecera --- */
.aif-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0 20px;
}
.aif-profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}
.aif-profile-info { display: flex; flex-direction: column; gap: 2px; }
.aif-profile-name { font-weight: 700; font-size: 15px; }
.aif-profile-fullname { font-size: 13px; color: #777; }
.aif-profile-stats { display: flex; gap: 16px; font-size: 13px; color: #555; margin-top: 4px; }
.aif-profile-stats strong { font-weight: 700; color: #111; }

/* --- Grid --- */
.aif-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Masonry via CSS columns como fallback */
.aif-masonry {
    display: block;
    column-gap: 12px;
}
.aif-masonry .aif-post-card {
    break-inside: avoid;
    margin-bottom: 12px;
}

/* --- Tarjeta --- */
.aif-post-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.aif-post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

/* --- Media --- */
.aif-post-media-link {
    display: block;
    text-decoration: none;
}
.aif-post-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1/1;
    background: #f5f5f5;
    /* El border-radius se gestiona desde Elementor individualmente */
}
.aif-post-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.aif-post-card:hover .aif-post-media img {
    transform: scale(1.05);
}

/* --- Badge tipo media --- */
.aif-media-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.55);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* --- Overlay --- */
.aif-post-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.aif-post-card:hover .aif-post-overlay { opacity: 1; }

.aif-overlay-stats {
    display: flex;
    gap: 20px;
    font-size: 15px;
    font-weight: 600;
}
.aif-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Contenido texto --- */
.aif-post-content {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.aif-post-username {
    font-size: 12px;
    font-weight: 700;
    color: #222;
    text-decoration: none;
}
.aif-post-caption {
    font-size: 13px;
    line-height: 1.5;
    color: #444;
    margin: 0;
}
.aif-post-date {
    font-size: 11px;
    color: #999;
}
.aif-post-meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}
.aif-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* =====================================================
   CARRUSEL
   ===================================================== */
.aif-carousel-wrap {
    position: relative;
}
.aif-swiper {
    overflow: hidden;
}
.aif-swiper .swiper-wrapper {
    display: flex;
}
.aif-swiper .swiper-slide {
    flex-shrink: 0;
}

.aif-swiper-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.aif-swiper-btn:hover { background: rgba(0,0,0,0.75); }
.aif-swiper-prev { left: 8px; }
.aif-swiper-next { right: 8px; }
.aif-swiper-btn svg { pointer-events: none; stroke: currentColor; fill: none; stroke-width: 2.5; }

.swiper-pagination {
    text-align: center;
    padding: 12px 0 4px;
}
.swiper-pagination-bullet {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    margin: 0 3px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.swiper-pagination-bullet-active {
    background: #000;
    transform: scale(1.3);
}

/* Swiper grid mode (múltiples filas) */
.aif-swiper .swiper-wrapper {
    flex-wrap: wrap; /* Swiper lo gestiona, esto es fallback */
}

/* =====================================================
   SINGLE / AUTO
   ===================================================== */
.aif-single-wrap {
    position: relative;
}
.aif-single-slide {
    display: none;
}
.aif-single-slide.is-active {
    display: block;
    animation: aif-fade-in 0.5s ease;
}

/* Transición zoom */
.aif-single-wrap[data-transition="zoom"] .aif-single-slide.is-active {
    animation: aif-zoom-in 0.5s ease;
}

/* Transición slide */
.aif-single-wrap[data-transition="slide"] .aif-single-slide.is-active {
    animation: aif-slide-in 0.5s ease;
}

@keyframes aif-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes aif-zoom-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes aif-slide-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* --- Barra de progreso --- */
.aif-progress-bar-bg {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}
.aif-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 999px;
    transition: width linear;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .aif-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .aif-grid {
        grid-template-columns: 1fr;
    }
    .aif-swiper-btn {
        width: 32px;
        height: 32px;
    }
}
