/* Y Instagram Feed - Frontend Styles */

.yif-container {
    position: relative;
    width: 100%;
}

.yif-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.yif-wrapper::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 70px;
    background: #000000;
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yif-wrapper::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 70px;
    background: #000000;
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yif-grid-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 300px;
}

.yif-grid {
    display: grid;
    gap: 0;
    width: 100%;
    transition: opacity 0.3s ease;
}

.yif-grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

.yif-grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.yif-grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.yif-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.yif-grid-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.yif-grid-cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Tablet Responsive (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
    .yif-container[data-tablet-columns="1"] .yif-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }
    .yif-container[data-tablet-columns="2"] .yif-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .yif-container[data-tablet-columns="3"] .yif-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .yif-container[data-tablet-columns="4"] .yif-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* Mobile Responsive (< 768px) */
@media (max-width: 767px) {
    .yif-container[data-mobile-columns="1"] .yif-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }
    .yif-container[data-mobile-columns="2"] .yif-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .yif-container[data-mobile-columns="3"] .yif-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Old responsive fallback - remove */
@media (max-width: 768px) {
    .yif-grid-cols-3:not([class*="data-tablet-columns"]),
    .yif-grid-cols-4:not([class*="data-tablet-columns"]),
    .yif-grid-cols-5:not([class*="data-tablet-columns"]),
    .yif-grid-cols-6:not([class*="data-tablet-columns"]) {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .yif-grid-cols-2:not([class*="data-mobile-columns"]),
    .yif-grid-cols-3:not([class*="data-mobile-columns"]),
    .yif-grid-cols-4:not([class*="data-mobile-columns"]),
    .yif-grid-cols-5:not([class*="data-mobile-columns"]),
    .yif-grid-cols-6:not([class*="data-mobile-columns"]) {
        grid-template-columns: repeat(1, 1fr);
    }
}

.yif-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #000000;
}

.yif-item-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    background: #000000;
}

.yif-item-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.yif-item:hover img {
    transform: scale(1.05);
}

.yif-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.yif-item:hover .yif-item-overlay {
    opacity: 1;
}

.yif-item-caption {
    color: #fff;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    max-height: 100%;
    overflow: hidden;
}

.yif-video-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Edge Navigation Buttons */
.yif-nav-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    flex-shrink: 0;
    position: relative;
}

.yif-nav-btn svg {
    width: 24px;
    height: 24px;
}

.yif-nav-btn svg path {
    stroke: #fff;
}

.yif-nav-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.9);
    border-color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.yif-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.yif-nav-edge-left {
    margin-right: 10px;
    margin-left: 10px;
}

.yif-nav-edge-right {
    margin-left: 10px;
    margin-right: 10px;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .yif-nav-btn {
        width: 44px;
        height: 44px;
    }
    
    .yif-nav-edge-left {
        margin-right: 10px;
    }
    
    .yif-nav-edge-right {
        margin-left: 10px;
    }
}

.yif-no-posts {
    padding: 40px;
    text-align: center;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-size: 16px;
}

/* Loading state */
.yif-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.yif-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #000;
    animation: yif-spin 0.8s linear infinite;
}

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

/* Touch swipe cursor */
.yif-grid-wrapper {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.yif-grid-wrapper.dragging {
    cursor: grabbing;
}

.yif-grid-wrapper.dragging .yif-item-link {
    pointer-events: none;
}

/* Lightbox Styles */
.yif-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yif-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    animation: yif-fadeIn 0.3s ease;
}

.yif-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: yif-scaleIn 0.3s ease;
    z-index: 1;
}

.yif-lightbox-media {
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    background: #000000;
}

.yif-lightbox-media img,
.yif-lightbox-media video {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.yif-lightbox-media video {
    background: #000000;
}

.yif-lightbox-caption {
    color: #fff;
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
    max-width: 800px;
    padding: 0 20px;
    margin-bottom: 15px;
}

.yif-lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.yif-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.yif-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: #333333;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.yif-lightbox-nav svg {
    width: 24px;
    height: 24px;
}

.yif-lightbox-nav svg path {
    stroke: #fff;
}

.yif-lightbox-nav:hover {
    background: #444444;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.yif-lightbox-prev {
    left: 20px;
}

.yif-lightbox-next {
    right: 20px;
}

.yif-lightbox-instagram {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.yif-lightbox-instagram:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Mobile Lightbox Adjustments */
@media (max-width: 768px) {
    .yif-lightbox-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .yif-lightbox-media {
        max-width: 95vw;
        max-height: 60vh;
    }
    
    .yif-lightbox-media img,
    .yif-lightbox-media video {
        max-height: 60vh;
    }
    
    .yif-lightbox-close {
        top: 10px;
        right: 10px;
    }
    
    .yif-lightbox-nav {
        width: 44px;
        height: 44px;
    }
    
    .yif-lightbox-prev {
        left: 10px;
    }
    
    .yif-lightbox-next {
        right: 10px;
    }
    
    .yif-lightbox-caption {
        font-size: 14px;
        padding: 0 15px;
    }
}

/* Animations */
@keyframes yif-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes yif-scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
