/**
 * Instagram Feed Plugin - Frontend Styles
 */

:root {
    --ig-primary: #0073aa;
    --ig-secondary: #ffffff;
    --ig-text: #333333;
    --ig-border: #e0e0e0;
    --ig-hover: rgba(0, 115, 170, 0.1);
}

.ig-feed-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.ig-feed-grid {
    display: grid;
    grid-template-columns: repeat(var(--ig-columns, 3), 1fr);
    gap: 15px;
    margin-bottom: 30px;
    align-items: start;
}

@media (max-width: 1024px) {
    .ig-feed-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ig-feed-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .ig-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .ig-modal-body {
        flex-direction: column;
        max-height: calc(100vh - 61px);
    }
    
    .ig-modal-media {
        flex: 0 0 auto;
        min-height: 50vh;
        max-height: 60vh;
    }
    
    .ig-modal-info {
        flex: 1;
        min-width: 0;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.0975);
    }
}




/* ============================================
   THEME STYLES
   ============================================ */

/* Theme 1: Overlay Likes - Likes on image with rounded background */
.ig-feed-container.ig-theme-overlay-likes .ig-post-item {
    margin-bottom: 0; /* Remove bottom margin for likes */
}

.ig-feed-container.ig-theme-overlay-likes .ig-post-likes-bottom {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ig-theme1-likes-bg, rgba(0, 0, 0, 0.7));
    color: var(--ig-theme1-likes-text, #ffffff);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: var(--ig-theme1-likes-size, 14px);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ig-feed-container.ig-theme-overlay-likes .ig-post-likes-bottom svg {
    width: var(--ig-theme1-likes-size, 14px);
    height: var(--ig-theme1-likes-size, 14px);
    fill: var(--ig-theme1-likes-text, #ffffff);
}

.ig-feed-container.ig-theme-overlay-likes .ig-post-likes-bottom span {
    color: var(--ig-theme1-likes-text, #ffffff);
    font-weight: 600;
}

/* Theme 2: Rounded - Rounded corners with shadows */
.ig-feed-container.ig-theme-rounded .ig-post-item {
    border-radius: var(--ig-theme2-radius, 16px);
    overflow: hidden;
    margin-bottom: 50px;
}

.ig-feed-container.ig-theme-rounded .ig-post-thumbnail {
    border-radius: var(--ig-theme2-radius, 16px);
}

.ig-feed-container.ig-theme-rounded.ig-shadow-none .ig-post-item {
    box-shadow: none;
}

.ig-feed-container.ig-theme-rounded.ig-shadow-light .ig-post-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ig-feed-container.ig-theme-rounded.ig-shadow-medium .ig-post-item {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ig-feed-container.ig-theme-rounded.ig-shadow-heavy .ig-post-item {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.ig-feed-container.ig-theme-rounded .ig-post-likes-bottom {
    bottom: -35px;
}

/* Theme 3: Framed - Frame around image */
.ig-feed-container.ig-theme-framed .ig-post-item {
    padding: var(--ig-theme3-frame-width, 8px);
    background: var(--ig-theme3-frame-color, #ffffff);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 50px;
}

.ig-feed-container.ig-theme-framed.ig-frame-solid .ig-post-item {
    border: var(--ig-theme3-frame-width, 8px) solid var(--ig-theme3-frame-color, #ffffff);
    padding: 0;
}

.ig-feed-container.ig-theme-framed.ig-frame-double .ig-post-item {
    border: var(--ig-theme3-frame-width, 8px) double var(--ig-theme3-frame-color, #ffffff);
    padding: 0;
}

.ig-feed-container.ig-theme-framed.ig-frame-dashed .ig-post-item {
    border: var(--ig-theme3-frame-width, 8px) dashed var(--ig-theme3-frame-color, #ffffff);
    padding: 0;
}

.ig-feed-container.ig-theme-framed .ig-post-thumbnail {
    border-radius: 0;
}

.ig-feed-container.ig-theme-framed .ig-post-likes-bottom {
    bottom: -35px;
}

/* Theme 4: Card - Card style with background */
.ig-feed-container.ig-theme-card .ig-post-item {
    background: var(--ig-theme4-card-bg, #ffffff);
    padding: var(--ig-theme4-card-padding, 10px);
    border-radius: 8px;
    margin-bottom: 50px;
}

.ig-feed-container.ig-theme-card.ig-card-shadow-none .ig-post-item {
    box-shadow: none;
}

.ig-feed-container.ig-theme-card.ig-card-shadow-light .ig-post-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ig-feed-container.ig-theme-card.ig-card-shadow-medium .ig-post-item {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ig-feed-container.ig-theme-card.ig-card-shadow-heavy .ig-post-item {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.ig-feed-container.ig-theme-card .ig-post-thumbnail {
    border-radius: 4px;
    overflow: hidden;
}

.ig-feed-container.ig-theme-card .ig-post-likes-bottom {
    bottom: -35px;
}

.ig-post-item {
    position: relative;
    aspect-ratio: 1;
    overflow: visible;
    border-radius: 0;
    cursor: pointer;
    background: var(--ig-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 50px;
}

.ig-post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ig-post-thumbnail {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 0;
}

.ig-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
    min-height: 100%;
    min-width: 100%;
    background: #f0f0f0;
}

/* Preload optimization */
.ig-post-thumbnail img[loading="lazy"] {
    content-visibility: auto;
    contain-intrinsic-size: 1px 100%;
}

.ig-post-item:hover .ig-post-thumbnail img {
    transform: scale(1.05);
}

.ig-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.ig-post-item:hover .ig-play-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.ig-carousel-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ig-post-likes-bottom {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    width: 100%;
    z-index: 10;
    white-space: nowrap;
}

.ig-post-likes-bottom svg {
    flex-shrink: 0;
}

.ig-post-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

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

.ig-hover-stats {
    display: flex;
    align-items: center;
    gap: 30px;
    color: white;
}

.ig-hover-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.ig-hover-stat span {
    color: white;
}

.ig-hover-stat svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.ig-carousel-count-hover {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: none;
}

.ig-post-item:hover .ig-carousel-count-hover {
    display: block;
}

.ig-total-likes {
    text-align: center;
    padding: 20px;
    background: var(--ig-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ig-likes-icon {
    font-size: 24px;
    margin-right: 8px;
}

.ig-likes-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--ig-primary);
}

.ig-instagram-button-wrapper {
    text-align: center;
    margin-top: 20px;
}

.ig-instagram-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    /* Default gradient - will be overridden by inline styles */
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: transform 0.3s ease;
    /* box-shadow removed as requested */
}

.ig-instagram-button:hover {
    transform: translateY(-2px);
    /* Preserve text color on hover */
}

.ig-instagram-button svg {
    width: 24px;
    height: 24px;
}

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

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

.ig-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ig-modal.active .ig-modal-overlay {
    opacity: 1;
}

.ig-modal-content {
    position: relative;
    max-width: 935px;
    width: 90%;
    max-height: 90vh;
    background: var(--ig-secondary);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10001;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 4px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ig-modal.active .ig-modal-content {
    opacity: 1;
    transform: scale(1);
}

.ig-modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.0975);
    background: var(--ig-secondary);
    flex-shrink: 0;
    margin-bottom: 0;
}

.ig-modal-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ig-modal-profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.ig-modal-profile-info {
    flex: 1;
}

.ig-modal-profile-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--ig-text);
}

.ig-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    transition: all 0.3s ease;
    opacity: 0.9;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.ig-modal-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    opacity: 1;
    transform: translateY(-50%) scale(1.15);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.ig-modal-nav:active {
    transform: translateY(-50%) scale(1.05);
}

.ig-modal-nav-prev {
    left: 20px;
}

.ig-modal-nav-next {
    right: 20px;
}

.ig-modal-nav svg {
    width: 28px;
    height: 28px;
    fill: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.ig-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.ig-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.ig-modal-body {
    display: flex;
    max-height: calc(90vh - 0px);
    overflow: hidden;
    min-height: 500px;
}

.ig-modal-media {
    flex: 0 0 60%;
    min-width: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

.ig-modal-media img,
.ig-modal-media video {
    max-width: 100%;
    max-height: calc(90vh - 0px);
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.ig-modal-media video {
    background: #000;
}

.ig-modal-media .ig-carousel-gallery {
    width: 100%;
    height: 100%;
    position: relative;
}

.ig-modal-media .ig-carousel-item {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.ig-modal-media .ig-carousel-item.active {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ig-modal-media .ig-carousel-item img,
.ig-modal-media .ig-carousel-item video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ig-modal-media .ig-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #333;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ig-modal-media .ig-carousel-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ig-modal-media .ig-carousel-prev {
    left: 20px;
}

.ig-modal-media .ig-carousel-next {
    right: 20px;
}

.ig-carousel-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    z-index: 10;
}

.ig-modal-info {
    flex: 0 0 40%;
    min-width: 335px;
    padding: 0;
    overflow-y: auto;
    max-height: calc(90vh - 0px);
    display: flex;
    flex-direction: column;
    background: var(--ig-secondary);
    border-left: 1px solid rgba(0, 0, 0, 0.0975);
}

.ig-modal-caption {
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: var(--ig-text);
    padding: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
}

.ig-modal-caption a {
    color: #00376b;
    text-decoration: none;
    font-weight: 600;
}

.ig-modal-caption a:hover {
    text-decoration: underline;
}

.ig-hashtag {
    display: inline;
    color: #00376b;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    word-break: break-word;
    margin-right: 4px;
}

.ig-hashtag:hover {
    opacity: 0.7;
    text-decoration: underline;
    color: #00376b;
}

.ig-modal-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.0975);
    flex-shrink: 0;
    background: var(--ig-secondary);
}

.ig-share-button,
.ig-view-post-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.0975);
    background: transparent;
    color: #000000 !important; /* Default black text */
    cursor: pointer;
}

.ig-button-icon {
    font-size: 16px;
}

/* Share Popup */
.ig-share-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ig-share-popup.active {
    opacity: 1;
    pointer-events: all;
}

.ig-share-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.ig-share-popup-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.ig-share-popup.active .ig-share-popup-content {
    transform: scale(1);
}

.ig-share-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.ig-share-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.ig-share-popup-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.ig-share-popup-close:hover {
    background: #f0f0f0;
}

.ig-share-popup-options {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ig-share-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: background 0.2s;
    border: 1px solid #e0e0e0;
}

.ig-share-option:hover {
    background: #f5f5f5;
}

.ig-share-option svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.ig-share-whatsapp {
    color: #25D366;
}

.ig-share-email {
    color: #34A853;
}

.ig-share-facebook {
    color: #1877F2;
}

.ig-share-twitter {
    color: #1DA1F2;
}

.ig-share-linkedin {
    color: #0077B5;
}

.ig-share-copy {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

.ig-share-url-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.ig-share-copy-btn {
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.ig-share-copy-btn:hover {
    background: #005a87;
}

.ig-share-button:hover,
.ig-view-post-button:hover {
    background: rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: var(--ig-text);
}

.ig-share-button svg,
.ig-view-post-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.ig-error,
.ig-empty {
    text-align: center;
    padding: 40px;
    color: #666;
    background: var(--ig-secondary);
    border-radius: 8px;
    margin: 20px 0;
}

/* Load More Button */
.ig-load-more-button-wrapper {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
}

.ig-load-more-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    /* Default styles - will be overridden by inline styles */
    background: var(--ig-primary, #0073aa);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;

}

.ig-load-more-button:hover {
    transform: translateY(-2px);
  
}

.ig-load-more-button:hover .ig-load-more-arrow {
    transform: translateY(3px);
}

.ig-load-more-button:active {
    transform: translateY(0);
}

.ig-load-more-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ig-load-more-arrow {
    font-size: 18px;
    line-height: 1;
}

.ig-load-more-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

.ig-load-more-wrapper {
    display: none;
}

.ig-load-more-grid {
    display: none;
}

@media (max-width: 768px) {
    .ig-modal-body {
        flex-direction: column;
    }
    
    .ig-modal-media {
        min-width: 100%;
        max-width: 100%;
        max-height: 50vh;
    }
    
    .ig-modal-info {
        max-height: 50vh;
    }
}

