/* ============================================================
   InstaFeed News v4.3.0
   Premium Instagram-style | Green + Orange accents
   ============================================================ */

/* ── Reset scoped to plugin ── */
.ifn-root *, .ifn-root *::before, .ifn-root *::after {
    box-sizing: border-box; margin: 0; padding: 0;
}
.ifn-root a   { text-decoration: none; color: inherit; }
.ifn-root img { display: block; max-width: 100%; }

/* ── Tokens ── */
.ifn-root {
    /* Primary = green, secondary = orange, accent red kept for likes */
    --green:  #16a34a;
    --green2: #15803d;
    --orange: #f97316;
    --red:    #e63946;
    --text:   #111111;
    --sub:    #4b5563;
    --muted:  #9ca3af;
    --bg:     #f3f4f6;
    --white:  #ffffff;
    --bd:     #e5e7eb;
    --sb-w:   244px;
    --r:      14px;

    display: flex;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* ============================================================
   LEFT SIDEBAR
   ============================================================ */
.ifn-left {
    width: var(--sb-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 14px 16px;
    background: var(--white);
    border-right: 1px solid var(--bd);
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 50;
}
.ifn-left::-webkit-scrollbar { display: none; }

/* Brand */
.ifn-brand { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--bd); }
.ifn-logo-img  { max-width: 140px; height: auto; }
.ifn-logo-text { font-size: 20px; font-weight: 900; color: var(--green); letter-spacing: -.5px; line-height: 1.1; }
.ifn-tagline   { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* Nav */
.ifn-nav { display: flex; flex-direction: column; gap: 2px; }
.ifn-nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 11px;
    font-size: 14.5px; font-weight: 600; color: var(--sub);
    transition: background 140ms, color 140ms;
}
.ifn-nav-link svg    { flex-shrink: 0; width: 20px; height: 20px; }
.ifn-nav-link:hover  { background: #f0fdf4; color: var(--green); }
.ifn-nav-link.active {
    background: linear-gradient(135deg, #f0fdf4 0%, #fff7ed 100%);
    color: var(--green);
    font-weight: 700;
}
.ifn-nav-link.active svg { stroke: var(--green); }

/* Social icons — ALWAYS visible, brand colored */
.ifn-social-heading {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .9px; color: var(--muted);
    margin-top: 20px; padding: 14px 0 8px;
    border-top: 1px solid var(--bd);
}
.ifn-social { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 16px; }

.ifn-soc-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--soc-color, #6b7280);
    color: #fff;
    transition: transform 160ms, opacity 160ms, box-shadow 160ms;
    flex-shrink: 0;
}
.ifn-soc-link:hover {
    transform: scale(1.12) translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
    opacity: .92;
}
/* Unset icons (admin-only) — dimmed */
.ifn-soc-link.ifn-soc-unset {
    opacity: .22;
    filter: grayscale(1);
}
.ifn-soc-link.ifn-soc-unset:hover { opacity: .5; filter: grayscale(.5); }

/* Footer */
.ifn-left-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--bd); }
.ifn-footer-links { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; font-size: 11px; margin-bottom: 5px; }
.ifn-footer-links a { color: var(--muted); }
.ifn-footer-links a:hover { color: var(--green); }
.ifn-footer-sep { color: var(--bd); }
.ifn-copy { font-size: 10.5px; color: #c0c0c8; }

/* ============================================================
   TABLET — slim sidebar, social icons survive as icon-only
   ============================================================ */
@media (max-width: 960px) {
    .ifn-root   { --sb-w: 72px; }
    /* hide text, keep icons */
    .ifn-logo-text, .ifn-tagline,
    .ifn-nav-link span,
    .ifn-social-heading,
    .ifn-left-footer { display: none; }
    .ifn-brand    { margin-bottom: 16px; padding-bottom: 12px; }
    .ifn-logo-img { max-width: 36px; }
    .ifn-nav-link { padding: 11px; justify-content: center; border-radius: 12px; }
    .ifn-left     { padding: 14px 8px; align-items: center; }
    /* Social icons stay visible — just stacked */
    .ifn-social { flex-direction: column; align-items: center; gap: 6px; padding-bottom: 10px; }
    .ifn-social-heading { display: none; }
}

/* ============================================================
   MAIN COLUMN
   ============================================================ */
.ifn-main { flex: 1; min-width: 0; max-width: 680px; margin: 0 auto; padding-bottom: 80px; }

/* View title (Discover / Saved Articles) */
.ifn-view-title {
    font-size: 20px; font-weight: 800; color: var(--text);
    padding: 18px 20px 2px;
    display: none; /* JS shows/hides */
}

/* ============================================================
   SEARCH ROW
   ============================================================ */
.ifn-search-row {
    position: sticky; top: 0; z-index: 40;
    background: var(--bg); padding: 14px 20px 12px;
    border-bottom: 1px solid var(--bd);
}
.ifn-search-inner { position: relative; display: flex; align-items: center; }
.ifn-srch-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted); display: flex; pointer-events: none; z-index: 1;
}
.ifn-srch-input {
    display: block; width: 100%; height: 42px;
    padding: 0 36px 0 44px;
    border: 1.5px solid var(--bd); border-radius: 22px;
    background: var(--white); font-size: 14px; color: var(--text);
    outline: none; transition: border-color 200ms, box-shadow 200ms;
    -webkit-appearance: none;
}
.ifn-srch-input::placeholder { color: var(--muted); }
.ifn-srch-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.ifn-search-inner:focus-within .ifn-srch-icon { color: var(--green); }
.ifn-srch-clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    width: 22px; height: 22px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center;
    color: var(--muted); font-size: 12px; background: none; border: none; cursor: pointer;
}
.ifn-srch-clear:hover { background: var(--bd); }

/* ============================================================
   CATEGORY STRIP
   ============================================================ */
.ifn-cat-strip {
    padding: 12px 20px; border-bottom: 1px solid var(--bd);
    background: var(--bg); position: sticky;
    top: 69px; /* overridden by JS dynamically */
    z-index: 39;
}
.ifn-cat-scroll {
    display: flex; gap: 8px; overflow-x: auto;
    scrollbar-width: none; padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}
.ifn-cat-scroll::-webkit-scrollbar { display: none; }

.ifn-cat-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; flex-shrink: 0; padding: 3px 5px;
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    outline: none; font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.ifn-cat-icon {
    width: 62px; height: 62px; border-radius: 50%; overflow: hidden;
    background: var(--bd); border: 2.5px solid transparent;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 180ms, box-shadow 180ms, transform 180ms;
    font-size: 22px; font-weight: 800;
}
.ifn-cat-icon img { width: 100%; height: 100%; object-fit: cover; }
.ifn-cat-icon-all { background: var(--white); color: var(--muted); }
.ifn-cat-item:hover  .ifn-cat-icon { transform: scale(1.07); }
.ifn-cat-item.active .ifn-cat-icon {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.18);
}
.ifn-cat-item.active .ifn-cat-icon-all { background: #fff7ed; color: var(--orange); }
.ifn-cat-label {
    font-size: 11px; font-weight: 600; color: var(--muted);
    text-align: center; line-height: 1.2; max-width: 68px; transition: color 180ms;
}
.ifn-cat-item.active .ifn-cat-label { color: var(--orange); }

/* ============================================================
   FEED
   ============================================================ */
.ifn-feed { display: flex; flex-direction: column; padding: 18px 18px 0; gap: 0; }

/* ============================================================
   CARD WRAP
   ============================================================ */
.ifn-card-wrap {
    background: var(--white); border-radius: var(--r);
    border: 1px solid var(--bd); margin-bottom: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow 220ms, transform 220ms;
    position: relative; isolation: isolate;
}
.ifn-card-wrap:hover { box-shadow: 0 6px 24px rgba(0,0,0,.10); transform: translateY(-2px); }
.ifn-card { display: block; color: var(--text); border-radius: var(--r) var(--r) 0 0; overflow: hidden; }

/* Image */
.ifn-card-img-wrap {
    position: relative; width: 100%; padding-top: 58%;
    overflow: hidden; background: #e5e7eb;
}
.ifn-card-img-wrap img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; transition: transform 360ms;
}
.ifn-card-wrap:hover .ifn-card-img-wrap img { transform: scale(1.04); }

/* Video */
.ifn-card-video-wrap { position: relative; width: 100%; padding-top: 56.25%; overflow: hidden; background: #000; }
.ifn-card-video      { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ifn-video-mute-btn  {
    position: absolute; bottom: 10px; right: 10px; z-index: 5;
    display: flex; align-items: center; gap: 5px;
    background: rgba(0,0,0,.55); color: #fff;
    border: none; border-radius: 20px; padding: 5px 10px 5px 8px;
    font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ifn-video-play-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.22); opacity: 0; transition: opacity 200ms; pointer-events: none; z-index: 4;
}
.ifn-card-video-wrap.paused .ifn-video-play-overlay { opacity: 1; }
.ifn-video-play-circle {
    width: 54px; height: 54px; border-radius: 50%;
    background: rgba(255,255,255,.88); display: flex; align-items: center; justify-content: center;
}

/* Category badge */
.ifn-card-badge {
    position: absolute; top: 12px; left: 12px;
    background: var(--orange); color: #fff;
    font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
    padding: 3px 10px; border-radius: 20px; pointer-events: none; z-index: 3;
}

/* Card text */
.ifn-card-body    { padding: 16px 18px 14px; }
.ifn-card-title   { font-size: 16.5px; font-weight: 800; line-height: 1.45; margin-bottom: 8px; }
.ifn-card-excerpt { font-size: 13.5px; line-height: 1.65; color: var(--sub); margin-bottom: 12px; }
.ifn-card-source  {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12.5px; font-weight: 700; color: var(--green);
    padding: 4px 11px 4px 9px;
    background: #f0fdf4; border-radius: 20px; margin-bottom: 10px;
    transition: background 140ms;
}
.ifn-card-source:hover { background: #dcfce7; }
.ifn-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--bd); }
.ifn-card-meta   { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.ifn-card-dot    { color: #d1d5db; }
.ifn-card-ago    { font-weight: 600; }
.ifn-card-readmore {
    font-size: 12.5px; font-weight: 700; color: var(--green);
    background: #f0fdf4; padding: 5px 14px; border-radius: 20px;
    transition: background 140ms, color 140ms;
}
.ifn-card-wrap:hover .ifn-card-readmore { background: var(--green); color: #fff; }

/* ============================================================
   ACTION BAR — Premium Instagram-style
   ============================================================ */
.ifn-card-actions {
    display: flex;
    align-items: center;
    padding: 4px 10px 8px;
    border-top: 1px solid var(--bd);
    border-radius: 0 0 var(--r) var(--r);
    background: var(--white);
    position: relative;
    gap: 2px;
}

/* Force visibility — some themes aggressively hide buttons */
.ifn-root .ifn-card-actions button,
.ifn-root .ifn-card-actions .ifn-act-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.ifn-act-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    background: transparent;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--sub);
    line-height: 1;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
    overflow: hidden;
    transition: color 140ms, background 140ms;
}
.ifn-act-btn:hover { background: var(--bg); }
.ifn-act-btn svg   { flex-shrink: 0; display: block; }

/* LIKE button */
.ifn-act-like:hover { color: var(--red); }
.ifn-act-like.liked { color: var(--red); }
.ifn-act-like.liked .ifn-heart-svg { fill: var(--red); stroke: var(--red); }

@keyframes ifn-heart-pop {
    0%   { transform: scale(1); }
    15%  { transform: scale(0.85); }
    35%  { transform: scale(1.32); }
    55%  { transform: scale(0.95); }
    70%  { transform: scale(1.15); }
    85%  { transform: scale(0.98); }
    100% { transform: scale(1); }
}
.ifn-act-like.pop .ifn-heart-svg {
    animation: ifn-heart-pop 550ms cubic-bezier(.34,1.56,.64,1) forwards;
}

/* SHARE button */
.ifn-act-share:hover { color: var(--orange); }

/* BOOKMARK button — pushed to right */
.ifn-act-bookmark { margin-left: auto; }
.ifn-act-bookmark:hover { color: var(--green); }
.ifn-act-bookmark.saved { color: var(--green); }
.ifn-act-bookmark.saved .ifn-bk-svg { fill: var(--green); stroke: var(--green); }

@keyframes ifn-bk-pop {
    0%   { transform: scale(1) translateY(0); }
    20%  { transform: scale(.82) translateY(-5px); }
    50%  { transform: scale(1.25) translateY(2px); }
    75%  { transform: scale(.96) translateY(-1px); }
    100% { transform: scale(1) translateY(0); }
}
.ifn-act-bookmark.pop .ifn-bk-svg {
    animation: ifn-bk-pop 480ms cubic-bezier(.34,1.56,.64,1) forwards;
}

.ifn-act-count { font-size: 12px; font-weight: 700; }
.ifn-act-label { font-size: 13px; }

/* Ripple */
.ifn-ripple {
    position: absolute; inset: 0; border-radius: 9px;
    background: rgba(0,0,0,.07); pointer-events: none;
    transform: scale(0); opacity: 1;
    animation: ifn-ripple 320ms ease forwards;
}
@keyframes ifn-ripple { to { transform: scale(1); opacity: 0; } }

/* Share wrap */
.ifn-act-share-wrap { position: relative; display: inline-flex; }

/* ============================================================
   SHARE DROPDOWN
   ============================================================ */
.ifn-share-dropdown {
    position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%); min-width: 190px;
    background: var(--white); border: 1px solid var(--bd); border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.07);
    z-index: 500; padding: 5px; overflow: hidden;
    transform-origin: bottom center;
    animation: ifn-dd-in 170ms cubic-bezier(.34,1.56,.64,1) both;
}
.ifn-share-dropdown[hidden] { display: none !important; }
@keyframes ifn-dd-in {
    from { opacity: 0; transform: translateX(-50%) scale(.84) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) scale(1)   translateY(0); }
}
.ifn-share-opt {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 11px; border-radius: 9px;
    font-size: 13px; font-weight: 600; color: var(--text);
    text-decoration: none; cursor: pointer;
    background: transparent; border: none; font-family: inherit;
    transition: background 100ms;
}
.ifn-share-opt:hover  { background: var(--bg); }
.ifn-share-icon {
    width: 28px; height: 28px; border-radius: 7px;
    background: var(--soc, #6b7280); color: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ============================================================
   LOADER
   ============================================================ */
.ifn-loader { display: none; justify-content: center; padding: 52px 0; }
.ifn-loader.is-visible { display: flex; }
.ifn-spinner {
    width: 32px; height: 32px; border: 3px solid var(--bd);
    border-top-color: var(--green); border-radius: 50%;
    animation: ifnspin .75s linear infinite;
}
@keyframes ifnspin { to { transform: rotate(360deg); } }

.ifn-empty { text-align: center; padding: 64px 20px; color: var(--muted); font-size: 15px; }
.ifn-empty-icon { font-size: 48px; margin-bottom: 12px; }

.ifn-more-wrap { text-align: center; padding: 18px 18px 4px; }
.ifn-more-btn {
    display: inline-block; padding: 11px 44px;
    border: 2px solid var(--green); border-radius: 26px;
    background: transparent; color: var(--green);
    font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit;
    transition: background 180ms, color 180ms, box-shadow 180ms;
}
.ifn-more-btn:hover { background: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,.28); }

/* ============================================================
   MOBILE BOTTOM TAB BAR
   ============================================================ */
.ifn-tab-bar {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(255,255,255,.96);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border-top: 1px solid var(--bd); height: 60px; padding: 0 6px;
    justify-content: space-around; align-items: center;
}
.ifn-tab-link {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); font-size: 9.5px; font-weight: 600;
    padding: 6px 12px; border-radius: 10px;
    transition: color 140ms; -webkit-tap-highlight-color: transparent;
}
.ifn-tab-link svg { width: 22px; height: 22px; stroke: currentColor; }
.ifn-tab-link.active, .ifn-tab-link:hover { color: var(--green); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .ifn-left    { display: none; }
    .ifn-tab-bar { display: flex; }
    .ifn-main    { max-width: 100%; padding-bottom: 72px; }
    .ifn-feed    { padding: 12px 12px 0; }
    .ifn-card-wrap    { margin-bottom: 14px; border-radius: 12px; }
    .ifn-card         { border-radius: 12px 12px 0 0; }
    .ifn-card-actions { border-radius: 0 0 12px 12px; padding: 3px 6px 7px; }
    .ifn-search-row   { padding: 10px 12px 10px; }
    .ifn-cat-strip    { padding: 10px 12px; top: 63px; }
    .ifn-cat-icon     { width: 52px; height: 52px; }
    .ifn-cat-label    { font-size: 10px; max-width: 54px; }
    .ifn-card-title   { font-size: 15.5px; }
    .ifn-card-body    { padding: 13px 14px 12px; }
    .ifn-act-btn      { padding: 6px 8px; font-size: 12.5px; gap: 4px; }
    .ifn-share-dropdown {
        left: 0; right: auto; transform: none; transform-origin: bottom left;
        animation-name: ifn-dd-left;
    }
    @keyframes ifn-dd-left {
        from { opacity: 0; transform: scale(.88) translateY(8px); }
        to   { opacity: 1; transform: scale(1)   translateY(0); }
    }
}
@media (max-width: 380px) {
    .ifn-act-label { display: none; }
    .ifn-act-btn   { padding: 8px 9px; }
}
