/* Custom Instagram Feed - Mobile First */
.biorganica-instagram-feed {
    background: #fafafa;
}

.instagram-header {
    text-align: center;
    margin-bottom: 30px;
}

.instagram-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
}

.instagram-header p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Loading State */
.instagram-loading {
    text-align: center;
    padding: 40px 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e1e1e1;
    border-top: 3px solid #e4405f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Instagram Grid - Mobile First (2 columns) */
.instagram-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

/* Instagram Item */
.instagram-item {
    position: relative;
    aspect-ratio: 9/16; /* Instagram Reels ratio */
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #000;
}

.instagram-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.instagram-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* Overlay */
.instagram-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 20px 12px 12px;
    color: white;
}

.instagram-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-item svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.instagram-caption {
    font-size: 11px;
    line-height: 1.3;
    opacity: 0.9;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Follow Button */
.instagram-footer {
    text-align: center;
    margin-top: 30px;
}

.follow-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.follow-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(228, 64, 95, 0.4);
    color: white;
    text-decoration: none;
}

/* Modal */
.instagram-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.instagram-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 95%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 20;
    transition: background 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.modal-close:hover {
    background: rgba(0,0,0,0.9);
}

.modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-image {
    width: 100% !important;
    height: 40vh !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
    flex-shrink: 0;
    aspect-ratio: auto !important;
}

.modal-info {
    padding: 16px;
    background: white;
    flex: 1 1 0% !important;
    display: block !important;
    overflow-y: auto !important;
    min-height: 200px;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.modal-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid #e1e1e1;
}

.modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.modal-username {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.modal-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.modal-caption {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 15px;
}

.modal-date {
    font-size: 12px;
    color: #999;
    margin-bottom: 15px;
}

.modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #e4405f;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.modal-link:hover {
    background: #d63384;
    color: white;
    text-decoration: none;
}

/* Tablet */
@media (min-width: 768px) {
    .instagram-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .instagram-header h3 {
        font-size: 28px;
    }

    .instagram-header p {
        font-size: 16px;
    }

    .instagram-caption {
        font-size: 12px;
        -webkit-line-clamp: 3;
    }

    .modal-content {
        max-width: 500px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .instagram-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .modal-content {
        max-width: 600px;
        display: flex;
        flex-direction: row;
        max-height: 80vh;
        aspect-ratio: auto;
    }

    .modal-image {
        aspect-ratio: 9/16 !important;
        width: auto !important;
        height: 50% !important;
        max-height: 80vh !important;
    }

    .modal-info {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        max-height: 100% !important;
        overflow-y: auto !important;
        min-width: 300px;
    }
}

/* Mobile-specific overrides to prevent desktop styles from interfering */
@media (max-width: 1023px) {
    .modal-image {
        width: 100% !important;
        height: 40vh !important;
        max-width: none !important;
        max-height: none !important;
        aspect-ratio: auto !important;
    }

    .modal-info {
        flex: 1 1 0% !important;
        display: block !important;
        flex-direction: column !important;
        overflow-y: auto !important;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .instagram-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 1000px;
    }
}