/* LA FORMA Instagram Widget Styles */

.laforma-instagram-widget {
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Header Styles */
.instagram-header {
    background: #fff;
    padding: 20px;
    border-bottom: 1px solid #dbdbdb;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-picture {
    flex-shrink: 0;
}

.profile-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.full-name a {
    color: #262626;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    line-height: 20px;
}

.username a {
    color: #8e8e8e;
    text-decoration: none;
    font-size: 14px;
    line-height: 18px;
}

.full-name a:hover,
.username a:hover {
    text-decoration: underline;
}

.stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.stat-value {
    font-weight: 600;
    font-size: 16px;
    color: #262626;
    line-height: 20px;
}

.stat-label {
    font-size: 14px;
    color: #8e8e8e;
    line-height: 18px;
}

.follow-button-wrapper {
    flex-shrink: 0;
}

.follow-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0095f6;
    color: #fff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.follow-button:hover {
    background: #1877f2;
    color: #fff;
    text-decoration: none;
}

.follow-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Posts Container */
.posts-container {
    position: relative;
    overflow: hidden;
}

.posts-carousel {
    position: relative;
    width: 100%;
}

.carousel-inner {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
}

/* Individual Post Items */
.post-item {
    flex: none;
    position: relative;
    cursor: pointer;
    background: #fafafa;
}

.post-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.post-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5;
    overflow: hidden;
}

.post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-item:hover .post-image {
    transform: scale(1.05);
}

/* Media Type Icons */
.media-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-icon svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* Post Overlay */
.post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

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

.post-content {
    text-align: center;
    width: 100%;
}

.post-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.stat-icon {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.stat-count {
    font-size: 14px;
}

.post-caption {
    font-size: 13px;
    line-height: 1.4;
    color: #fff;
    text-align: center;
    max-width: 200px;
    margin: 0 auto;
}

/* Carousel Navigation */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    color: #fff !important; /* Set color for currentColor inheritance */
}

.carousel-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav svg {
    fill: #fff !important;
    color: #fff !important;
}

.carousel-nav svg path {
    fill: #fff !important;
    color: #fff !important;
}

.prev-btn {
    left: 12px;
}

.next-btn {
    right: 12px;
}

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

.carousel-nav:disabled:hover {
    transform: translateY(-50%) scale(1);
    background: rgba(0, 0, 0, 0.8);
}

/* Desktop Layout - 5 columns (4x5 aspect ratio) */
@media (min-width: 769px) {
    .post-item {
        width: calc(20% - 8px);
        margin: 4px;
    }
    
    .carousel-inner {
        padding: 8px;
    }
    
    .posts-container {
        min-height: 320px;
    }
    
    /* Show 5 posts at once on desktop */
    .carousel-inner .post-item:nth-child(n+6) {
        display: none;
    }
}

/* Mobile Layout - 2x2 grid */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .stats {
        gap: 32px;
    }
    
    .posts-container {
        min-height: 500px;
    }
    
    .carousel-inner {
        flex-wrap: wrap;
        padding: 8px;
    }
    
    .post-item {
        width: calc(50% - 8px);
        margin: 4px;
    }
    
    /* Show 4 posts at once on mobile (2x2 grid) */
    .carousel-inner .post-item {
        display: block;
    }
    
    .carousel-inner .post-item:nth-child(n+5) {
        display: none;
    }
    
    /* Adjust navigation buttons for mobile */
    .carousel-nav {
        width: 36px;
        height: 36px;
    }
    
    .prev-btn {
        left: 8px;
    }
    
    .next-btn {
        right: 8px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .instagram-header {
        padding: 15px;
    }
    
    .profile-img {
        width: 48px;
        height: 48px;
    }
    
    .stats {
        gap: 20px;
    }
    
    .stat-value {
        font-size: 14px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .follow-button {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .post-overlay {
        padding: 15px;
    }
    
    .post-caption {
        font-size: 12px;
        max-width: 150px;
    }
    
    .stat {
        gap: 4px;
    }
    
    .stat-icon {
        width: 18px;
        height: 18px;
    }
    
    .stat-count {
        font-size: 12px;
    }
}

/* Animation classes for smooth transitions */
.carousel-inner.transitioning {
    transition: transform 0.3s ease;
}

/* Loading state */
.laforma-instagram-widget.loading {
    position: relative;
}

.laforma-instagram-widget.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

/* Accessibility improvements */
.post-link:focus {
    outline: 2px solid #0095f6;
    outline-offset: 2px;
}

.carousel-nav:focus {
    outline: 2px solid #0095f6;
    outline-offset: 2px;
}

.follow-button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .post-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .carousel-nav {
        background: #000;
        border: 1px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .carousel-inner,
    .post-image,
    .carousel-nav,
    .post-overlay {
        transition: none;
    }
    
    .post-item:hover .post-image {
        transform: none;
    }
}

/* Print styles */
@media print {
    .laforma-instagram-widget {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .carousel-nav {
        display: none;
    }
    
    .post-overlay {
        position: static;
        background: none;
        color: #000;
        opacity: 1;
    }
}
