/**
 * تحسينات الموبايل — akrammostafa.com
 * وضوح الكورسات والأزرار على الشاشات الصغيرة
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img,
video {
  max-width: 100%;
  height: auto;
}

/* ===== الصفحة الرئيسية — كروت الكورسات ===== */
@media (max-width: 768px) {
  .courses-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding-inline: 0;
  }

  .course-card {
    width: 100%;
    max-width: 100%;
  }

  .course-card-img {
    height: 170px;
  }

  .course-card-title {
    font-size: 18px !important;
    line-height: 1.45;
  }

  .course-card-desc {
    -webkit-line-clamp: 3;
    font-size: 14px !important;
    line-height: 1.7;
  }

  .course-card-meta {
    gap: 8px 14px;
    font-size: 13px !important;
  }

  .course-card-price .price {
    font-size: 24px !important;
  }

  .course-card-actions {
    flex-direction: column;
    gap: 10px;
  }

  .course-card-btn {
    width: 100%;
    min-height: 48px;
    font-size: 15px !important;
    padding: 12px 16px !important;
  }

  .section-title {
    font-size: 26px !important;
    line-height: 1.35;
  }

  .section-desc {
    font-size: 15px !important;
    line-height: 1.75;
    padding-inline: 4px;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .category-item {
    padding: 14px 10px !important;
  }

  .category-name {
    font-size: 12px !important;
  }

  .hero-stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px !important;
    width: 100%;
    padding-inline: 8px;
  }

  .stat-divider {
    display: none !important;
  }

  .hero-stat-num {
    font-size: 22px !important;
  }

  .hero-stat-label {
    font-size: 11px !important;
  }

  .social-feed-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .sf-body h3 {
    font-size: 16px !important;
  }

  .sf-actions {
    flex-direction: column;
  }

  .sf-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    text-align: center;
  }

  .footer-social {
    justify-content: center;
  }

  .btn-all-products {
    width: 100%;
    max-width: 320px;
    min-height: 48px;
    justify-content: center;
  }

  .header-btn span {
    display: none;
  }

  .header-btn {
    padding: 8px 10px !important;
    min-width: 40px;
    min-height: 40px;
  }
}

@media (max-width: 380px) {
  .hero-title {
    font-size: 24px !important;
  }

  .static-text,
  .typewriter {
    font-size: 22px !important;
  }

  .akram-hero-img,
  .hero-robot-img {
    width: 100% !important;
    max-width: 100% !important;
  }

  .hero-robot-container {
    width: calc(100vw - 20px) !important;
    max-width: none !important;
  }

  .course-card-title {
    font-size: 17px !important;
  }
}

/* ===== صفحة الكورسات courses.html ===== */
@media (max-width: 768px) {
  .courses-hero {
    padding: 100px 16px 50px !important;
  }

  .courses-hero h1 {
    font-size: 1.85rem !important;
    line-height: 1.3;
  }

  .courses-hero p {
    font-size: 1rem !important;
    padding-inline: 8px;
    line-height: 1.75;
  }

  .courses-hero-stats {
    gap: 1.25rem !important;
  }

  .hero-stat .num {
    font-size: 1.75rem !important;
  }

  .courses-section {
    padding: 50px 0 !important;
  }

  .courses-section .section-title h2 {
    font-size: 1.65rem !important;
  }

  .courses-section .courses-grid,
  body .courses-grid {
    grid-template-columns: 1fr !important;
    padding: 0 16px !important;
    gap: 1.25rem !important;
  }

  .course-card-body h3 {
    font-size: 1.15rem !important;
    line-height: 1.4;
  }

  .course-card-body p {
    font-size: 0.95rem !important;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.75) !important;
  }

  .course-card-thumb {
    height: 200px !important;
  }

  .btn-course-details {
    min-height: 48px !important;
    font-size: 1rem !important;
    padding: 0.9rem !important;
  }

  .courses-cta {
    padding: 50px 16px !important;
  }

  .courses-cta h2 {
    font-size: 1.5rem !important;
  }

  .btn-cta-wa {
    width: 100%;
    max-width: 300px;
    justify-content: center;
    min-height: 48px;
  }

  /* navbar style.css pages */
  .nav-menu {
    max-height: calc(100dvh - 70px);
    overflow-y: auto;
  }

  .nav-link {
    font-size: 16px !important;
    padding: 12px 16px !important;
  }
}

/* ===== إصلاح الأقسام الفارغة على الموبايل (AOS + reveal) ===== */
@media (max-width: 768px) {
  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .reveal,
  .reveal.visible {
    opacity: 1 !important;
    transform: none !important;
  }

  #social-feed:empty {
    min-height: 0;
  }

  #social-feed.sf-loading {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
  }

  #social-feed.sf-loading::before {
    content: 'جاري تحميل المحتوى...';
  }
}

/* أزرار لمس أوضح */
@media (hover: none) and (pointer: coarse) {
  .course-card-btn,
  .btn-course-details,
  .btn-primary,
  .btn-cta-wa,
  .nav-link,
  .sf-btn {
    min-height: 44px;
  }

  .course-card:hover {
    transform: none !important;
  }
}

/* مناطق آمنة للآيفون */
@supports (padding: max(0px)) {
  .header-inner,
  .container,
  .footer .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .whatsapp-float,
  .wa-float,
  .ai-fab-wrap {
    bottom: max(20px, env(safe-area-inset-bottom));
  }
}
