/* ==========================================================================
   Insta Feed - Frontend Styles
   ========================================================================== */

/* Container Principal */
.insta-feed-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px;
    overflow: hidden;
    box-sizing: border-box;
    min-height: 400px;
}

/* Cuando está cargando, mantener altura */
.insta-feed-container.loading-initial {
    min-height: 400px;
}

/* Loader Inicial */
.insta-feed-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.insta-feed-container:not(.loading-initial) .insta-feed-loader {
    opacity: 0;
    pointer-events: none;
}

.insta-feed-loader-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #1f1f1f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.insta-feed-loader-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Carrusel Wrapper */
.insta-feed-carousel {
    display: flex;
    gap: 20px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    opacity: 0;
}

.insta-feed-container:not(.loading-initial) .insta-feed-carousel {
    opacity: 1;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease 0.2s;
}

/* Item Individual */
.insta-feed-item {
    flex-shrink: 0;
    min-width: 0;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.insta-feed-item:hover {
    transform: translateY(-4px);
}

/* Imagen Container */
.insta-feed-image {
    position: relative;
    width: 100%;
    padding-bottom: 125%;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e3e8ef 100%);
}

.insta-feed-image a {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.insta-feed-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}

.insta-feed-item:hover .insta-feed-image img {
    transform: scale(1.05);
}

/* Overlay con Glassmorphism */
.insta-feed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.insta-feed-item:hover .insta-feed-overlay {
    opacity: 1;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.25);
}

.insta-feed-overlay svg {
    width: 48px;
    height: 48px;
    color: #1f1f1f;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.insta-feed-item:hover .insta-feed-overlay svg {
    transform: scale(1);
}

/* Descripción */
.insta-feed-description {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #4a5568;
}

.insta-feed-description p {
    margin: 0 0 10px;
}

.insta-feed-description p:last-child {
    margin-bottom: 0;
}

/* Indicadores (Bullets) */
.insta-feed-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
    padding: 0;
}

.insta-feed-indicators .indicator {
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    outline: none;
}

.insta-feed-indicators .indicator:hover {
    background: #9ca3af;
    transform: scale(1.2);
}

.insta-feed-indicators .indicator.active {
    background: #1f1f1f;
    width: 32px;
    border-radius: 5px;
}

.insta-feed-indicators .indicator:focus-visible {
    outline: 2px solid #1f1f1f;
    outline-offset: 3px;
}

/* Sin Posts */
.insta-feed-no-posts {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.insta-feed-no-posts p {
    font-size: 16px;
    margin: 0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet - 3 elementos */
@media (max-width: 1024px) {
    .insta-feed-container {
        padding: 0 15px;
    }
}

/* Mobile - 2 elementos */
@media (max-width: 768px) {
    .insta-feed-carousel {
        gap: 15px;
    }
    
    .insta-feed-container {
        padding: 0 10px;
        min-height: auto;
    }
    
    .insta-feed-container.loading-initial {
        min-height: 350px;
    }
    
    .insta-feed-item {
        border-radius: 12px;
    }
    
    .insta-feed-description {
        padding: 15px;
        font-size: 13px;
    }
    
    .insta-feed-overlay svg {
        width: 40px;
        height: 40px;
    }
    
    .insta-feed-indicators {
        margin-top: 30px;
        gap: 8px;
    }
    
    .insta-feed-indicators .indicator {
        width: 8px;
        height: 8px;
    }
    
    .insta-feed-indicators .indicator.active {
        width: 24px;
    }
}

/* Mobile pequeño */
@media (max-width: 480px) {
    .insta-feed-carousel {
        gap: 12px;
    }
    
    .insta-feed-description {
        padding: 12px;
        font-size: 12px;
    }
}

/* ==========================================================================
   Animaciones y Efectos
   ========================================================================== */

/* Fade in inicial */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.insta-feed-container:not(.loading-initial) .insta-feed-item {
    animation: fadeInUp 0.5s ease backwards;
}

.insta-feed-container:not(.loading-initial) .insta-feed-item:nth-child(1) { animation-delay: 0.05s; }
.insta-feed-container:not(.loading-initial) .insta-feed-item:nth-child(2) { animation-delay: 0.1s; }
.insta-feed-container:not(.loading-initial) .insta-feed-item:nth-child(3) { animation-delay: 0.15s; }
.insta-feed-container:not(.loading-initial) .insta-feed-item:nth-child(4) { animation-delay: 0.2s; }

/* Efecto smooth para touch devices */
@media (hover: none) {
    .insta-feed-overlay {
        display: none;
    }
    
    .insta-feed-item:active {
        transform: scale(0.98);
    }
}

/* Accesibilidad - Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .insta-feed-carousel,
    .insta-feed-item,
    .insta-feed-overlay,
    .insta-feed-image img {
        transition: none !important;
        animation: none !important;
    }
}