/**
 * Home Page Premium Styles
 * Modern UI/UX for Homepage
 * RTL Support for Persian Language
 */

/* ========================================
   HOME PAGE WRAPPER
   ======================================== */

.modern-home {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 50%);
    min-height: 100vh;
}

/* ========================================
   HERO CONTAINER - Clean Light Design
   ======================================== */

.hero-container {
    padding: 24px 0 40px;
    background: #fff;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #e8f0fe;
}

.hero-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    pointer-events: none;
}

.hero-container::after {
    display: none;
}

/* ========================================
   SECTION HEADERS - Premium Design
   ======================================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 3px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-title .icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 14px;
    font-size: 22px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.section-title h2 {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.view-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #6366f1;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.view-all:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    transform: translateX(-4px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.view-all i {
    transition: transform 0.3s ease;
}

.view-all:hover i {
    transform: translateX(-4px);
}

/* ========================================
   ENHANCED ARTICLE CARDS
   ======================================== */

.modern-home .card {
    background: #fff;
    border: 1px solid #e8f0fe;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.modern-home .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-color: #c7d2fe;
}

.modern-home .card .card-image {
    position: relative;
    overflow: hidden;
}

.modern-home .card .card-image img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-home .card:hover .card-image img {
    transform: scale(1.08);
}

.modern-home .card .card-body {
    padding: 20px;
}

.modern-home .card .card-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
    margin-bottom: 12px;
    color: #1e293b;
}

.modern-home .card .card-title a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.modern-home .card:hover .card-title a {
    color: #6366f1;
}

.modern-home .card .card-excerpt {
    font-size: 14px;
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 16px;
}

.modern-home .card .card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
    color: #94a3b8;
}

.modern-home .card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.modern-home .card-meta-item a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.modern-home .card-meta-item a:hover {
    color: #6366f1;
}

/* Category Badge */
.modern-home .category-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* ========================================
   CATEGORY SECTIONS - Grid Layout
   ======================================== */

.category-section-wrapper {
    background: #f8fafc;
    padding: 40px 0;
    margin: 40px 0;
}

.modern-home .news-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e8f0fe;
    transition: all 0.3s ease;
    height: 100%;
}

.modern-home .news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    border-color: #c7d2fe;
}

.modern-home .news-card .card-img-top {
    transition: transform 0.5s ease;
}

.modern-home .news-card:hover .card-img-top {
    transform: scale(1.05);
}

.modern-home .news-card .card-body {
    padding: 18px;
}

.modern-home .news-card .card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 10px;
}

.modern-home .news-card .news-card-title {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.modern-home .news-card:hover .news-card-title {
    color: #6366f1;
}

.modern-home .news-card .news-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #94a3b8;
}

/* ========================================
   SIDEBAR ENHANCEMENTS
   ======================================== */

.modern-home .sidebar {
    position: sticky;
    top: 90px;
}

.modern-home .sidebar .widget {
    background: #fff;
    border: 1px solid #e8f0fe;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.modern-home .sidebar .widget:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.modern-home .sidebar .widget h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f1f5f9;
}

.modern-home .sidebar .widget h3 i {
    color: #6366f1;
}

/* Popular Posts Widget */
.modern-home .popular-post-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.modern-home .popular-post-item:last-child {
    border-bottom: none;
}

.modern-home .popular-post-item:hover {
    background: #f8fafc;
    margin: 0 -12px;
    padding: 14px 12px;
    border-radius: 10px;
}

.modern-home .popular-post-number {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.modern-home .popular-post-content h6 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.5;
}

.modern-home .popular-post-content a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.modern-home .popular-post-content a:hover {
    color: #6366f1;
}

.modern-home .popular-post-meta {
    font-size: 11px;
    color: #94a3b8;
}

/* Tags Widget */
.modern-home .tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modern-home .tag-cloud a {
    padding: 8px 14px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.modern-home .tag-cloud a:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ========================================
   USER POSTS SECTION
   ======================================== */

.user-posts-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 50px 0;
    margin: 40px 0;
    border-radius: 0;
}

.modern-home .card-default.card-hover {
    background: #fff;
    border: 1px solid #e8f0fe;
    border-radius: 16px;
    transition: all 0.3s ease;
}

.modern-home .card-default.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    border-color: #c7d2fe;
}

/* ========================================
   QUESTIONS SECTION
   ======================================== */

.questions-section {
    background: #fff;
    padding: 50px 0;
}

.modern-home .card-minimal.card-hover {
    background: #fff;
    border: 1px solid #e8f0fe;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
}

.modern-home .card-minimal.card-hover:hover {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border-color: #fde047;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.15);
}

.modern-home .card-minimal .card-title a {
    color: #1e293b;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.modern-home .card-minimal:hover .card-title a {
    color: #b45309;
}

/* Ask Question CTA Button */
.ask-question-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.ask-question-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
    color: #fff;
}

/* ========================================
   TELEGRAM CTA ENHANCEMENT
   ======================================== */

.modern-home .telegram-cta {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #0369a1 100%);
    border-radius: 24px;
    padding: 50px 40px;
    position: relative;
    overflow: hidden;
}

.modern-home .telegram-cta::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.modern-home .telegram-cta::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.modern-home .telegram-button {
    background: #fff;
    color: #0284c7;
    padding: 16px 32px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.modern-home .telegram-button:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* ========================================
   PAGINATION - Premium Style
   ======================================== */

.modern-home .pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.modern-home .pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    background: #fff;
    color: #6366f1;
    border: 2px solid #e8f0fe;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.modern-home .pagination .page-item .page-link:hover {
    background: #f1f5f9;
    border-color: #6366f1;
}

.modern-home .pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.modern-home .pagination .page-item.disabled .page-link {
    background: #f9fafb;
    color: #cbd5e1;
    border-color: #f1f5f9;
}

/* ========================================
   FADE-IN ANIMATION
   ======================================== */

.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 991px) {
    .section-title h2 {
        font-size: 18px;
    }

    .section-title .icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .modern-home .sidebar {
        position: static;
        margin-top: 40px;
    }

    /* Ensure sidebar appears below content on mobile */
    .modern-home .row {
        display: flex;
        flex-direction: column;
    }

    .modern-home .row > .col-lg-8 {
        order: 0;
    }

    .modern-home .row > .col-lg-4 {
        order: 1;
    }
}

@media (max-width: 767px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .section-header::after {
        display: none;
    }

    .view-all {
        align-self: flex-end;
    }

    .hero-container {
        padding: 16px 0 24px;
    }

    .modern-home .card .card-body {
        padding: 16px;
    }

    .modern-home .sidebar .widget {
        padding: 18px;
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

[data-theme="dark"] .modern-home {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%);
}

[data-theme="dark"] .modern-home .card,
[data-theme="dark"] .modern-home .news-card,
[data-theme="dark"] .modern-home .sidebar .widget {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .modern-home .card .card-title a,
[data-theme="dark"] .modern-home .popular-post-content a,
[data-theme="dark"] .modern-home .card-minimal .card-title a {
    color: #e2e8f0;
}

[data-theme="dark"] .modern-home .card .card-excerpt,
[data-theme="dark"] .modern-home .card-meta {
    color: #94a3b8;
}

[data-theme="dark"] .section-title h2 {
    color: #e2e8f0;
}

[data-theme="dark"] .section-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .modern-home .tag-cloud a {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .modern-home .pagination .page-item .page-link {
    background: #1e293b;
    border-color: #334155;
}