/**
 * Najibul News — Homepage Feed Stylesheet
 *
 * ✅ Scoped to .news-app-container (no theme conflict)
 * ✅ App-like UI (cards, badges, micro-interactions)
 * ✅ Responsive: 3 col → 2 col → 1 col
 * ✅ Dark mode aware
 * ✅ Reduced motion support
 * ✅ Print styles
 * ✅ High contrast mode
 * ✅ Core Web Vitals friendly (no layout shifts)
 * ✅ Accessibility focus states
 * ✅ Balanced typography (no clipping, no overflow)
 *
 * Location: /wp-content/plugins/najibul-post-type/News/assets/css/news-homepage.css
 *
 * @package NajibulPT\News
 * @version 2.0.0
 */

/* ============================================
   ROOT VARIABLES — Scoped
   ============================================ */

.news-app-container {
    /* Brand colors */
    --news-hp-primary: #dc2626;
    --news-hp-primary-dark: #b91c1c;
    --news-hp-primary-light: #fef2f2;
    --news-hp-secondary: #2563eb;

    /* Text */
    --news-hp-text: #0f172a;
    --news-hp-text-subtle: #1e293b;
    --news-hp-text-muted: #64748b;

    /* Surfaces */
    --news-hp-bg: #f5f7fa;
    --news-hp-card: #ffffff;
    --news-hp-header-bg: rgba(255, 255, 255, 0.92);
    --news-hp-nav-bg: rgba(255, 255, 255, 0.8);
    --news-hp-end-bg: rgba(255, 255, 255, 0.85);
    --news-hp-border: #e2e8f0;
    --news-hp-border-soft: #f1f5f9;

    /* Shadows */
    --news-hp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --news-hp-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --news-hp-shadow-lg: 0 12px 28px -8px rgba(220, 38, 38, 0.15);

    /* Radii */
    --news-hp-radius-sm: 10px;
    --news-hp-radius-md: 14px;
    --news-hp-radius-lg: 16px;

    /* Motion */
    --news-hp-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Container */
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, system-ui, sans-serif;
    background: var(--news-hp-bg);
    color: var(--news-hp-text);
    min-height: 100vh;
    box-sizing: border-box;
}

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

/* ============================================
   APP HEADER
   ============================================ */

.news-app-container .app-header {
    background: var(--news-hp-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--news-hp-radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--news-hp-shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.news-app-container .app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.news-app-container .app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.news-app-container .brand-icon {
    font-size: 28px;
    line-height: 1;
}

.news-app-container .brand-title {
    font-size: clamp(20px, 3.5vw, 28px);
    font-weight: 800;
    background: linear-gradient(135deg, var(--news-hp-primary), var(--news-hp-primary-dark));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--news-hp-primary);
    margin: 0;
    line-height: 1.2;
    word-wrap: break-word;
}

.news-app-container .app-live-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(220, 38, 38, 0.08);
    padding: 6px 16px;
    border-radius: 30px;
    border: 1px solid rgba(220, 38, 38, 0.15);
}

.news-app-container .live-indicator {
    width: 8px;
    height: 8px;
    background: var(--news-hp-primary);
    border-radius: 50%;
    animation: news-hp-pulse-dot 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes news-hp-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.3; transform: scale(0.7); }
}

.news-app-container .live-label {
    color: var(--news-hp-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    font-weight: 700;
}

.news-app-container .live-clock {
    color: var(--news-hp-text-muted);
    font-weight: 400;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   ARROW NAVIGATION
   ============================================ */

.news-app-container .nav-arrows {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 0;
    margin-bottom: 16px;
    background: var(--news-hp-nav-bg);
    border-radius: 40px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.news-app-container .nav-arrow {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(220, 38, 38, 0.1);
    color: var(--news-hp-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.news-app-container .nav-arrow:hover {
    background: var(--news-hp-primary);
    color: #ffffff;
}

.news-app-container .nav-arrow:active {
    transform: scale(0.9);
}

.news-app-container .nav-arrow:focus-visible {
    outline: 2px solid var(--news-hp-primary);
    outline-offset: 2px;
}

.news-app-container .nav-arrow:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.news-app-container .nav-arrow svg {
    width: 20px;
    height: 20px;
}

.news-app-container .nav-page-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--news-hp-text-subtle);
    min-width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   FEED GRID
   ============================================ */

.news-app-container .news-feed {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

/* ============================================
   FEED ITEM
   ============================================ */

.news-app-container .feed-item {
    opacity: 0;
    transform: translateY(16px);
    animation: news-hp-feed-appear 0.4s ease forwards;
    min-width: 0;
}

@keyframes news-hp-feed-appear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-app-container .feed-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--news-hp-card);
    border-radius: var(--news-hp-radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--news-hp-shadow-sm);
    transition: transform var(--news-hp-transition),
                box-shadow var(--news-hp-transition),
                border-color var(--news-hp-transition);
    border: 1px solid rgba(0, 0, 0, 0.04);
    -webkit-tap-highlight-color: transparent;
}

.news-app-container .feed-link:hover {
    transform: translateY(-4px);
    box-shadow: var(--news-hp-shadow-lg);
    border-color: rgba(220, 38, 38, 0.08);
}

.news-app-container .feed-link:active {
    transform: scale(0.98);
}

.news-app-container .feed-link:focus-visible {
    outline: 2px solid var(--news-hp-primary);
    outline-offset: 2px;
}

/* ============================================
   FEED IMAGE
   ============================================ */

.news-app-container .feed-image-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #eef2f6;
    flex-shrink: 0;
}

.news-app-container .feed-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.news-app-container .feed-link:hover .feed-image {
    transform: scale(1.04);
}

/* Read time pill */
.news-app-container .feed-read-time {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ffffff;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

/* Badges */
.news-app-container .feed-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    line-height: 1.4;
}

.news-app-container .feed-badge.breaking {
    background: var(--news-hp-primary);
    color: #ffffff;
    animation: news-hp-pulse-badge 2s ease-in-out infinite;
}

@keyframes news-hp-pulse-badge {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

.news-app-container .feed-badge.trending {
    background: #f59e0b;
    color: #ffffff;
}

/* ============================================
   FEED CONTENT
   ============================================ */

.news-app-container .feed-content {
    padding: 14px 16px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-app-container .feed-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 6px 0;
    color: var(--news-hp-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.news-app-container .feed-excerpt {
    font-size: 13px;
    color: var(--news-hp-text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   FEED META
   ============================================ */

.news-app-container .feed-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px 14px;
    font-size: 11px;
    color: var(--news-hp-text-muted);
    flex-wrap: wrap;
    border-top: 1px solid var(--news-hp-border-soft);
    margin-top: auto;
    overflow: hidden;
}

.news-app-container .feed-author {
    font-weight: 600;
    color: var(--news-hp-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.news-app-container .feed-dot {
    color: #cbd5e1;
    font-size: 8px;
    flex-shrink: 0;
}

.news-app-container .feed-time {
    font-weight: 500;
    white-space: nowrap;
}

.news-app-container .meta-icon {
    font-size: 11px;
    margin-right: 2px;
}

.news-app-container .feed-ctr {
    color: var(--news-hp-primary);
    font-weight: 700;
    background: var(--news-hp-primary-light);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 10px;
    white-space: nowrap;
}

/* ============================================
   LOAD MORE BUTTON
   ============================================ */

.news-app-container .load-more-wrap {
    text-align: center;
    margin: 10px 0 40px;
}

.news-app-container .load-more-btn {
    background: linear-gradient(135deg, var(--news-hp-primary), var(--news-hp-primary-dark));
    color: #ffffff;
    border: none;
    padding: 12px 40px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 8px 24px -6px rgba(220, 38, 38, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1.3;
}

.news-app-container .load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -8px rgba(220, 38, 38, 0.4);
}

.news-app-container .load-more-btn:active {
    transform: scale(0.96);
}

.news-app-container .load-more-btn:focus-visible {
    outline: 2px solid var(--news-hp-primary);
    outline-offset: 3px;
}

.news-app-container .load-more-btn.loading,
.news-app-container .load-more-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.news-app-container .load-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: news-hp-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.news-app-container .load-more-btn.loading .load-spinner {
    display: inline-block;
}

@keyframes news-hp-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   FEED END MESSAGE
   ============================================ */

.news-app-container .feed-end {
    text-align: center;
    padding: 30px 20px;
    margin: 10px 0 30px;
    background: var(--news-hp-end-bg);
    border-radius: var(--news-hp-radius-lg);
    color: var(--news-hp-text-muted);
    font-size: 15px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.news-app-container .end-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
    line-height: 1;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.news-app-container .feed-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--news-hp-text-muted);
}

.news-app-container .empty-icon {
    font-size: 44px;
    display: block;
    margin-bottom: 10px;
    line-height: 1;
}

/* ============================================
   SCROLL SENTINEL
   ============================================ */

.news-app-container .scroll-sentinel {
    height: 1px;
    width: 100%;
    visibility: hidden;
}

/* ============================================
   RESPONSIVE — Tablet (2 columns)
   ============================================ */

@media (min-width: 769px) and (max-width: 992px) {
    .news-app-container .news-feed {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .news-app-container .feed-title {
        font-size: 15px;
    }

    .news-app-container .feed-excerpt {
        font-size: 13px;
    }
}

/* ============================================
   RESPONSIVE — Mobile (1 column)
   ============================================ */

@media (max-width: 768px) {
    .news-app-container {
        padding: 14px;
    }

    .news-app-container .news-feed {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .news-app-container .app-header {
        padding: 14px 16px;
        border-radius: var(--news-hp-radius-md);
    }

    .news-app-container .app-header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .news-app-container .app-brand {
        justify-content: center;
    }

    .news-app-container .brand-title {
        font-size: 22px;
    }

    .news-app-container .app-live-badge {
        justify-content: center;
        padding: 5px 14px;
        font-size: 12px;
    }

    .news-app-container .feed-title {
        font-size: 16px;
    }

    .news-app-container .feed-excerpt {
        font-size: 14px;
    }

    .news-app-container .feed-meta {
        font-size: 12px;
    }

    .news-app-container .feed-author {
        max-width: 100px;
    }

    .news-app-container .load-more-btn {
        padding: 12px 32px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   RESPONSIVE — Small Mobile
   ============================================ */

@media (max-width: 480px) {
    .news-app-container {
        padding: 8px;
    }

    .news-app-container .app-header {
        padding: 12px 14px;
        border-radius: var(--news-hp-radius-sm);
        margin-bottom: 14px;
    }

    .news-app-container .brand-icon {
        font-size: 22px;
    }

    .news-app-container .brand-title {
        font-size: 18px;
    }

    .news-app-container .app-live-badge {
        font-size: 10px;
        padding: 4px 12px;
        gap: 6px;
    }

    .news-app-container .live-clock {
        font-size: 10px;
    }

    .news-app-container .news-feed {
        gap: 12px;
    }

    .news-app-container .nav-arrows {
        gap: 12px;
        padding: 10px 0;
        border-radius: 30px;
    }

    .news-app-container .nav-arrow {
        width: 34px;
        height: 34px;
    }

    .news-app-container .nav-arrow svg {
        width: 16px;
        height: 16px;
    }

    .news-app-container .nav-page-info {
        font-size: 12px;
        min-width: 50px;
    }

    .news-app-container .feed-link {
        border-radius: 12px;
    }

    .news-app-container .feed-content {
        padding: 12px 14px 6px;
    }

    .news-app-container .feed-title {
        font-size: 14px;
        line-height: 1.3;
    }

    .news-app-container .feed-excerpt {
        font-size: 12px;
    }

    .news-app-container .feed-meta {
        padding: 8px 14px 12px;
        font-size: 10px;
        gap: 4px;
    }

    .news-app-container .feed-author {
        font-size: 10px;
        max-width: 80px;
    }

    .news-app-container .feed-read-time {
        font-size: 9px;
        padding: 2px 10px;
    }

    .news-app-container .feed-badge {
        font-size: 8px;
        padding: 3px 10px;
    }

    .news-app-container .feed-ctr {
        font-size: 9px;
        padding: 1px 8px;
    }

    .news-app-container .load-more-btn {
        padding: 10px 24px;
        font-size: 12px;
    }

    .news-app-container .feed-end {
        padding: 20px 16px;
        font-size: 13px;
    }

    .news-app-container .end-icon {
        font-size: 28px;
    }
}

/* ============================================
   DARK MODE
   ============================================ */

@media (prefers-color-scheme: dark) {
    .news-app-container {
        --news-hp-text: #f1f5f9;
        --news-hp-text-subtle: #e2e8f0;
        --news-hp-text-muted: #94a3b8;

        --news-hp-bg: #0f172a;
        --news-hp-card: #1e293b;
        --news-hp-header-bg: rgba(30, 41, 59, 0.92);
        --news-hp-nav-bg: rgba(30, 41, 59, 0.8);
        --news-hp-end-bg: rgba(30, 41, 59, 0.9);
        --news-hp-border: #334155;
        --news-hp-border-soft: #334155;

        --news-hp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
        --news-hp-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
        --news-hp-shadow-lg: 0 12px 28px -8px rgba(0, 0, 0, 0.4);

        --news-hp-primary-light: #1e293b;
    }

    .news-app-container .app-header {
        border-color: rgba(255, 255, 255, 0.05);
    }

    .news-app-container .brand-title {
        background: linear-gradient(135deg, #f87171, #dc2626);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .news-app-container .app-live-badge {
        background: rgba(220, 38, 38, 0.15);
        border-color: rgba(220, 38, 38, 0.2);
    }

    .news-app-container .live-clock {
        color: #94a3b8;
    }

    .news-app-container .nav-arrows {
        border-color: rgba(255, 255, 255, 0.05);
    }

    .news-app-container .nav-page-info {
        color: #e2e8f0;
    }

    .news-app-container .nav-arrow {
        background: rgba(220, 38, 38, 0.2);
        color: #f87171;
    }

    .news-app-container .nav-arrow:hover {
        background: #dc2626;
        color: #ffffff;
    }

    .news-app-container .feed-link {
        background: var(--news-hp-card);
        border-color: rgba(255, 255, 255, 0.05);
    }

    .news-app-container .feed-link:hover {
        border-color: rgba(220, 38, 38, 0.15);
    }

    .news-app-container .feed-title {
        color: #f1f5f9;
    }

    .news-app-container .feed-excerpt {
        color: #94a3b8;
    }

    .news-app-container .feed-meta {
        color: #94a3b8;
        border-top-color: #334155;
    }

    .news-app-container .feed-author {
        color: #60a5fa;
    }

    .news-app-container .feed-ctr {
        color: #f87171;
        background: #334155;
    }

    .news-app-container .feed-dot {
        color: #475569;
    }

    .news-app-container .feed-empty {
        color: #94a3b8;
    }

    .news-app-container .feed-end {
        color: #94a3b8;
        border-color: rgba(255, 255, 255, 0.05);
    }

    .news-app-container .load-more-btn {
        box-shadow: 0 8px 24px -6px rgba(220, 38, 38, 0.2);
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .news-app-container .feed-item {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .news-app-container .feed-link {
        transition: none;
    }

    .news-app-container .feed-link:hover {
        transform: none;
    }

    .news-app-container .feed-link:hover .feed-image {
        transform: none;
    }

    .news-app-container .load-spinner {
        animation-duration: 0.01ms;
    }

    .news-app-container .live-indicator {
        animation: none;
    }

    .news-app-container .feed-badge.breaking {
        animation: none;
    }

    .news-app-container .nav-arrow {
        transition: none;
    }
}

/* ============================================
   HIGH CONTRAST
   ============================================ */

@media (prefers-contrast: more) {
    .news-app-container .feed-link {
        border-width: 2px;
        border-color: rgba(0, 0, 0, 0.2);
    }

    .news-app-container .feed-title {
        text-decoration-thickness: 2px;
    }

    .news-app-container .nav-arrow:focus-visible,
    .news-app-container .feed-link:focus-visible,
    .news-app-container .load-more-btn:focus-visible {
        outline-width: 3px;
    }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
    .news-app-container {
        background: #ffffff;
        padding: 20px;
        max-width: 100%;
    }

    .news-app-container .feed-item {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .news-app-container .load-more-wrap,
    .news-app-container .feed-end,
    .news-app-container .live-indicator,
    .news-app-container .live-label,
    .news-app-container .live-clock,
    .news-app-container .scroll-sentinel,
    .news-app-container .nav-arrows,
    .news-app-container .feed-read-time,
    .news-app-container .feed-badge {
        display: none !important;
    }

    .news-app-container .news-feed {
        display: block;
    }

    .news-app-container .feed-item {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }

    .news-app-container .feed-link {
        box-shadow: none;
        border: 1px solid #dddddd;
        background: #ffffff;
    }

    .news-app-container .feed-title {
        color: #000000;
    }

    .news-app-container .feed-excerpt {
        color: #333333;
    }

    .news-app-container .feed-meta {
        color: #333333;
        border-top-color: #cccccc;
    }

    .news-app-container .feed-author {
        color: #000000;
    }

    .news-app-container .app-header {
        background: #ffffff !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: 1px solid #dddddd;
        box-shadow: none;
    }

    .news-app-container .brand-title {
        background: none !important;
        -webkit-text-fill-color: #000000 !important;
        color: #000000 !important;
    }
}