/* =========================================================
   teoria-mobile.css
   بطاقات فئات التؤوريا: الأيقونة فوق والاسم تحتها (عمودي) على كل الشاشات
   ضعه بعد style.css

   بنية البطاقة (من teoria.js):
   <a class="info-block glass-card">
     <div>                      <- الحاوية الداخلية (أيقونة + اسم)
       <div><img></div>         <- مربع الأيقونة
       <h3>الاسم</h3>
     </div>
     <div><i class="fa-arrow-left"></i></div>   <- السهم (نخفيه)
   </a>
========================================================= */

/* ---------- كل الشاشات ---------- */

/* البطاقة نفسها: عمودي وبالمنتصف */
#categories-grid > a {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  min-width: 0;
}

/* الحاوية الداخلية (فيها الأيقونة والاسم): عمودي أيضاً */
#categories-grid > a > div:first-child {
  display: flex !important;
  flex-direction: column !important;   /* الأيقونة فوق والاسم تحت */
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  width: 100% !important;
  min-width: 0;
}

/* السهم: نخفي الـ div كله حتى لا يترك فراغاً */
#categories-grid > a > div:last-child {
  display: none !important;
}

/* الاسم */
#categories-grid > a h3 {
  width: 100%;
  margin: 0 !important;
  text-align: center !important;
  line-height: 1.45 !important;
}

/* رسالة التحميل / الخطأ بعرض الصف كاملاً */
#categories-grid > [style*="grid-column"] {
  grid-column: 1 / -1 !important;
  display: block !important;
}

/* ---------- الهاتف: 3 أعمدة ---------- */
@media (max-width: 768px) {

  #categories-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-top: 10px !important;
  }

  #categories-grid > a {
    padding: 14px 6px 12px !important;
    border-radius: 16px !important;
  }

  #categories-grid > a > div:first-child {
    gap: 8px !important;
  }

  #categories-grid > a h3 {
    font-size: 0.76rem !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ---------- الشاشات الصغيرة جداً ---------- */
@media (max-width: 330px) {
  #categories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ---------- الحاسوب ---------- */
@media (min-width: 769px) {

  #categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    gap: 18px !important;
  }

  #categories-grid > a {
    padding: 26px 14px !important;
  }

  #categories-grid > a > div:first-child > div {
    width: 62px !important;
    height: 62px !important;
    border-radius: 16px !important;
  }

  #categories-grid > a > div:first-child > div img {
    width: 34px !important;
    height: 34px !important;
  }

  #categories-grid > a h3 {
    font-size: 1.05rem !important;
  }
}