/* ═══════════════════════════════════════════════
   Instagram Widget — Jana Adamdar
   Стили для карточек постов и профилей Instagram
═══════════════════════════════════════════════ */

.ig-widget { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* Карточка */
.ig-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    max-width: 500px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    transition: box-shadow .2s;
}
.ig-card:hover { box-shadow: 0 4px 24px rgba(0,0,0,.12); }

/* Шапка */
.ig-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
}
.ig-avatar {
    width: 36px; height: 36px;
    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: #fff; font-size: 18px; flex-shrink: 0;
}
.ig-meta { flex: 1; min-width: 0; }
.ig-author { display: block; font-weight: 700; font-size: 14px; color: #111; }
.ig-provider { font-size: 11px; color: #9ca3af; }
.ig-logo { color: #e1306c; font-size: 22px; text-decoration: none; flex-shrink: 0; }
.ig-logo:hover { color: #c13584; }

/* Медиа */
.ig-media {
    width: 100%;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: #f9fafb;
    max-height: 400px;
}
.ig-media-placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 48px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #9ca3af;
}

/* Тело */
.ig-body { padding: 14px; }
.ig-desc {
    font-size: 14px; color: #374151; line-height: 1.6;
    margin: 0 0 12px; word-break: break-word;
}

/* Кнопка */
.ig-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: #fff !important; text-decoration: none;
    padding: 8px 18px; border-radius: 9px;
    font-size: 13px; font-weight: 700;
    transition: opacity .2s;
}
.ig-btn:hover { opacity: .85; }

/* Профиль */
.ig-profile { }
.ig-profile-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px;
}
.ig-profile-avatar {
    width: 64px; height: 64px; border-radius: 50%;
    object-fit: cover;
    border: 3px solid transparent;
    background:
        linear-gradient(#fff,#fff) padding-box,
        linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888) border-box;
    flex-shrink: 0;
}
.ig-avatar-placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
}
.ig-profile-info { flex: 1; min-width: 0; }
.ig-profile-name { font-size: 16px; font-weight: 800; color: #111; }
.ig-stat { font-size: 13px; color: #6b7280; margin-top: 3px; }
.ig-stat strong { color: #111; }
.ig-profile-bio { font-size: 13px; color: #374151; line-height: 1.5; padding: 0 16px 12px; margin: 0; }
.ig-profile .ig-btn { margin: 0 16px 16px; }

/* Скелет */
.ig-skeleton { border: 1px solid #e5e7eb; border-radius: 16px; overflow: hidden; background: #fff; max-width: 500px; }
.ig-skeleton-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.ig-sk { background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%); background-size: 200% 100%; animation: igShimmer 1.5s infinite; border-radius: 6px; }
.ig-sk-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.ig-sk-line { height: 14px; }
.ig-sk-image { width: 100%; aspect-ratio: 1; max-height: 300px; border-radius: 0; }
@keyframes igShimmer { 0%{background-position:200%} 100%{background-position:-200%} }

/* Fallback ссылка */
.ig-fallback {
    display: flex; align-items: center; gap: 14px;
    padding: 16px; border: 1px solid #e5e7eb; border-radius: 16px;
    background: #fff; text-decoration: none; color: inherit;
    transition: border-color .2s, background .2s;
    max-width: 500px;
}
.ig-fallback:hover { border-color: #e1306c; background: #fff7f7; }
.ig-fallback-icon { font-size: 32px; color: #e1306c; flex-shrink: 0; }
.ig-fallback-title { font-weight: 700; font-size: 15px; color: #111; }
.ig-fallback-url { font-size: 13px; color: #9ca3af; margin-top: 2px; }

/* oEmbed обёртка */
.ig-oembed-wrap { padding: 4px; }
.ig-oembed-wrap .instagram-media { min-width: unset !important; margin: 0 !important; }

/* В новостях — ограничиваем ширину */
.news-ig-embed { max-width: 500px; margin: 16px auto; }

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .ig-card, .ig-skeleton, .ig-fallback { background: #1e293b; border-color: #334155; }
    .ig-author, .ig-profile-name { color: #f1f5f9; }
    .ig-desc, .ig-profile-bio { color: #cbd5e1; }
    .ig-header { border-color: #334155; }
    .ig-sk { background: linear-gradient(90deg,#334155 25%,#3f4f65 50%,#334155 75%); background-size:200% 100%; }
}
