/* Projects Section */
.projects-section {
    max-width: 1400px;
    margin: 4rem auto;
    padding: 3rem 2rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(66, 125, 192, 0.15);
}

.projects-container {
    width: 100%;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: #1f3079;
    margin-bottom: 1rem;
    font-weight: 700;
}

.section-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: #4a5868;
    margin-bottom: 3rem;
    font-weight: 400;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Project Card */
.project-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(66, 125, 192, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(66, 125, 192, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%; /* تمام کارت‌ها هم ارتفاع باشند */
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(66, 125, 192, 0.25);
    border-color: #427dc0;
}

/* Project Image - مشکل اصلی اینجا بود */
.project-image {
    position: relative;
    width: 100%;
    height: 280px; /* ارتفاع ثابت برای همه تصاویر */
    overflow: hidden;
    flex-shrink: 0; /* جلوگیری از کوچک شدن */
    background: #f8f9fa; /* پس‌زمینه در صورت عدم بارگذاری تصویر */
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* تغییر از cover به contain */
    object-position: center; /* وسط چین کردن تصویر */
    transition: transform 0.4s ease;
    background: white; /* پس‌زمینه سفید برای تصاویر شفاف */
}

/* اگر می‌خواهید تصاویر کل فضا رو پر کنند (ممکن است برش بخورند) */
.project-image.cover img {
    object-fit: cover;
}

/* اگر می‌خواهید تصاویر کشیده شوند تا کل فضا رو پر کنند */
.project-image.fill img {
    object-fit: fill;
}

.project-card:hover .project-image img {
    transform: scale(1.05); /* کمتر کردن مقدار scale */
}

/* Project Overlay */
.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(31, 48, 121, 0.9) 0%, rgba(66, 125, 192, 0.9) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.view-details {
    background: white;
    color: #1f3079;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 25px;
    font-family: 'Yekan Bakh', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    transform: translateY(10px);
}

.project-card:hover .view-details {
    transform: translateY(0);
}

.view-details:hover {
    background: #427dc0;
    color: white;
    transform: scale(1.05);
}

/* Project Info */
.project-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: right; /* اضافه کن - همه متن‌ها راست‌چین */
    direction: rtl; /* اضافه کن - جهت راست به چپ */
}

.project-title {
    font-size: 1.4rem;
    color: #1f3079;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-align: right; /* اضافه کن */
}

.project-category {
    display: inline-block;
    background: linear-gradient(135deg, #203F78 0%, #6e92da 100%);
    color: white;
    padding: 0.3rem 1rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    align-self: flex-start;
    text-align: center; /* اضافه کن - متن داخل دکمه وسط‌چین */
}

.project-description {
    color: #4a5868;
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    flex: 1;
    text-align: justify; /* justify کردن */
    text-justify: inter-word;
    direction: rtl;
}

/* Project Tags */
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    justify-content: flex-start; /* اضافه کن - تگ‌ها از راست شروع شوند */
    direction: rtl; /* اضافه کن */
}

.tag {
    background: rgba(66, 125, 192, 0.1);
    color: #427dc0;
    padding: 0.4rem 0.9rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(66, 125, 192, 0.2);
    transition: all 0.3s ease;
}

.tag:hover {
    background: #427dc0;
    color: white;
    border-color: #427dc0;
    transform: translateY(-2px);
}

/* Projects CTA */
.projects-cta {
    text-align: center;
    margin-top: 2rem;
}

.load-more-btn {
    background: linear-gradient(135deg, #203F78 0%, #427dc0 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 25px;
    font-family: 'Yekan Bakh', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(66, 125, 192, 0.3);
}

.load-more-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(66, 125, 192, 0.4);
    background: linear-gradient(135deg, #1f3079 0%, #3a6ba5 100%);
}

.load-more-btn:active {
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 968px) {
    .projects-section {
        margin: 2rem auto;
        padding: 2rem 1.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .section-subtitle {
        font-size: 1.1rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .project-image {
        height: 250px;
    }
}

@media (max-width: 768px) {
    .projects-section {
        margin: 2rem 1rem;
        padding: 2rem 1rem;
        border-radius: 20px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .project-title {
        font-size: 1.2rem;
    }

    .project-description {
        font-size: 0.95rem;
    }

    .project-image {
        height: 220px;
    }

    .load-more-btn {
        padding: 0.9rem 2.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-info {
        padding: 1.2rem;
    }

    .project-tags {
        gap: 0.4rem;
    }

    .tag {
        font-size: 0.8rem;
        padding: 0.35rem 0.8rem;
    }

    .view-details {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }

    .project-image {
        height: 200px;
    }
}

/* Animation for Cards on Load */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-card {
    animation: slideInUp 0.6s ease forwards;
    opacity: 0;
}

.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }
.project-card:nth-child(6) { animation-delay: 0.6s; }