/* تنظیمات مخصوص موبایل (عرض کمتر از ۴۸۰ پیکسل) */
@media (max-width: 480px) {
    
    /* 1. تنظیمات هدر و عنوان‌ها */
    .titr5 {
        font-size: 26px !important;
        line-height: 1.4;
        padding: 0 5px;
    }

    .p1 {
        font-size: 15px !important;
        padding: 0 10px;
    }

    /* 2. تصویر اصلی بالای صفحه */
    .img_Site {
        width: 90% !important;
        height: auto !important;
        max-height: 300px !important;
        border-radius: 10px;
    }

    /* 3. باکس‌های معرفی (ثبت فعالیت، اهداف و ...) */
    .box1, .box2, .box3 {
        float: none !important;
        width: 85% !important;
        margin: 20px auto !important;
        height: auto !important; /* ارتفاع خودکار */
        min-height: 220px;
        padding: 20px 10px;
    }

    .boxs_div1 {
        font-size: 18px !important;
    }
    
    .boxs_div2 {
        font-size: 15px !important;
    }

    /* 4. دکمه شروع */
    .btn_start {
        width: 80% !important;
        font-size: 16px !important;
        padding: 12px !important;
        margin-bottom: 25px;
    }

    /* 5. باکس متن نقل قول */
    .text2 {
        width: 90% !important;
        padding: 15px !important;
    }

    .p2 {
        font-size: 16px !important;
        line-height: 1.5;
    }

    /* ========================================= */
    /*      بخش مهم: باکس‌های توضیح (Explanation) */
    /* ========================================= */
    .col_Explanation {
        width: 95% !important;
        margin: 0 auto !important;
        background-image: none; /* حذف خطوط تزئینی برای سادگی */
        padding: 0;
    }

    .box_Explanation {
        height: auto !important; /* حذف ارتفاع ثابت */
        margin: 0 0 30px 0 !important; /* فاصله بین باکس‌ها */
        padding: 15px !important;
        border-radius: 15px !important;
    }

    /* عنوان‌های داخل باکس توضیح */
    .box_Explanation p {
        font-size: 18px !important;
        margin-bottom: 10px !important;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    /* آیکون‌های کنار عنوان */
    .box_Explanation p img {
        width: 25px !important;
        height: 25px !important;
        margin: 0 !important; /* حذف مارجین‌های عجیب */
    }

    /* متن توضیحات */
    .box_Explanation div {
        font-size: 15px !important;
        text-align: justify !important;
        line-height: 1.8 !important;
        margin-bottom: 15px !important;
        padding-bottom: 15px !important;
        border-bottom: 1px dashed #eee; /* خط جداکننده نازک */
    }

    /* تصاویر داخل باکس‌های توضیح */
    /* اینجا مهم‌ترین تغییر است: عکس‌ها را از حالت شناور خارج کرده و زیر متن قرار می‌دهیم */
    .box_Explanation img {
        float: none !important; /* حذف شناوری */
        margin: 10px auto 0 auto !important; /* وسط‌چین کردن */
        display: block;
        width: 100% !important; /* تمام عرض باکس */
        max-width: 280px !important; /* حداکثر عرض منطقی */
        height: auto !important;
        border-radius: 10px !important;
    }

    /* حذف مارجین‌های منفی که باعث به هم ریختگی می‌شدند */
    .box_Explanation_img_1,
    .box_Explanation_img_2_3,
    .box_Explanation_img_4 {
        margin-top: 15px !important; /* فاصله از متن بالا */
        width: 95% !important;
        height: auto !important;
    }

    /* 6. تصویر انتهای سایت */
    .img_end img {
        width: 100% !important;
        height: auto !important;
    }

    /* 7. دکمه اسکرول به بالا */
    .scroll-btn {
        bottom: 20px !important;
        right: 20px !important;
        width: 45px !important;
        height: 45px !important;
    }

    /* 8. پیام خوش‌آمدگویی (Toast) */
    .welcome-toast {
        width: 90% !important;
        right: -100% !important;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .welcome-toast.show {
        right: 5% !important;
    }

    /* 9. فوتر */
    .copyright_main {
        padding: 15px 10px !important;
    }
    
    .copy_text {
        font-size: 12px !important;
        padding: 0 5px;
    }
}




/* تنظیمات مخصوص موبایل (عرض کمتر از ۴۸۰ پیکسل) */
@media (max-width: 480px) {
    
    /* ... کدهای قبلی شما (مثل box_Explanation و ...) اینجا هستند ... */

    /* ========================================= */
    /*      تنظیمات پیام خوش‌آمدگویی (Toast)       */
    /* ========================================= */
    
    .welcome-toast {
        /* حذف عرض ثابت و پوزیشن‌های قدیمی */
        width: 90% !important; /* عرض ۹۰ درصد صفحه برای جا شدن راحت */
        right: 5% !important;  /* فاصله از راست برای وسط‌چین شدن نسبی */
        left: 5% !important;   /* فاصله از چپ */
        top: 80px !important;  /* فاصله از بالای صفحه (زیر منو) */
        margin: 0 !important;  /* حذف مارجین‌های قدیمی */
        padding: 10px 15px !important; /* کاهش پدینگ برای جا شدن متن */
        font-size: 14px !important; /* کاهش سایز فونت پیام */
        flex-direction: column; /* در صورت نیاز به چیدمان ستونی */
        align-items: center;    /* وسط‌چین کردن محتوا */
        text-align: center;     /* وسط‌چین کردن متن */
        gap: 5px;               /* فاصله کم بین آیکون و متن */
    }

    /* حالت نمایش (وقتی کلاس show اضافه می‌شود) */
    .welcome-toast.show {
        right: 5% !important; /* حفظ موقعیت */
        left: 5% !important;
        top: 80px !important;
    }

    /* تنظیمات آیکون داخل Toast */
    .toast-icon {
        width: 25px !important;
        height: 25px !important;
        margin-left: 0 !important;
    }
    
    .toast-icon svg {
        width: 100% !important;
        height: 100% !important;
    }

    /* تنظیمات متن داخل Toast */
    .toast-content {
        width: 100%;
        text-align: center;
    }

    .toast-content p {
        font-size: 13px !important; /* فونت کمی کوچک‌تر برای خوانایی در عرض کم */
        line-height: 1.4 !important;
        margin: 0 !important;
    }
    
    /* اطمینان از اینکه متن‌ها با فونت وزیر نمایش داده می‌شوند */
    .toast-content p[style*="Vazirmatn"] {
        font-family: 'Vazirmatn-Regular', sans-serif !important;
    }
    
    .toast-content p[style*="SemiBold"] {
        font-family: 'Vazirmatn-SemiBold', sans-serif !important;
    }
}




/* ========================================= */
/*      تنظیمات منوی همبرگری (Menu) موبایل     */
/* ========================================= */

@media (max-width: 1199px) {
    /* 1. تنظیمات نوار ناوبری */
    .custom-navbar {
        padding: 5px 0 !important;
        background-color: var(--bg-body) !important; /* هماهنگ با تم */
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

    .navbar-brand {
        font-size: 18px !important;
        padding: 5px !important;
    }

    .navbar-brand img {
        width: 40px !important;
        height: 40px !important;
        margin-left: 5px;
    }

    /* 2. دکمه همبرگری */
    .navbar-toggler {
        border: 1px solid #2e8a56 !important;
        padding: 4px 8px !important;
    }
    
    .navbar-toggler:focus {
        box-shadow: none !important;
    }

    /* 3. دکمه تغییر تم (خورشید/ماه) */
    .theme-btn {
        width: 45px !important;
        height: 45px !important;
        margin-left: 10px;
        margin-right: 0 !important;
        top: 0 !important;
    }

    .mode-icon {
        width: 20px !important;
        height: 20px !important;
    }

    /* 4. محتویات منوی بازشو (Collapse) */
    .navbar-collapse {
        background-color: var(--bg-body) !important;
        border-top: 1px solid rgba(0,0,0,0.1);
        padding: 15px 0 !important;
        max-height: 80vh; /* جلوگیری از بیرون زدن از صفحه */
        overflow-y: auto; /* اسکرول داخلی اگر منو طولانی شد */
    }

    .navbar-nav {
        width: 100% !important;
        justify-content: flex-start !important; /* چیدمان از راست */
        padding-right: 10px;
    }

    .nav-item {
        width: 100% !important;
        margin-bottom: 5px !important;
    }

    /* 5. لینک‌های منو */
    .textmeno-new {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        font-size: 18px !important;
        padding: 12px 10px !important;
        width: 100% !important;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        color: var(--text-primary) !important;
    }

    /* حذف آیکون‌های SVG کوچک در موبایل برای جلوگیری از شلوغی */
    .textmeno-new svg {
        width: 16px !important;
        height: 16px !important;
        opacity: 0.7;
    }

    /* 6. منوی کشویی پروفایل و تنظیمات */
    .dropdown-content {
        position: static !important; /* در موبایل بهتر است در جریان صفحه باشد */
        display: none !important; /* مخفی به صورت پیش‌فرض */
        width: 100% !important;
        background-color: rgba(46, 138, 86, 0.05) !important;
        border-radius: 10px;
        margin-top: 5px;
        margin-bottom: 10px;
        box-shadow: none !important;
        border: none !important;
        padding: 10px !important;
    }

    /* نمایش دراپ‌داون وقتی کلاس show دارد (توسط JS یا CSS hover) */
    .dropdown-user:hover .dropdown-content,
    .dropdown-user.show .dropdown-content {
        display: block !important;
        animation: fadeInSlide 0.3s ease;
    }

    .dropdown-content a {
        padding: 10px 15px !important;
        font-size: 16px !important;
        color: var(--text-primary) !important;
        display: flex;
        align-items: center;
        gap: 10px;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    .dropdown-content a:last-child {
        border-bottom: none;
    }

    /* دکمه‌های تغییر سایز فونت */
    .btn-group {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 10px;
    }
    
    .btn-check + .btn-outline-primary {
        flex: 1;
        font-size: 14px !important;
        padding: 5px !important;
    }

    /* 7. تنظیمات دکمه ورود/ثبت نام */
    .nav-link[href="login.php"] {
        font-size: 18px !important;
        font-weight: bold !important;
        background: rgba(52, 152, 219, 0.1);
        border-radius: 8px;
        margin-top: 10px;
        text-align: center;
    }

    /* 8. تصویر پروفایل در منو */
    .nav-profile-img {
        width: 30px !important;
        height: 30px !important;
        margin-left: 8px;
    }
    
    .bi-person-lines-fill {
        width: 25px !important;
        height: 25px !important;
    }

    .logo-font {
        color: var(--text-primary) !important;
    }
}


/* ========================================= */
/*      اصلاح حالت تاریک منو در موبایل          */
/* ========================================= */

@media (max-width: 1199px) {
    
    /* 1. تغییر رنگ پس‌زمینه نوار اصلی منو */
    [data-theme="dark"] .custom-navbar {
        background-color: #121212 !important; /* رنگ پس‌زمینه تیره */
        border-bottom: 1px solid #333 !important; /* خط جداکننده */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important; /* سایه */
    }

    /* 2. تغییر رنگ متن لینک‌های منو */
    [data-theme="dark"] .textmeno-new {
        color: #e0e0e0 !important; /* متن روشن */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important; /* خط جداکننده */
    }

    /* 3. تغییر رنگ آیکون همبرگری (منوی باز) */
    [data-theme="dark"] .navbar-toggler {
        border-color: #555 !important;
    }
    
    [data-theme="dark"] .navbar-toggler-icon {
        /* معکوس کردن رنگ آیکون سیاه به سفید */
        filter: invert(1) grayscale(100%) brightness(200%);
    }

    /* 4. تغییر رنگ باکس بازشونده منو (Collapse) */
    [data-theme="dark"] .navbar-collapse {
        background-color: #121212 !important; /* پس‌زمینه داخلی منو */
        border-top: 1px solid #333 !important;
    }

    /* 5. تغییر رنگ دراپ‌داون‌ها (مثل منوی پروفایل) */
    [data-theme="dark"] .dropdown-content {
        background-color: #1e1e1e !important; /* پس‌زمینه دراپ‌داون */
        border: 1px solid #333 !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
    }

    [data-theme="dark"] .dropdown-content a {
        color: #e0e0e0 !important; /* متن لینک‌های داخلی */
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }
    
    /* تغییر رنگ آیکون‌های داخل دراپ‌داون */
    [data-theme="dark"] .dropdown-content svg {
        filter: invert(1) brightness(200%); /* سفید کردن آیکون‌ها */
    }
}





/* ========================================= */
/*      تنظیمات صفحه ثبت فعالیت (Takalif) - نسخه نهایی موبایل */
/* ========================================= */

@media (max-width: 768px) {
    
    /* 1. تنظیمات کلی هدر و توضیحات */
    .titr5 {
        font-size: 24px !important;
        margin-bottom: 10px !important;
    }

    .p1 {
        font-size: 14px !important;
        padding: 0 15px;
        line-height: 1.6;
    }

    /* 2. فرم ثبت فعالیت روزانه */
    .inputs_task {
        width: 95% !important; /* کاهش عرض از 400px به 95% */
        margin: 10px auto !important;
        font-size: 16px !important;
        padding: 10px !important;
        box-sizing: border-box; /* جلوگیری از بیرون زدگی */
    }

    /* لیبل‌ها: در موبایل زیر فیلد قرار بگیرند */
    .labels2, .labels3, .labels4 {
        margin-left: 0 !important;
        margin-right: 10px !important;
        display: block !important;
        text-align: right !important;
        width: 100%;
        padding: 5px 0;
    }

    .labels2{
        padding: 1rem 1.75rem !important;
    }
    .labels3{
        padding: 1rem 1.75rem !important;
    }

    #label_display_2{
        display: none !important;
    }

    #label_display{
        display: none !important;
    }

    /* 3. دکمه‌های ثبت (روزانه و درسی) */
    .btn_sabt, .btn_school {
        width: 95% !important;
        padding: 12px 10px !important; /* حذف پدینگ‌های بزرگ 220px */
        font-size: 16px !important;
        margin: 10px auto !important;
        display: block;
        border-radius: 10px !important;
    }

    .btn_sabt{
        width: auto !important;
    }

    /* 4. باکس‌های ثبت نمره و مطالعه */
    .mb-4.p-3 {
        padding: 15px !important;
        margin-bottom: 20px !important;
        width: 95% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* 5. جداول */
    .table-responsive {
        width: 100%;
        overflow-x: auto; /* اسکرول افقی برای جدول */
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
    }

    .table {
        font-size: 13px !important;
        min-width: 300px;
    }

    .table th, .table td {
        padding: 8px 5px !important;
        white-space: nowrap;
    }

    /* دکمه‌های داخل جدول */
    .btn-success, .btn-danger {
        padding: 5px 8px !important;
        font-size: 11px !important;
        width: auto !important;
        margin: 2px;
    }

    /* 6. مودال (پنجره پاپ‌آپ) */
    .modal-dialog {
        margin: 10px !important;
        max-width: 98% !important;
    }

    .modal-content {
        padding: 10px !important;
    }

    .modal-header .btn-close {
        margin: 0 0 10px 0 !important;
        position: relative;
        float: left;
    }

    .modal-body input {
        width: 100% !important;
        margin-bottom: 15px !important;
    }

    .modal-footer {
        flex-direction: column-reverse !important;
        gap: 10px;
    }

    .modal-footer .btn {
        width: 100% !important;
    }

    /* 7. عنوان‌ها */
    h2, h3 {
        font-size: 18px !important;
        text-align: center;
    }

    h2 svg, h3 svg {
        width: 25px !important;
        height: 25px !important;
    }

    /* 8. تصویر پایان */
    .img_end img {
        width: 100% !important;
        height: auto !important;
    }
    
    /* 9. پیام خطا */
    .alerts {
        font-size: 14px !important;
        padding: 10px !important;
    }
}


/* ========================================= */
/*      اصلاح مودال (Modal) در موبایل          */
/* ========================================= */

@media (max-width: 768px) {
    
    /* تنظیمات کلی مودال برای موبایل */
    .modal-dialog {
        margin: 10px !important;
        max-width: 95% !important;
    }

    .modal-content {
        border-radius: 15px !important;
        padding: 0 !important; /* حذف پدینگ داخلی برای کنترل بهتر هدر */
        overflow: hidden;
    }

    /* 1. هدر مودال */
    .modal-header {
        padding: 15px !important;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        flex-direction: column-reverse; /* چیدمان عمودی در موبایل */
        align-items: flex-start;
    }

    /* 2. دکمه بستن (Close Button) */
    .modal-header .btn-close {
        /* حذف مارجین‌های ثابت دسکتاپ */
        margin: 0 0 10px 0 !important; 
        position: relative;
        float: left; /* در حالت RTL این یعنی سمت چپ */
        transform: scale(0.8); /* کمی کوچک کردن دکمه */
    }

    /* 3. عنوان مودال */
    .modal-title {
        font-size: 18px !important;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    /* 4. بدنه مودال */
    .modal-body {
        padding: 20px 15px !important;
    }

    .modal-body input {
        width: 100% !important;
        margin-bottom: 15px !important;
    }

    .modal-body label {
        margin-bottom: 5px !important;
        display: block;
        text-align: right;
    }

    /* 5. فوتر مودال */
    .modal-footer {
        flex-direction: column-reverse !important;
        gap: 10px;
        padding: 15px !important;
        border-top: 1px solid rgba(0,0,0,0.1);
    }

    .modal-footer .btn {
        width: 100% !important;
    }
}





/* تنظیمات ریسپانسیو برای موبایل (عرض ۳۷۵ پیکسل) */
@media (max-width: 480px) {

    /* ۱. هدر و عنوان‌ها */
    .titr5 {
        font-size: 24px !important; /* کوچک کردن تیتر اصلی */
        margin-bottom: 20px !important;
    }

    /* ۲. دکمه‌های انتخاب کتاب */
    .mybooks {
        padding: 10px !important;
        gap: 10px !important;
    }

    .btn_nemoodar {
        width: 100% !important; /* دکمه‌ها تمام عرض را بگیرند */
        height: auto !important;
        min-height: 80px !important;
        font-size: 14px !important;
        margin-bottom: 5px !important;
        flex-direction: row !important; /* آیکون و متن کنار هم */
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .icon_nemoodar {
        margin-bottom: 0 !important; /* حذف فاصله اضافی آیکون */
        margin-left: 10px !important;
    }

    /* ۳. باکس گزارش ماهانه */
    .col-md-4 {
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    .card {
        padding: 15px !important;
    }

    /* ۴. نمودار (مهم‌ترین بخش) */
    .chart_style {
        width: 100% !important; /* حذف عرض ثابت */
        margin-right: 0 !important; /* حذف حاشیه سمت راست */
        height: auto !important; /* ارتفاع خودکار */
        padding: 10px !important;
        background: rgba(255, 255, 255, 0.95); /* پس‌زمینه روشن‌تر برای خوانایی در موبایل */
        border-radius: 10px !important;
    }

    #simpleChart {
        height: 300px !important; /* ارتفاع مناسب برای موبایل */
        width: 100% !important;
    }

    /* ۵. فوتر و تصاویر انتهای صفحه */
    .img_end_nemoodar {
        width: 100% !important;
        margin-right: 0 !important;
        padding: 10px 0 !important;
    }

    .img_end_nemoodar img {
        width: 100% !important; /* تصویر تمام عرض شود */
        height: auto !important;
    }

    .copyright_main {
        height: auto !important;
        padding: 15px 10px !important;
    }

    .copy_text {
        font-size: 12px !important; /* کوچک کردن متن کپی‌رایت */
        padding: 0 10px !important;
    }

    /* ۶. فاصله‌های کلی */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    body {
        overflow-x: hidden; /* جلوگیری از اسکرول افقی */
    }
}


/* ========================================= */
/*      ریسپانسیو دقیق برای esteress.php      */
/* ========================================= */
@media (max-width: 480px) {
    
    /* 1. هدر (کیف پول و تاریخ) */
    .heder {
        width: 95% !important;
        flex-direction: column !important; /* زیر هم */
        align-items: center !important;
        gap: 8px !important;
        padding: 12px !important;
        margin-top: 10px;
    }

    .wallet {
        font-size: 15px !important;
        padding: 6px 16px !important;
        margin: 0 !important;
    }
    .tarikh_esteres {
        font-size: 15px !important;
        padding: 6px 16px !important;
        margin: 0 !important;
    }
    
    .wallet img {
        width: 18px !important;
        vertical-align: middle;
    }

    #jalaali-date {
        font-size: 13px !important;
        color: #666 !important;
        margin: 0 !important;
        text-align: center !important;
    }

    /* 2. بنر و متن‌ها */
    .img_baner {
        width: 90% !important;
        max-width: 340px !important;
        height: auto !important;
        margin-top: 15px !important;
        border-radius: 15px !important;
    }

    .titr5 {
        font-size: 26px !important;
        margin-top: 15px !important;
        padding: 0 10px !important;
    }

    .p1 {
        font-size: 14px !important;
        line-height: 1.6 !important;
        padding: 0 15px !important;
        margin-top: 10px !important;
    }

    /* 3. کانتینر بازی‌ها (اصلاح پخش و پلا) */
    .games_wrapper {
        display: flex !important;
        flex-direction: column !important; /* ستونی کردن */
        align-items: center !important;    /* وسط‌چین افقی */
        justify-content: center !important; /* وسط‌چین عمودی */
        gap: 25px !important;              /* فاصله دقیق بین دو بازی */
        margin-top: 30px !important;
        margin-bottom: 50px !important;
        padding: 0 20px !important;        /* فاصله از کناره‌های صفحه */
    }

    /* 4. باکس هر بازی (فرم و دکمه) */
    .games_wrapper > div {
        width: 100% !important;
        max-width: 320px !important; /* عرض ثابت برای زیبایی */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* 5. دکمه‌های بازی */
    .games_wrapper button {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        cursor: pointer;
    }

    .btn_game {
        width: 65% !important;
        height: auto !important;
        aspect-ratio: 4/3 !important; /* نسبت تصویر ثابت */
        object-fit: cover !important;
        border-radius: 20px !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
        transition: transform 0.2s ease !important;
    }

    .btn_game:active {
        transform: scale(0.96) !important;
    }

    /* متن‌های زیر دکمه (نام بازی و قیمت) */
    .games_wrapper button br {
        display: block !important;
        content: "";
        margin-bottom: 5px;
    }
    
    .games_wrapper span {
        font-size: 15px !important;
        font-weight: bold !important;
        margin-top: 8px !important;
        display: block !important;
    }

    /* 6. فوتر */
    .copyright_main {
        padding: 20px 10px !important;
        height: auto !important;
    }
    
    .copy_text {
        font-size: 12px !important;
    }
}




/* ========================================= */
/*      ریسپانسیو اختصاصی برای books.php      */
/*      عرض: 375px (موبایل)                   */
/* ========================================= */
@media (max-width: 480px) {

    /* 1. دکمه‌های انتخاب پایه (هفتم، هشتم، نهم) */
    .col_row_button {
        margin-top: 20px !important; /* کاهش فاصله از بالا */
        display: flex !important;
        flex-direction: column !important; /* زیر هم */
        align-items: center !important;
        gap: 15px !important; /* فاصله بین دکمه‌ها */
    }

    .button_books {
        width: 90% !important; /* عرض بیشتر برای لمس راحت‌تر */
        max-width: 300px !important;
        padding: 12px !important;
        font-size: 16px !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    }

    /* 2. لیست کتاب‌ها (کانتینر اصلی) */
    .col_element {
        width: 100% !important;
        padding: 0 10px !important;
    }

    /* 3. آیتم‌های کتاب (هر ردیف شامل عکس و دکمه) */
    /* در موبایل می‌خواهیم آیتم‌ها زیر هم باشند، نه کنار هم */
    .aitem {
        width: 100% !important; /* تمام عرض صفحه */
        flex-direction: column !important; /* محتوا زیر هم */
        align-items: center !important; /* وسط‌چین */
        margin-bottom: 20px !important; /* فاصله از آیتم بعدی */
        padding: 15px !important;
        background-color: var(--card-bg) !important; /* پس‌زمینه برای تمایز */
        border-radius: 15px !important;
        border: 1px solid rgba(0,0,0,0.05) !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.05) !important;
    }

    /* 4. بخش چپ آیتم (عکس + نام کتاب) */
    .content_left {
        flex-direction: column !important; /* عکس بالا، متن پایین */
        align-items: center !important;
        text-align: center !important;
        margin-bottom: 15px !important;
    }

    .img_books {
        width: 60% !important; /* بزرگ‌تر شدن عکس در موبایل */
        max-width: 120px !important;
        margin-bottom: 10px !important;
        height: auto !important;
    }

    .content_left span {
        font-size: 18px !important; /* بزرگ‌تر شدن نام کتاب */
        font-weight: bold !important;
        margin-right: 0 !important; /* حذف مارجین قدیمی */
        margin-top: 5px !important;
    }

    /* 5. دکمه‌های مشاهده و دانلود */
    .btn_container {
        width: 100% !important;
        flex-direction: row !important; /* دکمه‌ها کنار هم در پایین کارت */
        justify-content: center !important;
        gap: 10px !important;
    }

    .btn_upload_books {
        flex: 1 !important; /* دکمه‌ها فضای مساوی را پر کنند */
        padding: 10px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
    }

    /* 6. حذف خطوط جداکننده اضافی بین ردیف‌ها */
    .col_element > div[style*="display: flex"] {
        display: flex !important;
        flex-direction: column !important; /* در موبایل کل ردیف‌ها زیر هم */
        gap: 10px !important;
    }
    
    .col_element > div[style*="display: flex"] > div[style*="display: flex"] {
        flex-direction: column !important; /* آیتم‌های داخلی هم زیر هم */
        gap: 15px !important;
    }

    /* 7. تصویر انتهای صفحه */
    .img_end img {
        width: 100% !important;
        height: auto !important;
        margin-left: 0 !important;
    }
    
    /* 8. فوتر */
    .copyright_main {
        padding: 20px 10px !important;
        height: auto !important;
    }
    
    .copy_text {
        font-size: 12px !important;
    }
    
    /* جلوگیری از اسکرول افقی */
    body {
        overflow-x: hidden !important;
    }
}



/* ========================================= */
/*      ریسپانسیو اختصاصی برای viriesh.php      */
/*      عرض: 375px (موبایل)                   */
/* ========================================= */
@media (max-width: 480px) {
    .did{
        right: 85%;
    }

    .btn-save{
    font-size: 15px;
    }
}




/* ========================================= */
/*      ریسپانسیو اختصاصی برای صفحه راهنما    */
/*      (rahnama.php) - موبایل (375px)         */
/* ========================================= */

@media (max-width: 480px) {
    .btn_upload{
        width: 350px;
    }
}




/* ========================================= */
/*      ریسپانسیو اختصاصی برای صفحه ثبت‌نام    */
/*      (reg.php) - موبایل (375px)             */
/* ========================================= */

@media (max-width: 480px) {
    
    /* 1. تیتر اصلی بالای صفحه */
    .titr {
        font-size: 24px !important; /* کوچک کردن تیتر برای جا شدن */
        margin-top: 20px !important;
        padding: 0 10px;
        line-height: 1.4 !important;
    }

    /* 2. تصویر بنر */
    .img {
        width: 80% !important; /* افزایش عرض تصویر برای دید بهتر */
        height: auto !important;
        margin-top: 15px !important;
        border-radius: 20px !important;
    }

    /* 3. باکس شیشه‌ای فرم (کانتینر اصلی) */
    .col {
        width: 92% !important; /* عرض کامل‌تر */
        margin: 20px auto !important;
        padding: 15px !important;
        background-color: rgb(200 200 200 / 85%) !important; /* شفافیت بیشتر برای خوانایی */
    }

    /* 4. دکمه‌های بازگشت (بالای فرم) */
    .back {
        width: 40px !important;
        height: 40px !important;
        padding: 5px !important;
        margin: 2px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .back svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* 5. کانتینر ورودی‌های هم‌سطح (نام و موبایل) */
    /* در موبایل این‌ها باید زیر هم قرار بگیرند */
    .form1 div[style*="inline-flex"] {
        display: block !important; /* حذف فلکس اینلاین */
        width: 100% !important;
    }

    /* 6. استایل ورودی‌ها (Input Fields) */
    #input1, #input2, #input3, select.inputs_task {
        width: 100% !important; /* تمام عرض */
        margin-left: 0 !important; /* حذف مارجین‌های قدیمی */
        margin-bottom: 15px !important; /* فاصله از المان پایین */
        font-size: 16px !important; /* سایز مناسب برای کیبورد موبایل */
        box-sizing: border-box !important; /* جلوگیری از بیرون زدگی */
    }

    .input3_res{
        width: 100%;
    }

    /* 7. تنظیمات اختصاصی فیلد رمز عبور (به دلیل وجود آیکون چشم) */
    .password-container {
        position: relative !important;
        width: 100% !important;
        margin-bottom: 15px !important;
    }
    
    #input3 {
        padding-left: 45px !important; /* فاصله از آیکون چشم در سمت چپ */
        padding-right: 15px !important;
        direction: rtl;
        /* text-align: left !important; */
    }

    /* 8. آیکون نمایش/مخفی کردن رمز (چشم) */
    .toggle-password {
        left: 15px !important; /* ثابت در سمت چپ */
        right: auto !important;
        top: 40% !important;
        transform: translateY(-50%) !important;
        z-index: 1000 !important;
    }

    /* 9. دکمه ثبت‌نام */
    .btn2 {
        width: 100% !important;
        padding: 15px !important;
        font-size: 18px !important;
        margin-top: 10px !important;
    }

    /* 10. پیام‌های خطا و موفقیت */
    .alerts {
        font-size: 14px !important;
        padding: 10px !important;
        margin-top: 15px !important;
    }
    
    /* اطمینان از اسکرول نرم */
    body {
        overflow-x: hidden !important;
    }
}

/* تنظیمات کامل بک‌گراند برای جلوگیری از تکرار و پر کردن ارتفاع */
body.body_reg {
    background-image: url('bak.png');
    background-size: cover !important; /* تصویر کل صفحه را پر کند */
    background-position: center center !important; /* تصویر وسط چین شود */
    background-repeat: no-repeat !important; /* تکرار نشود */
    background-attachment: fixed !important; /* در اسکرول کردن تصویر ثابت بماند (حالت حرفه‌ای) */
    min-height: 100vh !important; /* ارتفاع حداقل برابر با ارتفاع صفحه نمایش */
    height: 100% !important;
}

/* نکته مهم: اگر منوی شما (header) روی بک‌گراند را پوشانده، این کد را هم اضافه کنید */
/* اگر منوی شما position: fixed دارد، این خط را اضافه کنید تا بک‌گراند از زیر منو دیده شود */
body.body_reg {
    background-color: #43cea2 !important; /* یک رنگ پیش‌فرض سبز تا زمانی که عکس لود شود */
}