/* ---------------------------------- */
/* 1. الإعدادات العامة للموقع          */
/* ---------------------------------- */
body {
    font-family: 'Cairo', sans-serif;
    background-color: #f9f9f9;
    margin: 0;
    direction: rtl;
    transition: background-color 0.4s ease;
}

/* الوضع الداكن للخلفية */
body.dark-mode {
    background-color: #1f140c;
}

/* ---------------------------------- */
/* 2. عناوين الأقسام والحاويات        */
/* ---------------------------------- */
.section-header {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 20px;
}

.section-header h2 {
    color: #66774a;
    font-size: 2.2rem;
    font-weight: 800;
}

/* لون العنوان في الوضع الداكن */
body.dark-mode .section-header h2 {
    color: #d4e0c0;
}

/* حاوية الكروت */
.cards-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 40px 10px;
    margin: 0 auto;
    max-width: 1280px;
    margin-bottom: 50px;
}

/* شكل الحاوية في الوضع الداكن */
body.dark-mode .cards-wrapper {
    background-color: #2b1d12;
    border-radius: 50px;
    margin-top: 20px;
}

/* ---------------------------------- */
/* 3. منطق كرت القلب (Flip Card)     */
/* ---------------------------------- */
.plant-card {
    width: 320px;
    height: 400px;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
    transition: transform 0.8s ease;
    z-index: 10;
}

/* المحتوى الداخلي للكرت */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s ease, box-shadow 0.4s ease;
    transform-style: preserve-3d;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
}

/* تأثير التحويم */
.plant-card:hover {
    z-index: 100;
    transform: scale(1.05) translateY(-15px);
}

/* قلب الكرت عند التحويم */
.plant-card:hover .card-inner {
    transform: rotateY(180deg);
    box-shadow: 0px 0px 20px rgba(102, 119, 74, 0.4);
}



/* ظل الوضع الداكن */
body.dark-mode .plant-card:hover .card-inner {
    box-shadow: 0px 0px 30px rgba(212, 224, 192, 0.3);
}

/* ---------------------------------- */
/* 4. وجهي الكرت وتأثير اللمعان       */
/* ---------------------------------- */
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(135deg, #e7e2d9 0%, #ffffff 50%, #e7e2d9 100%);
    background-size: 300% 100%;
    animation: shimmer-diag 20s infinite alternate;
}


/* الصندوق الداخلي */
.background-box {
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    height: 90%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);


    /* خلفية فاتحة */
    background: linear-gradient(135deg, #fdfbf9 0%, #ffffff 50%, #fdfbf9 100%);
    background-size: 300% 100%;
}



/* خلفية الوضع الداكن */
body.dark-mode .card-front,
body.dark-mode .background-box {
    background: linear-gradient(135deg, #5d4a3a 0%, #766453 50%, #5d4a3a 100%);
    background-size: 300% 100%;
    animation: shimmer-diag 10s infinite alternate;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* حركة اللمعان */
@keyframes shimmer-diag {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ---------------------------------- */
/* 5. محتوى الواجهة الأمامية          */
/* ---------------------------------- */
.plant-img {
    height: 250px;
    background-size: cover;
    background-position: center;
    border-bottom: 2px solid #f9f3ee;
    transition: transform 0.5s ease, filter 0.5s ease;
}

/* تكبير الصورة عند التحويم */
.plant-card:hover .plant-img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* صورة الوضع الداكن */
body.dark-mode .plant-img {
    border-bottom-color: rgba(0, 0, 0, 0.2);
    filter: brightness(0.95);
}

/* اسم النبتة */
.plant-name {
    color: #66774a;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 10px 15px 5px;
    text-align: center;
}

/* اسم النبتة في الوضع الداكن */
body.dark-mode .plant-name {
    color: #efe7d9;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
}

/* تصنيف النبتة */
.plant-category {
    color: #889977;
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-weight: 600;
    text-align: center;
}

/* تصنيف الوضع الداكن */
body.dark-mode .plant-category {
    color: #d4e0c0;
}

/* معلومات العناية */
.care-info {
    display: flex;
    justify-content: space-around;
    background-color: rgba(243, 236, 232, 0.6);
    padding: 10px;
    margin: auto 15px 15px;
    border-radius: 8px;
    gap: 3px;
    
}

/* خلفية الوضع الداكن */
body.dark-mode .care-info {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 12px
}

/* عنصر العناية */
.care-item {
    font-size: 0.8rem;
    color: #66774a;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 600;
    
}

/* لون النص الداكن */
body.dark-mode .care-item {
    color: #ffffff;
}

.care-item span {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

/* ---------------------------------- */
/* 6. محتوى الواجهة الخلفية           */
/* ---------------------------------- */
.card-back {
    background-color: #66774a;
    transform: rotateY(180deg);
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-image: url('images/Realistic-leaves.png');
    background-size: cover;
}

/* خلفية الوضع الداكن */
body.dark-mode .card-back {
    background-image: linear-gradient(
            rgba(43, 29, 18, 0.17),
            rgba(43, 29, 18, 0.226)
        ),
        url('images/Realistic-leaves.png');
}



/* عنوان الخلفية */
.card-back h3 {
    color: #66774a;
    font-size: 1.4rem;
}

body.dark-mode .card-back h3 {
    color: #ffffff;
}

/* نص الخلفية */
.card-back p {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.6;
}

body.dark-mode .card-back p {
    color: #f5f5f5;
}

/* زر التفاصيل */
.info-btn {
    border-radius: 25px;
    background-color: transparent;
    color: #66774a;
    border: 2px solid #66774a;
    text-decoration: none;
    padding: 10px 25px;
    font-weight: 700;
    transition: all 0.3s ease;
}

/* تحويم الزر */
.info-btn:hover {
    background-color: #66774a;
    color: white;
}

/* زر الوضع الداكن */
body.dark-mode .info-btn {
    color: #ffffff;
    border-color: #d4e0c0;
    background-color: rgba(212, 224, 192, 0.1);
}

body.dark-mode .info-btn:hover {
    background-color: #d4e0c0;
    color: #2b1d12;
}


/* ---------------------------------- */
/* 7. التصميم المتجاوب                */
/* ---------------------------------- */
@media (max-width: 768px) {
    .plant-card {
        width: 310px;
        height: 380px;
    }

    .section-header h2 {
        font-size: 1.8rem;
    }

    .plant-name {
        font-size: 1.2rem;
    }

    .background-box {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    /* تصغير الحاوية العامة لتقليل الفراغات */
    .cards-wrapper {
        padding: 20px 5px;
        gap: 20px;
    }

    /* تعديل أبعاد الكرت ليناسب عرض الموبايل الصغير */
    .plant-card {
        width: 280px;  
        height: 360px; 
    }

    /* تصغير عنوان القسم */
    .section-header h2 {
        font-size: 1.5rem;
    }

    /* تقليل حجم الصورة داخل الكرت */
    .plant-img {
        height: 180px; 
    }

    /* ضبط اسم النبتة والخطوط */
    .plant-name {
        font-size: 1.1rem;
        margin: 8px 10px 2px;
    }

    /* تقليل المسافات في صندوق العناية */
    .care-info {
        padding: 8px;
        margin: 5px 10px 10px;
        gap: 2px;
    }

    .care-item {
        font-size: 0.7rem; /* خط أصغر للأيقونات */
    }

    .care-item span {
        font-size: 1.1rem; /* تصغير حجم الإيموجي أو الأيقونة */
    }

    /* الواجهة الخلفية للكرت */
    .card-back {
        padding: 15px;
    }

    .card-back h3 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .card-back p {
        font-size: 0.85rem; /* تقليل حجم النص الوصفي */
        line-height: 1.4;
    }

    .info-btn {
        padding: 8px 18px; /* تصغير حجم الزر */
        font-size: 0.9rem;
    }
}