/* Estilos para componente Instagram Feed - UNLA */
/* Prefijo unla-feed- para evitar conflictos con temas de WordPress */

:root {
    --unla-feed-primary: #d81b60;
    /* Color cercano al branding UNLA / action button */
    --unla-feed-bg: transparent;
    --unla-feed-card-bg: #ffffff;
    --unla-feed-text-main: #262626;
    --unla-feed-text-muted: #8e8e8e;
    --unla-feed-border: #efefef;
    --unla-feed-radius: 4px;
    /* Las tarjetas de IG suelen ser un poco cuadradas, pero la imagen muestra algo de radio */
    --unla-feed-card-radius: 8px;
    --unla-feed-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --unla-feed-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.25);
    --unla-feed-font: 'Inter', system-ui, -apple-system, sans-serif;
    --unla-feed-transition: all 0.3s ease;
}

/* Base Demo Styles (solo para index.html local, en WP no aplicaría) */
body {
    margin: 0;
    font-family: var(--unla-feed-font);
    background: transparent;
    color: var(--unla-feed-text-main);
}

body::before {
    display: none;
}

.unla-feed-hidden {
    display: none !important;
}

/* =========================================
   FEED MAIN LAYOUT
========================================= */
.unla-feed-page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.unla-feed-page-header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.unla-feed-page-header h2 {
    font-size: 28px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    margin: 0;
}

.unla-feed-loading {
    text-align: center;
    color: white;
    font-size: 18px;
    padding: 40px;
}

/* Mensajes de Error */
.unla-feed-error-msg {
    background: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 15px 20px;
    border-radius: var(--unla-feed-radius);
    text-align: center;
    font-weight: 500;
    grid-column: 1 / -1;
}

/* Layout Grid */
.unla-feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Layout Masonry */
.unla-feed-masonry {
    column-count: 3;
    column-gap: 24px;
}

@media (max-width: 1024px) {
    .unla-feed-masonry {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .unla-feed-masonry {
        column-count: 1;
    }

    .unla-feed-grid {
        grid-template-columns: 1fr;
    }
}

.unla-feed-masonry .unla-feed-card {
    break-inside: avoid;
    margin-bottom: 24px;
}

/* =========================================
   POST CARD (Réplica de imagen)
========================================= */
.unla-feed-card {
    background: var(--unla-feed-card-bg);
    border-radius: var(--unla-feed-card-radius);
    overflow: hidden;
    box-shadow: var(--unla-feed-shadow);
    transition: var(--unla-feed-transition);
    cursor: pointer;
    font-family: var(--unla-feed-font);
    display: flex;
    flex-direction: column;
}

.unla-feed-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--unla-feed-shadow-hover);
}

/* Header de la Card */
.unla-feed-card-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--unla-feed-border);
}

.unla-feed-card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e1e1e1;
    margin-right: 12px;
    display: none;
    /* Según imagen, no hay avatar, solo texto y fecha */
}

.unla-feed-card-user-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.unla-feed-card-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--unla-feed-text-main);
}

.unla-feed-card-date {
    font-size: 12px;
    color: var(--unla-feed-text-muted);
    margin-top: 2px;
}

.unla-feed-card-logo {
    color: var(--unla-feed-text-main);
    font-size: 20px;
}

/* Media (Imagen) */
.unla-feed-card-media-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    /* Cuadrado perfecto base, aunque puede ser dinámico */
    background: #f0f0f0;
    overflow: hidden;
}

/* Si es masonry, permitiremos que la imagen defina su propia altura quitando padding */
.unla-feed-masonry .unla-feed-card-media-wrapper {
    padding-bottom: 0;
}

.unla-feed-card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.unla-feed-masonry .unla-feed-card-img {
    position: relative;
    display: block;
    height: auto;
}

.unla-feed-card-icon-type {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    font-size: 18px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Contenido / Caption */
.unla-feed-card-content {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.unla-feed-card-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.unla-feed-action-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--unla-feed-text-main);
    font-size: 14px;
    font-weight: 500;
}

.unla-feed-action-item i {
    font-size: 18px;
}

.unla-feed-card-caption {
    font-size: 14px;
    color: var(--unla-feed-text-main);
    line-height: 1.5;
    display: -webkit-box;
    line-clamp: 4;
    -webkit-line-clamp: 4;
    /* Truncar a 4 líneas en el grid */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-wrap;
    word-break: break-word;
}

.unla-feed-masonry .unla-feed-card-caption {
    /* En masonry podríamos no truncar o truncar más largo */
    line-clamp: 6;
    -webkit-line-clamp: 6;
}

/* =========================================
   LIGHTBOX MODAL
========================================= */
.unla-feed-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unla-feed-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.unla-feed-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    background: var(--unla-feed-card-bg);
    border-radius: var(--unla-feed-card-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    overflow: hidden;
    max-height: 90vh;
    animation: unlaSlideUp 0.3s ease forwards;
}

@keyframes unlaSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.unla-feed-lightbox-layout {
    display: flex;
    width: 100%;
}

.unla-feed-lightbox-media {
    flex: 6;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unla-feed-lightbox-media img,
.unla-feed-lightbox-media video {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.unla-feed-lightbox-info {
    flex: 4;
    display: flex;
    flex-direction: column;
    background: var(--unla-feed-card-bg);
    min-width: 300px;
    max-width: 400px;
    /* Borde en móviles/desktop dependiendo el layout */
    border-left: 1px solid var(--unla-feed-border);
}

.unla-feed-lightbox-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Move close button to be visible on white bg if on mobile */

.unla-feed-lightbox-header {
    padding: 16px;
    border-bottom: 1px solid var(--unla-feed-border);
    display: flex;
    align-items: center;
}

.unla-feed-lightbox-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 12px;
}

.unla-feed-lightbox-user {
    display: flex;
    flex-direction: column;
}

.unla-feed-lightbox-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--unla-feed-text-main);
}

.unla-feed-lightbox-date {
    font-size: 12px;
    color: var(--unla-feed-text-muted);
}

.unla-feed-lightbox-scrollable {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
}

.unla-feed-lightbox-caption {
    font-size: 14px;
    line-height: 1.6;
    color: var(--unla-feed-text-main);
    white-space: pre-wrap;
    word-break: break-word;
}

.unla-feed-lightbox-footer {
    padding: 16px;
    border-top: 1px solid var(--unla-feed-border);
}

.unla-feed-btn-view {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px;
    background: var(--unla-feed-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--unla-feed-radius);
    font-weight: 600;
    transition: background 0.2s;
}

.unla-feed-btn-view:hover {
    background: #c2185b;
}

/* Responsivo para el Lightbox */
@media (max-width: 768px) {

    /* En mobile no mostraremos el lightbox por requerimiento (se redirige a IG),
       pero dejamos estilos por si se necesita */
    .unla-feed-lightbox-layout {
        flex-direction: column;
    }

    .unla-feed-lightbox-info {
        max-width: 100%;
        border-left: none;
        border-top: 1px solid var(--unla-feed-border);
        flex: none;
        max-height: 40vh;
    }

    .unla-feed-lightbox-close {
        color: #333;
        top: 10px;
        right: 10px;
        background: rgba(255, 255, 255, 0.8);
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}