﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'robotoserif-regular';
    src: url('../fonts/robotoserif-regular.ttf') format('truetype');
}

@font-face {
    font-family: 'oldstandardtt-regular';
    src: url('../fonts/oldstandardtt-regular.ttf') format('truetype');
}

body {
    margin: 0;
    padding: 0;
    font-family: robotoserif-regular !important;
    letter-spacing: 2px;
    background: #070b14;
    color: white;
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100%;
    position: relative;
}

.no-news {
    color: #aaa;
    text-align: center;
    padding: 40px;
    font-size: 18px;
    grid-column: 1 / -1;
}

/* ===== WRAPPER SEARCH ===== */
.search-wrapper {
    position: relative;
    width: 100%;
}

#clearSearch {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: 0.3s;
}

    #clearSearch:hover {
        color: #fff;
        background: rgba(255,255,255,0.1);
    }

#newsSearch {
    width: 100%;
    padding-right: 45px !important; /* فضا برای دکمه Clear */
}

    /* جلوگیری از اسکرول وقتی مودال باز است */
    body.modal-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
    }

.wn-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    overflow-x: hidden !important;
    position: relative;
}

/* HEADER */
.wn-header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
    max-width: 100%;
}

    .wn-header h1 {
        font-size: 3rem;
        margin-bottom: 10px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .wn-header p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        padding: 0 10px;
    }

/* SEARCH */
.wn-search {
    margin-bottom: 30px;
    width: 100%;
    max-width: 100%;
}

    .wn-search input {
        width: 100%;
        max-width: 100%;
        padding: 14px;
        border-radius: 12px;
        border: none;
        outline: none;
        background: #111827;
        color: white;
        box-sizing: border-box;
        font-size: 16px;
    }

/* GRID */
.wn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: visible !important;
}

/* CARD */
.wn-card {
    background: #111827;
    border-radius: 20px;
    overflow: hidden;
    transition: .3s;
    cursor: pointer;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

    .wn-card:hover {
        transform: translateY(-8px);
        border : solid 3px rgb(124, 58, 237, 1.00);
        /*box-shadow: 0 10px 40px rgba(124,58,237,.25);*/
    }

    .wn-card img {
        width: 100%;
        height: 200px;
        object-fit: cover;
        display: block;
        flex-shrink: 0;
    }

.wn-body {
    padding: 15px;
    flex: 1;
    min-width: 0;
}

    .wn-body h3 {
        margin-bottom: 10px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        font-size: 1.2rem;
        overflow: hidden;
    }

    .wn-body p {
        opacity: .7;
        font-size: .9rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.4;
        overflow: hidden;
    }

.wn-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: .8rem;
    opacity: .8;
    flex-wrap: wrap;
    gap: 10px;
}

    .wn-footer a {
        color: #06b6d4;
        text-decoration: none;
        cursor: pointer;
        word-wrap: break-word;
    }

/* SKELETON */
.wn-skeleton {
    height: 260px;
    border-radius: 20px;
    background: linear-gradient(90deg, #111827 25%, #1f2937 50%, #111827 75%);
    background-size: 400% 100%;
    animation: shimmer 1.2s infinite;
    width: 100%;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-content {
    background-color: #111827;
    margin: 20px auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    text-align: center;
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 0; /* مهم برای وسط‌چین شدن عمودی */
    padding: 0;
    margin: 0;
}

    .close-modal:hover {
        color: #06b6d4;
        background: rgba(0, 0, 0, 0.8);
    }

.modal-img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

.modal-body {
    padding: 30px;
}

    .modal-body h2 {
        margin-bottom: 15px;
        color: #06b6d4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

.modal-date {
    color: #888;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.modal-description {
    line-height: 1.6;
    font-size: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* ======================
   ریسپانسیو کامل موبایل - بدون اسکرول افقی
====================== */

/* تبلت */
@media (max-width: 768px) {
    .wn-container {
        padding: 20px 15px;
    }

    .wn-header h1 {
        font-size: 2rem;
    }

    .wn-header p {
        font-size: 0.9rem;
        padding: 0 5px;
    }

    .wn-search input {
        padding: 12px;
        font-size: 15px;
    }

    .wn-grid {
        gap: 15px;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }

    .wn-card img {
        height: 180px;
    }

    .wn-body {
        padding: 12px;
    }

        .wn-body h3 {
            font-size: 1.1rem;
        }

    /* Modal */
    .modal-content {
        width: 95%;
        margin: 15px auto;
    }

    .modal-body {
        padding: 20px;
    }

        .modal-body h2 {
            font-size: 1.3rem;
        }

    .modal-img {
        max-height: 250px;
    }

    .close-modal {
        right: 15px;
        top: 10px;
        font-size: 30px;
        width: 35px;
        height: 35px;
    }
}

/* موبایل متوسط */
@media (max-width: 600px) {
    .wn-container {
        padding: 15px 12px;
    }

    .wn-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .wn-card img {
        height: 200px;
    }
}

/* موبایل کوچک */
@media (max-width: 480px) {
    .wn-container {
        padding: 12px 10px;
    }

    .wn-header h1 {
        font-size: 1.8rem;
    }

    .wn-header p {
        font-size: 0.85rem;
        padding: 0 5px;
    }

    .wn-search input {
        padding: 10px;
        font-size: 14px;
    }

    .wn-grid {
        gap: 12px;
    }

    .wn-card {
        border-radius: 15px;
    }

        .wn-card img {
            height: 180px;
        }

    .wn-body {
        padding: 12px;
    }

        .wn-body h3 {
            font-size: 1rem;
            margin-bottom: 8px;
        }

        .wn-body p {
            font-size: 0.85rem;
        }

    .wn-footer {
        font-size: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    /* Modal */
    .modal-content {
        width: 98%;
        margin: 10px auto;
        border-radius: 15px;
    }

    .modal-body {
        padding: 15px;
    }

        .modal-body h2 {
            font-size: 1.1rem;
            margin-bottom: 10px;
        }

    .modal-date {
        font-size: 0.8rem;
        margin-bottom: 12px;
    }

    .modal-description {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .modal-img {
        max-height: 200px;
    }

    .close-modal {
        right: 10px;
        top: 8px;
        font-size: 25px;
        width: 30px;
        height: 30px;
    }
}

/* موبایل خیلی کوچک */
@media (max-width: 360px) {
    .wn-container {
        padding: 10px 8px;
    }

    .wn-header h1 {
        font-size: 1.5rem;
    }

    .wn-card img {
        height: 150px;
    }

    .wn-body h3 {
        font-size: 0.95rem;
    }

    .modal-body h2 {
        font-size: 1rem;
    }

    .modal-description {
        font-size: 0.85rem;
    }
}

/* جلوگیری از هرگونه overflow در تمام المان‌ها */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

/* حذف اسکرول افقی در موبایل */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 3px;
        height: 0px; /* مخفی کردن اسکرول افقی */
    }

    ::-webkit-scrollbar-track {
        background: #111827;
    }

    ::-webkit-scrollbar-thumb {
        background: #06b6d4;
        border-radius: 10px;
    }

    
    body {
        overflow-x: hidden !important;
    }

    .wn-grid {
        overflow-x: visible !important;
    }
}




/* ======================
   حالت افقی موبایل (Landscape / Rotate)
====================== */

/* موبایل در حالت افقی */
@media (max-width: 900px) and (orientation: landscape) {
    .wn-container {
        padding: 15px 20px;
    }

    .wn-header h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .wn-header p {
        font-size: 0.8rem;
        margin-bottom: 0;
    }

    .wn-header {
        margin-bottom: 15px;
    }

    .wn-search {
        margin-bottom: 15px;
    }

        .wn-search input {
            padding: 8px 12px;
            font-size: 14px;
        }

    /* گرید در حالت افقی - 2 یا 3 ستون */
    .wn-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 12px;
    }

    .wn-card img {
        height: 140px;
    }

    .wn-body {
        padding: 10px;
    }

        .wn-body h3 {
            font-size: 0.95rem;
            margin-bottom: 5px;
        }

        .wn-body p {
            font-size: 0.8rem;
            line-height: 1.3;
        }

    .wn-footer {
        margin-top: 8px;
        font-size: 0.7rem;
    }

    /* مودال در حالت افقی */
    .modal-content {
        width: 85%;
        max-width: 900px;
        margin: 10px auto;
        display: flex;
        flex-direction: row;
        max-height: 85vh;
    }

    .modal-img {
        width: 40%;
        max-height: none;
        border-radius: 20px 0 0 20px;
        object-fit: cover;
    }

    .modal-body {
        width: 60%;
        padding: 20px;
        overflow-y: auto;
        max-height: 85vh;
    }

        .modal-body h2 {
            font-size: 1.2rem;
            margin-bottom: 8px;
        }

    .modal-date {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .modal-description {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .close-modal {
        right: 10px;
        top: 8px;
        width: 30px;
        height: 30px;
        font-size: 24px;
        background: rgba(0, 0, 0, 0.7);
    }
}

/* موبایل‌های خیلی کوچک در حالت افقی */
@media (max-width: 700px) and (orientation: landscape) {
    .wn-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
    }

    .wn-card img {
        height: 120px;
    }

    .wn-body {
        padding: 8px;
    }

        .wn-body h3 {
            font-size: 0.85rem;
        }

        .wn-body p {
            font-size: 0.75rem;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

    .modal-img {
        width: 35%;
    }

    .modal-body {
        width: 65%;
        padding: 15px;
    }
}

/* تبلت در حالت افقی */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .wn-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }

    .wn-card img {
        height: 180px;
    }

    .modal-content {
        width: 80%;
        max-width: 1000px;
    }
}

/* ======================
   بهبود اسکرول در حالت افقی
====================== */
@media (orientation: landscape) {
    body {
        overflow-x: hidden !important;
    }

    /* اسکرول عمودی نرم برای محتوای مودال */
    .modal-body::-webkit-scrollbar {
        width: 4px;
    }

    .modal-body::-webkit-scrollbar-track {
        background: #1f2937;
        border-radius: 10px;
    }

    .modal-body::-webkit-scrollbar-thumb {
        background: #06b6d4;
        border-radius: 10px;
    }
}