﻿/* =========================
   BASE
========================= */

:root {
    --bg: #f5f7fb;
    --card: #fff;
    --text: #111;
    --muted: #666;
    --soft: #999;
    --shadow: 0 2px 10px rgba(0,0,0,0.06);
    --hoverShadow: 0 15px 40px rgba(0,0,0,0.12);
    --primary: #e63946;
}

body {
    margin: 0;
    font-family: tahoma;
    background: var(--bg);
    color: var(--text);
    transition: background .3s ease,color .3s ease;
}

body {
    font-family: "Vazirmatn", "IRANSans", tahoma, sans-serif;
    font-weight: 400;
    letter-spacing: -0.2px;
    padding-top: 90px;
}
/* =========================
   LAYOUT
========================= */

.container {
    max-width: 1100px;
}

/* =========================
   NEWS GRID (ONLY ONE SYSTEM)
========================= */

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
    gap: 20px;
}

/* =========================
   NEWS CARD
========================= */

.news-card {
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all .3s ease;
    display: flex;
    flex-direction: column;
}

    .news-card:hover {
        transform: translateY(-6px);
        box-shadow: var(--hoverShadow);
    }

/* =========================
   IMAGE
========================= */


/* badge */
.news-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
}

/* =========================
   BODY
========================= */

.news-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* title */
.news-title {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

    .news-title a {
        text-decoration: none;
        color: var(--text);
        font-weight: 700;
        transition: .2s;
    }

        .news-title a:hover {
            color: var(--primary);
        }

/* summary */
.news-summary,
.news-desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* footer */
.news-footer {
    margin-top: auto;
    font-size: 12px;
    color: var(--soft);
    display: flex;
    justify-content: space-between;
}

/* =========================
   SOURCE TAG
========================= */

.news-source {
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================
   DARK MODE (CLEAN ONLY)
========================= */

body.dark {
    --bg: #0f1115;
    --card: #1a1d24;
    --text: #e6e6e6;
    --muted: #b5b5b5;
    --soft: #999;
    --shadow: 0 2px 10px rgba(0,0,0,0.4);
    --hoverShadow: 0 15px 40px rgba(0,0,0,0.5);
}

/* =========================
   SKELETON
========================= */

.skeleton {
    background: linear-gradient(90deg,#eee 25%,#f5f5f5 37%,#eee 63%);
    background-size: 400% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.skeleton-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.skeleton-img {
    width: 120px;
    height: 80px;
}

.skeleton-line {
    height: 10px;
    margin-bottom: 8px;
}

.skeleton-title {
    width: 70%;
}

.skeleton-text {
    width: 100%;
}

.skeleton-small {
    width: 40%;
}

/* dark skeleton */
body.dark .skeleton {
    background: linear-gradient(90deg,#2a2f3a 25%,#333a46 37%,#2a2f3a 63%);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

.news-title {
    font-weight: 600;
}

a {
    text-decoration: none;
    color: #000;
}

.news-body p {
    font-size: 13px;
    color: #666;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* تعداد خطوط ثابت */
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

@media (max-width: 768px) {
    .news-body p {
        -webkit-line-clamp: 2;
    }
}

.news-body h6 {
    margin: 0;
}

    .news-body h6 a {
        display: -webkit-box;
        -webkit-line-clamp: 2; /* حداکثر 2 خط */
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-decoration: none;
        color: #111;
        font-weight: 700;
        line-height: 1.6;
        min-height: 3.2em; /* برای یکدست شدن ارتفاع کارت‌ها */
    }

        .news-body h6 a:hover {
            color: #e63946;
            transition: 0.2s;
        }

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: #888;
}

    .news-footer div {
        white-space: nowrap;
    }

        .news-footer div:last-child {
            background: #f1f3f5;
            padding: 2px 6px;
            border-radius: 6px;
        }

.news-footer {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 10px;
    font-size: 11px;
    color: #888;
}

.news-date,
.news-source {
    display: inline-block;
    white-space: nowrap;
}

.news-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: all .25s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

    .news-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 12px 30px rgba(0,0,0,0.12);
    }

    /* IMAGE */
    .news-card img {
        width: 100%;
        height: 190px;
        object-fit: cover;
        display: block;
        transition: transform .4s ease;
    }

    .news-card:hover img {
        transform: scale(1.05);
    }

/* BODY */
.news-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    /* TITLE */
    .news-body h6 {
        margin: 0;
        font-size: 15px;
        line-height: 1.7;
    }

        .news-body h6 a {
            text-decoration: none;
            color: #111;
            font-weight: 700;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

            .news-body h6 a:hover {
                color: #e63946;
            }

    /* SUMMARY */
    .news-body p {
        margin: 0;
        font-size: 13px;
        color: #666;
        line-height: 1.8;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* FOOTER */
    .news-body > div {
        margin-top: auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 11px;
        color: #888;
        gap: 10px;
    }

/* SOURCE BADGE */
.news-source {
    background: #f1f3f5;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.news-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: #666;
    font-size: 13px;
}

/* spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-top: 2px solid #e63946;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.news-header {
    margin-bottom: 15px;
    padding: 14px;
    background: linear-gradient(135deg,#fff,#f7f9fc);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* TOP ROW */
.news-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* TITLE */
.news-header-title {
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #111;
}

    .news-header-title .dot {
        width: 8px;
        height: 8px;
        background: #e63946;
        border-radius: 50%;
        animation: pulse 1.5s infinite;
    }

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.4);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* SEARCH BOX */
.news-search {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,0.04);
}

    .news-search input {
        border: none;
        outline: none;
        padding: 8px 10px;
        font-size: 13px;
        width: 180px;
    }

    .news-search button {
        border: none;
        background: #e63946;
        color: #fff;
        padding: 8px 10px;
        cursor: pointer;
        transition: 0.2s;
    }

        .news-search button:hover {
            background: #c92a36;
        }

/* SUBTITLE */
.news-header-sub {
    margin-top: 8px;
    font-size: 12px;
    color: #777;
}

.news-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 12px 15px;
}

#newsContainer {
    display: flex;
    flex-wrap: wrap;
}

    /* دسکتاپ */
    #newsContainer > .col {
        width: 33.333%;
    }

/* تبلت */
@media (max-width: 992px) {
    #newsContainer > .col {
        width: 50%;
    }
}

/* موبایل → تک ستونه */
@media (max-width: 768px) {
    #newsContainer > .col {
        width: 100%;
    }
}

.news-card {
    width: 100%;
}

.news-body {
    padding: 12px;
}


.news-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    height: 100%;
}

.news-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    height: 100%;
}


.news-body {
    padding: 14px;
}

.news-title a {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.8;
    color: #222;
    text-decoration: none;
}

.news-summary {
    font-size: 14px;
    color: #555;
    margin-top: 8px;
    line-height: 1.9;
}

.news-meta {
    margin-top: 10px;
    font-size: 12px;
    color: #888;
}

@media (max-width: 768px) {
    .news-title a {
        font-size: 18px;
        line-height: 2;
    }

    .news-summary {
        font-size: 15px;
    }
}

.news-card {
    margin-bottom: 15px;
}

    .news-card img {
        width: 100%;
        height: 180px;
        object-fit: cover;
        display: block;
    }

.top-news-section {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #111827, #1f2937);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.top-news-title {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .top-news-title::before {
        content: "★";
        color: gold;
        font-size: 20px;
    }

.top-news-section .news-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    transition: 0.3s;
    border: none;
}

    .top-news-section .news-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 12px 25px rgba(0,0,0,0.25);
    }

.top-news-section .news-img {
    height: 160px;
    width: 100%;
    object-fit: cover;
}

.top-news-section .news-body {
    padding: 10px 12px;
}

.top-news-section .news-title a {
    font-size: 14px;
    font-weight: bold;
    color: #111;
    text-decoration: none;
}

    .top-news-section .news-title a:hover {
        color: #d62828;
    }

.top-news-section .news-meta {
    font-size: 11px;
    color: #666;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
}