/* Feed — smooth scroll experience */
.feed-page {
    max-width: 560px;
    margin: 0 auto;
    padding-bottom: 80px;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ══════════════════════════════════════════
   FILTER BAR — separate block above the feed
   ══════════════════════════════════════════ */
.feed-filter-bar {
    max-width: 560px;
    margin: 0 auto;
    padding: 12px 0 8px;
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    box-sizing: border-box;
}

.feed-filter-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.feed-cat-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 20px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 25, 20, 0.7);
    color: var(--text-secondary);
    border-radius: 24px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    white-space: nowrap;
    line-height: 1;
}

.feed-cat-btn:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
    color: var(--text-primary);
}

.feed-cat-btn.active {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.3);
}

/* "Ещё" dropdown wrapper */
.feed-more-wrap {
    position: relative;
    flex-shrink: 0;
}

.feed-more-btn {
    gap: 4px;
}

.feed-more-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.25s;
}

.feed-more-wrap.open .feed-more-arrow {
    transform: rotate(180deg);
}

.feed-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: rgba(15, 25, 20, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.feed-more-wrap.open .feed-dropdown {
    display: block;
    animation: dropIn 0.2s ease-out;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.feed-drop-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.feed-drop-item:hover {
    background: rgba(52, 211, 153, 0.1);
    color: var(--text-primary);
}

.feed-drop-item.active {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    color: #fff;
}

/* ══════════════════════════════════════════
   FEED STREAM
   ══════════════════════════════════════════ */
.feed-stream {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Skeleton loading cards */
.feed-skeleton {
    background: rgba(15, 25, 20, 0.85);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
}

.feed-skeleton-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(110deg, rgba(255,255,255,0.03) 30%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.feed-skeleton-body { padding: 20px 24px; }

.feed-skeleton-line {
    height: 14px;
    border-radius: 8px;
    background: linear-gradient(110deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    margin-bottom: 12px;
}

.feed-skeleton-line:nth-child(1) { width: 35%; height: 10px; margin-bottom: 14px; }
.feed-skeleton-line:nth-child(2) { width: 90%; height: 18px; }
.feed-skeleton-line:nth-child(3) { width: 100%; }
.feed-skeleton-line:nth-child(4) { width: 70%; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ══════════════════════════════════════════
   FEED CARD
   ══════════════════════════════════════════ */
.feed-card {
    background: rgba(15, 25, 20, 0.85);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    opacity: 0;
    transform: translateY(40px) scale(0.97);
    transition: opacity 0.5s cubic-bezier(.4,0,.2,1),
                transform 0.5s cubic-bezier(.4,0,.2,1),
                box-shadow 0.3s ease;
}

.feed-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.feed-card:hover {
    box-shadow: 0 16px 48px rgba(5, 150, 105, 0.1),
                0 0 0 1px rgba(52, 211, 153, 0.08);
}

/* Card image */
.feed-card-img-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.1), rgba(212, 165, 116, 0.1));
}

.feed-card-img {
    width: 100%;
    height: 120%;
    object-fit: cover;
    display: block;
    transform: translateY(-10%);
    transition: transform 0.4s cubic-bezier(.4,0,.2,1);
    will-change: transform;
}

.feed-card:hover .feed-card-img {
    transform: translateY(-10%) scale(1.03);
}

.feed-card-img-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.08), rgba(212, 165, 116, 0.08));
    position: relative;
}

.feed-card-img-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(transparent, rgba(15, 25, 20, 0.6));
    pointer-events: none;
}

/* Card body */
.feed-card-body {
    padding: 20px 24px 22px;
}

/* Source/category badge */
.feed-card-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 12px;
    background: rgba(52, 211, 153, 0.1);
    color: var(--emerald-light);
}

.feed-card-source.business { background: rgba(212, 165, 116, 0.1); color: var(--gold-light); }
.feed-card-source.world { background: rgba(14, 165, 233, 0.1); color: var(--info); }
.feed-card-source.science { background: rgba(224, 122, 95, 0.1); color: var(--coral); }
.feed-card-source.lifestyle { background: rgba(234, 179, 8, 0.1); color: var(--warning); }
.feed-card-source.sport { background: rgba(34, 197, 94, 0.1); color: #4ade80; }
.feed-card-source.auto { background: rgba(99, 102, 241, 0.1); color: #818cf8; }
.feed-card-source.entertainment { background: rgba(236, 72, 153, 0.1); color: #f472b6; }
.feed-card-source.ad { background: rgba(220, 38, 38, 0.1); color: #f87171; }

/* Title */
.feed-card-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 8px;
    color: var(--text-primary);
    transition: color 0.2s;
}

.feed-card:hover .feed-card-title {
    color: var(--emerald-light);
}

/* Description */
.feed-card-desc {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card footer */
.feed-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    gap: 12px;
}

.feed-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.feed-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* ══════════════════════════════════════════
   ACTION BUTTONS
   ══════════════════════════════════════════ */
.feed-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.feed-action-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 25, 20, 0.6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.feed-action-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle at center, rgba(52,211,153,0.2), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.feed-action-btn:hover::after { opacity: 1; }

.feed-action-btn:hover {
    border-color: var(--emerald-light);
    color: var(--emerald-light);
    transform: scale(1.1);
}

.feed-action-btn:active {
    transform: scale(0.92);
}

.feed-action-btn.liked {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.feed-action-btn.liked::after {
    background: radial-gradient(circle at center, rgba(239,68,68,0.15), transparent 70%);
    opacity: 1;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.35); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.feed-action-btn.pop {
    animation: heartPop 0.45s cubic-bezier(.4,0,.2,1);
}

.feed-action-btn svg {
    width: 17px;
    height: 17px;
    position: relative;
    z-index: 1;
}

/* CTA link */
.feed-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    text-decoration: none;
    white-space: nowrap;
}

.feed-card-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
    color: #fff;
}

.feed-card-cta:active {
    transform: translateY(0) scale(0.97);
}

.feed-card-cta svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.feed-card-cta:hover svg {
    transform: translate(2px, -2px);
}

/* ══════════════════════════════════════════
   LOADER / END / SCROLLTOP / PROGRESS
   ══════════════════════════════════════════ */
.feed-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.feed-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(52, 211, 153, 0.15);
    border-top-color: var(--emerald-light);
    border-radius: 50%;
    animation: feedSpin 0.7s linear infinite;
}

@keyframes feedSpin {
    to { transform: rotate(360deg); }
}

.feed-end {
    text-align: center;
    padding: 48px 0;
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0;
    animation: fadeUp 0.5s ease forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.feed-scroll-top {
    margin-bottom: 80px;
    position: fixed;
    bottom: 90px;
    right: 28px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.35);
    z-index: 50;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.feed-scroll-top.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.feed-scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(5, 150, 105, 0.45);
}

.feed-scroll-top:active {
    transform: translateY(0) scale(0.95);
}

.feed-scroll-top svg {
    width: 22px;
    height: 22px;
}

.feed-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--emerald), var(--emerald-light), var(--gold));
    z-index: 999;
    width: 0%;
    transition: width 0.15s linear;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */

/* Tablet landscape */
@media (max-width: 1200px) {
    .feed-page,
    .feed-filter-bar {
        max-width: 520px;
    }
}

/* Tablet portrait — sidebar collapses */
@media (max-width: 992px) {
    .feed-page,
    .feed-filter-bar {
        max-width: 100%;
        padding-left: 16px;
        padding-right: 16px;
    }

    .feed-card-title { font-size: 19px; }
    .feed-card-desc { font-size: 15px; }

    .feed-scroll-top {
        bottom: 80px;
        right: 20px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .feed-filter-bar {
        max-width: 100%;
        padding: 10px 14px 6px;
    }

    .feed-filter-inner {
        gap: 6px;
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .feed-cat-btn {
        padding: 10px 16px;
        font-size: 15px;
        border-radius: 20px;
    }

    .feed-more-arrow {
        width: 16px;
        height: 16px;
    }

    .feed-dropdown {
        right: auto;
        left: 0;
        min-width: 200px;
        border-radius: 14px;
    }

    .feed-drop-item {
        padding: 14px 18px;
        font-size: 16px;
    }

    .feed-page {
        max-width: 100%;
        padding: 0 12px 110px;
    }

    .feed-stream {
        gap: 16px;
    }

    .feed-card {
        border-radius: 20px;
    }

    .feed-card-img-wrap {
        aspect-ratio: 16 / 10;
    }

    .feed-card-body {
        padding: 18px 18px 20px;
    }

    .feed-card-source {
        font-size: 12px;
        padding: 6px 12px;
        margin-bottom: 12px;
    }

    .feed-card-title {
        font-size: 20px;
        line-height: 1.35;
        margin-bottom: 8px;
    }

    .feed-card-desc {
        font-size: 16px;
        line-height: 1.6;
        -webkit-line-clamp: 3;
        margin-bottom: 16px;
    }

    .feed-card-meta {
        font-size: 14px;
    }

    .feed-card-footer {
        gap: 10px;
    }

    .feed-action-btn {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .feed-action-btn svg {
        width: 20px;
        height: 20px;
    }

    .feed-card-cta {
        padding: 12px 20px;
        font-size: 15px;
        border-radius: 14px;
    }

    .feed-card-cta svg {
        width: 16px;
        height: 16px;
    }

    .feed-scroll-top {
        bottom: 100px;
        right: 14px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
    }

    .feed-scroll-top svg {
        width: 24px;
        height: 24px;
    }

    .feed-skeleton {
        border-radius: 20px;
    }

    .feed-card-img-placeholder {
        font-size: 64px;
    }

    .feed-loader { font-size: 15px; }
    .feed-end { font-size: 15px; }
}

/* Small mobile */
@media (max-width: 480px) {
    .feed-filter-bar {
        padding: 8px 10px 6px;
    }

    .feed-filter-inner {
        gap: 5px;
    }

    .feed-cat-btn {
        padding: 9px 13px;
        font-size: 14px;
    }

    .feed-dropdown {
        min-width: 180px;
    }

    .feed-drop-item {
        padding: 13px 16px;
        font-size: 15px;
    }

    .feed-page {
        padding: 0 10px 110px;
    }

    .feed-stream {
        gap: 14px;
    }

    .feed-card {
        border-radius: 18px;
    }

    .feed-card-body {
        padding: 16px 16px 18px;
    }

    .feed-card-title {
        font-size: 19px;
    }

    .feed-card-desc {
        font-size: 15px;
        line-height: 1.55;
    }

    .feed-card-meta {
        font-size: 13px;
    }

    .feed-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding-top: 14px;
    }

    .feed-card-meta {
        order: 2;
        justify-content: center;
    }

    .feed-card-actions {
        order: 1;
        justify-content: center;
        gap: 12px;
    }

    .feed-action-btn {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .feed-action-btn svg {
        width: 22px;
        height: 22px;
    }

    .feed-card-cta {
        padding: 14px 22px;
        font-size: 16px;
        border-radius: 16px;
        flex: 1;
        justify-content: center;
    }

    .feed-card-cta svg {
        width: 17px;
        height: 17px;
    }

    .feed-scroll-top {
        bottom: 100px;
        right: 12px;
        width: 48px;
        height: 48px;
    }

    .feed-progress { height: 2px; }
}

/* Tiny screens */
@media (max-width: 360px) {
    .feed-cat-btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    .feed-card-title { font-size: 18px; }
    .feed-card-desc { font-size: 14px; }

    .feed-action-btn {
        width: 44px;
        height: 44px;
    }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .feed-card:hover {
        box-shadow: none;
    }

    .feed-card:hover .feed-card-title {
        color: var(--text-primary);
    }

    .feed-card:hover .feed-card-img {
        transform: translateY(-10%);
    }

    .feed-action-btn:hover {
        transform: none;
    }

    .feed-action-btn:hover::after {
        opacity: 0;
    }

    .feed-action-btn:active {
        transform: scale(0.9);
        background: var(--glass-hover);
    }

    .feed-card-cta:hover {
        transform: none;
        box-shadow: none;
    }

    .feed-card-cta:active {
        transform: scale(0.96);
    }

    .feed-cat-btn:hover {
        transform: none;
        background: rgba(15, 25, 20, 0.7);
        border-color: var(--glass-border);
        color: var(--text-secondary);
    }

    .feed-cat-btn.active:hover {
        background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
        color: #fff;
    }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .feed-page {
        padding-bottom: calc(110px + env(safe-area-inset-bottom));
    }

    .feed-scroll-top {
        bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .feed-card {
        opacity: 1;
        transform: none;
        transition: box-shadow 0.3s ease;
    }
    .feed-skeleton-img,
    .feed-skeleton-line {
        animation: none;
    }
    .feed-spinner {
        animation: none;
    }
    .feed-action-btn.pop {
        animation: none;
    }
}
