/* assets/css/style.css */

/* =========================================
   1. تعریف فونت‌ها (Bahij_Zar)
   ========================================= */
@font-face {
    font-family: 'Bahij_Zar';
    /* اولویت با فرمت woff برای موبایل */
    src: url('../fonts/Bahij_Zar.woff') format('woff'),
         url('../fonts/Bahij_Zar.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Bahij_Zar';
    /* اگر فایل بولد دارید نام آن را اینجا بنویسید (مثلا Bahij_ZarBd.ttf) */
    /* فعلا از همان فایل اصلی استفاده می‌کنیم */
    src: url('../fonts/Bahij_Zar.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* =========================================
   2. تنظیمات کلی (Reset & Typography)
   ========================================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    direction: rtl;
    background-color: #f4f4f4;
    color: #333;
    
    /* تعریف فونت جدید */
    font-family: 'Bahij_Zar', Tahoma, Arial, sans-serif;

    /* تنظیمات برای نمایش صحیح و جلوگیری از بهم‌ریختگی */
    letter-spacing: 0 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* اجبار فونت روی تمام عناصر */
h1, h2, h3, h4, h5, h6, 
p, a, span, div, li, 
button, input, select, textarea {
    font-family: 'Bahij_Zar', Tahoma, sans-serif !important;
    letter-spacing: 0 !important;
}

a { text-decoration: none; transition: all 0.3s ease; }
img { max-width: 100%; height: auto; }
.container { width: 90%; max-width: 1200px; margin: 0 auto; }
.container-fluid { width: 95%; margin: 0 auto; }

/* =========================================
   3. هدر و منو (Navbar)
   ========================================= */
.navbar {
    background-color: #0f2b4c; 
    color: white;
    position: relative;
    border-bottom: 4px solid #0056b3;
    z-index: 1000;
    height: 60px;
    display: flex; align-items: center;
}
.navbar .container { width: 100%; max-width: 1200px; }

.main-menu {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 0;
}
.main-menu > li { position: relative; flex-shrink: 0; }
.main-menu a {
    display: block; padding: 20px 15px; color: white;
    white-space: nowrap; font-size: 15px; transition: background 0.3s;
}
.main-menu a:hover { background-color: #1a4270; }
.main-menu i, .main-menu .fa, .main-menu .arrow { display: none !important; }

/* دراپ‌داون */
.dropdown-menu {
    display: none; position: absolute; top: 100%; right: 0;
    background-color: #0f2b4c; min-width: 220px;
    border-radius: 0 0 5px 5px; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1000; padding: 0; list-style: none;
}
li:hover > .dropdown-menu { display: block; }
.dropdown-menu li { position: relative; border-bottom: 1px solid #1a4270; }
.dropdown-menu a { padding: 12px 20px; font-size: 14px; text-align: right; }
.dropdown-menu .dropdown-menu { top: 0; right: 100%; margin-right: 0; margin-top: -1px; border-radius: 5px; }

@media (max-width: 992px) {
    .navbar { height: auto; padding: 10px 0; }
    .main-menu { flex-wrap: wrap; }
    .dropdown-menu { position: static; box-shadow: none; background: #0b223d; width: 100%; }
    .dropdown-menu .dropdown-menu { right: 0; background: #081a2f; }
}

/* =========================================
   4. بخش هیرو (Hero Section)
   ========================================= */
.hero-section { padding: 20px 0; background: #fff; }
.hero-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 25px; align-items: start; }
.hero-side { display: flex; flex-direction: column; gap: 25px; }

.hero-card {
    background: #fff; border: 1px solid #e1e4e8; border-radius: 10px;
    overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; flex-direction: column;
}
.hero-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); border-color: #d1d5da; }

.hero-img-box { display: block; width: 100%; position: relative; height: auto; overflow: hidden; }
.hero-img-box img { width: 100%; height: auto; display: block; object-fit: cover; }

.hero-content-box { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.hero-content-box h3, .hero-content-box h4 { margin: 0 0 10px 0; line-height: 1.4; font-weight: bold; }
.hero-content-box h3 a { font-size: 20px; color: #2c3e50; }
.hero-content-box h4 a { font-size: 16px; color: #2c3e50; }
.hero-content-box h3 a:hover, .hero-content-box h4 a:hover { color: #0056b3; }
.hero-content-box p { font-size: 13px; color: #666; line-height: 1.8; margin-bottom: 15px; flex-grow: 1; }
.read-more-btn { font-size: 12px; color: #0056b3; font-weight: bold; align-self: flex-end; }
.read-more-btn:hover { text-decoration: underline; }

.category-tag {
    position: absolute; top: 15px; right: 15px; padding: 4px 12px;
    border-radius: 4px; color: #fff; font-size: 12px; font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.category-tag.red { background-color: #e74c3c; }
.category-tag.yellow { background-color: #f1c40f; color: #333; }
.category-tag.green { background-color: #2ecc71; }

@media (max-width: 768px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-side { flex-direction: column; }
    .hero-img-box img { max-height: 400px; }
}

/* =========================================
   5. بخش مجله‌ای (Mixed Posts)
   ========================================= */
.mixed-posts-section { background: #fff; padding: 60px 0; border-top: 1px solid #eee; }
.section-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-text, .btn-outline { color: #0056b3; font-size: 14px; font-weight: bold; }

.magazine-top-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; margin-bottom: 40px; }
.mag-card-medium {
    background: #fff; border-radius: 10px; overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); transition: transform 0.3s; border: 1px solid #f0f0f0;
}
.mag-card-medium:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.12); }
.mag-img-medium { display: block; width: 100%; height: 200px; position: relative; overflow: hidden; }
.mag-img-medium img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.mag-card-medium:hover .mag-img-medium img { transform: scale(1.1); }
.mag-cat { position: absolute; bottom: 10px; right: 10px; color: white; padding: 3px 10px; border-radius: 4px; font-size: 11px; font-weight: bold; }
.mag-content { padding: 15px; }
.mag-content h3 { margin: 0 0 10px 0; font-size: 16px; font-weight: bold; height: 48px; overflow: hidden; }
.mag-content h3 a { color: #333; }
.meta-date { font-size: 11px; color: #999; }

.magazine-grid-layout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.mag-card-small { display: flex; align-items: center; background: #fdfdfd; border: 1px solid #eee; border-radius: 8px; overflow: hidden; padding: 10px; transition: 0.3s; }
.mag-card-small:hover { border-color: #0056b3; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.mag-img-small { width: 70px; height: 70px; flex-shrink: 0; border-radius: 6px; overflow: hidden; margin-left: 10px; }
.mag-img-small img { width: 100%; height: 100%; object-fit: cover; }
.mag-info-small { flex-grow: 1; }
.mag-info-small h5 { margin: 0 0 5px 0; font-size: 13px; font-weight: bold; height: 36px; overflow: hidden; }
.mag-info-small h5 a { color: #444; }
.date-small { font-size: 10px; color: #aaa; }

@media (max-width: 992px) {
    .magazine-top-row { grid-template-columns: repeat(2, 1fr); }
    .magazine-grid-layout { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .magazine-top-row { grid-template-columns: 1fr; }
    .magazine-grid-layout { grid-template-columns: 1fr; }
    .mag-card-small { margin-bottom: 10px; }
}

/* =========================================
   6. اسلایدرها (Bio, Video)
   ========================================= */
.bio-section { background: #fff; padding: 40px 0; }
.video-section { background: #fdfdfd; padding: 50px 0; border-top: 1px solid #eaeaea; }

.bio-carousel-wrapper, .video-carousel-wrapper { position: relative; padding: 0 50px; }

.bio-scroller, .video-scroller {
    display: flex; gap: 20px; overflow-x: auto; scroll-behavior: smooth;
    padding-bottom: 20px; scrollbar-width: none;
}
.bio-scroller::-webkit-scrollbar, .video-scroller::-webkit-scrollbar { display: none; }

/* Bio Card */
.bio-card-slider { text-align: center; min-width: 200px; flex-shrink: 0; }
.bio-img-slider { width: 100%; height: 160px; border-radius: 4px; border: 1px solid #ddd; padding: 3px; background: #fff; margin-bottom: 10px; transition: 0.3s; }
.bio-img-slider img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; }
.bio-card-slider:hover .bio-img-slider { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); border-color: #0f2b4c; }
.bio-card-slider h5 { margin: 0; font-size: 14px; }

/* Video Card */
.video-card-slider { flex: 0 0 auto; width: 280px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); transition: transform 0.3s ease; border: 1px solid #f0f0f0; cursor: pointer; }
.video-card-slider:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.15); border-color: #0f2b4c; }
.video-img-box { position: relative; width: 100%; height: 160px; background: #000; }
.video-img-box img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; transition: 0.3s; }
.video-card-slider:hover .video-img-box img { opacity: 1; transform: scale(1.05); }
.play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 50px; height: 50px; background: rgba(0,0,0,0.5); border-radius: 50%; border: 2px solid #fff; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: 0.3s; z-index: 2; }
.video-card-slider:hover .play-icon { background: #cc181e; transform: translate(-50%, -50%) scale(1.1); }
.video-info { padding: 15px; text-align: center; height: 60px; display: flex; align-items: center; justify-content: center; }
.video-info h5 { margin: 0; font-size: 14px; font-weight: bold; color: #333; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Navigation Buttons */
.nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
    border-radius: 50%; background-color: #fff; border: 1px solid #ddd; color: #0f2b4c;
    font-size: 18px; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 10;
    display: flex; align-items: center; justify-content: center; transition: 0.3s;
}
.nav-btn:hover { background-color: #0f2b4c; color: #fff; border-color: #0f2b4c; }
.right-btn { right: 0; }
.left-btn { left: 0; }

@media (max-width: 768px) {
    .bio-carousel-wrapper, .video-carousel-wrapper { padding: 0; }
    .nav-btn { display: none; }
    .bio-scroller, .video-scroller { padding: 0 20px 20px 0; scrollbar-width: none; }
    .bio-card-slider { min-width: 160px; max-width: 160px; }
    .video-card-slider { min-width: 260px; max-width: 260px; width: 260px; }
}

/* =========================================
   7. کتابخانه (Library)
   ========================================= */
.library-section { background: #e8e4dc; }
.books-shelf { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 15px solid #c4a484; }
.book-card-3d { width: 140px; text-align: center; perspective: 1000px; }
.book-cover { display: block; width: 100%; height: 200px; box-shadow: -5px 5px 10px rgba(0,0,0,0.3); transition: transform 0.3s; transform-origin: left center; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card-3d:hover .book-cover { transform: rotateY(-15deg) scale(1.05); }
.book-info { margin-top: 15px; opacity: 0.8; }
.book-info h3 { font-size: 13px; margin: 0; color: #333; }
.book-info span { font-size: 11px; color: #666; }

/* =========================================
   8. مقالات (Articles Grid)
   ========================================= */
.articles-section { background: #f9f9f9; padding: 20px 0; }
.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 25px; }
.art-card {
    background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: 0.3s; border-top: 3px solid transparent; display: flex; flex-direction: column;
}
.art-card:hover { transform: translateY(-5px); border-top-color: #0f2b4c; }
.art-img { display: block; height: 140px; overflow: hidden; }
.art-img img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.art-card:hover .art-img img { transform: scale(1.1); }
.art-body { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.art-body .date { font-size: 11px; color: #999; display: block; margin-bottom: 5px; }
.art-body h3 { margin: 0 0 10px; font-size: 16px; line-height: 1.4; }
.art-body p { font-size: 13px; color: #666; line-height: 1.6; margin-bottom: 15px; }
.read-link { color: #0f2b4c; font-size: 12px; font-weight: bold; margin-top: auto; display: inline-block; }

/* حالت اسکرول افقی برای موبایل */
@media (max-width: 768px) {
    .articles-grid {
        display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 15px;
        padding-bottom: 20px; scroll-behavior: smooth; scrollbar-width: none;
    }
    .articles-grid::-webkit-scrollbar { display: none; }
    .art-card { min-width: 260px; max-width: 260px; flex-shrink: 0; }
}

/* =========================================
   9. بخش لاتین (Latin Train)
   ========================================= */
.latin-train-light { background-color: #ffffff; padding: 50px 0; border-top: 1px solid #eee; border-bottom: 1px solid #eee; direction: ltr; text-align: left; }
.train-header-light { display: flex; justify-content: space-between; align-items: center; padding: 0 30px; margin-bottom: 25px; max-width: 100%; }
.header-title h2 { font-size: 24px; font-weight: 800; color: #333; margin: 0; text-transform: uppercase; letter-spacing: -0.5px; }
.header-title .sub-title { font-size: 13px; color: #888; font-weight: 500; }
.train-track-light { display: flex; gap: 20px; overflow-x: auto; padding: 10px 30px 40px 30px; scroll-behavior: smooth; scrollbar-width: none; }
.train-track-light::-webkit-scrollbar { display: none; }

.train-card-light { min-width: 19%; max-width: 19%; background: #fff; border: 1px solid #f0f0f0; border-radius: 8px; overflow: hidden; transition: transform 0.3s, box-shadow 0.3s; }
.train-card-light:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.08); border-color: transparent; }
.card-img-top { height: 160px; width: 100%; position: relative; overflow: hidden; }
.card-img-top img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.train-card-light:hover .card-img-top img { transform: scale(1.08); }
.card-body-light { padding: 15px; }
.date-text { font-size: 11px; color: #999; display: block; margin-bottom: 8px; }
.post-title { font-size: 15px; font-weight: 700; line-height: 1.4; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 42px; }
.post-title a { color: #222; }
.post-title a:hover { color: #e67e22; }

@media (max-width: 1200px) { .train-card-light { min-width: 24%; max-width: 24%; } }
@media (max-width: 992px) { .train-card-light { min-width: 32%; max-width: 32%; } }
@media (max-width: 600px) { .train-card-light { min-width: 60%; max-width: 60%; } }

/* =========================================
   10. Video Modal
   ========================================= */
.video-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9); z-index: 10000; justify-content: center; align-items: center; }
.video-modal-content { position: relative; width: 90%; max-width: 800px; background: #000; border-radius: 8px; box-shadow: 0 0 20px rgba(255, 255, 255, 0.2); }
.responsive-iframe-container { position: relative; overflow: hidden; padding-top: 56.25%; }
.responsive-iframe-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
.close-modal-btn { position: absolute; top: -40px; right: 0; color: #fff; font-size: 20px; font-weight: bold; cursor: pointer; background: rgba(255,255,255,0.1); padding: 5px 15px; border-radius: 20px; }
.close-modal-btn:hover { color: #ff9800; background: rgba(255,255,255,0.2); }

/* =========================================
   11. فوتر (Bahij_Zar)
   ========================================= */
.site-footer {
    background: #0f2b4c;
    color: #fff;
    padding: 40px 0;
    text-align: center;
    margin-top: 0;
    font-family: 'Bahij_Zar', Tahoma, Arial, sans-serif;
}
.site-footer a { color: #0056b3; }
/* --- تنظیمات مخصوص موبایل و آیفون --- */
@media only screen and (max-width: 768px) {

    /* 1. کانتینر اصلی: گرفتن ۹۰٪ عرض صفحه */
    .articles-section .container {
        width: 90% !important;
        max-width: 90% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* 2. گرید مقالات: اجبار به تک‌ستون با عرض ۱۰۰٪ */
    .articles-grid {
        display: block; /* در موبایل گرید را برمی‌داریم تا مشکلات سافاری حل شود */
        width: 100%;
    }

    /* 3. کارت مقاله: پر کردن فضای کانتینر */
    .art-card {
        width: 100%;
        margin-bottom: 25px; /* فاصله بین کارت‌ها */
        display: flex;
        flex-direction: column;
    }

    .art-img {
        height: 220px; /* ارتفاع مناسب برای تصویر */
        width: 100%;
    }
    
    .art-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* 4. اصلاح هدر بخش (عنوان صفحه) */
    .section-header-modern {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 30px;
    }

    /* 5. دکمه‌های صفحه‌بندی */
    .pagination-wrapper {
        justify-content: space-between;
        gap: 10px;
    }
    
    .page-numbers { display: none; } /* حذف شماره‌ها در موبایل */
    
    .page-btn {
        flex: 1;
        text-align: center;
        justify-content: center;
        font-size: 14px;
        padding: 12px 0;
    }
}