/**
 * Instagram Feed Pro - Frontend CSS
 * Utilise des variables CSS pour la personnalisation
 */

.ifp-container {
    --ifp-primary: #E1306C;
    --ifp-secondary: #833AB4;
    --ifp-accent: #F77737;
    --ifp-text: #FFFFFF;
    --ifp-overlay: rgba(0, 0, 0, 0.7);
    --ifp-radius: 12px;
    --ifp-spacing: 16px;
    
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

.ifp-container *, .ifp-container *::before, .ifp-container *::after {
    box-sizing: border-box;
}

.ifp-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 60px;
}

.ifp-carousel {
    overflow: hidden;
    width: 100%;
    touch-action: pan-y pinch-zoom;
}

.ifp-carousel-track {
    display: flex;
    gap: var(--ifp-spacing);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ifp-post-card {
    flex: 0 0 calc(33.333% - var(--ifp-spacing) * 2 / 3);
    max-width: calc(33.333% - var(--ifp-spacing) * 2 / 3);
    min-width: calc(33.333% - var(--ifp-spacing) * 2 / 3);
    border-radius: var(--ifp-radius);
    overflow: hidden;
    background: #fff;
    transition: transform 300ms ease, box-shadow 300ms ease;
}

.ifp-post-card:hover {
    transform: translateY(-5px);
}

.ifp-post-link {
    display: block;
    text-decoration: none;
}

.ifp-post-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    overflow: hidden;
    background: #f0f0f0;
}

.ifp-post-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms ease, opacity 300ms ease;
}

.ifp-post-card:hover .ifp-post-image {
    transform: scale(1.05);
    opacity: 0.85;
}

.ifp-video-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 2;
}

.ifp-video-indicator svg {
    width: 12px;
    height: 12px;
    margin-left: 2px;
}

.ifp-post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ifp-overlay);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 300ms ease;
}

.ifp-post-card:hover .ifp-post-overlay {
    opacity: 1;
}

.ifp-post-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
}

.ifp-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ifp-text);
    font-size: 16px;
    font-weight: 600;
}

.ifp-stat svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.ifp-likes svg {
    fill: var(--ifp-primary);
}

.ifp-comments svg {
    fill: var(--ifp-accent);
}

.ifp-post-caption {
    color: var(--ifp-text);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    max-width: 90%;
    opacity: 0.9;
}

.ifp-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ifp-primary), var(--ifp-secondary));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 10;
    transition: all 300ms ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 0;
    outline: none;
}

.ifp-nav:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.ifp-nav:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

.ifp-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%);
    pointer-events: none;
}

.ifp-nav svg {
    width: 20px;
    height: 20px;
}

.ifp-nav-prev { left: 0; }
.ifp-nav-next { right: 0; }

.ifp-dots-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.ifp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 300ms ease;
    opacity: 0.5;
}

.ifp-dot:hover {
    background: var(--ifp-accent);
    opacity: 0.8;
    transform: scale(1.2);
}

.ifp-dot.active {
    background: linear-gradient(135deg, var(--ifp-primary), var(--ifp-secondary));
    width: 24px;
    border-radius: 5px;
    opacity: 1;
}

.ifp-dot.visible {
    background: var(--ifp-accent);
    opacity: 0.7;
}

.ifp-follow-button-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.ifp-follow-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--ifp-primary), var(--ifp-secondary), var(--ifp-accent));
    background-size: 200% 200%;
    animation: ifp-gradient 3s ease infinite;
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    transition: all 300ms ease;
    box-shadow: 0 4px 15px rgba(131, 58, 180, 0.4);
}

.ifp-follow-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(131, 58, 180, 0.5);
    color: #fff;
}

.ifp-instagram-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

@keyframes ifp-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.ifp-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--ifp-radius);
    padding: 16px 20px;
    color: #856404;
    text-align: center;
}

@media (max-width: 992px) {
    .ifp-post-card {
        flex: 0 0 calc(50% - var(--ifp-spacing) / 2);
        max-width: calc(50% - var(--ifp-spacing) / 2);
        min-width: calc(50% - var(--ifp-spacing) / 2);
    }
    .ifp-carousel-wrapper { padding: 0 50px; }
}

@media (max-width: 768px) {
    .ifp-post-card {
        flex: 0 0 100%;
        max-width: 100%;
        min-width: 100%;
    }
    .ifp-carousel-wrapper { padding: 0 45px; }
    .ifp-nav { width: 36px; height: 36px; }
    .ifp-nav svg { width: 16px; height: 16px; }
}

@media (max-width: 480px) {
    .ifp-carousel-wrapper { padding: 0 40px; }
    .ifp-nav { width: 32px; height: 32px; }
}
