/* ============================================================
   InstaFeed News v4.1.1 — fixed action bar, loader, sticky, video
   ============================================================ */

/* ── Scoped reset ── */
.ifn-root *, .ifn-root *::before, .ifn-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
.ifn-root a   { text-decoration: none; }
.ifn-root img { display: block; max-width: 100%; }

/* ── Design tokens ── */
.ifn-root {
    --acc:   #e63946;
    --text:  #111111;
    --sub:   #4b5563;
    --muted: #9ca3af;
    --bg:    #f3f4f6;
    --white: #ffffff;
    --bd:    #e5e7eb;
    --sb-w:  244px;
    --r:     16px;
    --sp:    cubic-bezier(.34,1.56,.64,1);
    --ease:  cubic-bezier(.22,1,.36,1);

    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: 28px 16px 20px;
    background: var(--white);
    border-right: 1px solid var(--bd);
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 50;
}
.ifn-left::-webkit-scrollbar { display: none; }
.ifn-brand { margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--bd); }
.ifn-logo-img  { max-width: 140px; height: auto; }
.ifn-logo-text { font-size: 21px; font-weight: 900; color: var(--acc); letter-spacing: -.5px; }
.ifn-tagline   { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.ifn-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ifn-nav-link {
    display: flex; align-items: center; gap: 13px;
    padding: 11px 14px; border-radius: 12px;
    font-size: 15px; font-weight: 600; color: var(--sub);
    transition: background 150ms, color 150ms;
}
.ifn-nav-link svg    { flex-shrink: 0; opacity: .7; }
.ifn-nav-link:hover  { background: var(--bg); color: var(--text); }
.ifn-nav-link.active { background: rgba(230,57,70,.09); color: var(--acc); font-weight: 700; }
.ifn-nav-link.active svg { stroke: var(--acc); opacity: 1; }
.ifn-social-heading {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
    color: var(--muted); padding: 20px 0 10px;
    border-top: 1px solid var(--bd); margin-top: 16px;
}
.ifn-social { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 18px; }
.ifn-soc-link {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--bg); color: var(--muted);
    transition: background 150ms, color 150ms;
}
.ifn-soc-link:hover { background: var(--acc); color: #fff; }
.ifn-left-footer { display: flex; flex-direction: column; gap: 7px; padding-top: 14px; border-top: 1px solid var(--bd); }
.ifn-footer-links { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 11.5px; }
.ifn-footer-links a { color: var(--muted); }
.ifn-footer-links a:hover { color: var(--acc); }
.ifn-footer-sep { color: #d1d5db; }
.ifn-copy { font-size: 11px; color: #c0c0c8; }

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

/* ============================================================
   SEARCH ROW
   ============================================================ */
.ifn-search-row {
    position: sticky; top: 0; z-index: 40;
    background: var(--bg); padding: 16px 20px 14px;
}
.ifn-search-row::after { content: ''; display: block; height: 1px; background: var(--bd); margin-top: 12px; }
.ifn-search-inner { position: relative; display: flex; align-items: center; }
.ifn-srch-icon {
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
    color: var(--muted); display: flex; pointer-events: none; z-index: 1;
}
.ifn-srch-input {
    display: block; width: 100%; height: 44px;
    padding: 0 38px 0 46px;
    border: 1.5px solid var(--bd); border-radius: 24px;
    background: var(--white); font-size: 14.5px; color: var(--text);
    outline: none; box-shadow: none;
    transition: border-color 200ms, box-shadow 200ms;
    -webkit-appearance: none; appearance: none;
}
.ifn-srch-input::placeholder { color: var(--muted); }
.ifn-srch-input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(230,57,70,.11); }
.ifn-search-inner:focus-within .ifn-srch-icon { color: var(--acc); }
.ifn-srch-clear {
    position: absolute; right: 11px; 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: 13px;
    background: none; border: none; cursor: pointer;
    transition: background 120ms;
}
.ifn-srch-clear:hover { background: var(--bd); }

/* ============================================================
   CATEGORY STRIP
   top is set dynamically by JS via --ifn-cat-top on .ifn-main
   ============================================================ */
.ifn-cat-strip {
    padding: 14px 20px; border-bottom: 1px solid var(--bd);
    background: var(--bg);
    position: sticky; top: var(--ifn-cat-top, 77px); z-index: 30;
    /* z-index 30 < search(40) but must NOT paint over card share dropdown(500) */
}
.ifn-cat-scroll {
    display: flex; gap: 10px; 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: 7px; flex-shrink: 0; padding: 4px 6px;
    cursor: pointer; background: transparent !important; border: none !important;
    outline: none; box-shadow: none !important;
    font-family: inherit; -webkit-tap-highlight-color: transparent;
    border-radius: 0 !important;  /* some themes add border-radius to buttons */
}
.ifn-cat-icon {
    width: 64px; height: 64px; border-radius: 50%; overflow: hidden;
    background: var(--bd); border: 2.5px solid transparent;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 200ms, box-shadow 200ms, transform 200ms var(--sp);
}
.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.06); }
.ifn-cat-item.active .ifn-cat-icon { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(230,57,70,.15); }
.ifn-cat-item.active .ifn-cat-icon-all { background: rgba(230,57,70,.08); color: var(--acc); }
.ifn-cat-label {
    font-size: 11.5px; font-weight: 600; color: var(--muted);
    text-align: center; line-height: 1.25; max-width: 70px; transition: color 200ms;
}
.ifn-cat-item.active .ifn-cat-label { color: var(--acc); }

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

/* ============================================================
   CARD WRAP
   ============================================================ */
.ifn-card-wrap {
    background: var(--white); border-radius: var(--r);
    border: 1px solid var(--bd); margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    transition: box-shadow 240ms var(--ease), transform 240ms var(--ease);
    position: relative;
    isolation: isolate;   /* own stacking context — dropdown z-index relative to this */
}
.ifn-card-wrap:hover { box-shadow: 0 8px 32px rgba(0,0,0,.11); 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: 60%;
    overflow: hidden; background: #e8eaed;
}
.ifn-card-img-wrap img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; transition: transform 380ms var(--ease);
}
.ifn-card-wrap:hover .ifn-card-img-wrap img { transform: scale(1.04); }

/* ── VIDEO EMBED ── */
.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);
    transition: background 150ms;
}
.ifn-video-mute-btn:hover { background: rgba(0,0,0,.8); }
.ifn-video-play-overlay {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,.25);
    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: 56px; height: 56px; border-radius: 50%;
    background: rgba(255,255,255,.9);
    display: flex; align-items: center; justify-content: center;
}

.ifn-card-badge {
    position: absolute; top: 14px; left: 14px;
    background: var(--acc); color: #fff;
    font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
    padding: 4px 11px; border-radius: 20px; pointer-events: none; z-index: 3;
}
.ifn-card-body    { padding: 18px 20px 14px; }
.ifn-card-title   { font-size: 17px; font-weight: 800; line-height: 1.45; margin-bottom: 9px; }
.ifn-card-excerpt { font-size: 14px; line-height: 1.7; color: var(--sub); margin-bottom: 12px; }
.ifn-card-source {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 13px; font-weight: 700; color: var(--acc);
    padding: 5px 12px 5px 10px;
    background: rgba(230,57,70,.07); border-radius: 20px; margin-bottom: 12px;
    transition: background 150ms;
}
.ifn-card-source:hover { background: rgba(230,57,70,.13); }
.ifn-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 11px; border-top: 1px solid var(--bd); }
.ifn-card-meta   { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ifn-card-dot    { color: #ddd; }
.ifn-card-ago    { font-weight: 600; }
.ifn-card-readmore {
    font-size: 13px; font-weight: 700; color: var(--acc);
    background: rgba(230,57,70,.08); padding: 6px 16px; border-radius: 22px;
    transition: background 150ms, color 150ms;
}
.ifn-card-wrap:hover .ifn-card-readmore { background: var(--acc); color: #fff; }

/* ============================================================
   ACTION BAR — THE FIX
   No !important on display/visibility — that was fighting themes.
   Instead we rely on specificity (.ifn-card-actions .ifn-act-btn)
   and scoped override for theme button resets.
   ============================================================ */
.ifn-card-actions {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 6px 8px 10px;
    border-top: 1px solid var(--bd);
    border-radius: 0 0 var(--r) var(--r);
    background: var(--white);
    position: relative;
}

/* Force any theme button reset to not hide our 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-bookmark { margin-left: auto; }

.ifn-act-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #262626;
    line-height: 1;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
    overflow: hidden;
    transition: color 150ms;
}
.ifn-act-btn:active { transform: scale(0.88); transition-duration: 50ms; }
.ifn-act-btn svg    { flex-shrink: 0; display: block; }
.ifn-act-label { line-height: 1; }
.ifn-act-count { font-size: 13px; font-weight: 700; line-height: 1; color: inherit; }

.ifn-act-like.liked { color: #e63946; }
.ifn-act-like.liked .ifn-heart-svg { fill: #e63946; stroke: #e63946; }

@keyframes ifn-heart-pop {
    0%   { transform: scale(1); }   20%  { transform: scale(1.28); }
    45%  { transform: scale(0.88); } 70%  { transform: scale(1.14); }
    90%  { transform: scale(0.97); } 100% { transform: scale(1); }
}
.ifn-act-like.pop .ifn-heart-svg { animation: ifn-heart-pop 480ms var(--sp) forwards; }

.ifn-act-bookmark.saved { color: #111; }
.ifn-act-bookmark.saved .ifn-bk-svg { fill: #111; stroke: #111; }

@keyframes ifn-bk-pop {
    0%   { transform: scale(1) translateY(0); }  25% { transform: scale(.86) translateY(-4px); }
    55%  { transform: scale(1.22) translateY(2px); } 80% { transform: scale(.97) translateY(-1px); }
    100% { transform: scale(1) translateY(0); }
}
.ifn-act-bookmark.pop .ifn-bk-svg { animation: ifn-bk-pop 440ms var(--sp) forwards; }

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

.ifn-ripple {
    position: absolute; inset: 0; border-radius: 8px;
    background: rgba(0,0,0,.06); pointer-events: none;
    transform: scale(0); opacity: 1;
    animation: ifn-ripple 360ms var(--ease) forwards;
}
@keyframes ifn-ripple { to { transform: scale(1); opacity: 0; } }

/* ============================================================
   SHARE DROPDOWN
   ============================================================ */
.ifn-share-dropdown {
    position: absolute; bottom: calc(100% + 10px); left: 50%;
    transform: translateX(-50%); min-width: 196px;
    background: #fff; border: 1px solid var(--bd); border-radius: 16px;
    box-shadow: 0 8px 28px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.06);
    z-index: 500; overflow: hidden; padding: 6px;
    transform-origin: bottom center;
    animation: ifn-dd 180ms var(--sp) both;
}
.ifn-share-dropdown[hidden] { display: none; }
@keyframes ifn-dd {
    from { opacity: 0; transform: translateX(-50%) scale(.88) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) scale(1)   translateY(0); }
}
.ifn-share-opt {
    display: flex; align-items: center; gap: 11px; width: 100%;
    padding: 9px 12px; border-radius: 10px;
    font-size: 13.5px; font-weight: 600; color: var(--text);
    text-decoration: none; cursor: pointer;
    background: transparent; border: none; font-family: inherit;
    transition: background 110ms;
}
.ifn-share-opt:hover  { background: var(--bg); }
.ifn-share-opt:active { background: var(--bd); }
.ifn-share-icon {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--soc, #6b7280); color: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ============================================================
   LOADER — display:none by default, JS adds .is-visible
   ============================================================ */
.ifn-loader { display: none; justify-content: center; padding: 52px 0; }
.ifn-loader.is-visible { display: flex; }
.ifn-spinner {
    width: 34px; height: 34px; border: 3px solid #e5e7eb;
    border-top-color: var(--acc); border-radius: 50%;
    animation: ifnspin .75s linear infinite;
}
@keyframes ifnspin { to { transform: rotate(360deg); } }
.ifn-empty { text-align: center; padding: 72px 20px; color: var(--muted); font-size: 15px; }
.ifn-more-wrap { text-align: center; padding: 20px 20px 4px; }
.ifn-more-btn {
    display: inline-block; padding: 12px 48px;
    border: 2px solid var(--acc); border-radius: 28px;
    background: transparent; color: var(--acc);
    font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
    transition: background 180ms, color 180ms, box-shadow 180ms;
}
.ifn-more-btn:hover { background: var(--acc); color: #fff; box-shadow: 0 4px 14px rgba(230,57,70,.28); }
.ifn-more-btn:active { transform: scale(0.97); }

/* ============================================================
   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: 62px; padding: 0 8px;
    justify-content: space-around; align-items: center;
}
.ifn-tab-link {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted); font-size: 10px; font-weight: 600;
    padding: 6px 14px; border-radius: 12px; transition: color 150ms;
    -webkit-tap-highlight-color: transparent;
}
.ifn-tab-link svg { stroke: currentColor; }
.ifn-tab-link.active, .ifn-tab-link:hover { color: var(--acc); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
    .ifn-root { --sb-w: 68px; }
    .ifn-logo-text, .ifn-tagline, .ifn-nav-link span,
    .ifn-left-footer, .ifn-social-heading, .ifn-social { display: none; }
    .ifn-brand { margin-bottom: 16px; padding-bottom: 14px; }
    .ifn-logo-img { max-width: 36px; }
    .ifn-nav-link { padding: 12px; justify-content: center; }
    .ifn-left { padding: 16px 8px; align-items: center; }
}
@media (max-width: 600px) {
    .ifn-left    { display: none; }
    .ifn-tab-bar { display: flex; }
    .ifn-main    { max-width: 100%; padding-bottom: 74px; }
    .ifn-feed         { padding: 14px 12px 0; }
    .ifn-card-wrap    { margin-bottom: 16px; border-radius: 14px; }
    .ifn-card         { border-radius: 14px 14px 0 0; }
    .ifn-card-actions { border-radius: 0 0 14px 14px; padding: 4px 6px 8px; }
    .ifn-search-row { padding: 12px 14px 12px; }
    .ifn-srch-input { height: 42px; }
    .ifn-cat-strip  { padding: 10px 14px; }
    .ifn-cat-icon   { width: 54px; height: 54px; }
    .ifn-cat-label  { font-size: 10.5px; max-width: 56px; }
    .ifn-card-title { font-size: 16px; }
    .ifn-card-body  { padding: 14px 16px 12px; }
    .ifn-act-btn    { padding: 7px 9px; font-size: 13px; gap: 5px; }
    .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(.9) translateY(6px); }
        to   { opacity: 1; transform: scale(1)  translateY(0); }
    }
    .ifn-more-wrap { padding: 14px 14px 4px; }
}
@media (max-width: 380px) {
    .ifn-card-body { padding: 12px 14px 12px; }
    .ifn-act-label { display: none; }
    .ifn-act-count { display: inline; }
    .ifn-act-btn   { padding: 8px; gap: 0; }
}
